Closed Bug 327580 Opened 20 years ago Closed 20 years ago

fix image decoder endianness/RGB issues

Categories

(Core :: Graphics, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: vlad, Assigned: vlad)

References

Details

Attachments

(1 file, 1 obsolete file)

We've had some hacks in the decoder/image code that fell apart once we started building on mac, with both big and little endian support. Need to formalize the contract that all data going in to nsThebesImage is to be in R G B order. Later on we should look at converting the image decoders to just output ARGB directly.
Patch fix. Forces all decoders to give us RGB data if MOZ_CAIRO_GFX, and then we assemble that data into a dword based on the current endianness.
Attachment #212185 - Flags: review?(pavlov)
Er, ignore the two Paint/Fill hunks in there, typo.
Comment on attachment 212185 [details] [diff] [review] fix image decoder rgb order & endianness + // Output is always ARGB with A in the high byte of a dword +#ifdef IS_LITTLE_ENDIAN return (aAlpha << 24) | (r << 16) | (g << 8) | b; +#else + return (b << 24) | (g << 16) | (r << 8) | aAlpha; +#endif but, this doesn't always put it in the high byte. you put it in the low byte on bit-endian platforms. isn't that wrong?
Er, yes. Good catch, I had my mind going crazy last night trying to figure out who was swapping where.. I'll fix that and test on OSX/PPC over the weekend.
Updated patch; tested on win32, intel mac, ppc mac.
Attachment #212185 - Attachment is obsolete: true
Attachment #212648 - Flags: review?(pavlov)
Attachment #212185 - Flags: review?(pavlov)
Attachment #212648 - Flags: review?(pavlov) → review+
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Assignee: nobody → vladimir
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: