[poppler] 3 commits - poppler/CairoFontEngine.cc poppler/CairoOutputDev.cc poppler/CairoOutputDev.h
Carlos Garcia Campos
carlosgc at kemper.freedesktop.org
Mon Aug 10 11:05:14 PDT 2009
poppler/CairoFontEngine.cc | 19 ++-----------------
poppler/CairoOutputDev.cc | 16 +++++++++++++---
poppler/CairoOutputDev.h | 1 +
3 files changed, 16 insertions(+), 20 deletions(-)
New commits:
commit 15752b7cd5c94620e3ad3b6afd9c70ccc754c9b3
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Mon Aug 10 20:02:13 2009 +0200
[cairo] Add empty updateBlendMode to CairoImageOutputDev
Fixes a crash when using CairoImageOutputDev with a document with blend
modes.
diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h
index 071c171..e0e1813 100644
--- a/poppler/CairoOutputDev.h
+++ b/poppler/CairoOutputDev.h
@@ -366,6 +366,7 @@ public:
virtual void updateStrokeColor(GfxState *state) { }
virtual void updateFillOpacity(GfxState *state) { }
virtual void updateStrokeOpacity(GfxState *state) { }
+ virtual void updateBlendMode(GfxState *state) { }
//----- update text state
virtual void updateFont(GfxState *state) { }
commit 45dae4e66b2b833f95656850b5f1b0ffd1d96f1d
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Mon Aug 10 20:00:04 2009 +0200
[cairo] Use current fill_opacity when drawing images
Fixes launchpad bug #342282 (page 2 of the attached document)
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 6e9874e..af92776 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -1885,7 +1885,7 @@ void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
int *maskColors, GBool inlineImg)
{
cairo_surface_t *image;
- cairo_pattern_t *pattern;
+ cairo_pattern_t *pattern, *maskPattern;
ImageStream *imgStr;
cairo_matrix_t matrix;
unsigned char *buffer;
@@ -1988,17 +1988,27 @@ void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
cairo_matrix_scale (&matrix, width, -height);
cairo_pattern_set_matrix (pattern, &matrix);
+ if (!mask && fill_opacity != 1.0) {
+ maskPattern = cairo_pattern_create_rgba (1., 1., 1., fill_opacity);
+ } else if (mask) {
+ maskPattern = cairo_pattern_reference (mask);
+ } else {
+ maskPattern = NULL;
+ }
+
cairo_save (cairo);
cairo_set_source (cairo, pattern);
cairo_rectangle (cairo, 0., 0., 1., 1.);
- if (mask) {
+ if (maskPattern) {
cairo_clip (cairo);
- cairo_mask (cairo, mask);
+ cairo_mask (cairo, maskPattern);
} else {
cairo_fill (cairo);
}
cairo_restore (cairo);
+ cairo_pattern_destroy (maskPattern);
+
if (cairo_shape) {
cairo_save (cairo_shape);
cairo_set_source (cairo_shape, pattern);
commit b1cd54546844f2f7cd6bf7cc14b7584c84c3fc14
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Mon Aug 10 19:55:44 2009 +0200
[cairo] Do not save the font file twice for FreeType fonts
Fixes bug #20491.
diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc
index 6490235..329ff42 100644
--- a/poppler/CairoFontEngine.cc
+++ b/poppler/CairoFontEngine.cc
@@ -154,10 +154,6 @@ CairoFont::getSubstitutionCorrection(GfxFont *gfxFont)
static cairo_user_data_key_t _ft_cairo_key;
-static void fileWrite(void *stream, char *data, int len) {
- fwrite(data, 1, len, (FILE *)stream);
-}
-
static void
_ft_done_face_uncached (void *closure)
{
@@ -367,7 +363,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref,
FT_Library lib, GBool useCIDs) {
Ref embRef;
Object refObj, strObj;
- GooString *tmpFileName, *fileName,*tmpFileName2;
+ GooString *tmpFileName, *fileName;
DisplayFontParam *dfp;
FILE *tmpFile;
int c, i, n;
@@ -493,21 +489,10 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref,
codeToGID = ((Gfx8BitFont *)gfxFont)->getCodeToGIDMap(ff);
codeToGIDLen = 256;
}
- if (!openTempFile(&tmpFileName2, &tmpFile, "wb")) {
- delete ff;
- error(-1, "failed to open truetype tempfile\n");
- goto err2;
- }
- ff->writeTTF(&fileWrite, tmpFile);
- fclose(tmpFile);
- delete ff;
-
- if (! _ft_new_face (lib, tmpFileName2->getCString(), &face, &font_face)) {
+ if (! _ft_new_face (lib, fileName->getCString(), &face, &font_face)) {
error(-1, "could not create truetype face\n");
goto err2;
}
- unlink (tmpFileName2->getCString());
- delete tmpFileName2;
break;
case fontCIDType0:
More information about the poppler
mailing list