[poppler] poppler/poppler: CairoOutputDev.cc, 1.31, 1.32 CairoOutputDev.h, 1.12, 1.13

Kristian Høgsberg krh at kemper.freedesktop.org
Tue Apr 11 19:07:09 PDT 2006


Update of /cvs/poppler/poppler/poppler
In directory kemper:/tmp/cvs-serv7212/poppler

Modified Files:
	CairoOutputDev.cc CairoOutputDev.h 
Log Message:
2006-04-11  Kristian Høgsberg  <krh at redhat.com>

	* configure.ac:
	* poppler-glib.pc.in:
	* glib/Makefile.am:
	* glib/poppler-page.cc:
	* glib/poppler-page.h:
	* glib/poppler.h:
	* poppler/CairoOutputDev.cc:
	* poppler/CairoOutputDev.h:
	* glib/poppler-features.h.in:
	Make the CairoOutputDev render to a cairo_t instead of a
	cairo_surface_t and expose that functionality in the glib wrapper
	(poppler_page_render).

	* test/Makefile.am:
	* test/gtk-cairo-test.cc:
	Update gtk-cairo-test to use this new interface and add a spin
	button for changing page (#5951).

	* utils/Makefile.am (EXTRA_DIST): Fix warning where this was
	assigned twice.
	


Index: CairoOutputDev.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/CairoOutputDev.cc,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- CairoOutputDev.cc	10 Apr 2006 18:12:44 -0000	1.31
+++ CairoOutputDev.cc	12 Apr 2006 02:07:07 -0000	1.32
@@ -52,12 +52,12 @@
   FT_Init_FreeType(&ft_lib);
   fontEngine = NULL;
   glyphs = NULL;
-  surface = NULL;
   fill_pattern = NULL;
   stroke_pattern = NULL;
   stroke_opacity = 1.0;
   fill_opacity = 1.0;
   textClipPath = NULL;
+  cairo = NULL;
 }
 
 CairoOutputDev::~CairoOutputDev() {
@@ -65,16 +65,19 @@
     delete fontEngine;
   }
   FT_Done_FreeType(ft_lib);
-  cairo_surface_destroy (surface);
+  cairo_destroy (cairo);
   cairo_pattern_destroy (stroke_pattern);
   cairo_pattern_destroy (fill_pattern);
 }
 
-void CairoOutputDev::setSurface(cairo_surface_t *surface)
+void CairoOutputDev::setCairo(cairo_t *cairo)
 {
-  cairo_surface_destroy (this->surface);
-  cairo_surface_reference (surface);
-  this->surface = surface;
+  if (this->cairo != NULL)
+    cairo_destroy (this->cairo);
+  if (cairo != NULL)
+    this->cairo = cairo_reference (cairo);
+  else
+    this->cairo = NULL;
 }
 
 void CairoOutputDev::startDoc(XRef *xrefA) {
@@ -85,14 +88,6 @@
   fontEngine = new CairoFontEngine(ft_lib);
 }
 
-void CairoOutputDev::startPage(int pageNum, GfxState *state) {
-  cairo = cairo_create (surface);
-}
-
-void CairoOutputDev::endPage() {
-  cairo_destroy (cairo);
-}
-
 void CairoOutputDev::drawLink(Link *link, Catalog *catalog) {
 }
 

Index: CairoOutputDev.h
===================================================================
RCS file: /cvs/poppler/poppler/poppler/CairoOutputDev.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- CairoOutputDev.h	18 Feb 2006 20:17:00 -0000	1.12
+++ CairoOutputDev.h	12 Apr 2006 02:07:07 -0000	1.13
@@ -57,10 +57,10 @@
   //----- initialization and control
 
   // Start a page.
-  virtual void startPage(int pageNum, GfxState *state);
+  virtual void startPage(int pageNum, GfxState *state) { }
 
   // End a page.
-  virtual void endPage();
+  virtual void endPage() { }
 
   //----- link borders
   virtual void drawLink(Link *link, Catalog *catalog);
@@ -136,7 +136,7 @@
  
   GBool isReverseVideo() { return gFalse; }
   
-  void setSurface (cairo_surface_t *surface);
+  void setCairo (cairo_t *cr);
 
 protected:
   void doPath(GfxState *state, GfxPath *path);



More information about the poppler mailing list