summaryrefslogtreecommitdiff
path: root/src/ps_image.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2010-06-07 13:39:03 +0000
committerManolo Gouy <Manolo>2010-06-07 13:39:03 +0000
commitda5042584abf40bec2e31154feaadfab29f070c7 (patch)
treeda306fbd2f7321cacdbde75138c8436ee46bb7c1 /src/ps_image.cxx
parent9416e3480aea607becc2e0576b606552fd42cca6 (diff)
Fix image bug reported by Csaba in r7626 + fix regression in ps_image.cxx
inadvertently brought in by r7617. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7634 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/ps_image.cxx')
-rw-r--r--src/ps_image.cxx22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/ps_image.cxx b/src/ps_image.cxx
index fa4a6fe2c..51646efa6 100644
--- a/src/ps_image.cxx
+++ b/src/ps_image.cxx
@@ -20,7 +20,9 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
-// Please report all bugs and problems to "fltk-bugs@fltk.org".
+// Please report all bugs and problems on the following page:
+//
+// http://www.fltk.org/str.php
//
#ifndef FL_DOXYGEN
@@ -182,20 +184,12 @@ int Fl_PostScript_Graphics_Driver::alpha_mask(const uchar * data, int w, int h,
return 0;
}
+// bitwise inversion of all 4-bit quantities
+static const unsigned char swapped[16] = {0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15};
-
-// TODO: anybody has more efficient algoritm?
-static inline uchar swap_byte(const uchar i){
- uchar b =0;
- if(i & 1) b |= 128;
- if(i & 2) b |= 64;
- if(i & 4) b |= 32;
- if(i & 8) b |= 16;
- if(i & 16) b |= 8;
- if(i & 32) b |= 4;
- if(i & 64) b |= 2;
- if(i & 128) b |= 1;
- return b;
+// bitwise inversion of a byte
+static inline uchar swap_byte(const uchar b) {
+ return (swapped[b & 0xF] << 4) | swapped[b >> 4];
}