diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/document.cpp | 3 | ||||
| -rw-r--r-- | src/widgets/eek-preview.cpp | 33 | ||||
| -rw-r--r-- | src/widgets/gradient-toolbar.cpp | 3 |
3 files changed, 22 insertions, 17 deletions
diff --git a/src/document.cpp b/src/document.cpp index b5383c91d..18d714bad 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -37,11 +37,11 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include <gtk/gtk.h> #include <string> #include <cstring> #include <2geom/transforms.h> +#include "widgets/desktop-widget.h" #include "desktop.h" #include "dir-util.h" #include "display/drawing-item.h" @@ -60,7 +60,6 @@ #include "sp-object-repr.h" #include "transf_mat_3x4.h" #include "unit-constants.h" -#include "widgets/desktop-widget.h" #include "xml/repr.h" #include "xml/rebase-hrefs.h" #include "libcroco/cr-cascade.h" diff --git a/src/widgets/eek-preview.cpp b/src/widgets/eek-preview.cpp index 36281f4d8..eb77bc8d7 100644 --- a/src/widgets/eek-preview.cpp +++ b/src/widgets/eek-preview.cpp @@ -233,28 +233,31 @@ gboolean eek_preview_expose_event( GtkWidget* widget, GdkEventExpose* event ) allocation.width, allocation.height); } - GdkGC *gc = gdk_gc_new( gtk_widget_get_window (widget) ); EekPreview* preview = EEK_PREVIEW(widget); GdkColor fg = {0, preview->_r, preview->_g, preview->_b}; gdk_colormap_alloc_color( gdk_colormap_get_system(), &fg, FALSE, TRUE ); - gdk_gc_set_foreground( gc, &fg ); gtk_widget_get_allocation (widget, &allocation); + cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(widget)); - gdk_draw_rectangle( gtk_widget_get_window (widget), - gc, - TRUE, - insetX, insetY, - allocation.width - (insetX * 2), allocation.height - (insetY * 2) ); + GdkRectangle rect = {insetX, + insetY, + allocation.width - (insetX * 2), + allocation.height - (insetY * 2)}; + + gdk_cairo_set_source_color(cr, &fg); + gdk_cairo_rectangle(cr, &rect); + cairo_paint(cr); + cairo_destroy(cr); if ( preview->_previewPixbuf ) { GtkDrawingArea* da = &(preview->drawing); - GdkDrawable* drawable = (GdkDrawable*) gtk_widget_get_window(GTK_WIDGET(da)); - gint w = 0; - gint h = 0; - gdk_drawable_get_size(drawable, &w, &h); - if ((w != preview->_scaledW) || (h != preview->_scaledH)) { + GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(da)); + gint w = gdk_window_get_width(window); + gint h = gdk_window_get_height(window); + + if ((w != preview->_scaledW) || (h != preview->_scaledH)) { if (preview->_scaled) { g_object_unref(preview->_scaled); } @@ -264,7 +267,11 @@ gboolean eek_preview_expose_event( GtkWidget* widget, GdkEventExpose* event ) } GdkPixbuf* pix = (preview->_scaled) ? preview->_scaled : preview->_previewPixbuf; - gdk_draw_pixbuf( drawable, 0, pix, 0, 0, 0, 0, w, h, GDK_RGB_DITHER_NONE, 0, 0 ); + GdkDrawable* drawable = (GdkDrawable*) window; + cairo_t* cr2 = gdk_cairo_create(drawable); + gdk_cairo_set_source_pixbuf(cr2, pix, 0, 0); + cairo_paint(cr2); + cairo_destroy(cr); } diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp index 465c426fc..88e871e42 100644 --- a/src/widgets/gradient-toolbar.cpp +++ b/src/widgets/gradient-toolbar.cpp @@ -16,8 +16,8 @@ # include "config.h" #endif +#include "ui/widget/color-preview.h" #include "verbs.h" -#include <gtk/gtk.h> #include "macros.h" #include "widgets/button.h" @@ -51,7 +51,6 @@ #include "../ink-comboboxentry-action.h" #include "sp-stop.h" -#include "ui/widget/color-preview.h" #include "svg/css-ostringstream.h" #include "svg/svg-color.h" #include "desktop-style.h" |
