diff -upr poppler/glib/poppler-page.cc poppler.new/glib/poppler-page.cc --- poppler/glib/poppler-page.cc 2005-11-04 22:03:55.000000000 +0300 +++ poppler.new/glib/poppler-page.cc 2005-11-17 16:06:56.000000000 +0300 @@ -390,7 +390,7 @@ poppler_page_set_selection_alpha (Popple 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,22 @@ poppler_page_set_selection_alpha (Popple 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; + for (y = 0; y < height; y++) + { + dst = pixbuf_data + y * pixbuf_rowstride; + for (x = 0; x < width; x++) + { + dst[3] = 0x00; + dst += pixbuf_n_channels; + } + } + region = poppler_page_get_selection_region (page, scale, selection); gdk_region_get_rectangles (region, &rectangles, &n_rectangles); @@ -460,14 +472,14 @@ poppler_page_render_selection (PopplerPa 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); diff -upr poppler/poppler/CairoOutputDev.cc poppler.new/poppler/CairoOutputDev.cc --- poppler/poppler/CairoOutputDev.cc 2005-10-30 23:29:05.000000000 +0300 +++ poppler.new/poppler/CairoOutputDev.cc 2005-11-17 14:16:48.000000000 +0300 @@ -305,7 +305,7 @@ void CairoOutputDev::fill(GfxState *stat doPath (state, state->getPath(), gFalse); cairo_set_fill_rule (cairo, CAIRO_FILL_RULE_WINDING); cairo_set_source_rgba (cairo, - fill_color.r, fill_color.g, fill_color.b, + fill_color.r / 65535.0, fill_color.g / 65535.0, fill_color.b / 65535.0, fill_opacity); LOG(printf ("fill\n")); cairo_fill (cairo); @@ -315,7 +315,7 @@ void CairoOutputDev::eoFill(GfxState *st doPath (state, state->getPath(), gFalse); cairo_set_fill_rule (cairo, CAIRO_FILL_RULE_EVEN_ODD); cairo_set_source_rgb (cairo, - fill_color.r, fill_color.g, fill_color.b); + fill_color.r / 65535.0, fill_color.g / 65535.0, fill_color.b / 65535.0); LOG(printf ("fill-eo\n")); cairo_fill (cairo); } diff -upr poppler/poppler/CairoOutputDev.h poppler.new/poppler/CairoOutputDev.h --- poppler/poppler/CairoOutputDev.h 2005-10-30 23:29:05.000000000 +0300 +++ poppler.new/poppler/CairoOutputDev.h 2005-11-17 13:37:15.000000000 +0300 @@ -15,7 +15,7 @@ #endif #include "goo/gtypes.h" -#include +#include #include "OutputDev.h" #include "GfxState.h" diff -upr poppler/poppler/TextOutputDev.cc poppler.new/poppler/TextOutputDev.cc --- poppler/poppler/TextOutputDev.cc 2005-10-30 23:29:05.000000000 +0300 +++ poppler.new/poppler/TextOutputDev.cc 2005-11-17 14:36:39.000000000 +0300 @@ -3414,8 +3414,8 @@ void TextLine::visitSelection(TextSelect (selection->x2 < p->xMax && selection->y2 < p->yMax)) if (begin == NULL) begin = p; - if ((selection->x1 > p->xMin && selection->y1 > p->yMin) || - (selection->x2 > p->xMin && selection->y2 > p->yMin)) + if ((selection->x1 > p->xMin && selection->y1 > p->yMin || + selection->x2 > p->xMin && selection->y2 > p->yMin) && (begin != NULL)) end = p->next; } @@ -3482,8 +3482,8 @@ void TextBlock::visitSelection(TextSelec stop_y = selection->y1; } - if (selection->x1 > p->xMin && selection->y1 > p->yMin || - selection->x2 > p->xMin && selection->y2 > p->yMin) + if ((selection->x1 > p->xMin && selection->y1 > p->yMin || + selection->x2 > p->xMin && selection->y2 > p->yMin) && (begin != NULL)) end = p->next; }