From: buliabyak Date: Fri, 2 Mar 2007 14:56:25 +0000 (+0000) Subject: patch the RGBA/BGRA incompatibility (until we're not using cairo throughout) X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f390bad3d9dbda44129dbb03065f032c791096e4;p=inkscape.git patch the RGBA/BGRA incompatibility (until we're not using cairo throughout) --- diff --git a/src/display/nr-arena-glyphs.cpp b/src/display/nr-arena-glyphs.cpp index b4bf81c8d..c8e51a19c 100644 --- a/src/display/nr-arena-glyphs.cpp +++ b/src/display/nr-arena-glyphs.cpp @@ -446,7 +446,9 @@ nr_arena_glyphs_group_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPi return item->state; guint32 rgba = item->arena->outlinecolor; - cairo_set_source_rgba(ct, SP_RGBA32_R_F(rgba), SP_RGBA32_G_F(rgba), SP_RGBA32_B_F(rgba), SP_RGBA32_A_F(rgba)); + // FIXME: we use RGBA buffers but cairo writes BGRA (on i386), so we must cheat + // by setting color channels in the "wrong" order + cairo_set_source_rgba(ct, SP_RGBA32_B_F(rgba), SP_RGBA32_G_F(rgba), SP_RGBA32_R_F(rgba), SP_RGBA32_A_F(rgba)); cairo_set_tolerance(ct, 1.25); // low quality, but good enough for outline mode for (child = group->children; child != NULL; child = child->next) { diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp index bd6ca1df8..b8bfee05c 100644 --- a/src/display/nr-arena-shape.cpp +++ b/src/display/nr-arena-shape.cpp @@ -736,7 +736,9 @@ cairo_arena_shape_render_outline(cairo_t *ct, NRArenaItem *item, NR::Point shift return item->state; guint32 rgba = NR_ARENA_ITEM(shape)->arena->outlinecolor; - cairo_set_source_rgba(ct, SP_RGBA32_R_F(rgba), SP_RGBA32_G_F(rgba), SP_RGBA32_B_F(rgba), SP_RGBA32_A_F(rgba)); + // FIXME: we use RGBA buffers but cairo writes BGRA (on i386), so we must cheat + // by setting color channels in the "wrong" order + cairo_set_source_rgba(ct, SP_RGBA32_B_F(rgba), SP_RGBA32_G_F(rgba), SP_RGBA32_R_F(rgba), SP_RGBA32_A_F(rgba)); cairo_set_line_width(ct, 0.5); cairo_set_tolerance(ct, 1.25); // low quality, but good enough for outline mode @@ -778,7 +780,8 @@ cairo_arena_shape_render_stroke(NRArenaItem *item, NRRectL *area, NRPixBlock *pb shape->_stroke.opacity); } - // for some reason cairo needs bgra, not rgba + // FIXME: we use RGBA buffers but cairo writes BGRA (on i386), so we must cheat + // by setting color channels in the "wrong" order cairo_set_source_rgba(ct, SP_RGBA32_B_F(rgba), SP_RGBA32_G_F(rgba), SP_RGBA32_R_F(rgba), SP_RGBA32_A_F(rgba)); float style_width = MAX(0.125, shape->_stroke.width * scale);