libicon: reorder gradient stops when loading from BMessage
Some files have gradients stops stored in an incorrect order. Fixes #14210
This commit is contained in:
@@ -70,9 +70,11 @@ Gradient::Gradient(BMessage* archive)
|
|||||||
// color steps
|
// color steps
|
||||||
BGradient::ColorStop step;
|
BGradient::ColorStop step;
|
||||||
for (int32 i = 0; archive->FindFloat("offset", i, &step.offset) >= B_OK; i++) {
|
for (int32 i = 0; archive->FindFloat("offset", i, &step.offset) >= B_OK; i++) {
|
||||||
if (archive->FindInt32("color", i, (int32*)&step.color) >= B_OK)
|
if (archive->FindInt32("color", i, (int32*)&step.color) >= B_OK) {
|
||||||
AddColor(step, i);
|
// Use the slower method of adding by offset in case the gradient
|
||||||
else
|
// was not stored with steps in the correct order
|
||||||
|
AddColor(step.color, step.offset);
|
||||||
|
} else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (archive->FindInt32("type", (int32*)&fType) < B_OK)
|
if (archive->FindInt32("type", (int32*)&fType) < B_OK)
|
||||||
|
|||||||
Reference in New Issue
Block a user