From d839a0bd78361930e5e2fe889df12e1e853ffed3 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 12 Apr 2006 02:07:07 +0000 Subject: 2006-04-11 Kristian Høgsberg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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. --- poppler/CairoOutputDev.cc | 23 +++++++++-------------- poppler/CairoOutputDev.h | 6 +++--- 2 files changed, 12 insertions(+), 17 deletions(-) (limited to 'poppler') diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index 7407978a..fdb8a233 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -52,12 +52,12 @@ CairoOutputDev::CairoOutputDev() { 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 @@ CairoOutputDev::~CairoOutputDev() { 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 @@ void CairoOutputDev::startDoc(XRef *xrefA) { 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) { } diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h index bbf0ce44..f2c7284a 100644 --- a/poppler/CairoOutputDev.h +++ b/poppler/CairoOutputDev.h @@ -57,10 +57,10 @@ public: //----- 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 @@ public: GBool isReverseVideo() { return gFalse; } - void setSurface (cairo_surface_t *surface); + void setCairo (cairo_t *cr); protected: void doPath(GfxState *state, GfxPath *path); -- cgit v1.2.3