Opened 11 years ago
Closed 11 years ago
#10773 closed bug (fixed)
Gradient color stop sorting is not stable.
Reported by: | pulkomandy | Owned by: | stippi |
---|---|---|---|
Priority: | normal | Milestone: | R1 |
Component: | Kits/Interface Kit | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | Blocking: | #10542 | |
Platform: | All |
Description
Consider the following code used to create a stripped pattern using a BGradient:
gradient.AddColor(black, 0); gradient.AddColor(black, 127); gradient.AddColor(white, 127); gradient.AddColor(white, 255);
In ConvertToScreenForDrawing, the gradient stops will be sorted using BList.Sort. The sorting algorithm is not stable, so the two middle stops may be swapped. There are two ways to fix this:
- Implement a stable sorting algorithm (http://en.wikipedia.org/wiki/Category:Stable_sorts)
- Remove the AddColorStop method index parameter and use code similar to AddColor to find the proper index, or make that method private. This would allow BGradient to keep the list sorted, and remove the need for sorting it later. The method is used only in app_server (for reading the gradient data from app_server link) and when unarchiving a gradient.
What is the preferred solution?
Change History (2)
comment:1 by , 11 years ago
Blocking: | 10542 added |
---|
comment:2 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Fixed in hrev47193.