[poppler] Branch 'poppler-0.10' - poppler/ArthurOutputDev.cc poppler/CairoOutputDev.cc poppler/Page.cc poppler/Stream.cc poppler/Stream.h utils/ImageOutputDev.cc
Carlos Garcia Campos
carlosgc at kemper.freedesktop.org
Mon May 11 00:46:05 PDT 2009
poppler/ArthurOutputDev.cc | 1 +
poppler/CairoOutputDev.cc | 20 +++++++++++++++++---
poppler/Page.cc | 1 +
poppler/Stream.cc | 4 ++++
poppler/Stream.h | 3 +++
utils/ImageOutputDev.cc | 1 +
6 files changed, 27 insertions(+), 3 deletions(-)
New commits:
commit 28a99ec03e25f3320ecd471ae1349b67c30c3bb6
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Mon May 11 09:45:06 2009 +0200
Make sure ImageStream::close() is called after ImageStream::reset()
diff --git a/poppler/ArthurOutputDev.cc b/poppler/ArthurOutputDev.cc
index 01c8384..f64fdc2 100644
--- a/poppler/ArthurOutputDev.cc
+++ b/poppler/ArthurOutputDev.cc
@@ -731,6 +731,7 @@ void ArthurOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
cairo_pattern_destroy (pattern);
cairo_surface_destroy (image);
free (buffer);
+ imgStr->close ();
delete imgStr;
#endif
}
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index ec86a77..d7f8cb8 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -1034,11 +1034,13 @@ void CairoOutputDev::drawImageMaskRegular(GfxState *state, Object *ref, Stream *
image = cairo_image_surface_create_for_data (buffer, CAIRO_FORMAT_A8,
width, height, row_stride);
if (image == NULL) {
+ imgStr->close();
delete imgStr;
return;
}
pattern = cairo_pattern_create_for_surface (image);
if (pattern == NULL) {
+ imgStr->close();
delete imgStr;
return;
}
@@ -1075,6 +1077,7 @@ void CairoOutputDev::drawImageMaskRegular(GfxState *state, Object *ref, Stream *
cairo_pattern_destroy (pattern);
cairo_surface_destroy (image);
free (buffer);
+ imgStr->close();
delete imgStr;
}
@@ -1294,11 +1297,13 @@ void CairoOutputDev::drawImageMaskPrescaled(GfxState *state, Object *ref, Stream
image = cairo_image_surface_create_for_data (buffer, CAIRO_FORMAT_A8,
scaledWidth, scaledHeight, row_stride);
if (image == NULL) {
+ imgStr->close();
delete imgStr;
return;
}
pattern = cairo_pattern_create_for_surface (image);
if (pattern == NULL) {
+ imgStr->close();
delete imgStr;
return;
}
@@ -1346,6 +1351,7 @@ void CairoOutputDev::drawImageMaskPrescaled(GfxState *state, Object *ref, Stream
cairo_pattern_destroy (pattern);
cairo_surface_destroy (image);
free (buffer);
+ imgStr->close();
delete imgStr;
}
@@ -1385,9 +1391,8 @@ void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref,
maskImage = cairo_image_surface_create_for_data (maskBuffer, CAIRO_FORMAT_A8,
maskWidth, maskHeight, row_stride);
-
+ maskImgStr->close();
delete maskImgStr;
- maskStr->close();
unsigned char *buffer;
unsigned int *dest;
@@ -1421,12 +1426,14 @@ void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref,
width, height, width * 4);
if (image == NULL) {
+ imgStr->close();
delete imgStr;
return;
}
pattern = cairo_pattern_create_for_surface (image);
maskPattern = cairo_pattern_create_for_surface (maskImage);
if (pattern == NULL) {
+ imgStr->close();
delete imgStr;
return;
}
@@ -1466,6 +1473,7 @@ void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref,
cairo_surface_destroy (image);
free (buffer);
free (maskBuffer);
+ imgStr->close();
delete imgStr;
}
@@ -1501,8 +1509,8 @@ void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *s
maskImage = cairo_image_surface_create_for_data (maskBuffer, CAIRO_FORMAT_A8,
maskWidth, maskHeight, row_stride);
+ maskImgStr->close();
delete maskImgStr;
- maskStr->close();
unsigned char *buffer;
unsigned int *dest;
@@ -1537,12 +1545,14 @@ void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *s
width, height, width * 4);
if (image == NULL) {
+ imgStr->close();
delete imgStr;
return;
}
pattern = cairo_pattern_create_for_surface (image);
maskPattern = cairo_pattern_create_for_surface (maskImage);
if (pattern == NULL) {
+ imgStr->close();
delete imgStr;
return;
}
@@ -1587,6 +1597,7 @@ void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *s
free (buffer);
free (maskBuffer);
+ imgStr->close();
delete imgStr;
}
void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
@@ -1654,11 +1665,13 @@ void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
}
if (image == NULL) {
+ imgStr->close();
delete imgStr;
return;
}
pattern = cairo_pattern_create_for_surface (image);
if (pattern == NULL) {
+ imgStr->close();
delete imgStr;
return;
}
@@ -1693,6 +1706,7 @@ void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
cairo_pattern_destroy (pattern);
cairo_surface_destroy (image);
free (buffer);
+ imgStr->close();
delete imgStr;
}
diff --git a/poppler/Page.cc b/poppler/Page.cc
index 1cc2cfb..e968851 100644
--- a/poppler/Page.cc
+++ b/poppler/Page.cc
@@ -563,6 +563,7 @@ GBool Page::loadThumb(unsigned char **data_out,
}
}
*data_out = pixbufdata;
+ imgstr->close();
delete imgstr;
}
diff --git a/poppler/Stream.cc b/poppler/Stream.cc
index 385e545..ed4641a 100644
--- a/poppler/Stream.cc
+++ b/poppler/Stream.cc
@@ -415,6 +415,10 @@ void ImageStream::reset() {
str->reset();
}
+void ImageStream::close() {
+ str->close();
+}
+
GBool ImageStream::getPixel(Guchar *pix) {
int i;
diff --git a/poppler/Stream.h b/poppler/Stream.h
index 2d1598f..8316e73 100644
--- a/poppler/Stream.h
+++ b/poppler/Stream.h
@@ -291,6 +291,9 @@ public:
// Reset the stream.
void reset();
+ // Close the stream previously reset
+ void close();
+
// Gets the next pixel from the stream. <pix> should be able to hold
// at least nComps elements. Returns false at end of file.
GBool getPixel(Guchar *pix);
diff --git a/utils/ImageOutputDev.cc b/utils/ImageOutputDev.cc
index be3807f..f7d69d2 100644
--- a/utils/ImageOutputDev.cc
+++ b/utils/ImageOutputDev.cc
@@ -217,6 +217,7 @@ void ImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
p += colorMap->getNumPixelComps();
}
}
+ imgStr->close();
delete imgStr;
fclose(f);
More information about the poppler
mailing list