summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/desktop-style.cpp2
-rw-r--r--src/ege-color-prof-tracker.cpp3
-rw-r--r--src/ege-select-one-action.cpp10
-rw-r--r--src/extension/dependency.cpp4
-rw-r--r--src/extension/internal/filter/paint.h1
-rw-r--r--src/extension/internal/pdfinput/pdf-parser.cpp565
6 files changed, 292 insertions, 293 deletions
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp
index 2ea3c876b..40132ec58 100644
--- a/src/desktop-style.cpp
+++ b/src/desktop-style.cpp
@@ -446,9 +446,9 @@ stroke_average_width (GSList const *objects)
static bool vectorsClose( std::vector<double> const &lhs, std::vector<double> const &rhs )
{
- static double epsilon = 1e-6;
bool isClose = false;
if ( lhs.size() == rhs.size() ) {
+ static double epsilon = 1e-6;
isClose = true;
for ( size_t i = 0; (i < lhs.size()) && isClose; ++i ) {
isClose = fabs(lhs[i] - rhs[i]) < epsilon;
diff --git a/src/ege-color-prof-tracker.cpp b/src/ege-color-prof-tracker.cpp
index 2e1b8188f..53004a96d 100644
--- a/src/ege-color-prof-tracker.cpp
+++ b/src/ege-color-prof-tracker.cpp
@@ -566,9 +566,8 @@ GdkFilterReturn x11_win_filter(GdkXEvent *xevent,
const gchar* name = gdk_x11_get_xatom_name(note->atom);
if ( strncmp("_ICC_PROFILE", name, 12 ) == 0 ) {
XEvent* native = (XEvent*)xevent;
- Status stat = Success;
XWindowAttributes tmp;
- stat = XGetWindowAttributes( native->xproperty.display, native->xproperty.window, &tmp );
+ Status stat = XGetWindowAttributes( native->xproperty.display, native->xproperty.window, &tmp );
if ( stat ) {
GdkDisplay* display = gdk_x11_lookup_xdisplay(native->xproperty.display);
if ( display ) {
diff --git a/src/ege-select-one-action.cpp b/src/ege-select-one-action.cpp
index 33cfd04f2..871b961bd 100644
--- a/src/ege-select-one-action.cpp
+++ b/src/ege-select-one-action.cpp
@@ -567,7 +567,6 @@ GtkWidget* create_menu_item( GtkAction* action )
if ( IS_EGE_SELECT_ONE_ACTION(action) ) {
EgeSelectOneAction* act = EGE_SELECT_ONE_ACTION( action );
gchar* sss = 0;
- gboolean valid = FALSE;
gint index = 0;
GtkTreeIter iter;
GSList* group = 0;
@@ -577,7 +576,7 @@ GtkWidget* create_menu_item( GtkAction* action )
item = gtk_menu_item_new_with_label( sss );
- valid = gtk_tree_model_get_iter_first( act->private_data->model, &iter );
+ gboolean valid = gtk_tree_model_get_iter_first( act->private_data->model, &iter );
while ( valid ) {
gchar* str = 0;
gtk_tree_model_get( act->private_data->model, &iter,
@@ -746,8 +745,6 @@ GtkWidget* create_tool_item( GtkAction* action )
gtk_container_add( GTK_CONTAINER(item), holder );
} else {
- GtkCellRenderer * renderer = 0;
-
#if GTK_CHECK_VERSION(3,0,0)
GtkWidget* holder = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4);
gtk_box_set_homogeneous(GTK_BOX(holder), FALSE);
@@ -759,8 +756,8 @@ GtkWidget* create_tool_item( GtkAction* action )
GtkWidget *normal;
if (act->private_data->selectionMode == SELECTION_OPEN) {
- normal = gtk_combo_box_new_with_model_and_entry (act->private_data->model);
- gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (normal), act->private_data->labelColumn);
+ normal = gtk_combo_box_new_with_model_and_entry (act->private_data->model);
+ gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (normal), act->private_data->labelColumn);
GtkWidget *child = gtk_bin_get_child( GTK_BIN(normal) );
if (GTK_IS_ENTRY(child)) {
@@ -783,6 +780,7 @@ GtkWidget* create_tool_item( GtkAction* action )
}
}
else {
+ GtkCellRenderer * renderer = NULL;
normal = gtk_combo_box_new_with_model( act->private_data->model );
if ( act->private_data->iconColumn >= 0 ) {
renderer = gtk_cell_renderer_pixbuf_new();
diff --git a/src/extension/dependency.cpp b/src/extension/dependency.cpp
index 7c358d871..78012ccc8 100644
--- a/src/extension/dependency.cpp
+++ b/src/extension/dependency.cpp
@@ -122,8 +122,7 @@ Dependency::~Dependency (void)
found then a TRUE is returned. If we get all the way through the
path then a FALSE is returned, the command could not be found.
*/
-bool
-Dependency::check (void) const
+bool Dependency::check (void) const
{
// std::cout << "Checking: " << *this << std::endl;
@@ -216,7 +215,6 @@ Dependency::check (void) const
g_free(orig_path);
return FALSE; /* Reverse logic in this one */
- break;
}
} /* switch _location */
break;
diff --git a/src/extension/internal/filter/paint.h b/src/extension/internal/filter/paint.h
index f04dd92f9..4052f4391 100644
--- a/src/extension/internal/filter/paint.h
+++ b/src/extension/internal/filter/paint.h
@@ -133,7 +133,6 @@ Chromolitho::get_filter_text (Inkscape::Extension::Extension * ext)
std::ostringstream noise;
std::ostringstream dblend;
std::ostringstream smooth;
- std::ostringstream grain;
std::ostringstream grainxf;
std::ostringstream grainyf;
std::ostringstream grainc;
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
index e57161e5a..3be7af34f 100644
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
@@ -1220,7 +1220,6 @@ void PdfParser::opSetStrokeColor(Object args[], int numArgs) {
void PdfParser::opSetFillColorN(Object args[], int numArgs) {
GfxColor color;
- GfxPattern *pattern;
int i;
if (state->getFillColorSpace()->getMode() == csPattern) {
@@ -1243,6 +1242,7 @@ void PdfParser::opSetFillColorN(Object args[], int numArgs) {
state->setFillColor(&color);
builder->updateStyle(state);
}
+ GfxPattern *pattern;
#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
if (args[numArgs-1].isName() &&
(pattern = res->lookupPattern(args[numArgs-1].getName(), NULL))) {
@@ -1279,7 +1279,6 @@ void PdfParser::opSetFillColorN(Object args[], int numArgs) {
void PdfParser::opSetStrokeColorN(Object args[], int numArgs) {
GfxColor color;
- GfxPattern *pattern;
int i;
if (state->getStrokeColorSpace()->getMode() == csPattern) {
@@ -1303,6 +1302,7 @@ void PdfParser::opSetStrokeColorN(Object args[], int numArgs) {
state->setStrokeColor(&color);
builder->updateStyle(state);
}
+ GfxPattern *pattern;
#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
if (args[numArgs-1].isName() &&
(pattern = res->lookupPattern(args[numArgs-1].getName(), NULL))) {
@@ -2702,333 +2702,338 @@ void PdfParser::opXObject(Object args[], int /*numArgs*/)
void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg)
{
- Dict *dict, *maskDict;
- int width, height;
- int bits;
- StreamColorSpaceMode csMode;
- GBool mask;
- GBool invert;
- GfxColorSpace *colorSpace, *maskColorSpace;
- GfxImageColorMap *colorMap, *maskColorMap;
- Object maskObj, smaskObj;
- GBool haveColorKeyMask, haveExplicitMask, haveSoftMask;
- int maskColors[2*gfxColorMaxComps];
- int maskWidth, maskHeight;
- GBool maskInvert;
- Stream *maskStr;
- Object obj1, obj2;
- int i;
-
- // get info from the stream
- bits = 0;
- csMode = streamCSNone;
- str->getImageParams(&bits, &csMode);
-
- // get stream dict
- dict = str->getDict();
-
- // get size
- dict->lookup(const_cast<char*>("Width"), &obj1);
- if (obj1.isNull()) {
- obj1.free();
- dict->lookup(const_cast<char*>("W"), &obj1);
- }
- if (obj1.isInt())
- width = obj1.getInt();
- else if (obj1.isReal())
- width = (int)obj1.getReal();
- else
- goto err2;
- obj1.free();
- dict->lookup(const_cast<char*>("Height"), &obj1);
- if (obj1.isNull()) {
- obj1.free();
- dict->lookup(const_cast<char*>("H"), &obj1);
- }
- if (obj1.isInt())
- height = obj1.getInt();
- else if (obj1.isReal())
- height = (int)obj1.getReal();
- else
- goto err2;
- obj1.free();
-
- // image or mask?
- dict->lookup(const_cast<char*>("ImageMask"), &obj1);
- if (obj1.isNull()) {
- obj1.free();
- dict->lookup(const_cast<char*>("IM"), &obj1);
- }
- mask = gFalse;
- if (obj1.isBool())
- mask = obj1.getBool();
- else if (!obj1.isNull())
- goto err2;
- obj1.free();
-
- // bit depth
- if (bits == 0) {
- dict->lookup(const_cast<char*>("BitsPerComponent"), &obj1);
+ Dict *dict;
+ int width, height;
+ int bits;
+ StreamColorSpaceMode csMode;
+ GBool mask;
+ GBool invert;
+ Object maskObj, smaskObj;
+ GBool haveColorKeyMask, haveExplicitMask, haveSoftMask;
+ GBool maskInvert;
+ Object obj1, obj2;
+
+ // get info from the stream
+ bits = 0;
+ csMode = streamCSNone;
+ str->getImageParams(&bits, &csMode);
+
+ // get stream dict
+ dict = str->getDict();
+
+ // get size
+ dict->lookup(const_cast<char*>("Width"), &obj1);
if (obj1.isNull()) {
- obj1.free();
- dict->lookup(const_cast<char*>("BPC"), &obj1);
+ obj1.free();
+ dict->lookup(const_cast<char*>("W"), &obj1);
}
- if (obj1.isInt()) {
- bits = obj1.getInt();
- } else if (mask) {
- bits = 1;
- } else {
- goto err2;
+ if (obj1.isInt()){
+ width = obj1.getInt();
}
- obj1.free();
- }
-
- // display a mask
- if (mask) {
-
- // check for inverted mask
- if (bits != 1)
- goto err1;
- invert = gFalse;
- dict->lookup(const_cast<char*>("Decode"), &obj1);
- if (obj1.isNull()) {
- obj1.free();
- dict->lookup(const_cast<char*>("D"), &obj1);
+ else if (obj1.isReal()) {
+ width = (int)obj1.getReal();
}
- if (obj1.isArray()) {
- obj1.arrayGet(0, &obj2);
- if (obj2.isInt() && obj2.getInt() == 1)
- invert = gTrue;
- obj2.free();
- } else if (!obj1.isNull()) {
- goto err2;
+ else {
+ goto err2;
}
obj1.free();
-
- // draw it
- builder->addImageMask(state, str, width, height, invert);
-
- } else {
-
- // get color space and color map
- dict->lookup(const_cast<char*>("ColorSpace"), &obj1);
+ dict->lookup(const_cast<char*>("Height"), &obj1);
if (obj1.isNull()) {
- obj1.free();
- dict->lookup(const_cast<char*>("CS"), &obj1);
+ obj1.free();
+ dict->lookup(const_cast<char*>("H"), &obj1);
}
- if (obj1.isName()) {
- res->lookupColorSpace(obj1.getName(), &obj2);
- if (!obj2.isNull()) {
- obj1.free();
- obj1 = obj2;
- } else {
- obj2.free();
- }
+ if (obj1.isInt()) {
+ height = obj1.getInt();
}
- if (!obj1.isNull()) {
-#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
- colorSpace = GfxColorSpace::parse(&obj1, NULL);
-#else
- colorSpace = GfxColorSpace::parse(&obj1);
-#endif
- } else if (csMode == streamCSDeviceGray) {
- colorSpace = new GfxDeviceGrayColorSpace();
- } else if (csMode == streamCSDeviceRGB) {
- colorSpace = new GfxDeviceRGBColorSpace();
- } else if (csMode == streamCSDeviceCMYK) {
- colorSpace = new GfxDeviceCMYKColorSpace();
- } else {
- colorSpace = NULL;
+ else if (obj1.isReal()){
+ height = static_cast<int>(obj1.getReal());
}
- obj1.free();
- if (!colorSpace) {
- goto err1;
+ else {
+ goto err2;
}
- dict->lookup(const_cast<char*>("Decode"), &obj1);
+ obj1.free();
+
+ // image or mask?
+ dict->lookup(const_cast<char*>("ImageMask"), &obj1);
if (obj1.isNull()) {
- obj1.free();
- dict->lookup(const_cast<char*>("D"), &obj1);
+ obj1.free();
+ dict->lookup(const_cast<char*>("IM"), &obj1);
+ }
+ mask = gFalse;
+ if (obj1.isBool()) {
+ mask = obj1.getBool();
+ }
+ else if (!obj1.isNull()) {
+ goto err2;
}
- colorMap = new GfxImageColorMap(bits, &obj1, colorSpace);
obj1.free();
- if (!colorMap->isOk()) {
- delete colorMap;
- goto err1;
- }
-
- // get the mask
- haveColorKeyMask = haveExplicitMask = haveSoftMask = gFalse;
- maskStr = NULL; // make gcc happy
- maskWidth = maskHeight = 0; // make gcc happy
- maskInvert = gFalse; // make gcc happy
- maskColorMap = NULL; // make gcc happy
- dict->lookup(const_cast<char*>("Mask"), &maskObj);
- dict->lookup(const_cast<char*>("SMask"), &smaskObj);
- if (smaskObj.isStream()) {
- // soft mask
- if (inlineImg) {
- goto err1;
- }
- maskStr = smaskObj.getStream();
- maskDict = smaskObj.streamGetDict();
- maskDict->lookup(const_cast<char*>("Width"), &obj1);
+
+ // bit depth
+ if (bits == 0) {
+ dict->lookup(const_cast<char*>("BitsPerComponent"), &obj1);
if (obj1.isNull()) {
- obj1.free();
- maskDict->lookup(const_cast<char*>("W"), &obj1);
+ obj1.free();
+ dict->lookup(const_cast<char*>("BPC"), &obj1);
}
- if (!obj1.isInt()) {
- goto err2;
+ if (obj1.isInt()) {
+ bits = obj1.getInt();
+ } else if (mask) {
+ bits = 1;
+ } else {
+ goto err2;
}
- maskWidth = obj1.getInt();
obj1.free();
- maskDict->lookup(const_cast<char*>("Height"), &obj1);
- if (obj1.isNull()) {
- obj1.free();
- maskDict->lookup(const_cast<char*>("H"), &obj1);
- }
- if (!obj1.isInt()) {
- goto err2;
+ }
+
+ // display a mask
+ if (mask) {
+ // check for inverted mask
+ if (bits != 1) {
+ goto err1;
}
- maskHeight = obj1.getInt();
- obj1.free();
- maskDict->lookup(const_cast<char*>("BitsPerComponent"), &obj1);
+ invert = gFalse;
+ dict->lookup(const_cast<char*>("Decode"), &obj1);
if (obj1.isNull()) {
- obj1.free();
- maskDict->lookup(const_cast<char*>("BPC"), &obj1);
+ obj1.free();
+ dict->lookup(const_cast<char*>("D"), &obj1);
}
- if (!obj1.isInt()) {
- goto err2;
+ if (obj1.isArray()) {
+ obj1.arrayGet(0, &obj2);
+ if (obj2.isInt() && obj2.getInt() == 1) {
+ invert = gTrue;
+ }
+ obj2.free();
+ } else if (!obj1.isNull()) {
+ goto err2;
}
- int maskBits = obj1.getInt();
obj1.free();
- maskDict->lookup(const_cast<char*>("ColorSpace"), &obj1);
+
+ // draw it
+ builder->addImageMask(state, str, width, height, invert);
+
+ } else {
+ // get color space and color map
+ GfxColorSpace *colorSpace;
+ dict->lookup(const_cast<char*>("ColorSpace"), &obj1);
if (obj1.isNull()) {
- obj1.free();
- maskDict->lookup(const_cast<char*>("CS"), &obj1);
+ obj1.free();
+ dict->lookup(const_cast<char*>("CS"), &obj1);
}
if (obj1.isName()) {
- res->lookupColorSpace(obj1.getName(), &obj2);
- if (!obj2.isNull()) {
+ res->lookupColorSpace(obj1.getName(), &obj2);
+ if (!obj2.isNull()) {
obj1.free();
obj1 = obj2;
- } else {
+ } else {
obj2.free();
- }
+ }
}
+ if (!obj1.isNull()) {
#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
- maskColorSpace = GfxColorSpace::parse(&obj1, NULL);
+ colorSpace = GfxColorSpace::parse(&obj1, NULL);
#else
- maskColorSpace = GfxColorSpace::parse(&obj1);
-#endif
+ colorSpace = GfxColorSpace::parse(&obj1);
+#endif
+ } else if (csMode == streamCSDeviceGray) {
+ colorSpace = new GfxDeviceGrayColorSpace();
+ } else if (csMode == streamCSDeviceRGB) {
+ colorSpace = new GfxDeviceRGBColorSpace();
+ } else if (csMode == streamCSDeviceCMYK) {
+ colorSpace = new GfxDeviceCMYKColorSpace();
+ } else {
+ colorSpace = NULL;
+ }
obj1.free();
- if (!maskColorSpace || maskColorSpace->getMode() != csDeviceGray) {
+ if (!colorSpace) {
goto err1;
}
- maskDict->lookup(const_cast<char*>("Decode"), &obj1);
+ dict->lookup(const_cast<char*>("Decode"), &obj1);
if (obj1.isNull()) {
- obj1.free();
- maskDict->lookup(const_cast<char*>("D"), &obj1);
+ obj1.free();
+ dict->lookup(const_cast<char*>("D"), &obj1);
}
- maskColorMap = new GfxImageColorMap(maskBits, &obj1, maskColorSpace);
+ GfxImageColorMap *colorMap = new GfxImageColorMap(bits, &obj1, colorSpace);
obj1.free();
- if (!maskColorMap->isOk()) {
- delete maskColorMap;
+ if (!colorMap->isOk()) {
+ delete colorMap;
goto err1;
}
- //~ handle the Matte entry
- haveSoftMask = gTrue;
- } else if (maskObj.isArray()) {
- // color key mask
- for (i = 0;
- i < maskObj.arrayGetLength() && i < 2*gfxColorMaxComps;
- ++i) {
- maskObj.arrayGet(i, &obj1);
- maskColors[i] = obj1.getInt();
- obj1.free();
- }
- haveColorKeyMask = gTrue;
- } else if (maskObj.isStream()) {
- // explicit mask
- if (inlineImg) {
- goto err1;
- }
- maskStr = maskObj.getStream();
- maskDict = maskObj.streamGetDict();
- maskDict->lookup(const_cast<char*>("Width"), &obj1);
- if (obj1.isNull()) {
- obj1.free();
- maskDict->lookup(const_cast<char*>("W"), &obj1);
- }
- if (!obj1.isInt()) {
- goto err2;
- }
- maskWidth = obj1.getInt();
- obj1.free();
- maskDict->lookup(const_cast<char*>("Height"), &obj1);
- if (obj1.isNull()) {
- obj1.free();
- maskDict->lookup(const_cast<char*>("H"), &obj1);
- }
- if (!obj1.isInt()) {
- goto err2;
- }
- maskHeight = obj1.getInt();
- obj1.free();
- maskDict->lookup(const_cast<char*>("ImageMask"), &obj1);
- if (obj1.isNull()) {
- obj1.free();
- maskDict->lookup(const_cast<char*>("IM"), &obj1);
- }
- if (!obj1.isBool() || !obj1.getBool()) {
- goto err2;
- }
- obj1.free();
- maskInvert = gFalse;
- maskDict->lookup(const_cast<char*>("Decode"), &obj1);
- if (obj1.isNull()) {
- obj1.free();
- maskDict->lookup(const_cast<char*>("D"), &obj1);
- }
- if (obj1.isArray()) {
- obj1.arrayGet(0, &obj2);
- if (obj2.isInt() && obj2.getInt() == 1) {
- maskInvert = gTrue;
- }
- obj2.free();
- } else if (!obj1.isNull()) {
- goto err2;
- }
- obj1.free();
- haveExplicitMask = gTrue;
- }
-
- // draw it
- if (haveSoftMask) {
- builder->addSoftMaskedImage(state, str, width, height, colorMap,
+
+ // get the mask
+ int maskColors[2*gfxColorMaxComps];
+ haveColorKeyMask = haveExplicitMask = haveSoftMask = gFalse;
+ Stream *maskStr = NULL;
+ int maskWidth = 0;
+ int maskHeight = 0;
+ maskInvert = gFalse;
+ GfxImageColorMap *maskColorMap = NULL;
+ dict->lookup(const_cast<char*>("Mask"), &maskObj);
+ dict->lookup(const_cast<char*>("SMask"), &smaskObj);
+ Dict* maskDict;
+ if (smaskObj.isStream()) {
+ // soft mask
+ if (inlineImg) {
+ goto err1;
+ }
+ maskStr = smaskObj.getStream();
+ maskDict = smaskObj.streamGetDict();
+ maskDict->lookup(const_cast<char*>("Width"), &obj1);
+ if (obj1.isNull()) {
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("W"), &obj1);
+ }
+ if (!obj1.isInt()) {
+ goto err2;
+ }
+ maskWidth = obj1.getInt();
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("Height"), &obj1);
+ if (obj1.isNull()) {
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("H"), &obj1);
+ }
+ if (!obj1.isInt()) {
+ goto err2;
+ }
+ maskHeight = obj1.getInt();
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("BitsPerComponent"), &obj1);
+ if (obj1.isNull()) {
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("BPC"), &obj1);
+ }
+ if (!obj1.isInt()) {
+ goto err2;
+ }
+ int maskBits = obj1.getInt();
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("ColorSpace"), &obj1);
+ if (obj1.isNull()) {
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("CS"), &obj1);
+ }
+ if (obj1.isName()) {
+ res->lookupColorSpace(obj1.getName(), &obj2);
+ if (!obj2.isNull()) {
+ obj1.free();
+ obj1 = obj2;
+ } else {
+ obj2.free();
+ }
+ }
+#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
+ GfxColorSpace *maskColorSpace = GfxColorSpace::parse(&obj1, NULL);
+#else
+ GfxColorSpace *maskColorSpace = GfxColorSpace::parse(&obj1);
+#endif
+ obj1.free();
+ if (!maskColorSpace || maskColorSpace->getMode() != csDeviceGray) {
+ goto err1;
+ }
+ maskDict->lookup(const_cast<char*>("Decode"), &obj1);
+ if (obj1.isNull()) {
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("D"), &obj1);
+ }
+ maskColorMap = new GfxImageColorMap(maskBits, &obj1, maskColorSpace);
+ obj1.free();
+ if (!maskColorMap->isOk()) {
+ delete maskColorMap;
+ goto err1;
+ }
+ //~ handle the Matte entry
+ haveSoftMask = gTrue;
+ } else if (maskObj.isArray()) {
+ // color key mask
+ int i;
+ for (i = 0; i < maskObj.arrayGetLength() && i < 2*gfxColorMaxComps; ++i) {
+ maskObj.arrayGet(i, &obj1);
+ maskColors[i] = obj1.getInt();
+ obj1.free();
+ }
+ haveColorKeyMask = gTrue;
+ } else if (maskObj.isStream()) {
+ // explicit mask
+ if (inlineImg) {
+ goto err1;
+ }
+ maskStr = maskObj.getStream();
+ maskDict = maskObj.streamGetDict();
+ maskDict->lookup(const_cast<char*>("Width"), &obj1);
+ if (obj1.isNull()) {
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("W"), &obj1);
+ }
+ if (!obj1.isInt()) {
+ goto err2;
+ }
+ maskWidth = obj1.getInt();
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("Height"), &obj1);
+ if (obj1.isNull()) {
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("H"), &obj1);
+ }
+ if (!obj1.isInt()) {
+ goto err2;
+ }
+ maskHeight = obj1.getInt();
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("ImageMask"), &obj1);
+ if (obj1.isNull()) {
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("IM"), &obj1);
+ }
+ if (!obj1.isBool() || !obj1.getBool()) {
+ goto err2;
+ }
+ obj1.free();
+ maskInvert = gFalse;
+ maskDict->lookup(const_cast<char*>("Decode"), &obj1);
+ if (obj1.isNull()) {
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("D"), &obj1);
+ }
+ if (obj1.isArray()) {
+ obj1.arrayGet(0, &obj2);
+ if (obj2.isInt() && obj2.getInt() == 1) {
+ maskInvert = gTrue;
+ }
+ obj2.free();
+ } else if (!obj1.isNull()) {
+ goto err2;
+ }
+ obj1.free();
+ haveExplicitMask = gTrue;
+ }
+
+ // draw it
+ if (haveSoftMask) {
+ builder->addSoftMaskedImage(state, str, width, height, colorMap,
maskStr, maskWidth, maskHeight, maskColorMap);
- delete maskColorMap;
- } else if (haveExplicitMask) {
- builder->addMaskedImage(state, str, width, height, colorMap,
+ delete maskColorMap;
+ } else if (haveExplicitMask) {
+ builder->addMaskedImage(state, str, width, height, colorMap,
maskStr, maskWidth, maskHeight, maskInvert);
- } else {
- builder->addImage(state, str, width, height, colorMap,
- haveColorKeyMask ? maskColors : (int *)NULL);
+ } else {
+ builder->addImage(state, str, width, height, colorMap,
+ haveColorKeyMask ? maskColors : static_cast<int *>(NULL));
+ }
+ delete colorMap;
+
+ maskObj.free();
+ smaskObj.free();
}
- delete colorMap;
- maskObj.free();
- smaskObj.free();
- }
-
- return;
+ return;
err2:
- obj1.free();
+ obj1.free();
err1:
#ifdef POPPLER_NEW_ERRORAPI
- error(errSyntaxError, getPos(), "Bad image parameters");
+ error(errSyntaxError, getPos(), "Bad image parameters");
#else
- error(getPos(), const_cast<char*>("Bad image parameters"));
+ error(getPos(), const_cast<char*>("Bad image parameters"));
#endif
}