diff options
Diffstat (limited to 'src/dialogs/stroke-style.cpp')
| -rw-r--r-- | src/dialogs/stroke-style.cpp | 75 |
1 files changed, 14 insertions, 61 deletions
diff --git a/src/dialogs/stroke-style.cpp b/src/dialogs/stroke-style.cpp index 3db6c62ee..bab57b679 100644 --- a/src/dialogs/stroke-style.cpp +++ b/src/dialogs/stroke-style.cpp @@ -35,9 +35,9 @@ #include "sp-linear-gradient.h" #include "sp-radial-gradient.h" #include "marker.h" -#include <sp-pattern.h> -#include <widgets/paint-selector.h> -#include <widgets/dash-selector.h> +#include "sp-pattern.h" +#include "widgets/paint-selector.h" +#include "widgets/dash-selector.h" #include "style.h" #include "gradient-chemistry.h" #include "sp-namedview.h" @@ -56,9 +56,11 @@ #include "widgets/icon.h" #include "helper/stock-items.h" #include "io/sys.h" +#include "ui/cache/svg_preview_cache.h" #include "dialogs/stroke-style.h" + /* Paint */ static void sp_stroke_style_paint_construct(SPWidget *spw, SPPaintSelector *psel); @@ -550,7 +552,7 @@ sp_stroke_radio_button(GtkWidget *tb, char const *icon, * preview images of each marker in the marker menu. */ static GtkWidget * -sp_marker_prev_new(unsigned size, gchar const *mname, +sp_marker_prev_new(unsigned psize, gchar const *mname, SPDocument *source, SPDocument *sandbox, gchar *menu_id, NRArena const *arena, unsigned visionkey, NRArenaItem *root) { @@ -594,66 +596,12 @@ sp_marker_prev_new(unsigned size, gchar const *mname, } /* Update to renderable state */ - NRMatrix t; double sf = 0.8; - nr_matrix_set_scale(&t, sf, sf); - nr_arena_item_set_transform(root, &t); - NRGC gc(NULL); - nr_matrix_set_identity(&gc.transform); - nr_arena_item_invoke_update( root, NULL, &gc, - NR_ARENA_ITEM_STATE_ALL, - NR_ARENA_ITEM_STATE_NONE ); - - /* Item integer bbox in points */ - NRRectL ibox; - ibox.x0 = (int) floor(sf * dbox.min()[NR::X] + 0.5); - ibox.y0 = (int) floor(sf * dbox.min()[NR::Y] + 0.5); - ibox.x1 = (int) floor(sf * dbox.max()[NR::X] + 0.5); - ibox.y1 = (int) floor(sf * dbox.max()[NR::Y] + 0.5); - - /* Find visible area */ - int width = ibox.x1 - ibox.x0; - int height = ibox.y1 - ibox.y0; - int dx = size; - int dy = size; - dx=(dx - width)/2; // watch out for size, since 'unsigned'-'signed' can cause problems if the result is negative - dy=(dy - height)/2; - - NRRectL area; - area.x0 = ibox.x0 - dx; - area.y0 = ibox.y0 - dy; - area.x1 = area.x0 + size; - area.y1 = area.y0 + size; - - /* Actual renderable area */ - NRRectL ua; - ua.x0 = MAX(ibox.x0, area.x0); - ua.y0 = MAX(ibox.y0, area.y0); - ua.x1 = MIN(ibox.x1, area.x1); - ua.y1 = MIN(ibox.y1, area.y1); - - /* Set up pixblock */ - guchar *px = g_new(guchar, 4 * size * size); - memset(px, 0x00, 4 * size * size); - - /* Render */ - NRPixBlock B; - nr_pixblock_setup_extern( &B, NR_PIXBLOCK_MODE_R8G8B8A8N, - ua.x0, ua.y0, ua.x1, ua.y1, - px + 4 * size * (ua.y0 - area.y0) + - 4 * (ua.x0 - area.x0), - 4 * size, FALSE, FALSE ); - nr_arena_item_invoke_render( root, &ua, &B, - NR_ARENA_ITEM_RENDER_NO_CACHE ); - nr_pixblock_release(&B); + GdkPixbuf* pixbuf = render_pixbuf(root, sf, dbox, psize); // Create widget - GtkWidget *pb = gtk_image_new_from_pixbuf(gdk_pixbuf_new_from_data(px, - GDK_COLORSPACE_RGB, - TRUE, - 8, size, size, size * 4, - (GdkPixbufDestroyNotify)g_free, - NULL)); + GtkWidget *pb = gtk_image_new_from_pixbuf(get_pixbuf(pixbuf)); + return pb; } @@ -753,6 +701,10 @@ sp_marker_list_from_doc (GtkWidget *m, SPDocument *current_doc, SPDocument *sour if (!SP_IS_MARKER(ml->data)) continue; +/* + Bug 980157 wants to have stock markers show up at the top of the dropdown menu + Thus we can skip all of this code, which simply looks for duplicate stock markers + Inkscape::XML::Node *repr = SP_OBJECT_REPR((SPItem *) ml->data); bool stock_dupe = false; @@ -767,6 +719,7 @@ sp_marker_list_from_doc (GtkWidget *m, SPDocument *current_doc, SPDocument *sour if (stock_dupe) // stock item, dont add to list from current doc continue; +*/ // Add to the list of markers we really do wish to show clean_ml = g_slist_prepend (clean_ml, ml->data); |
