Closed Bug 386937 Opened 17 years ago Closed 13 years ago

ConvertPixel doesn't work as nsColor and gfx_color are not compatible...

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: alfredkayser, Assigned: alfredkayser)

References

Details

Attachments

(1 file)

In, the code assumes that nscolor and the aPixel (gfx_color) formats are equal.
http://lxr.mozilla.org/mozilla/source/gfx/src/thebes/nsThebesDeviceContext.cpp#435
435 nsThebesDeviceContext::ConvertPixel(nscolor aColor, PRUint32 & aPixel)

In fact they are not.
nsColor uses ABGR and gfx_color (cairo) uses ARGB.
Furthermore, in gfxColor gfxRGBA() and ::Packed, allows all kinds of formats, while only PACKED_ABGR is really used.
GFX_PACKED_PIXEL(a,r,g,b) produces the cairo format: ARGB.

In order to remove all this confusion, 
I would propose to convert all to one format: PACKED_ARGB (for the PRUint32 packed version), which is compatible with the Cairo image surface encoding).
All other places don't really care about the order.
nsColor always uses macro's access the parts.
And gfxColor can also easily be made to only handle ARGB.
Standardization to the Cairo format is also needed in qCMS.
Using one packed color format throughout the mozilla codebase will make live a lot easier.
Assignee: nobody → alfredkayser
Blocks: 490700
Product: Core → Core Graveyard
Actually ConvertPixel is not used anywhere, so I propose to remove it before it gets misused.
Status: NEW → ASSIGNED
Component: Image: Painting → GFX: Color Management
Product: Core Graveyard → Core
Attachment #419553 - Flags: review?(vladimir)
Attachment #419553 - Attachment is patch: true
Attachment #419553 - Attachment mime type: application/octet-stream → text/plain
Flags: wanted1.9.2?
QA Contact: image.gfx → color-management
Attachment #419553 - Flags: review?(vladimir) → review?(gavin.sharp)
Comment on attachment 419553 [details] [diff] [review]
Simple removal of ConvertPixel (and DebugShowCairo...)

Not sure why you asked me to review this, I'm not a gfx peer and don't really know anything about cairo :)
Attachment #419553 - Flags: review?(gavin.sharp)
Attachment #419553 - Flags: review?(vladimir)
Blocks: deadcode
The patch landed, why the bug is still opened?
Assignee: alfredkayser → nobody
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Component: GFX: Color Management → Graphics
QA Contact: color-management → thebes
Resolution: --- → FIXED
Assignee: nobody → alfredkayser
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: