[poppler] splash/SplashBitmap.cc splash/Splash.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Thu May 16 11:54:30 PDT 2013


 splash/Splash.cc       |    4 ++--
 splash/SplashBitmap.cc |   24 ++++++++++++++++++++++--
 2 files changed, 24 insertions(+), 4 deletions(-)

New commits:
commit b3d8f510e30fb4d8da9069390d5e9bd8a283fbd6
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date:   Thu May 16 20:52:09 2013 +0200

    Fix splashModeBGR8 rendering
    
    Also make SplashBitmap able to write splashModeBGR8 images
    
    Bug #64381

diff --git a/splash/Splash.cc b/splash/Splash.cc
index fd618cd..6a1891e 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -182,7 +182,7 @@ SplashPipeResultColorCtrl Splash::pipeResultColorAlphaNoBlend[] = {
   splashPipeResultColorAlphaNoBlendMono,
   splashPipeResultColorAlphaNoBlendMono,
   splashPipeResultColorAlphaNoBlendRGB,
-  splashPipeResultColorNoAlphaBlendRGB,
+  splashPipeResultColorAlphaNoBlendRGB,
   splashPipeResultColorAlphaNoBlendRGB
 #if SPLASH_CMYK
   ,
@@ -195,7 +195,7 @@ SplashPipeResultColorCtrl Splash::pipeResultColorAlphaBlend[] = {
   splashPipeResultColorAlphaBlendMono,
   splashPipeResultColorAlphaBlendMono,
   splashPipeResultColorAlphaBlendRGB,
-  splashPipeResultColorNoAlphaBlendRGB,
+  splashPipeResultColorAlphaBlendRGB,
   splashPipeResultColorAlphaBlendRGB
 #if SPLASH_CMYK
   ,
diff --git a/splash/SplashBitmap.cc b/splash/SplashBitmap.cc
index 93d2da8..ac344f1 100644
--- a/splash/SplashBitmap.cc
+++ b/splash/SplashBitmap.cc
@@ -19,7 +19,7 @@
 // Copyright (C) 2010 Harry Roberts <harry.roberts at midnight-labs.org>
 // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger at googlemail.com>
 // Copyright (C) 2010 William Bader <williambader at hotmail.com>
-// Copyright (C) 2011, 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2011-2013 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2012 Anthony Wesley <awesley at smartnetworks.com.au>
 //
 // To see a description of the changes please see the Changelog file that
@@ -573,7 +573,7 @@ void SplashBitmap::getCMYKLine(int yl, SplashColorPtr line) {
 #endif
 
 SplashError SplashBitmap::writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int vDPI) {
-  if (mode != splashModeRGB8 && mode != splashModeMono8 && mode != splashModeMono1 && mode != splashModeXBGR8
+  if (mode != splashModeRGB8 && mode != splashModeMono8 && mode != splashModeMono1 && mode != splashModeXBGR8 && mode != splashModeBGR8
 #if SPLASH_CMYK
       && mode != splashModeCMYK8 && mode != splashModeDeviceN8
 #endif
@@ -657,6 +657,26 @@ SplashError SplashBitmap::writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int
     }
     break;
     
+    case splashModeBGR8:
+    {
+      unsigned char *row = new unsigned char[3 * width];
+      for (int y = 0; y < height; y++) {
+        // Convert into a PNG row
+        for (int x = 0; x < width; x++) {
+          row[3*x] = data[y * rowSize + x * 3 + 2];
+          row[3*x+1] = data[y * rowSize + x * 3 + 1];
+          row[3*x+2] = data[y * rowSize + x * 3];
+        }
+
+        if (!writer->writeRow(&row)) {
+          delete[] row;
+          return splashErrGeneric;
+        }
+      }
+      delete[] row;
+    }
+    break;
+    
     case splashModeXBGR8:
     {
       unsigned char *row = new unsigned char[3 * width];


More information about the poppler mailing list