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.
Actually ConvertPixel is not used anywhere, so I propose to remove it before it gets misused.
Created attachment 419553 [details] [diff] [review] Simple removal of ConvertPixel (and DebugShowCairo...)
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 :)
The patch landed, why the bug is still opened?