Bug#306041: dia: Please include patch to fix endianess with regard to cairo

Hervé Cauwelier HervĂ© Cauwelier <hcauwelier@oursours.net>, 306041@bugs.debian.org
Sun, 24 Apr 2005 00:01:13 +0200


This is a multi-part message in MIME format.
--------------030600020801070206090002
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Package: dia
Severity: wishlist
Tags: patch

Quoting Hans Breuer  <hans@breuer.org>:

"* plug-ins/cairo/diacairo.c : image rendering had an endianess
  issue (or is this working around a libpixman bug?;)"

The change is attached as a dpatch file.

-- 
Hervé Cauwelier
http://www.oursours.net/

--------------030600020801070206090002
Content-Type: text/plain;
 name="05_fix-image-rendering-endianess.dpatch"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
 filename="05_fix-image-rendering-endianess.dpatch"

#! /bin/sh /usr/share/dpatch/dpatch-run
## 05_fix-image-rendering-endianess.dpatch by Hervé Cauwelier <hcauwelier@oursours.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

@DPATCH@
diff -urNad dia-0.94.0/plug-ins/cairo/diacairo.c /tmp/dpep.XP1Enb/dia-0.94.0/plug-ins/cairo/diacairo.c
--- dia-0.94.0/plug-ins/cairo/diacairo.c	2004-08-16 09:56:21.000000000 +0200
+++ /tmp/dpep.XP1Enb/dia-0.94.0/plug-ins/cairo/diacairo.c	2005-04-23 20:31:09.138064832 +0200
@@ -675,10 +675,17 @@
           p2[2] = (guint8)((p1[0] * alpha) / 255);
           p2[3] = (guint8)alpha;
 #else
+#  if G_BYTE_ORDER == G_LITTLE_ENDIAN
           p2[0] = p1[2]; /* b */
           p2[1] = p1[1]; /* g */
           p2[2] = p1[0]; /* r */
           p2[3] = p1[3]; /* a */
+#  else
+          p2[3] = p1[2]; /* b */
+          p2[2] = p1[1]; /* g */
+          p2[1] = p1[0]; /* r */
+          p2[0] = p1[3]; /* a */
+#  endif
 #endif
           p1+=4;
           p2+=4;
@@ -705,11 +712,18 @@
         {
           for (x = 0; x < w; x++)
             {
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
               /* apparently BGR is required */
               p2[x*4  ] = p1[x*3+2];
               p2[x*4+1] = p1[x*3+1];
               p2[x*4+2] = p1[x*3  ];
               p2[x*4+3] = 0x80; /* should not matter */
+#else
+              p2[x*4+3] = p1[x*3+2];
+              p2[x*4+2] = p1[x*3+1];
+              p2[x*4+1] = p1[x*3  ];
+              p2[x*4+0] = 0x80; /* should not matter */
+#endif
             }
           p2 += (w*4);
           p1 += rs;


--------------030600020801070206090002--