[poppler] poppler/glib: poppler-page.cc,1.38,1.39

Kristian Høgsberg krh at freedesktop.org
Sat Dec 3 13:55:38 PST 2005


Update of /cvs/poppler/poppler/glib
In directory gabe:/tmp/cvs-serv3997/glib

Modified Files:
	poppler-page.cc 
Log Message:
2005-12-03  Kristian Høgsberg  <krh at redhat.com>

        Fixes from Nickolay V. Shmyrev:

        * poppler/TextOutputDev.cc (TextLine::visitSelection,
        TextBlock::visitSelection): Fix selection crash with zero-width
        word boxes or zero-height line boxes (#4402).

        * poppler/CairoOutputDev.h: Fix wrong cairo-ft.h include (#4413).

        * poppler/CairoOutputDev.cc (eoFill, fill):
        * glib/poppler-page.cc (poppler_page_render_selection): Update to
        work with new GfxColor definition and use
        cairo_pattern_create_rgba() to cache cairo_pattern_t's for the
        fill and stroke colors.

        * glib/poppler-page.cc (poppler_page_set_selection_alpha): Zero
        out pixbuf first.



Index: poppler-page.cc
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-page.cc,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- poppler-page.cc	4 Nov 2005 19:03:55 -0000	1.38
+++ poppler-page.cc	3 Dec 2005 21:55:36 -0000	1.39
@@ -390,7 +390,7 @@
 				  PopplerRectangle *selection)
 {
   GdkRegion *region;
-  gint n_rectangles, i, x, y;
+  gint n_rectangles, i, x, y, width, height;
   GdkRectangle *rectangles;
   int pixbuf_rowstride, pixbuf_n_channels;
   guchar *pixbuf_data, *dst;
@@ -398,10 +398,14 @@
   pixbuf_data = gdk_pixbuf_get_pixels (pixbuf);
   pixbuf_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
   pixbuf_n_channels = gdk_pixbuf_get_n_channels (pixbuf);
+  width = gdk_pixbuf_get_width (pixbuf);
+  height = gdk_pixbuf_get_height (pixbuf);
 
   if (pixbuf_n_channels != 4)
     return;
 
+  gdk_pixbuf_fill(pixbuf, 0);
+
   region = poppler_page_get_selection_region (page, scale, selection);
 
   gdk_region_get_rectangles (region, &rectangles, &n_rectangles);
@@ -460,14 +464,14 @@
 			     selection->x2, selection->y2);
 
   GfxColor gfx_background_color = { 
-    background_color->red / 65535.0,
-    background_color->green / 65535.0,
-    background_color->blue / 65535.0
+    background_color->red,
+    background_color->green,
+    background_color->blue
   };
   GfxColor gfx_glyph_color = {
-    glyph_color->red / 65535.0,
-    glyph_color->green / 65535.0,
-    glyph_color->blue / 65535.0
+    glyph_color->red,
+    glyph_color->green,
+    glyph_color->blue
   };
 
   text_dev = poppler_page_get_text_output_dev (page);



More information about the poppler mailing list