[cairo-bugs] [Bug 43158] New: Does not hold to requested or stated pixel formats

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Nov 22 02:04:36 PST 2011


https://bugs.freedesktop.org/show_bug.cgi?id=43158

             Bug #: 43158
           Summary: Does not hold to requested or stated pixel formats
    Classification: Unclassified
           Product: cairo
           Version: 1.10.2
          Platform: x86 (IA32)
        OS/Version: Linux (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: general
        AssignedTo: cworth at cworth.org
        ReportedBy: marcus-yass at ihug.co.nz
         QAContact: cairo-bugs at cairographics.org


On my machine, the following code will illustrate cairo's failure to store its
image surface in the requested format.
Results indicate that the used format comes out BGRA32 no matter what it says
it has chosen.
I can't tell how I can figure out which backend I'm running under, so I've put
this in "general".

#include <cairo/cairo.h>
#include <stdio.h>
#include <stdint.h>
int main(int argc, char** argv){
    const int w=10, h=10;
    cairo_surface_t* ul = cairo_image_surface_create(
        CAIRO_FORMAT_RGB24,w,h);
    printf("%d\n", cairo_image_surface_get_format(ul));
    cairo_t* draw = cairo_create(ul);
    cairo_set_source_rgba(draw,1,0.5,0.27,1);
    cairo_paint(draw);
    uint8_t* dat = (uint8_t*)(cairo_image_surface_get_data(ul));
    for(unsigned iy=0; iy<h; ++iy){
        for(unsigned ix=0; ix<w; ++ix){
            unsigned pixelP = cairo_image_surface_get_stride(ul)*iy + ix*4;
            printf(
                "%x, %x, %x, %x\n",
                dat[pixelP],
                dat[pixelP+1],
                dat[pixelP+2],
                dat[pixelP+3]);
        }
        printf("%c", '\n');
    }
}

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.


More information about the cairo-bugs mailing list