summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2007-03-02 19:39:26 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2007-03-02 19:39:26 +0000
commitc982ffba81e29dd0a457a1ef7e05813d50196c65 (patch)
treef9e45427ee2a052c73317b60ed4b0ccb620a6efc /src
parentcairoify image outlines (diff)
downloadinkscape-c982ffba81e29dd0a457a1ef7e05813d50196c65.tar.gz
inkscape-c982ffba81e29dd0a457a1ef7e05813d50196c65.zip
blind fix for endianness, needs testing by someone on a big-endian machine
(bzr r2506)
Diffstat (limited to 'src')
-rw-r--r--src/display/canvas-arena.cpp22
1 files changed, 22 insertions, 0 deletions
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);