summaryrefslogtreecommitdiff
path: root/splash
diff options
context:
space:
mode:
authorThomas Freitag <Thomas.Freitag@alfa.de>2013-05-16 20:52:09 +0200
committerAlbert Astals Cid <aacid@kde.org>2013-05-16 20:53:37 +0200
commitb3d8f510e30fb4d8da9069390d5e9bd8a283fbd6 (patch)
tree94efad742976bccd1093393fb8acf1ecfe1c6319 /splash
parent8640933a3aa7dbafa21765d029e97b4bba76716c (diff)
Fix splashModeBGR8 rendering
Also make SplashBitmap able to write splashModeBGR8 images Bug #64381
Diffstat (limited to 'splash')
-rw-r--r--splash/Splash.cc4
-rw-r--r--splash/SplashBitmap.cc24
2 files changed, 24 insertions, 4 deletions
diff --git a/splash/Splash.cc b/splash/Splash.cc
index fd618cd7..6a1891ef 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 93d2da8a..ac344f17 100644
--- a/splash/SplashBitmap.cc
+++ b/splash/SplashBitmap.cc
@@ -19,7 +19,7 @@
// Copyright (C) 2010 Harry Roberts <harry.roberts@midnight-labs.org>
// Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com>
// Copyright (C) 2010 William Bader <williambader@hotmail.com>
-// Copyright (C) 2011, 2012 Thomas Freitag <Thomas.Freitag@alfa.de>
+// Copyright (C) 2011-2013 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2012 Anthony Wesley <awesley@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];