[poppler] poppler/GfxState.cc poppler/GfxState.h
Albert Astals Cid
aacid at kemper.freedesktop.org
Mon May 18 11:45:28 PDT 2009
poppler/GfxState.cc | 70 +++++++++++++++++++++++++++++++++++++++++++++-------
poppler/GfxState.h | 64 ++++++++++-------------------------------------
2 files changed, 75 insertions(+), 59 deletions(-)
New commits:
commit f78d3a7ff5ef4b500d76d84ebc45aac3be162dab
Author: Albert Astals Cid <aacid at kde.org>
Date: Mon May 18 20:44:40 2009 +0200
Move lcms.h include to GfxState.cc, replace lcms typedefs by void *
diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index 1ca3289..8fcc7a0 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -128,6 +128,64 @@ static char *gfxColorSpaceModeNames[] = {
#define nGfxColorSpaceModes ((sizeof(gfxColorSpaceModeNames) / sizeof(char *)))
+#ifdef USE_CMS
+
+#include <lcms.h>
+
+#define COLOR_PROFILE_DIR "/ColorProfiles/"
+#define GLOBAL_COLOR_PROFILE_DIR POPPLER_DATADIR COLOR_PROFILE_DIR
+
+void GfxColorTransform::doTransform(void *in, void *out, unsigned int size) {
+ cmsDoTransform(transform, in, out, size);
+}
+
+// transformA should be a cmsHTRANSFORM
+GfxColorTransform::GfxColorTransform(void *transformA) {
+ transform = transformA;
+ refCount = 1;
+}
+
+GfxColorTransform::~GfxColorTransform() {
+ cmsDeleteTransform(transform);
+}
+
+void GfxColorTransform::ref() {
+ refCount++;
+}
+
+unsigned int GfxColorTransform::unref() {
+ return --refCount;
+}
+
+static cmsHPROFILE RGBProfile = NULL;
+static GooString *displayProfileName = NULL; // display profile file Name
+static cmsHPROFILE displayProfile = NULL; // display profile
+static unsigned int displayPixelType = 0;
+static GfxColorTransform *XYZ2DisplayTransform = NULL;
+
+// convert color space signature to cmsColor type
+static unsigned int getCMSColorSpaceType(icColorSpaceSignature cs);
+static unsigned int getCMSNChannels(icColorSpaceSignature cs);
+static cmsHPROFILE loadColorProfile(const char *fileName);
+
+void GfxColorSpace::setDisplayProfile(void *displayProfileA) {
+ displayProfile = displayProfileA;
+}
+
+void GfxColorSpace::setDisplayProfileName(GooString *name) {
+ displayProfileName = name->copy();
+}
+
+cmsHPROFILE GfxColorSpace::getRGBProfile() {
+ return RGBProfile;
+}
+
+cmsHPROFILE GfxColorSpace::getDisplayProfile() {
+ return displayProfile;
+}
+
+#endif
+
//------------------------------------------------------------------------
// GfxColorSpace
//------------------------------------------------------------------------
@@ -227,13 +285,7 @@ void GfxColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length) {
}
#ifdef USE_CMS
-cmsHPROFILE GfxColorSpace::RGBProfile = NULL;
-cmsHPROFILE GfxColorSpace::displayProfile = NULL;
-GooString *GfxColorSpace::displayProfileName = NULL;
-unsigned int GfxColorSpace::displayPixelType = 0;
-GfxColorTransform *GfxColorSpace::XYZ2DisplayTransform = NULL;
-
-cmsHPROFILE GfxColorSpace::loadColorProfile(const char *fileName)
+cmsHPROFILE loadColorProfile(const char *fileName)
{
cmsHPROFILE hp = NULL;
FILE *fp;
@@ -324,7 +376,7 @@ int GfxColorSpace::setupColorProfiles()
return 0;
}
-unsigned int GfxColorSpace::getCMSColorSpaceType(icColorSpaceSignature cs)
+unsigned int getCMSColorSpaceType(icColorSpaceSignature cs)
{
switch (cs) {
case icSigXYZData:
@@ -380,7 +432,7 @@ unsigned int GfxColorSpace::getCMSColorSpaceType(icColorSpaceSignature cs)
return PT_RGB;
}
-unsigned int GfxColorSpace::getCMSNChannels(icColorSpaceSignature cs)
+unsigned int getCMSNChannels(icColorSpaceSignature cs)
{
switch (cs) {
case icSigXYZData:
diff --git a/poppler/GfxState.h b/poppler/GfxState.h
index ad5fae6..09abc2f 100644
--- a/poppler/GfxState.h
+++ b/poppler/GfxState.h
@@ -33,9 +33,6 @@
#include "goo/gtypes.h"
#include "Object.h"
#include "Function.h"
-#ifdef USE_CMS
-#include "lcms.h"
-#endif
class Array;
class GfxFont;
@@ -155,36 +152,20 @@ enum GfxColorSpaceMode {
csPattern
};
-#ifdef USE_CMS
-
-#define COLOR_PROFILE_DIR "/ColorProfiles/"
-#define GLOBAL_COLOR_PROFILE_DIR POPPLER_DATADIR COLOR_PROFILE_DIR
-
// wrapper of cmsHTRANSFORM to copy
class GfxColorTransform {
public:
- void doTransform(void *in, void *out, unsigned int size) {
- cmsDoTransform(transform, in, out, size);
- }
- GfxColorTransform(cmsHTRANSFORM transformA) {
- transform = transformA;
- refCount = 1;
- }
- ~GfxColorTransform() {
- cmsDeleteTransform(transform);
- }
- void ref() {
- refCount++;
- }
- unsigned int unref() {
- return --refCount;
- }
+ void doTransform(void *in, void *out, unsigned int size);
+ // transformA should be a cmsHTRANSFORM
+ GfxColorTransform(void *transformA);
+ ~GfxColorTransform();
+ void ref();
+ unsigned int unref();
private:
GfxColorTransform() {}
- cmsHTRANSFORM transform;
+ void *transform;
unsigned int refCount;
};
-#endif
class GfxColorSpace {
public:
@@ -225,32 +206,15 @@ public:
// Return the name of the <idx>th color space mode.
static char *getColorSpaceModeName(int idx);
-private:
#ifdef USE_CMS
-protected:
- static cmsHPROFILE RGBProfile;
- static GooString *displayProfileName; // display profile file Name
- static cmsHPROFILE displayProfile; // display profile
- static unsigned int displayPixelType;
- static GfxColorTransform *XYZ2DisplayTransform;
- // convert color space signature to cmsColor type
- static unsigned int getCMSColorSpaceType(icColorSpaceSignature cs);
- static unsigned int getCMSNChannels(icColorSpaceSignature cs);
- static cmsHPROFILE loadColorProfile(const char *fileName);
-public:
static int setupColorProfiles();
- static void setDisplayProfile(cmsHPROFILE displayProfileA) {
- displayProfile = displayProfileA;
- }
- static void setDisplayProfileName(GooString *name) {
- displayProfileName = name->copy();
- }
- static cmsHPROFILE getRGBProfile() {
- return RGBProfile;
- }
- static cmsHPROFILE getDisplayProfile() {
- return displayProfile;
- }
+ // displayProfileA should be a cmsHPROFILE
+ static void setDisplayProfile(void *displayProfileA);
+ static void setDisplayProfileName(GooString *name);
+ // result will be a cmsHPROFILE
+ static void *getRGBProfile();
+ // result will be a cmsHPROFILE
+ static void *getDisplayProfile();
#endif
};
More information about the poppler
mailing list