From: buliabyak Date: Fri, 2 Mar 2007 19:39:26 +0000 (+0000) Subject: blind fix for endianness, needs testing by someone on a big-endian machine X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1dac100531fd623ce8143f6ef1d39527e6c95728;p=inkscape.git blind fix for endianness, needs testing by someone on a big-endian machine --- diff --git a/src/display/canvas-arena.cpp b/src/display/canvas-arena.cpp index 95e3757d4..de43ec80d 100644 --- a/src/display/canvas-arena.cpp +++ b/src/display/canvas-arena.cpp @@ -293,6 +293,28 @@ streamline rendering. if (pb.empty == FALSE) { + if (arena->arena->rendermode == RENDERMODE_OUTLINE) { + // currently we only use cairo in outline mode + + // ENDIANNESS FIX + // Inkscape and GTK use fixed byte order in their buffers: r, g, b, a. + // Cairo reads/writes buffer values as in32s and therefore depends on the hardware byte order + // (little-endian vs big-endian). + // Until we move ALL of inkscape rendering and screen display to cairo, + // we must reverse the order for big-endian architectures (e.g. PowerPC). + if (G_BYTE_ORDER == G_BIG_ENDIAN) { + unsigned char *start = NR_PIXBLOCK_PX(&pb); + unsigned char *end = start + pb.rs * (pb.area.y1 - pb.area.y0); + for (unsigned char *i = start; i < end; i += 4) { + unsigned char tmp0 = i[0]; + unsigned char tmp1 = i[1]; + i[0] = i[3]; + i[1] = i[2]; + i[2] = tmp1; + i[3] = tmp0; + } + } + } // this does the 32->24 squishing, using an assembler routine: nr_blit_pixblock_pixblock (&cb, &pb);