[poppler] poppler/glib: poppler-page.cc, 1.33, 1.34 poppler-page.h,
1.19, 1.20
Kristian Hogsberg
krh at freedesktop.org
Wed Aug 24 11:57:48 PDT 2005
Update of /cvs/poppler/poppler/glib
In directory gabe:/tmp/cvs-serv14238/glib
Modified Files:
poppler-page.cc poppler-page.h
Log Message:
2005-08-24 Kristian Høgsberg <krh at redhat.com>
* poppler/TextOutputDev.cc: Push rotation argument down to
GfxState constructor. This is still not completely functional yet.
* glib/poppler-page.cc (poppler_page_render_selection): Add
rotation argument so API is useful. Not yet implemented.
(poppler_page_prepare_output_dev): Patch from Marco to fix
rotation using the cairo backend.
Index: poppler-page.cc
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-page.cc,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- poppler-page.cc 22 Aug 2005 18:20:12 -0000 1.33
+++ poppler-page.cc 24 Aug 2005 18:57:46 -0000 1.34
@@ -116,6 +116,7 @@
static void
poppler_page_prepare_output_dev (PopplerPage *page,
double scale,
+ int rotation,
gboolean transparent,
OutputDevData *output_dev_data)
{
@@ -124,8 +125,13 @@
int cairo_width, cairo_height, cairo_rowstride;
unsigned char *cairo_data;
- cairo_width = MAX ((int)(page->page->getWidth() * scale + 0.5), 1);
- cairo_height = MAX ((int)(page->page->getHeight() * scale + 0.5), 1);
+ if (rotation == 90 || rotation == 270) {
+ cairo_width = MAX ((int)(page->page->getHeight() * scale + 0.5), 1);
+ cairo_height = MAX ((int)(page->page->getWidth() * scale + 0.5), 1);
+ } else {
+ cairo_width = MAX ((int)(page->page->getWidth() * scale + 0.5), 1);
+ cairo_height = MAX ((int)(page->page->getHeight() * scale + 0.5), 1);
+ }
output_dev = page->document->output_dev;
cairo_rowstride = cairo_width * 4;
@@ -199,6 +205,7 @@
static void
poppler_page_prepare_output_dev (PopplerPage *page,
double scale,
+ int rotation,
gboolean transparent,
OutputDevData *output_dev_data)
{
@@ -264,6 +271,7 @@
* @src_y: y coordinate of upper left corner
* @src_width: width of rectangle to render
* @src_height: height of rectangle to render
+ * @scale: scale specified as pixels per point
* @rotation: rotate the document by the specified degree
* @pixbuf: pixbuf to render into
*
@@ -285,7 +293,7 @@
g_return_if_fail (scale > 0.0);
g_return_if_fail (pixbuf != NULL);
- poppler_page_prepare_output_dev (page, scale, FALSE, &data);
+ poppler_page_prepare_output_dev (page, scale, rotation, FALSE, &data);
page->page->displaySlice(page->document->output_dev,
72.0 * scale, 72.0 * scale,
@@ -414,7 +422,8 @@
/**
* poppler_page_render_selection:
* @page: the #PopplerPage for which to render selection
- * @scale: scale to use for rendering
+ * @scale: scale specified as pixels per point
+ * @rotation: rotate the document by the specified degree
* @pixbuf: pixbuf to render to
* @selection: start and end point of selection as a rectangle
* @old_selection: previous selection
@@ -433,6 +442,7 @@
void
poppler_page_render_selection (PopplerPage *page,
gdouble scale,
+ int rotation,
GdkPixbuf *pixbuf,
PopplerRectangle *selection,
PopplerRectangle *old_selection,
@@ -459,9 +469,9 @@
text_dev = poppler_page_get_text_output_dev (page);
output_dev = page->document->output_dev;
- poppler_page_prepare_output_dev (page, scale, TRUE, &data);
+ poppler_page_prepare_output_dev (page, scale, rotation, TRUE, &data);
- text_dev->drawSelection (output_dev, scale, &pdf_selection,
+ text_dev->drawSelection (output_dev, scale, rotation, &pdf_selection,
&gfx_glyph_color, &gfx_background_color);
poppler_page_copy_to_pixbuf (page, pixbuf, &data);
Index: poppler-page.h
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-page.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- poppler-page.h 22 Aug 2005 18:20:12 -0000 1.19
+++ poppler-page.h 24 Aug 2005 18:57:46 -0000 1.20
@@ -64,6 +64,7 @@
PopplerRectangle *selection);
void poppler_page_render_selection (PopplerPage *page,
gdouble scale,
+ int rotation,
GdkPixbuf *pixbuf,
PopplerRectangle *selection,
PopplerRectangle *old_selection,
More information about the poppler
mailing list