diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2013-09-13 21:14:45 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2013-09-13 21:14:45 +0000 |
| commit | 0697088a2e3fbb3f7777db721e8c5e4661311dbe (patch) | |
| tree | f7171656bbb4330a5aef0c30b01981d64196993d /src/ui/widget | |
| parent | Use g_match_info_free instead of g_match_info_unref (diff) | |
| download | inkscape-0697088a2e3fbb3f7777db721e8c5e4661311dbe.tar.gz inkscape-0697088a2e3fbb3f7777db721e8c5e4661311dbe.zip | |
Improve the functions which create GdkPixbuf from Cairo surface
and vice versa. Simplifies some code.
Also introduce proper refcounting into svg_preview_cache.cpp
and fix its users.
(bzr r12512)
Diffstat (limited to 'src/ui/widget')
| -rw-r--r-- | src/ui/widget/color-preview.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/ui/widget/color-preview.cpp b/src/ui/widget/color-preview.cpp index 4b4a7b738..5bcd16528 100644 --- a/src/ui/widget/color-preview.cpp +++ b/src/ui/widget/color-preview.cpp @@ -73,9 +73,9 @@ ColorPreview::on_expose_event (GdkEventExpose *event) if (get_is_drawable()) { Cairo::RefPtr<Cairo::Context> cr = get_window()->create_cairo_context(); - cr->rectangle(event->area.x, event->area.y, + cr->rectangle(event->area.x, event->area.y, event->area.width, event->area.height); - cr->clip(); + cr->clip(); result = on_draw(cr); } @@ -176,12 +176,7 @@ ColorPreview::toPixbuf (int width, int height) cairo_destroy(ct); cairo_surface_flush(s); - GdkPixbuf* pixbuf = gdk_pixbuf_new_from_data( cairo_image_surface_get_data(s), - GDK_COLORSPACE_RGB, TRUE, 8, - width, height, cairo_image_surface_get_stride(s), - ink_cairo_pixbuf_cleanup, s); - convert_pixbuf_argb32_to_normal(pixbuf); - + GdkPixbuf* pixbuf = ink_pixbuf_create_from_cairo_surface(s); return pixbuf; } |
