Commit 9e6eeec5 authored by Kristian Høgsberg's avatar Kristian Høgsberg

2005-05-26 Kristian Høgsberg <krh@redhat.com>

        * poppler/CairoOutputDev.cc (clip): Remove snapToGrid so clip()
        prototype matches what Gfx actually calls (fixes clipping).

        * poppler/CairoOutputDev.cc: Update fill color, stroke color, fill
        opacity and stroke opacity from GfxState on restore, since they
        aren't handled by cairo_restore() (#3362).

        * poppler/CairoOutputDev.cc: Comment out tolerance setting until
        we figure out how cairo settings relate to pdf settings.

        * poppler/CairoOutputDev.cc: Support fill and stroke opacity.
parent 89a633ed
2005-05-26 Kristian Høgsberg <krh@redhat.com>
* poppler/CairoOutputDev.cc (clip): Remove snapToGrid so clip()
prototype matches what Gfx actually calls (fixes clipping).
* poppler/CairoOutputDev.cc: Update fill color, stroke color, fill
opacity and stroke opacity from GfxState on restore, since they
aren't handled by cairo_restore() (#3362).
* poppler/CairoOutputDev.cc: Comment out tolerance setting until
we figure out how cairo settings relate to pdf settings.
* poppler/CairoOutputDev.cc: Support fill and stroke opacity.
* poppler/GfxState.cc:
* poppler/GfxState.h: Add GfxColorSpace::getRGBLine here and
implement in subclasses.
......
......@@ -83,7 +83,7 @@ void CairoOutputDev::startPage(int pageNum, GfxState *state) {
cairo_set_line_join (cairo, CAIRO_LINE_JOIN_MITER);
cairo_set_dash (cairo, NULL, 0, 0.0);
cairo_set_miter_limit (cairo, 10);
cairo_set_tolerance (cairo, 1);
// cairo_set_tolerance (cairo, 1);
}
void CairoOutputDev::endPage() {
......@@ -100,8 +100,13 @@ void CairoOutputDev::saveState(GfxState *state) {
void CairoOutputDev::restoreState(GfxState *state) {
LOG(printf ("restore\n"));
cairo_restore (cairo);
/* TODO: Is this really needed for cairo? Maybe not */
needFontUpdate = gTrue;
/* These aren't restored by cairo_restore() since we keep them in
* the output device. */
updateFillColor(state);
updateStrokeColor(state);
updateFillOpacity(state);
updateStrokeOpacity(state);
}
void CairoOutputDev::updateAll(GfxState *state) {
......@@ -113,6 +118,8 @@ void CairoOutputDev::updateAll(GfxState *state) {
updateMiterLimit(state);
updateFillColor(state);
updateStrokeColor(state);
updateFillOpacity(state);
updateStrokeOpacity(state);
needFontUpdate = gTrue;
}
......@@ -146,7 +153,7 @@ void CairoOutputDev::updateLineDash(GfxState *state) {
}
void CairoOutputDev::updateFlatness(GfxState *state) {
cairo_set_tolerance (cairo, state->getFlatness());
// cairo_set_tolerance (cairo, state->getFlatness());
}
void CairoOutputDev::updateLineJoin(GfxState *state) {
......@@ -196,6 +203,16 @@ void CairoOutputDev::updateStrokeColor(GfxState *state) {
LOG(printf ("stroke color: %f %f %f\n", stroke_color.r, stroke_color.g, stroke_color.b));
}
void CairoOutputDev::updateFillOpacity(GfxState *state) {
fill_opacity = state->getFillOpacity();
LOG(printf ("fill opacity: %f\n", fill_opacity));
}
void CairoOutputDev::updateStrokeOpacity(GfxState *state) {
stroke_opacity = state->getStrokeOpacity();
LOG(printf ("stroke opacity: %f\n", stroke_opacity));
}
void CairoOutputDev::updateFont(GfxState *state) {
cairo_font_face_t *font_face;
double m11, m12, m21, m22;
......@@ -283,8 +300,9 @@ void CairoOutputDev::doPath(GfxState *state, GfxPath *path,
void CairoOutputDev::stroke(GfxState *state) {
doPath (state, state->getPath(), gFalse);
cairo_set_source_rgb (cairo,
stroke_color.r, stroke_color.g, stroke_color.b);
cairo_set_source_rgba (cairo,
stroke_color.r, stroke_color.g, stroke_color.b,
stroke_opacity);
LOG(printf ("stroke\n"));
cairo_stroke (cairo);
}
......@@ -292,8 +310,9 @@ void CairoOutputDev::stroke(GfxState *state) {
void CairoOutputDev::fill(GfxState *state) {
doPath (state, state->getPath(), gFalse);
cairo_set_fill_rule (cairo, CAIRO_FILL_RULE_WINDING);
cairo_set_source_rgb (cairo,
fill_color.r, fill_color.g, fill_color.b);
cairo_set_source_rgba (cairo,
fill_color.r, fill_color.g, fill_color.b,
fill_opacity);
LOG(printf ("fill\n"));
cairo_fill (cairo);
}
......@@ -307,8 +326,8 @@ void CairoOutputDev::eoFill(GfxState *state) {
cairo_fill (cairo);
}
void CairoOutputDev::clip(GfxState *state, GBool snapToGrid) {
doPath (state, state->getPath(), snapToGrid);
void CairoOutputDev::clip(GfxState *state) {
doPath (state, state->getPath(), gFalse);
cairo_set_fill_rule (cairo, CAIRO_FILL_RULE_WINDING);
cairo_clip (cairo);
LOG (printf ("clip\n"));
......@@ -611,7 +630,7 @@ void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
cairo_matrix_invert (&matrix);
cairo_pattern_set_matrix (pattern, &matrix);
cairo_pattern_set_filter (pattern, CAIRO_FILTER_BEST);
cairo_pattern_set_filter (pattern, CAIRO_FILTER_BILINEAR);
cairo_set_source (cairo, pattern);
cairo_paint (cairo);
......
......@@ -81,6 +81,8 @@ public:
virtual void updateLineWidth(GfxState *state);
virtual void updateFillColor(GfxState *state);
virtual void updateStrokeColor(GfxState *state);
virtual void updateFillOpacity(GfxState *state);
virtual void updateStrokeOpacity(GfxState *state);
//----- update text state
virtual void updateFont(GfxState *state);
......@@ -91,7 +93,7 @@ public:
virtual void eoFill(GfxState *state);
//----- path clipping
virtual void clip(GfxState *state, GBool snapToGrid);
virtual void clip(GfxState *state);
virtual void eoClip(GfxState *state);
//----- text drawing
......@@ -128,6 +130,8 @@ protected:
GfxRGB fill_color;
GfxRGB stroke_color;
double fill_opacity;
double stroke_opacity;
CairoFont *currentFont;
XRef *xref; // xref table for current document
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment