Code

patch the RGBA/BGRA incompatibility (until we're not using cairo throughout)
authorbuliabyak <buliabyak@users.sourceforge.net>
Fri, 2 Mar 2007 14:56:25 +0000 (14:56 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Fri, 2 Mar 2007 14:56:25 +0000 (14:56 +0000)
src/display/nr-arena-glyphs.cpp
src/display/nr-arena-shape.cpp

index b4bf81c8dab50b00c29549a491d0691815b93a08..c8e51a19c49d27ca4f63e939c63afdded18c82a4 100644 (file)
@@ -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) {
index bd6ca1df8c18e270447fbaeb614721b0f6f766f4..b8bfee05c3447ceb26d35919b2554192fdee8c5f 100644 (file)
@@ -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);