? glib/libtool.debug ? glib/poppler-features.h Index: poppler/CairoOutputDev.cc =================================================================== RCS file: /cvs/poppler/poppler/poppler/CairoOutputDev.cc,v retrieving revision 1.35 diff -u -r1.35 CairoOutputDev.cc --- poppler/CairoOutputDev.cc 27 Apr 2006 17:26:37 -0000 1.35 +++ poppler/CairoOutputDev.cc 28 Apr 2006 22:06:50 -0000 @@ -124,9 +124,46 @@ needFontUpdate = gTrue; } +static void print_matrix(char *name, cairo_matrix_t matrix) { + printf("%s: %f %f, %f %f, %f %f\n", + name, + matrix.xx, + matrix.xy, + matrix.yx, + matrix.yy, + matrix.x0, + matrix.y0); +} + +void CairoOutputDev::setDefaultCTM(double *ctm) { + cairo_matrix_t matrix; + matrix.xx = ctm[0]; + matrix.xy = ctm[1]; + matrix.yx = ctm[2]; + matrix.yy = ctm[3]; + matrix.x0 = ctm[4]; + matrix.y0 = ctm[5]; + print_matrix("default", matrix); + + cairo_set_matrix (cairo, &matrix); + + OutputDev::setDefaultCTM(ctm); +} + void CairoOutputDev::updateCTM(GfxState *state, double m11, double m12, double m21, double m22, double m31, double m32) { + double *ctm = state->getCTM(); + cairo_matrix_t matrix; + matrix.xx = m11; + matrix.xy = m12; + matrix.yx = m21; + matrix.yy = m22; + matrix.x0 = m31; + matrix.y0 = m32; + print_matrix("transform", matrix); + cairo_transform (cairo, &matrix); + updateLineDash(state); updateLineJoin(state); updateLineCap(state); @@ -191,10 +228,11 @@ void CairoOutputDev::updateLineWidth(GfxState *state) { LOG(printf ("line width: %f\n", state->getTransformedLineWidth())); + printf ("line width: %f\n", state->getLineWidth()); if (state->getTransformedLineWidth() == 0.0) { cairo_set_line_width (cairo, 72.0/300.0); } else { - cairo_set_line_width (cairo, state->getTransformedLineWidth()); + cairo_set_line_width (cairo, state->getLineWidth()); } } @@ -271,13 +309,16 @@ font_face = currentFont->getFontFace(); cairo_set_font_face (cairo, font_face); - - matrix.xx = m11; - matrix.xy = -m21; - matrix.yx = m12; - matrix.yy = -m22; - matrix.x0 = 0; - matrix.y0 = 0; + + double fontSize = state->getFontSize(); + double *m = state->getTextMat(); + matrix.xx = m[0] * fontSize; + matrix.xy = m[1] * fontSize; + matrix.yx = -m[2] * fontSize; + matrix.yy = -m[3] * fontSize; + matrix.x0 = m[4]; + matrix.y0 = m[5]; + print_matrix("font", matrix); cairo_set_font_matrix (cairo, &matrix); } @@ -285,29 +326,47 @@ GfxSubpath *subpath; double x1, y1, x2, y2, x3, y3; int i, j; - + double *ctm = state->getCTM(); + cairo_matrix_t matrix; + matrix.xx = ctm[0]; + matrix.xy = ctm[1]; + matrix.yx = ctm[2]; + matrix.yy = ctm[3]; + matrix.x0 = ctm[4]; + matrix.y0 = ctm[5]; + cairo_save (cairo); + //cairo_transform (cairo, &matrix); for (i = 0; i < path->getNumSubpaths(); ++i) { subpath = path->getSubpath(i); if (subpath->getNumPoints() > 0) { - state->transform(subpath->getX(0), subpath->getY(0), &x1, &y1); + /*state->transform(subpath->getX(0), subpath->getY(0), &x1, &y1); cairo_move_to (cairo, x1, y1); - LOG (printf ("move_to %f, %f\n", x1, y1)); + */ + cairo_move_to (cairo, subpath->getX(0), subpath->getY(0)); + //LOG (printf ("move_to %f, %f\n", x1, y1)); j = 1; while (j < subpath->getNumPoints()) { if (subpath->getCurve(j)) { - state->transform(subpath->getX(j), subpath->getY(j), &x1, &y1); +/* state->transform(subpath->getX(j), subpath->getY(j), &x1, &y1); state->transform(subpath->getX(j+1), subpath->getY(j+1), &x2, &y2); state->transform(subpath->getX(j+2), subpath->getY(j+2), &x3, &y3); cairo_curve_to (cairo, x1, y1, x2, y2, - x3, y3); + x3, y3);*/ + cairo_curve_to( cairo, + subpath->getX(j), subpath->getY(j), + subpath->getX(j+1), subpath->getY(j+1), + subpath->getX(j+2), subpath->getY(j+2)); + LOG (printf ("curve_to %f, %f %f, %f %f, %f\n", x1, y1, x2, y2, x3, y3)); + //printf ("curve_to %f, %f %f, %f %f, %f\n", x1, y1, x2, y2, x3, y3); j += 3; } else { - state->transform(subpath->getX(j), subpath->getY(j), &x1, &y1); +/* state->transform(subpath->getX(j), subpath->getY(j), &x1, &y1); cairo_line_to (cairo, x1, y1); - LOG(printf ("line_to %f, %f\n", x1, y1)); + LOG(printf ("line_to %f, %f\n", x1, y1));*/ + cairo_line_to (cairo, subpath->getX(j), subpath->getY(j)); ++j; } } @@ -317,12 +376,14 @@ } } } + cairo_restore (cairo); } void CairoOutputDev::stroke(GfxState *state) { doPath (state, state->getPath()); cairo_set_source (cairo, stroke_pattern); LOG(printf ("stroke\n")); + printf ("stroke\n"); cairo_stroke (cairo); } @@ -376,8 +437,10 @@ glyphs[glyphCount].index = currentFont->getGlyph (code, u, uLen); state->transform(x - originX, y - originY, &tx, &ty); - glyphs[glyphCount].x = tx; - glyphs[glyphCount].y = ty; +// glyphs[glyphCount].x = tx; +// glyphs[glyphCount].y = ty; + glyphs[glyphCount].x = x - originX; + glyphs[glyphCount].y = y - originY; glyphCount++; } @@ -399,6 +462,7 @@ if (!(render & 1)) { LOG (printf ("fill string\n")); + printf ("fill string\n"); cairo_set_source (cairo, fill_pattern); cairo_show_glyphs (cairo, glyphs, glyphCount); } @@ -438,10 +502,26 @@ GBool CairoOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen) { + + cairo_save (cairo); + double *ctm; + cairo_matrix_t matrix; + int invert_bit; + int row_stride; + + ctm = state->getCTM(); + matrix.xx = ctm[0]; + matrix.xy = ctm[1]; + matrix.yx = ctm[2]; + matrix.yy = ctm[3]; + matrix.x0 = ctm[4]; + matrix.y0 = ctm[5]; + cairo_set_matrix(cairo, &matrix); return gFalse; } void CairoOutputDev::endType3Char(GfxState *state) { + cairo_restore (cairo); } void CairoOutputDev::type3D0(GfxState *state, double wx, double wy) { @@ -477,7 +557,7 @@ cairo_matrix_t matrix; int invert_bit; int row_stride; - +#if 0 ctm = state->getCTM(); LOG (printf ("drawImageMask %dx%d, matrix: %f, %f, %f, %f, %f, %f\n", width, height, ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5])); @@ -487,6 +567,14 @@ matrix.yy = -ctm[3] / height; matrix.x0 = ctm[2] + ctm[4]; matrix.y0 = ctm[3] + ctm[5]; +#endif + matrix.xx = width; + matrix.xy = 0.0; + matrix.yx = 0.0; + matrix.yy = -height; + matrix.x0 = 0.0; + matrix.y0 = height; + /* work around a cairo bug when scaling 1x1 surfaces */ if (width == 1 && height == 1) { @@ -535,7 +623,7 @@ return; } - cairo_matrix_invert (&matrix); + cairo_pattern_set_matrix (pattern, &matrix); /* we should actually be using CAIRO_FILTER_NEAREST here. However, @@ -546,7 +634,9 @@ /* FIXME: Doesn't the image mask support any colorspace? */ cairo_set_source (cairo, fill_pattern); cairo_mask (cairo, pattern); + //cairo_mask_surface (cairo, image, 0, 0); + cairo_restore (cairo); cairo_pattern_destroy (pattern); cairo_surface_destroy (image); free (buffer); @@ -656,9 +746,27 @@ maskMatrix.x0 = ctm[2] + ctm[4]; maskMatrix.y0 = ctm[3] + ctm[5]; - cairo_matrix_invert (&matrix); + matrix.xx = width; + matrix.xy = 0.0; + matrix.yx = 0.0; + matrix.yy = -height; + matrix.x0 = 0.0; + matrix.y0 = height; + + maskMatrix.xx = maskWidth; + maskMatrix.xy = 0.0; + maskMatrix.yx = 0.0; + maskMatrix.yy = -maskHeight; + maskMatrix.x0 = 0.0; + maskMatrix.y0 = maskHeight; + + +/* cairo_matrix_invert (&matrix); cairo_matrix_invert (&maskMatrix); + cairo_matrix_init_scale (&matrix, width, -height); + cairo_matrix_init_scale (&maskMatrix, maskWidth, -maskHeight); +*/ cairo_pattern_set_matrix (pattern, &matrix); cairo_pattern_set_matrix (maskPattern, &maskMatrix); @@ -771,9 +879,28 @@ maskMatrix.x0 = ctm[2] + ctm[4]; maskMatrix.y0 = ctm[3] + ctm[5]; + matrix.xx = width; + matrix.xy = 0.0; + matrix.yx = 0.0; + matrix.yy = -height; + matrix.x0 = 0.0; + matrix.y0 = height; + + maskMatrix.xx = maskWidth; + maskMatrix.xy = 0.0; + maskMatrix.yx = 0.0; + maskMatrix.yy = -maskHeight; + maskMatrix.x0 = 0.0; + maskMatrix.y0 = maskHeight; + +/* + cairo_matrix_invert (&matrix); cairo_matrix_invert (&maskMatrix); + cairo_matrix_init_scale (&matrix, width, -height); + cairo_matrix_init_scale (&maskMatrix, maskWidth, -maskHeight); +*/ cairo_pattern_set_matrix (pattern, &matrix); cairo_pattern_set_matrix (maskPattern, &maskMatrix); @@ -868,14 +995,22 @@ ctm = state->getCTM(); LOG (printf ("drawImageMask %dx%d, matrix: %f, %f, %f, %f, %f, %f\n", width, height, ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5])); - matrix.xx = ctm[0] / width; + /*matrix.xx = ctm[0] / width; matrix.xy = -ctm[2] / height; matrix.yx = ctm[1] / width; matrix.yy = -ctm[3] / height; matrix.x0 = ctm[2] + ctm[4]; matrix.y0 = ctm[3] + ctm[5]; +*/ + matrix.xx = width; + matrix.xy = 0.0; + matrix.yx = 0.0; + matrix.yy = -height; + matrix.x0 = 0.0; + matrix.y0 = height; - cairo_matrix_invert (&matrix); +// cairo_matrix_init_scale (&matrix, width, -height); + //cairo_matrix_invert (&matrix); cairo_pattern_set_matrix (pattern, &matrix); cairo_pattern_set_filter (pattern, CAIRO_FILTER_BILINEAR); Index: poppler/CairoOutputDev.h =================================================================== RCS file: /cvs/poppler/poppler/poppler/CairoOutputDev.h,v retrieving revision 1.14 diff -u -r1.14 CairoOutputDev.h --- poppler/CairoOutputDev.h 12 Apr 2006 06:52:07 -0000 1.14 +++ poppler/CairoOutputDev.h 28 Apr 2006 22:06:51 -0000 @@ -71,6 +71,7 @@ //----- update graphics state virtual void updateAll(GfxState *state); + virtual void setDefaultCTM(double *ctm); virtual void updateCTM(GfxState *state, double m11, double m12, double m21, double m22, double m31, double m32); virtual void updateLineDash(GfxState *state);