summaryrefslogtreecommitdiff
path: root/poppler/GfxState.cc
diff options
context:
space:
mode:
Diffstat (limited to 'poppler/GfxState.cc')
-rw-r--r--poppler/GfxState.cc94
1 files changed, 46 insertions, 48 deletions
diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index 85954556..0dc02b47 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -42,2 +42,3 @@
#include "Page.h"
+#include "Gfx.h"
#include "GfxState.h"
@@ -194,3 +195,3 @@ GfxColorSpace::~GfxColorSpace() {
-GfxColorSpace *GfxColorSpace::parse(Object *csObj) {
+GfxColorSpace *GfxColorSpace::parse(Object *csObj, Gfx *gfx) {
GfxColorSpace *cs;
@@ -226,11 +227,11 @@ GfxColorSpace *GfxColorSpace::parse(Object *csObj) {
} else if (obj1.isName("ICCBased")) {
- cs = GfxICCBasedColorSpace::parse(csObj->getArray());
+ cs = GfxICCBasedColorSpace::parse(csObj->getArray(), gfx);
} else if (obj1.isName("Indexed") || obj1.isName("I")) {
- cs = GfxIndexedColorSpace::parse(csObj->getArray());
+ cs = GfxIndexedColorSpace::parse(csObj->getArray(), gfx);
} else if (obj1.isName("Separation")) {
- cs = GfxSeparationColorSpace::parse(csObj->getArray());
+ cs = GfxSeparationColorSpace::parse(csObj->getArray(), gfx);
} else if (obj1.isName("DeviceN")) {
- cs = GfxDeviceNColorSpace::parse(csObj->getArray());
+ cs = GfxDeviceNColorSpace::parse(csObj->getArray(), gfx);
} else if (obj1.isName("Pattern")) {
- cs = GfxPatternColorSpace::parse(csObj->getArray());
+ cs = GfxPatternColorSpace::parse(csObj->getArray(), gfx);
} else {
@@ -1394,3 +1395,3 @@ GfxColorSpace *GfxICCBasedColorSpace::copy() {
-GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr) {
+GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr, Gfx *gfx) {
GfxICCBasedColorSpace *cs;
@@ -1413,5 +1414,5 @@ GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr) {
// check cache
- if (iccProfileStreamA.num > 0) {
+ if (gfx && iccProfileStreamA.num > 0) {
GfxICCBasedColorSpaceKey k(iccProfileStreamA.num, iccProfileStreamA.gen);
- GfxICCBasedColorSpaceItem *item = static_cast<GfxICCBasedColorSpaceItem *>(cache->lookup(k));
+ GfxICCBasedColorSpaceItem *item = static_cast<GfxICCBasedColorSpaceItem *>(gfx->getIccColorSpaceCache()->lookup(k));
if (item != NULL)
@@ -1444,3 +1445,3 @@ GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr) {
if (dict->lookup("Alternate", &obj2)->isNull() ||
- !(altA = GfxColorSpace::parse(&obj2))) {
+ !(altA = GfxColorSpace::parse(&obj2, gfx))) {
switch (nCompsA) {
@@ -1534,6 +1535,6 @@ GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr) {
// put this colorSpace into cache
- if (iccProfileStreamA.num > 0) {
+ if (gfx && iccProfileStreamA.num > 0) {
GfxICCBasedColorSpaceKey *k = new GfxICCBasedColorSpaceKey(iccProfileStreamA.num, iccProfileStreamA.gen);
GfxICCBasedColorSpaceItem *item = new GfxICCBasedColorSpaceItem(cs);
- cache->put(k, item);
+ gfx->getIccColorSpaceCache()->put(k, item);
}
@@ -1685,6 +1686,2 @@ void GfxICCBasedColorSpace::getDefaultRanges(double *decodeLow,
-#ifdef USE_CMS
-PopplerCache *GfxICCBasedColorSpace::cache = new PopplerCache(5);
-#endif
-
//------------------------------------------------------------------------
@@ -1715,3 +1712,3 @@ GfxColorSpace *GfxIndexedColorSpace::copy() {
-GfxColorSpace *GfxIndexedColorSpace::parse(Array *arr) {
+GfxColorSpace *GfxIndexedColorSpace::parse(Array *arr, Gfx *gfx) {
GfxIndexedColorSpace *cs;
@@ -1729,3 +1726,3 @@ GfxColorSpace *GfxIndexedColorSpace::parse(Array *arr) {
arr->get(1, &obj1);
- if (!(baseA = GfxColorSpace::parse(&obj1))) {
+ if (!(baseA = GfxColorSpace::parse(&obj1, gfx))) {
error(-1, "Bad Indexed color space (base color space)");
@@ -1875,3 +1872,3 @@ GfxColorSpace *GfxSeparationColorSpace::copy() {
//~ handle the 'All' and 'None' colorants
-GfxColorSpace *GfxSeparationColorSpace::parse(Array *arr) {
+GfxColorSpace *GfxSeparationColorSpace::parse(Array *arr, Gfx *gfx) {
GfxSeparationColorSpace *cs;
@@ -1893,3 +1890,3 @@ GfxColorSpace *GfxSeparationColorSpace::parse(Array *arr) {
arr->get(2, &obj1);
- if (!(altA = GfxColorSpace::parse(&obj1))) {
+ if (!(altA = GfxColorSpace::parse(&obj1, gfx))) {
error(-1, "Bad Separation color space (alternate color space)");
@@ -1998,3 +1995,3 @@ GfxColorSpace *GfxDeviceNColorSpace::copy() {
//~ handle the 'None' colorant
-GfxColorSpace *GfxDeviceNColorSpace::parse(Array *arr) {
+GfxColorSpace *GfxDeviceNColorSpace::parse(Array *arr, Gfx *gfx) {
GfxDeviceNColorSpace *cs;
@@ -2032,3 +2029,3 @@ GfxColorSpace *GfxDeviceNColorSpace::parse(Array *arr) {
arr->get(2, &obj1);
- if (!(altA = GfxColorSpace::parse(&obj1))) {
+ if (!(altA = GfxColorSpace::parse(&obj1, gfx))) {
error(-1, "Bad DeviceN color space (alternate color space)");
@@ -2136,3 +2133,3 @@ GfxColorSpace *GfxPatternColorSpace::copy() {
-GfxColorSpace *GfxPatternColorSpace::parse(Array *arr) {
+GfxColorSpace *GfxPatternColorSpace::parse(Array *arr, Gfx *gfx) {
GfxPatternColorSpace *cs;
@@ -2148,3 +2145,3 @@ GfxColorSpace *GfxPatternColorSpace::parse(Array *arr) {
arr->get(1, &obj1);
- if (!(underA = GfxColorSpace::parse(&obj1))) {
+ if (!(underA = GfxColorSpace::parse(&obj1, gfx))) {
error(-1, "Bad Pattern color space (underlying color space)");
@@ -2187,3 +2184,3 @@ GfxPattern::~GfxPattern() {
-GfxPattern *GfxPattern::parse(Object *obj) {
+GfxPattern *GfxPattern::parse(Object *obj, Gfx *gfx) {
GfxPattern *pattern;
@@ -2202,3 +2199,3 @@ GfxPattern *GfxPattern::parse(Object *obj) {
} else if (obj1.isInt() && obj1.getInt() == 2) {
- pattern = GfxShadingPattern::parse(obj);
+ pattern = GfxShadingPattern::parse(obj, gfx);
}
@@ -2330,3 +2327,3 @@ GfxPattern *GfxTilingPattern::copy() {
-GfxShadingPattern *GfxShadingPattern::parse(Object *patObj) {
+GfxShadingPattern *GfxShadingPattern::parse(Object *patObj, Gfx *gfx) {
Dict *dict;
@@ -2343,3 +2340,3 @@ GfxShadingPattern *GfxShadingPattern::parse(Object *patObj) {
dict->lookup("Shading", &obj1);
- shadingA = GfxShading::parse(&obj1);
+ shadingA = GfxShading::parse(&obj1, gfx);
obj1.free();
@@ -2416,3 +2413,3 @@ GfxShading::~GfxShading() {
-GfxShading *GfxShading::parse(Object *obj) {
+GfxShading *GfxShading::parse(Object *obj, Gfx *gfx) {
GfxShading *shading;
@@ -2440,9 +2437,9 @@ GfxShading *GfxShading::parse(Object *obj) {
case 1:
- shading = GfxFunctionShading::parse(dict);
+ shading = GfxFunctionShading::parse(dict, gfx);
break;
case 2:
- shading = GfxAxialShading::parse(dict);
+ shading = GfxAxialShading::parse(dict, gfx);
break;
case 3:
- shading = GfxRadialShading::parse(dict);
+ shading = GfxRadialShading::parse(dict, gfx);
break;
@@ -2450,3 +2447,3 @@ GfxShading *GfxShading::parse(Object *obj) {
if (obj->isStream()) {
- shading = GfxGouraudTriangleShading::parse(4, dict, obj->getStream());
+ shading = GfxGouraudTriangleShading::parse(4, dict, obj->getStream(), gfx);
} else {
@@ -2458,3 +2455,3 @@ GfxShading *GfxShading::parse(Object *obj) {
if (obj->isStream()) {
- shading = GfxGouraudTriangleShading::parse(5, dict, obj->getStream());
+ shading = GfxGouraudTriangleShading::parse(5, dict, obj->getStream(), gfx);
} else {
@@ -2466,3 +2463,3 @@ GfxShading *GfxShading::parse(Object *obj) {
if (obj->isStream()) {
- shading = GfxPatchMeshShading::parse(6, dict, obj->getStream());
+ shading = GfxPatchMeshShading::parse(6, dict, obj->getStream(), gfx);
} else {
@@ -2474,3 +2471,3 @@ GfxShading *GfxShading::parse(Object *obj) {
if (obj->isStream()) {
- shading = GfxPatchMeshShading::parse(7, dict, obj->getStream());
+ shading = GfxPatchMeshShading::parse(7, dict, obj->getStream(), gfx);
} else {
@@ -2491,3 +2488,3 @@ GfxShading *GfxShading::parse(Object *obj) {
-GBool GfxShading::init(Dict *dict) {
+GBool GfxShading::init(Dict *dict, Gfx *gfx) {
Object obj1, obj2;
@@ -2496,3 +2493,3 @@ GBool GfxShading::init(Dict *dict) {
dict->lookup("ColorSpace", &obj1);
- if (!(colorSpace = GfxColorSpace::parse(&obj1))) {
+ if (!(colorSpace = GfxColorSpace::parse(&obj1, gfx))) {
error(-1, "Bad color space in shading dictionary");
@@ -2593,3 +2590,3 @@ GfxFunctionShading::~GfxFunctionShading() {
-GfxFunctionShading *GfxFunctionShading::parse(Dict *dict) {
+GfxFunctionShading *GfxFunctionShading::parse(Dict *dict, Gfx *gfx) {
GfxFunctionShading *shading;
@@ -2661,3 +2658,3 @@ GfxFunctionShading *GfxFunctionShading::parse(Dict *dict) {
funcsA, nFuncsA);
- if (!shading->init(dict)) {
+ if (!shading->init(dict, gfx)) {
delete shading;
@@ -2751,3 +2748,3 @@ GfxAxialShading::~GfxAxialShading() {
-GfxAxialShading *GfxAxialShading::parse(Dict *dict) {
+GfxAxialShading *GfxAxialShading::parse(Dict *dict, Gfx *gfx) {
GfxAxialShading *shading;
@@ -2826,3 +2823,3 @@ GfxAxialShading *GfxAxialShading::parse(Dict *dict) {
funcsA, nFuncsA, extend0A, extend1A);
- if (!shading->init(dict)) {
+ if (!shading->init(dict, gfx)) {
delete shading;
@@ -2915,3 +2912,3 @@ GfxRadialShading::~GfxRadialShading() {
-GfxRadialShading *GfxRadialShading::parse(Dict *dict) {
+GfxRadialShading *GfxRadialShading::parse(Dict *dict, Gfx *gfx) {
GfxRadialShading *shading;
@@ -2994,3 +2991,3 @@ GfxRadialShading *GfxRadialShading::parse(Dict *dict) {
funcsA, nFuncsA, extend0A, extend1A);
- if (!shading->init(dict)) {
+ if (!shading->init(dict, gfx)) {
delete shading;
@@ -3145,3 +3142,4 @@ GfxGouraudTriangleShading *GfxGouraudTriangleShading::parse(int typeA,
Dict *dict,
- Stream *str) {
+ Stream *str,
+ Gfx *gfx) {
GfxGouraudTriangleShading *shading;
@@ -3341,3 +3339,3 @@ GfxGouraudTriangleShading *GfxGouraudTriangleShading::parse(int typeA,
funcsA, nFuncsA);
- if (!shading->init(dict)) {
+ if (!shading->init(dict, gfx)) {
delete shading;
@@ -3453,3 +3451,3 @@ GfxPatchMeshShading::~GfxPatchMeshShading() {
GfxPatchMeshShading *GfxPatchMeshShading::parse(int typeA, Dict *dict,
- Stream *str) {
+ Stream *str, Gfx *gfx) {
GfxPatchMeshShading *shading;
@@ -3954,3 +3952,3 @@ GfxPatchMeshShading *GfxPatchMeshShading::parse(int typeA, Dict *dict,
funcsA, nFuncsA);
- if (!shading->init(dict)) {
+ if (!shading->init(dict, gfx)) {
delete shading;