[poppler] poppler/poppler: CairoOutputDev.cc, 1.13, 1.14 CairoOutputDev.h, 1.3, 1.4

Kristian Hogsberg krh at freedesktop.org
Thu May 26 06:03:38 PDT 2005


Update of /cvs/poppler/poppler/poppler
In directory gabe:/tmp/cvs-serv28037/poppler

Modified Files:
	CairoOutputDev.cc CairoOutputDev.h 
Log Message:
2005-05-26  Kristian Høgsberg  <krh at 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.



Index: CairoOutputDev.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/CairoOutputDev.cc,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- CairoOutputDev.cc	26 May 2005 12:52:38 -0000	1.13
+++ CairoOutputDev.cc	26 May 2005 13:03:35 -0000	1.14
@@ -83,7 +83,7 @@
   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::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 @@
   updateMiterLimit(state);
   updateFillColor(state);
   updateStrokeColor(state);
+  updateFillOpacity(state);
+  updateStrokeOpacity(state);
   needFontUpdate = gTrue;
 }
 
@@ -146,7 +153,7 @@
 }
 
 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 @@
   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::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::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 @@
   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 @@
   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);
 

Index: CairoOutputDev.h
===================================================================
RCS file: /cvs/poppler/poppler/poppler/CairoOutputDev.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CairoOutputDev.h	11 Mar 2005 16:42:20 -0000	1.3
+++ CairoOutputDev.h	26 May 2005 13:03:35 -0000	1.4
@@ -81,6 +81,8 @@
   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 @@
   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 @@
   
   GfxRGB fill_color;
   GfxRGB stroke_color;
+  double fill_opacity;
+  double stroke_opacity;
   CairoFont *currentFont;
   
   XRef *xref;			// xref table for current document



More information about the poppler mailing list