Bug 37050

Summary: CAIRO_FORMAT_RGB24 mapped to wrong DirectFB pixelformat.
Product: cairo Reporter: haithem <haithem.rahmani>
Component: directfb backendAssignee: cairo-bugs mailing list <cairo-bugs>
Status: RESOLVED NOTABUG QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: 1.10.2   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description haithem 2011-05-09 23:41:30 UTC
Hi,

in the file "src/cairo-directfb-surface"
CAIRO_FORMAT_RGB24 should be mapped to DSPF_RGB24 instead of DSPF_RGB32.
attached a patch for it.

regards.
Haithem.
Comment 1 Andrea Canciani 2011-05-09 23:49:37 UTC
(In reply to comment #0)
> Hi,
> 
> in the file "src/cairo-directfb-surface"
> CAIRO_FORMAT_RGB24 should be mapped to DSPF_RGB24 instead of DSPF_RGB32.

I don't think so. The DirectFB documentation (http://directfb.org/docs/DirectFB_Reference_1_5/types.html#DFBSurfacePixelFormat) states:
DSPF_RGB24	 	DFB_SURFACE_PIXELFORMAT( 2, 24, 0, 0, 0, 3, 0, 0, 0, 0, 0 )	 	24 bit RGB (3 byte, red 8@16, green 8@8, blue 8@0)
DSPF_RGB32	 	DFB_SURFACE_PIXELFORMAT( 3, 24, 0, 0, 0, 4, 0, 0, 0, 0, 0 )	 	24 bit RGB (4 byte, nothing@24, red 8@16, green 8@8, blue 8@0)

So we obviously need DSPF_RGB32, because:

CAIRO_FORMAT_RGB24 each pixel is a 32-bit quantity, with the upper 8 bits unused. Red, Green, and Blue are stored in the remaining 24 bits in that order.

(from http://www.cairographics.org/manual/cairo-Image-Surfaces.html#cairo-format-t )

Please check again and reopen if I'm missing something.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.