summaryrefslogtreecommitdiff
path: root/poppler
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2006-04-12 02:07:07 +0000
committerKristian Høgsberg <krh@redhat.com>2006-04-12 02:07:07 +0000
commitd839a0bd78361930e5e2fe889df12e1e853ffed3 (patch)
treee0bb395c98ad609c8f08c112df82700bb124d990 /poppler
parentb198c9801c668014c0979c57033a0637e7e046e2 (diff)
2006-04-11 Kristian Høgsberg <krh@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.
Diffstat (limited to 'poppler')
-rw-r--r--poppler/CairoOutputDev.cc23
-rw-r--r--poppler/CairoOutputDev.h6
2 files changed, 12 insertions, 17 deletions
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);