From f35bb1f74a0ffeb5c6477a25e3c4cde87a97bcf1 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 12:06:06 +0200 Subject: Removed unused includes, decrease compilation time (bzr r15025) --- src/widgets/icon.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/widgets/icon.cpp') diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index f2031fe51..d12ee981d 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -18,20 +18,15 @@ #include #include -#include #include #include #include -#include -#include -#include #include <2geom/transforms.h> #include "path-prefix.h" #include "preferences.h" #include "inkscape.h" #include "document.h" -#include "sp-item.h" #include "display/cairo-utils.h" #include "display/drawing-context.h" #include "display/drawing-item.h" -- cgit v1.2.3 From 43b49e325db73cc19b1731db6c69545664ee8fbe Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 13:26:17 +0200 Subject: Reverted changes to r15024 after many building problems (bzr r15027) --- src/widgets/icon.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/widgets/icon.cpp') diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index d12ee981d..f2031fe51 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -18,15 +18,20 @@ #include #include +#include #include #include #include +#include +#include +#include #include <2geom/transforms.h> #include "path-prefix.h" #include "preferences.h" #include "inkscape.h" #include "document.h" +#include "sp-item.h" #include "display/cairo-utils.h" #include "display/drawing-context.h" #include "display/drawing-item.h" -- cgit v1.2.3 From 49a7927ecf31ace696e9e5770e8d6543c356db7a Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 28 Jul 2016 19:15:34 +0100 Subject: Finish removing GTK+ 2 fallbacks (bzr r15023.2.8) --- src/widgets/icon.cpp | 51 --------------------------------------------------- 1 file changed, 51 deletions(-) (limited to 'src/widgets/icon.cpp') diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index f2031fe51..38b4f2897 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -64,10 +64,6 @@ struct IconImpl { static void sizeAllocate(GtkWidget *widget, GtkAllocation *allocation); static gboolean draw(GtkWidget *widget, cairo_t *cr); -#if !GTK_CHECK_VERSION(3,0,0) - static gboolean expose(GtkWidget *widget, GdkEventExpose *event); -#endif - static void screenChanged( GtkWidget *widget, GdkScreen *previous_screen ); static void styleSet( GtkWidget *widget, GtkStyle *previous_style ); static void themeChanged( SPIcon *icon ); @@ -149,14 +145,9 @@ sp_icon_class_init(SPIconClass *klass) object_class->dispose = IconImpl::dispose; -#if GTK_CHECK_VERSION(3,0,0) widget_class->get_preferred_width = IconImpl::getPreferredWidth; widget_class->get_preferred_height = IconImpl::getPreferredHeight; widget_class->draw = IconImpl::draw; -#else - widget_class->size_request = IconImpl::sizeRequest; - widget_class->expose_event = IconImpl::expose; -#endif widget_class->size_allocate = IconImpl::sizeAllocate; widget_class->screen_changed = IconImpl::screenChanged; widget_class->style_set = IconImpl::styleSet; @@ -244,37 +235,15 @@ gboolean IconImpl::draw(GtkWidget *widget, cairo_t* cr) bool unref_image = false; /* copied from the expose function of GtkImage */ -#if GTK_CHECK_VERSION(3,0,0) if (gtk_widget_get_state_flags (GTK_WIDGET(icon)) != GTK_STATE_FLAG_NORMAL && image) { -#else - if (gtk_widget_get_state (GTK_WIDGET(icon)) != GTK_STATE_NORMAL && image) { - std::cerr << "IconImpl::draw: Ooops! It is called in GTK2" << std::endl; -#endif std::cerr << "IconImpl::draw: No image, creating fallback" << std::endl; -#if GTK_CHECK_VERSION(3,0,0) - // image = gtk_render_icon_pixbuf(gtk_widget_get_style_context(widget), - // source, - // (GtkIconSize)-1); - - // gtk_render_icon_pixbuf deprecated, replaced by: GtkIconTheme *icon_theme = gtk_icon_theme_get_default(); image = gtk_icon_theme_load_icon (icon_theme, "gtk-image", 32, (GtkIconLookupFlags)0, NULL); -#else - GtkIconSource *source = gtk_icon_source_new(); - gtk_icon_source_set_pixbuf(source, icon->pb); - gtk_icon_source_set_size(source, GTK_ICON_SIZE_SMALL_TOOLBAR); // note: this is boilerplate and not used - gtk_icon_source_set_size_wildcarded(source, FALSE); - image = gtk_style_render_icon(gtk_widget_get_style(widget), source, - gtk_widget_get_direction(widget), - (GtkStateType) gtk_widget_get_state(widget), - (GtkIconSize)-1, widget, "gtk-image"); - gtk_icon_source_free(source); -#endif unref_image = true; } @@ -283,12 +252,7 @@ gboolean IconImpl::draw(GtkWidget *widget, cairo_t* cr) GtkAllocation allocation; GtkRequisition requisition; gtk_widget_get_allocation(widget, &allocation); - -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_get_preferred_size(widget, &requisition, NULL); -#else - gtk_widget_get_requisition(widget, &requisition); -#endif int x = floor(allocation.x + ((allocation.width - requisition.width) * 0.5)); int y = floor(allocation.y + ((allocation.height - requisition.height) * 0.5)); @@ -308,21 +272,6 @@ gboolean IconImpl::draw(GtkWidget *widget, cairo_t* cr) return TRUE; } -#if !GTK_CHECK_VERSION(3,0,0) -gboolean IconImpl::expose(GtkWidget *widget, GdkEventExpose * /*event*/) -{ - gboolean result = TRUE; - - if (gtk_widget_is_drawable(widget)) { - cairo_t * cr = gdk_cairo_create(gtk_widget_get_window(widget)); - result = draw(widget, cr); - cairo_destroy(cr); - } - - return result; -} -#endif - // PUBLIC CALL: void sp_icon_fetch_pixbuf( SPIcon *icon ) { -- cgit v1.2.3 From 35830f456cadaecf8b8e3944e3031a1a93f6cb41 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 3 Aug 2016 15:29:38 +0200 Subject: Removed unused includes, decreased compilation time. Once again (bzr r15034) --- src/widgets/icon.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/widgets/icon.cpp') diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index f2031fe51..515deb565 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -16,22 +16,19 @@ # include "config.h" #endif +#include +#include #include #include -#include #include #include #include -#include -#include -#include #include <2geom/transforms.h> #include "path-prefix.h" #include "preferences.h" #include "inkscape.h" #include "document.h" -#include "sp-item.h" #include "display/cairo-utils.h" #include "display/drawing-context.h" #include "display/drawing-item.h" -- cgit v1.2.3 From b2c6a66276f5df743c5b78ef0e78c11051200df8 Mon Sep 17 00:00:00 2001 From: tghs <> Date: Wed, 25 Jan 2017 10:49:49 +0100 Subject: [Bug #1537497] Icon preview doesn't render background. Fixed bugs: - https://launchpad.net/bugs/1537497 (bzr r15446) --- src/widgets/icon.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/widgets/icon.cpp') diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index 1efa8f06b..885deaab7 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -35,6 +35,7 @@ #include "display/drawing.h" #include "io/sys.h" #include "sp-root.h" +#include "sp-namedview.h" #include "util/units.h" #include "icon.h" @@ -1163,6 +1164,19 @@ sp_icon_doc_icon( SPDocument *doc, Inkscape::Drawing &drawing, CAIRO_FORMAT_ARGB32, psize, psize, stride); Inkscape::DrawingContext dc(s, ua.min()); + SPNamedView *nv = sp_document_namedview(doc, NULL); + float bg_r = SP_RGBA32_R_F(nv->pagecolor); + float bg_g = SP_RGBA32_G_F(nv->pagecolor); + float bg_b = SP_RGBA32_B_F(nv->pagecolor); + float bg_a = SP_RGBA32_A_F(nv->pagecolor); + + cairo_t *cr = cairo_create(s); + cairo_set_source_rgba(cr, bg_r, bg_g, bg_b, bg_a); + cairo_rectangle(cr, 0, 0, psize, psize); + cairo_fill(cr); + cairo_save(cr); + cairo_destroy(cr); + drawing.render(dc, ua); cairo_surface_destroy(s); -- cgit v1.2.3