Revision: 4165
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4165&view=rev
Author:   ossman_
Date:     2010-10-13 10:45:21 +0000 (Wed, 13 Oct 2010)

Log Message:
-----------
Converting a integer shift to a byte offset of course depends on endianness
as the first byte might be either shift 0 or shift 24.

Modified Paths:
--------------
    trunk/common/rfb/PixelFormat.cxx

Modified: trunk/common/rfb/PixelFormat.cxx
===================================================================
--- trunk/common/rfb/PixelFormat.cxx    2010-10-11 10:13:40 UTC (rev 4164)
+++ trunk/common/rfb/PixelFormat.cxx    2010-10-13 10:45:21 UTC (rev 4165)
@@ -187,9 +187,15 @@
     // Optimised common case
     rdr::U8 *r, *g, *b;
 
-    r = dst + redShift/8;
-    g = dst + greenShift/8;
-    b = dst + blueShift/8;
+    if (bigEndian) {
+      r = dst + (24 - redShift)/8;
+      g = dst + (24 - greenShift)/8;
+      b = dst + (24 - blueShift)/8;
+    } else {
+      r = dst + redShift/8;
+      g = dst + greenShift/8;
+      b = dst + blueShift/8;
+    }
 
     while (pixels--) {
       *r = *(src++);
@@ -253,9 +259,15 @@
     // Optimised common case
     const rdr::U8 *r, *g, *b;
 
-    r = src + redShift/8;
-    g = src + greenShift/8;
-    b = src + blueShift/8;
+    if (bigEndian) {
+      r = src + (24 - redShift)/8;
+      g = src + (24 - greenShift)/8;
+      b = src + (24 - blueShift)/8;
+    } else {
+      r = src + redShift/8;
+      g = src + greenShift/8;
+      b = src + blueShift/8;
+    }
 
     while (pixels--) {
       *(dst++) = *r;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Tigervnc-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tigervnc-commits

Reply via email to