mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 15:31:14 +00:00
Sort colours in bitmap as expected by Cairo.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@21664 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c1399ee9b7
commit
2435fad1b6
2 changed files with 29 additions and 4 deletions
|
@ -1,8 +1,13 @@
|
|||
2005-08-20 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/cairo/CairoFaceInfo.h (-fontFace): Use
|
||||
* Source/cairo/CairoGState.m (-DPSImage::::::::):
|
||||
For the ARGB32 case sort the colour fields in the bitmap correctly.
|
||||
|
||||
2005-08-20 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/cairo/CairoFaceInfo.m (-fontFace): Use
|
||||
_cairo_toy_font_face_create, as Cairo did rename this function.
|
||||
* Headers/cairo/CairoFontInfo.h (_cairo_glyph_for_NSGlyph): Use
|
||||
* Source/cairo/CairoFontInfo.m (_cairo_glyph_for_NSGlyph): Use
|
||||
Cairo function _cairo_scaled_font_text_to_glyphs to convert to glyphs.
|
||||
|
||||
2005-08-16 Adrian Robert <arobert@cogsci.ucsd.edu>
|
||||
|
|
|
@ -1022,7 +1022,11 @@ _set_op(cairo_t * ct, NSCompositingOperation op)
|
|||
cairo_format_t format;
|
||||
NSAffineTransformStruct tstruct;
|
||||
cairo_surface_t *surface;
|
||||
|
||||
unsigned char *tmp;
|
||||
int i = 0;
|
||||
unsigned int pixels = pixelsHigh * pixelsWide;
|
||||
const unsigned char *bits = data[0];
|
||||
|
||||
/*
|
||||
NSLog(@"%@ DPSimage %dx%d (%p)", self, pixelsWide, pixelsHigh,
|
||||
cairo_current_target_surface (_ct));
|
||||
|
@ -1037,6 +1041,16 @@ _set_op(cairo_t * ct, NSCompositingOperation op)
|
|||
switch (bitsPerSample * samplesPerPixel)
|
||||
{
|
||||
case 32:
|
||||
tmp = objc_malloc(pixels * 4);
|
||||
while (i < pixels*4)
|
||||
{
|
||||
tmp[i+0] = bits[i+2];
|
||||
tmp[i+1] = bits[i+1];
|
||||
tmp[i+2] = bits[i+0];
|
||||
tmp[i+3] = bits[i+3];
|
||||
i += 4;
|
||||
}
|
||||
bits = tmp;
|
||||
format = CAIRO_FORMAT_ARGB32;
|
||||
break;
|
||||
case 24:
|
||||
|
@ -1063,11 +1077,17 @@ _set_op(cairo_t * ct, NSCompositingOperation op)
|
|||
tstruct.tX, tstruct.tY);
|
||||
cairo_transform(_ct, &local_matrix);
|
||||
|
||||
surface = cairo_image_surface_create_for_data((void*)data,
|
||||
surface = cairo_image_surface_create_for_data((void*)bits,
|
||||
format,
|
||||
pixelsWide,
|
||||
pixelsHigh,
|
||||
bytesPerRow);
|
||||
|
||||
if (bits != data[0])
|
||||
{
|
||||
objc_free(bits);
|
||||
}
|
||||
|
||||
if (surface == NULL)
|
||||
{
|
||||
NSLog(@"Image surface could not be created");
|
||||
|
|
Loading…
Reference in a new issue