diff options
author | Carlos Garcia Campos <carlosgc@gnome.org> | 2009-05-11 09:45:06 +0200 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2009-05-11 09:45:06 +0200 |
commit | 28a99ec03e25f3320ecd471ae1349b67c30c3bb6 (patch) | |
tree | 8af49e615b412f31aa3b68b7dd3b584d1550c133 | |
parent | a69d40832f581a8a3c7fbf44b50051668be61814 (diff) |
Make sure ImageStream::close() is called after ImageStream::reset()
-rw-r--r-- | poppler/ArthurOutputDev.cc | 1 | ||||
-rw-r--r-- | poppler/CairoOutputDev.cc | 20 | ||||
-rw-r--r-- | poppler/Page.cc | 1 | ||||
-rw-r--r-- | poppler/Stream.cc | 4 | ||||
-rw-r--r-- | poppler/Stream.h | 3 | ||||
-rw-r--r-- | utils/ImageOutputDev.cc | 1 |
6 files changed, 27 insertions, 3 deletions
diff --git a/poppler/ArthurOutputDev.cc b/poppler/ArthurOutputDev.cc index 01c83847..f64fdc2a 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 ec86a777..d7f8cb8f 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 1cc2cfb7..e968851c 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 385e5453..ed4641a9 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 2d1598ff..8316e73c 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 be3807f7..f7d69d2d 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); |