Commit b5321c4f authored by Thomas Freitag's avatar Thomas Freitag Committed by Albert Astals Cid

use getCMYK/DeviceNLine in CMYK mode if available

Second part of bug 66928
parent d006ac56
This diff is collapsed.
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
// Copyright (C) 2009-2011, 2013 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2009-2011, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com> // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com>
// Copyright (C) 2011 Andrea Canciani <ranma42@gmail.com> // Copyright (C) 2011 Andrea Canciani <ranma42@gmail.com>
// Copyright (C) 2011, 2012 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2011-2013 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2013 Lu Wang <coolwanglu@gmail.com> // Copyright (C) 2013 Lu Wang <coolwanglu@gmail.com>
// //
// To see a description of the changes please see the Changelog file that // To see a description of the changes please see the Changelog file that
...@@ -210,6 +210,8 @@ public: ...@@ -210,6 +210,8 @@ public:
virtual void getRGBLine(Guchar * /*in*/, unsigned int * /*out*/, int /*length*/) { error(errInternal, -1, "GfxColorSpace::getRGBLine (first variant) this should not happen"); } virtual void getRGBLine(Guchar * /*in*/, unsigned int * /*out*/, int /*length*/) { error(errInternal, -1, "GfxColorSpace::getRGBLine (first variant) this should not happen"); }
virtual void getRGBLine(Guchar * /*in*/, Guchar * /*out*/, int /*length*/) { error(errInternal, -1, "GfxColorSpace::getRGBLine (second variant) this should not happen"); } virtual void getRGBLine(Guchar * /*in*/, Guchar * /*out*/, int /*length*/) { error(errInternal, -1, "GfxColorSpace::getRGBLine (second variant) this should not happen"); }
virtual void getRGBXLine(Guchar * /*in*/, Guchar * /*out*/, int /*length*/) { error(errInternal, -1, "GfxColorSpace::getRGBXLine this should not happen"); } virtual void getRGBXLine(Guchar * /*in*/, Guchar * /*out*/, int /*length*/) { error(errInternal, -1, "GfxColorSpace::getRGBXLine this should not happen"); }
virtual void getCMYKLine(Guchar * /*in*/, Guchar * /*out*/, int /*length*/) { error(errInternal, -1, "GfxColorSpace::getCMYKLine this should not happen"); }
virtual void getDeviceNLine(Guchar * /*in*/, Guchar * /*out*/, int /*length*/) { error(errInternal, -1, "GfxColorSpace::getDeviceNLine this should not happen"); }
// create mapping for spot colorants // create mapping for spot colorants
virtual void createMapping(GooList *separationList, int maxSepComps); virtual void createMapping(GooList *separationList, int maxSepComps);
...@@ -218,6 +220,10 @@ public: ...@@ -218,6 +220,10 @@ public:
virtual GBool useGetRGBLine() { return gFalse; } virtual GBool useGetRGBLine() { return gFalse; }
// Does this ColorSpace support getGrayLine? // Does this ColorSpace support getGrayLine?
virtual GBool useGetGrayLine() { return gFalse; } virtual GBool useGetGrayLine() { return gFalse; }
// Does this ColorSpace support getCMYKLine?
virtual GBool useGetCMYKLine() { return gFalse; }
// Does this ColorSpace support getDeviceNLine?
virtual GBool useGetDeviceNLine() { return gFalse; }
// Return the number of color components. // Return the number of color components.
virtual int getNComps() = 0; virtual int getNComps() = 0;
...@@ -279,9 +285,13 @@ public: ...@@ -279,9 +285,13 @@ public:
virtual void getRGBLine(Guchar *in, unsigned int *out, int length); virtual void getRGBLine(Guchar *in, unsigned int *out, int length);
virtual void getRGBLine(Guchar *in, Guchar *out, int length); virtual void getRGBLine(Guchar *in, Guchar *out, int length);
virtual void getRGBXLine(Guchar *in, Guchar *out, int length); virtual void getRGBXLine(Guchar *in, Guchar *out, int length);
virtual void getCMYKLine(Guchar *in, Guchar *out, int length);
virtual void getDeviceNLine(Guchar *in, Guchar *out, int length);
virtual GBool useGetRGBLine() { return gTrue; } virtual GBool useGetRGBLine() { return gTrue; }
virtual GBool useGetGrayLine() { return gTrue; } virtual GBool useGetGrayLine() { return gTrue; }
virtual GBool useGetCMYKLine() { return gTrue; }
virtual GBool useGetDeviceNLine() { return gTrue; }
virtual int getNComps() { return 1; } virtual int getNComps() { return 1; }
virtual void getDefaultColor(GfxColor *color); virtual void getDefaultColor(GfxColor *color);
...@@ -350,9 +360,13 @@ public: ...@@ -350,9 +360,13 @@ public:
virtual void getRGBLine(Guchar *in, unsigned int *out, int length); virtual void getRGBLine(Guchar *in, unsigned int *out, int length);
virtual void getRGBLine(Guchar *in, Guchar *out, int length); virtual void getRGBLine(Guchar *in, Guchar *out, int length);
virtual void getRGBXLine(Guchar *in, Guchar *out, int length); virtual void getRGBXLine(Guchar *in, Guchar *out, int length);
virtual void getCMYKLine(Guchar *in, Guchar *out, int length);
virtual void getDeviceNLine(Guchar *in, Guchar *out, int length);
virtual GBool useGetRGBLine() { return gTrue; } virtual GBool useGetRGBLine() { return gTrue; }
virtual GBool useGetGrayLine() { return gTrue; } virtual GBool useGetGrayLine() { return gTrue; }
virtual GBool useGetCMYKLine() { return gTrue; }
virtual GBool useGetDeviceNLine() { return gTrue; }
virtual int getNComps() { return 3; } virtual int getNComps() { return 3; }
virtual void getDefaultColor(GfxColor *color); virtual void getDefaultColor(GfxColor *color);
...@@ -424,7 +438,11 @@ public: ...@@ -424,7 +438,11 @@ public:
virtual void getRGBLine(Guchar *in, unsigned int *out, int length); virtual void getRGBLine(Guchar *in, unsigned int *out, int length);
virtual void getRGBLine(Guchar *, Guchar *out, int length); virtual void getRGBLine(Guchar *, Guchar *out, int length);
virtual void getRGBXLine(Guchar *in, Guchar *out, int length); virtual void getRGBXLine(Guchar *in, Guchar *out, int length);
virtual void getCMYKLine(Guchar *in, Guchar *out, int length);
virtual void getDeviceNLine(Guchar *in, Guchar *out, int length);
virtual GBool useGetRGBLine() { return gTrue; } virtual GBool useGetRGBLine() { return gTrue; }
virtual GBool useGetCMYKLine() { return gTrue; }
virtual GBool useGetDeviceNLine() { return gTrue; }
virtual int getNComps() { return 4; } virtual int getNComps() { return 4; }
virtual void getDefaultColor(GfxColor *color); virtual void getDefaultColor(GfxColor *color);
...@@ -502,8 +520,12 @@ public: ...@@ -502,8 +520,12 @@ public:
virtual void getRGBLine(Guchar *in, unsigned int *out, int length); virtual void getRGBLine(Guchar *in, unsigned int *out, int length);
virtual void getRGBLine(Guchar *in, Guchar *out, int length); virtual void getRGBLine(Guchar *in, Guchar *out, int length);
virtual void getRGBXLine(Guchar *in, Guchar *out, int length); virtual void getRGBXLine(Guchar *in, Guchar *out, int length);
virtual void getCMYKLine(Guchar *in, Guchar *out, int length);
virtual void getDeviceNLine(Guchar *in, Guchar *out, int length);
virtual GBool useGetRGBLine(); virtual GBool useGetRGBLine();
virtual GBool useGetCMYKLine();
virtual GBool useGetDeviceNLine();
virtual int getNComps() { return nComps; } virtual int getNComps() { return nComps; }
virtual void getDefaultColor(GfxColor *color); virtual void getDefaultColor(GfxColor *color);
...@@ -548,8 +570,12 @@ public: ...@@ -548,8 +570,12 @@ public:
virtual void getRGBLine(Guchar *in, unsigned int *out, int length); virtual void getRGBLine(Guchar *in, unsigned int *out, int length);
virtual void getRGBLine(Guchar *in, Guchar *out, int length); virtual void getRGBLine(Guchar *in, Guchar *out, int length);
virtual void getRGBXLine(Guchar *in, Guchar *out, int length); virtual void getRGBXLine(Guchar *in, Guchar *out, int length);
virtual void getCMYKLine(Guchar *in, Guchar *out, int length);
virtual void getDeviceNLine(Guchar *in, Guchar *out, int length);
virtual GBool useGetRGBLine() { return gTrue; } virtual GBool useGetRGBLine() { return gTrue; }
virtual GBool useGetCMYKLine() { return gTrue; }
virtual GBool useGetDeviceNLine() { return gTrue; }
virtual int getNComps() { return 1; } virtual int getNComps() { return 1; }
virtual void getDefaultColor(GfxColor *color); virtual void getDefaultColor(GfxColor *color);
...@@ -1126,6 +1152,8 @@ public: ...@@ -1126,6 +1152,8 @@ public:
double getDecodeHigh(int i) { return decodeLow[i] + decodeRange[i]; } double getDecodeHigh(int i) { return decodeLow[i] + decodeRange[i]; }
bool useRGBLine() { return (colorSpace2 && colorSpace2->useGetRGBLine ()) || (!colorSpace2 && colorSpace->useGetRGBLine ()); } bool useRGBLine() { return (colorSpace2 && colorSpace2->useGetRGBLine ()) || (!colorSpace2 && colorSpace->useGetRGBLine ()); }
bool useCMYKLine() { return (colorSpace2 && colorSpace2->useGetCMYKLine ()) || (!colorSpace2 && colorSpace->useGetCMYKLine ()); }
bool useDeviceNLine() { return (colorSpace2 && colorSpace2->useGetDeviceNLine ()) || (!colorSpace2 && colorSpace->useGetDeviceNLine ()); }
// Convert an image pixel to a color. // Convert an image pixel to a color.
void getGray(Guchar *x, GfxGray *gray); void getGray(Guchar *x, GfxGray *gray);
...@@ -1134,6 +1162,8 @@ public: ...@@ -1134,6 +1162,8 @@ public:
void getRGBLine(Guchar *in, Guchar *out, int length); void getRGBLine(Guchar *in, Guchar *out, int length);
void getRGBXLine(Guchar *in, Guchar *out, int length); void getRGBXLine(Guchar *in, Guchar *out, int length);
void getGrayLine(Guchar *in, Guchar *out, int length); void getGrayLine(Guchar *in, Guchar *out, int length);
void getCMYKLine(Guchar *in, Guchar *out, int length);
void getDeviceNLine(Guchar *in, Guchar *out, int length);
void getCMYK(Guchar *x, GfxCMYK *cmyk); void getCMYK(Guchar *x, GfxCMYK *cmyk);
void getDeviceN(Guchar *x, GfxColor *deviceN); void getDeviceN(Guchar *x, GfxColor *deviceN);
void getColor(Guchar *x, GfxColor *color); void getColor(Guchar *x, GfxColor *color);
......
...@@ -2888,19 +2888,27 @@ GBool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine, ...@@ -2888,19 +2888,27 @@ GBool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine,
break; break;
#if SPLASH_CMYK #if SPLASH_CMYK
case splashModeCMYK8: case splashModeCMYK8:
for (x = 0, q = colorLine; x < imgData->width; ++x, p += nComps) { if (imgData->colorMap->useCMYKLine()) {
imgData->colorMap->getCMYK(p, &cmyk); imgData->colorMap->getCMYKLine(p, (Guchar *) colorLine, imgData->width);
*q++ = colToByte(cmyk.c); } else {
*q++ = colToByte(cmyk.m); for (x = 0, q = colorLine; x < imgData->width; ++x, p += nComps) {
*q++ = colToByte(cmyk.y); imgData->colorMap->getCMYK(p, &cmyk);
*q++ = colToByte(cmyk.k); *q++ = colToByte(cmyk.c);
*q++ = colToByte(cmyk.m);
*q++ = colToByte(cmyk.y);
*q++ = colToByte(cmyk.k);
}
} }
break; break;
case splashModeDeviceN8: case splashModeDeviceN8:
for (x = 0, q = colorLine; x < imgData->width; ++x, p += nComps) { if (imgData->colorMap->useDeviceNLine()) {
imgData->colorMap->getDeviceN(p, &deviceN); imgData->colorMap->getDeviceNLine(p, (Guchar *) colorLine, imgData->width);
for (int cp = 0; cp < SPOT_NCOMPS+4; cp++) } else {
*q++ = colToByte(deviceN.c[cp]); for (x = 0, q = colorLine; x < imgData->width; ++x, p += nComps) {
imgData->colorMap->getDeviceN(p, &deviceN);
for (int cp = 0; cp < SPOT_NCOMPS+4; cp++)
*q++ = colToByte(deviceN.c[cp]);
}
} }
break; break;
#endif #endif
......
...@@ -46,11 +46,9 @@ typedef double SplashCoord; ...@@ -46,11 +46,9 @@ typedef double SplashCoord;
#define splashAASize 4 #define splashAASize 4
#ifdef SPLASH_CMYK
#ifndef SPOT_NCOMPS #ifndef SPOT_NCOMPS
#define SPOT_NCOMPS 4 #define SPOT_NCOMPS 4
#endif #endif
#endif
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// colors // colors
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment