Commit 8dce80eb authored by Kristian Høgsberg's avatar Kristian Høgsberg

2005-08-24 Kristian Høgsberg <krh@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.
parent b909b5ae
2005-08-24 Kristian Høgsberg <krh@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.
Tue Aug 23 17:21:02 2005 Jonathan Blandford <jrb@redhat.com>
* test/Makefile.am (gtk_cairo_test_LDADD): add
......
......@@ -116,6 +116,7 @@ typedef struct {
static void
poppler_page_prepare_output_dev (PopplerPage *page,
double scale,
int rotation,
gboolean transparent,
OutputDevData *output_dev_data)
{
......@@ -124,8 +125,13 @@ poppler_page_prepare_output_dev (PopplerPage *page,
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 @@ typedef struct {
static void
poppler_page_prepare_output_dev (PopplerPage *page,
double scale,
int rotation,
gboolean transparent,
OutputDevData *output_dev_data)
{
......@@ -264,6 +271,7 @@ poppler_page_copy_to_pixbuf(PopplerPage *page,
* @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 @@ poppler_page_render_to_pixbuf (PopplerPage *page,
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_set_selection_alpha (PopplerPage *page,
/**
* 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 @@ poppler_page_set_selection_alpha (PopplerPage *page,
void
poppler_page_render_selection (PopplerPage *page,
gdouble scale,
int rotation,
GdkPixbuf *pixbuf,
PopplerRectangle *selection,
PopplerRectangle *old_selection,
......@@ -459,9 +469,9 @@ poppler_page_render_selection (PopplerPage *page,
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);
......
......@@ -64,6 +64,7 @@ GdkRegion * poppler_page_get_selection_region (PopplerPage *page,
PopplerRectangle *selection);
void poppler_page_render_selection (PopplerPage *page,
gdouble scale,
int rotation,
GdkPixbuf *pixbuf,
PopplerRectangle *selection,
PopplerRectangle *old_selection,
......
......@@ -3193,6 +3193,7 @@ class TextSelectionPainter : public TextSelectionVisitor {
public:
TextSelectionPainter(TextPage *page,
double scale,
int rotation,
OutputDev *out,
GfxColor *box_color,
GfxColor *glyph_color);
......@@ -3219,6 +3220,7 @@ private:
TextSelectionPainter::TextSelectionPainter(TextPage *page,
double scale,
int rotation,
OutputDev *out,
GfxColor *box_color,
GfxColor *glyph_color)
......@@ -3229,7 +3231,7 @@ TextSelectionPainter::TextSelectionPainter(TextPage *page,
{
PDFRectangle box(0, 0, page->pageWidth, page->pageHeight);
state = new GfxState(72 * scale, 72 * scale, &box, 0, gFalse);
state = new GfxState(72 * scale, 72 * scale, &box, rotation, gFalse);
out->startPage (0, state);
......@@ -3523,10 +3525,12 @@ void TextPage::visitSelection(TextSelectionVisitor *visitor,
void TextPage::drawSelection(OutputDev *out,
double scale,
int rotation,
PDFRectangle *selection,
GfxColor *glyph_color, GfxColor *box_color)
{
TextSelectionPainter painter(this, scale, out, box_color, glyph_color);
TextSelectionPainter painter(this, scale, rotation,
out, box_color, glyph_color);
visitSelection(&painter, selection);
}
......@@ -4094,9 +4098,10 @@ GooString *TextOutputDev::getText(double xMin, double yMin,
void TextOutputDev::drawSelection(OutputDev *out,
double scale,
int rotation,
PDFRectangle *selection,
GfxColor *glyph_color, GfxColor *box_color) {
text->drawSelection(out, scale, selection, glyph_color, box_color);
text->drawSelection(out, scale, rotation, selection, glyph_color, box_color);
}
GooList *TextOutputDev::getSelectionRegion(PDFRectangle *selection,
......
......@@ -425,6 +425,7 @@ public:
void drawSelection(OutputDev *out,
double scale,
int rotation,
PDFRectangle *selection,
GfxColor *glyph_color, GfxColor *box_color);
......@@ -586,7 +587,8 @@ public:
double *xMin, double *yMin,
double *xMax, double *yMax);
void drawSelection(OutputDev *out, double scale, PDFRectangle *selection,
void drawSelection(OutputDev *out, double scale, int rotation,
PDFRectangle *selection,
GfxColor *glyph_color, GfxColor *box_color);
GooList *getSelectionRegion(PDFRectangle *selection, double scale);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment