summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9608cf1)
raw | patch | inline | side by side (parent: 9608cf1)
author | mental <mental@users.sourceforge.net> | |
Sun, 4 Mar 2007 19:06:11 +0000 (19:06 +0000) | ||
committer | mental <mental@users.sourceforge.net> | |
Sun, 4 Mar 2007 19:06:11 +0000 (19:06 +0000) |
rect handling, though)
14 files changed:
diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp
index fbceb4eb5467096df8a220045e8c4af010aa4ef3..2a55d43b0a4d709f8f96ed9973d9adeab3108939 100644 (file)
--- a/src/conn-avoid-ref.cpp
+++ b/src/conn-avoid-ref.cpp
// some convex hull code, though not NR::ConvexHull as this
// only keeps the bounding box of the convex hull currently.
- // TODO: SPItem::invokeBbox gives the wrong result for some objects
+ // TODO: SPItem::getBounds gives the wrong result for some objects
// that have internal representations that are updated later
// by the sp_*_update functions, e.g., text.
sp_document_ensure_up_to_date(item->document);
- NR::Rect rHull = item->invokeBbox(sp_item_i2doc_affine(item));
+ NR::Rect rHull = item->getBounds(sp_item_i2doc_affine(item));
double spacing = desktop->namedview->connector_spacing;
index 5cd5df143fe19667f9d61ee3fc10bc19e7758207..00fcac48e8ac1d8706bf1f66957386620e66359d 100644 (file)
/* Set up pixblock */
guchar *px = g_new(guchar, 4 * width * height);
-
- if (px == NULL) {
- return 0; // buffer is too big or too small, cannot pick, so return 0
- }
-
memset(px, 0x00, 4 * width * height);
/* Render */
nr_pixblock_setup_extern( &pb, NR_PIXBLOCK_MODE_R8G8B8A8N,
ibox.x0, ibox.y0, ibox.x1, ibox.y1,
px, 4 * width, FALSE, FALSE );
- nr_arena_item_invoke_render(NULL, trace_root, &ibox, &pb,
+ nr_arena_item_invoke_render( trace_root, &ibox, &pb,
NR_ARENA_ITEM_RENDER_NO_CACHE );
double R = 0, G = 0, B = 0, A = 0;
w = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-w", 0);
h = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-h", 0);
} else {
- NR::Rect const r = SP_ITEM(obj)->invokeBbox(sp_item_i2doc_affine(SP_ITEM(obj)));
+ NR::Rect const r = SP_ITEM(obj)->getBounds(sp_item_i2doc_affine(SP_ITEM(obj)));
c = r.midpoint();
w = r.dimensions()[NR::X];
h = r.dimensions()[NR::Y];
center_set = true;
}
- gchar *affinestr=sp_svg_transform_write(t);
- clone->setAttribute("transform", affinestr);
- g_free(affinestr);
+ gchar affinestr[80];
+ if (sp_svg_transform_write(affinestr, 79, t)) {
+ clone->setAttribute("transform", affinestr);
+ } else {
+ clone->setAttribute("transform", NULL);
+ }
if (opacity < 1.0) {
sp_repr_set_css_double(clone, "opacity", opacity);
index 58505df97760153b8f5bc1c6f0409b0915e3de51..53c5c722fc2eed963b6528c7d78065d2897517e0 100644 (file)
static GtkWidget * marker_end_menu = NULL;
static SPObject *ink_extract_marker_name(gchar const *n);
-static void ink_markers_menu_update(SPWidget* spw);
+static void ink_markers_menu_update();
static Inkscape::UI::Cache::SvgPreview svg_preview_cache;
sp_stroke_style_paint_update (spw);
}
+static void
+sp_stroke_style_widget_transientize_callback(Inkscape::Application *inkscape,
+ SPDesktop *desktop,
+ SPWidget *spw )
+{
+ ink_markers_menu_update();
+}
+
/**
* Gets the active stroke style property, then sets the appropriate color, alpha, gradient,
* pattern, etc. for the paint-selector.
}
-static void
-sp_stroke_style_widget_transientize_callback(Inkscape::Application *inkscape,
- SPDesktop *desktop,
- SPWidget *spw )
-{
-// TODO: Either of these will cause crashes sometimes
-// sp_stroke_style_line_update( SP_WIDGET(spw), desktop ? sp_desktop_selection(desktop) : NULL);
-// ink_markers_menu_update(spw);
-}
-
/**
* Creates a copy of the marker named mname, determines its visible and renderable
* area in menu_id's bounding box, and then renders it. This allows us to fill in
// Find object's bbox in document
NR::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object)));
- NR::Rect const dbox = SP_ITEM(object)->invokeBbox(i2doc);
+ NR::Rect const dbox = SP_ITEM(object)->getBounds(i2doc);
if (dbox.isEmpty()) {
return NULL;
@@ -721,6 +719,15 @@ sp_marker_list_from_doc (GtkWidget *m, SPDocument *current_doc, SPDocument *sour
GSList *ml = ink_marker_list_get(source);
GSList *clean_ml = NULL;
+ // Do this here, outside of loop, to speed up preview generation:
+ /* Create new arena */
+ NRArena const *arena = NRArena::create();
+ /* Create ArenaItem and set transform */
+ unsigned const visionkey = sp_item_display_key_new(1);
+/*
+ NRArenaItem *root = sp_item_invoke_show( SP_ITEM(SP_DOCUMENT_ROOT (sandbox)), (NRArena *) arena, visionkey, SP_ITEM_SHOW_DISPLAY );
+*/
+
for (; ml != NULL; ml = ml->next) {
if (!SP_IS_MARKER(ml->data))
continue;
@@ -779,7 +786,7 @@ ink_marker_menu_create_menu(GtkWidget *m, gchar *menu_id, SPDocument *doc, SPDoc
GtkWidget *i = gtk_menu_item_new();
gtk_widget_show(i);
- g_object_set_data(G_OBJECT(i), "marker", (void *) "none");
+// g_object_set_data(G_OBJECT(i), "marker", (void *) "none");
GtkWidget *hb = gtk_hbox_new(FALSE, MARKER_ITEM_MARGIN);
gtk_widget_show(hb);
@@ -818,7 +825,6 @@ ink_marker_menu_create_menu(GtkWidget *m, gchar *menu_id, SPDocument *doc, SPDoc
sp_document_ensure_up_to_date(doc);
sp_marker_list_from_doc ( m, doc, markers_doc, NULL, sandbox, menu_id );
}
-
}
gchar *menu_id = (gchar *) g_object_get_data(G_OBJECT(mnu), "menu_id");
sp_repr_css_set_property(css, menu_id, marker);
- // Also update the marker dropdown menus, so the document's markers
- // show up at the top of the menu
-// sp_stroke_style_line_update( SP_WIDGET(spw), desktop ? sp_desktop_selection(desktop) : NULL);
- ink_markers_menu_update(SP_WIDGET(spw));
-
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
- GSList const *items = selection->itemList();
- for (; items != NULL; items = items->next) {
+ Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ GSList const *items = selection->itemList();
+ for (; items != NULL; items = items->next) {
SPItem *item = (SPItem *) items->data;
if (!SP_IS_SHAPE(item) || SP_IS_RECT(item)) // can't set marker to rect, until it's converted to using <path>
continue;
sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE,
_("Set markers"));
+ // Lastly, also update the marker dropdown menus, so the document's markers
+ // show up at the top of the menu
+ ink_markers_menu_update();
};
-static int
-ink_marker_menu_get_pos(GtkMenu* mnu, gchar* markname) {
-
- if (markname == NULL)
- markname = (gchar *) g_object_get_data(G_OBJECT(gtk_menu_get_active(mnu)), "marker");
-
- if (markname == NULL)
- return 0;
-
- GList *kids = GTK_MENU_SHELL(mnu)->children;
- int i = 0;
- for (; kids != NULL; kids = kids->next) {
- gchar *mark = (gchar *) g_object_get_data(G_OBJECT(kids->data), "marker");
- if ( mark && strcmp(mark, markname) == 0 ) {
- break;
- }
- i++;
- }
- return i;
-}
-
static void
-ink_markers_menu_update(SPWidget* spw) {
+ink_markers_menu_update() {
SPDesktop *desktop = inkscape_active_desktop();
SPDocument *document = sp_desktop_document(desktop);
SPDocument *sandbox = ink_markers_preview_doc ();
GtkWidget *m;
- int pos;
- gtk_signal_handler_block_by_func( GTK_OBJECT(marker_start_menu), GTK_SIGNAL_FUNC(sp_marker_select), spw);
- pos = ink_marker_menu_get_pos(GTK_MENU(gtk_option_menu_get_menu(GTK_OPTION_MENU(marker_start_menu))), NULL);
m = gtk_menu_new();
gtk_widget_show(m);
ink_marker_menu_create_menu(m, "marker-start", document, sandbox);
gtk_option_menu_remove_menu(GTK_OPTION_MENU(marker_start_menu));
gtk_option_menu_set_menu(GTK_OPTION_MENU(marker_start_menu), m);
- gtk_option_menu_set_history(GTK_OPTION_MENU(marker_start_menu), pos);
- gtk_signal_handler_unblock_by_func( GTK_OBJECT(marker_start_menu), GTK_SIGNAL_FUNC(sp_marker_select), spw);
- gtk_signal_handler_block_by_func( GTK_OBJECT(marker_mid_menu), GTK_SIGNAL_FUNC(sp_marker_select), spw);
- pos = ink_marker_menu_get_pos(GTK_MENU(gtk_option_menu_get_menu(GTK_OPTION_MENU(marker_mid_menu))), NULL);
m = gtk_menu_new();
gtk_widget_show(m);
ink_marker_menu_create_menu(m, "marker-mid", document, sandbox);
gtk_option_menu_remove_menu(GTK_OPTION_MENU(marker_mid_menu));
gtk_option_menu_set_menu(GTK_OPTION_MENU(marker_mid_menu), m);
- gtk_option_menu_set_history(GTK_OPTION_MENU(marker_mid_menu), pos);
- gtk_signal_handler_unblock_by_func( GTK_OBJECT(marker_mid_menu), GTK_SIGNAL_FUNC(sp_marker_select), spw);
- gtk_signal_handler_block_by_func( GTK_OBJECT(marker_end_menu), GTK_SIGNAL_FUNC(sp_marker_select), spw);
- pos = ink_marker_menu_get_pos(GTK_MENU(gtk_option_menu_get_menu(GTK_OPTION_MENU(marker_end_menu))), NULL);
m = gtk_menu_new();
gtk_widget_show(m);
ink_marker_menu_create_menu(m, "marker-end", document, sandbox);
gtk_option_menu_remove_menu(GTK_OPTION_MENU(marker_end_menu));
gtk_option_menu_set_menu(GTK_OPTION_MENU(marker_end_menu), m);
- gtk_option_menu_set_history(GTK_OPTION_MENU(marker_end_menu), pos);
- gtk_signal_handler_unblock_by_func( GTK_OBJECT(marker_end_menu), GTK_SIGNAL_FUNC(sp_marker_select), spw);
}
/**
else
markname = g_strdup(SP_OBJECT_REPR(marker)->attribute("id"));
- int markpos = ink_marker_menu_get_pos(m, markname);
+ int markpos = 0;
+ GList *kids = GTK_MENU_SHELL(m)->children;
+ int i = 0;
+ for (; kids != NULL; kids = kids->next) {
+ gchar *mark = (gchar *) g_object_get_data(G_OBJECT(kids->data), "marker");
+ if ( mark && strcmp(mark, markname) == 0 ) {
+ markpos = i;
+ break;
+ }
+ i++;
+ }
gtk_option_menu_set_history(GTK_OPTION_MENU(mnu), markpos);
g_free (markname);
gchar* b = g_strdup(p);
b[c] = '\0';
+
SPDesktop *desktop = inkscape_active_desktop();
SPDocument *doc = sp_desktop_document(desktop);
SPObject *marker = doc->getObjectById(b);
index 693426d2d82f7b01a9c9e9cfc1c8e7e4e5c2601a..d56d083ba0e138fc57d0aa5bce6deb81be8285ab 100644 (file)
using NR::X;
using NR::Y;
- NR::Rect const a = first->invokeBbox(sp_item_i2doc_affine(first));
+ NR::Rect const a = first->getBounds(sp_item_i2doc_affine(first));
double const a_height = a.dimensions()[Y];
- NR::Rect const b = second->invokeBbox(sp_item_i2doc_affine(second));
+ NR::Rect const b = second->getBounds(sp_item_i2doc_affine(second));
double const b_height = b.dimensions()[Y];
bool a_in_b_vert = false;
int
sp_compare_y_position(SPItem *first, SPItem *second)
{
- NR::Rect const a = first->invokeBbox(sp_item_i2doc_affine(first));
- NR::Rect const b = second->invokeBbox(sp_item_i2doc_affine(second));
+ NR::Rect const a = first->getBounds(sp_item_i2doc_affine(first));
+ NR::Rect const b = second->getBounds(sp_item_i2doc_affine(second));
if (a.min()[NR::Y] > b.min()[NR::Y]) {
return 1;
cnt=0;
for (; items != NULL; items = items->next) {
SPItem *item = SP_ITEM(items->data);
- NR::Rect const b = item->invokeBbox(sp_item_i2doc_affine(item));
+ NR::Rect const b = item->getBounds(sp_item_i2doc_affine(item));
width = b.dimensions()[NR::X];
height = b.dimensions()[NR::Y];
cx = b.midpoint()[NR::X];
const GSList *sizes = sorted;
for (; sizes != NULL; sizes = sizes->next) {
SPItem *item = SP_ITEM(sizes->data);
- NR::Rect const b = item->invokeBbox(sp_item_i2doc_affine(item));
+ NR::Rect const b = item->getBounds(sp_item_i2doc_affine(item));
width = b.dimensions()[NR::X];
height = b.dimensions()[NR::Y];
if (width > col_widths[(cnt % NoOfCols)]) {
for (; current_row != NULL; current_row = current_row->next) {
SPItem *item=SP_ITEM(current_row->data);
Inkscape::XML::Node *repr = SP_OBJECT_REPR(item);
- NR::Rect const b = item->invokeBbox(sp_item_i2doc_affine(item));
+ NR::Rect const b = item->getBounds(sp_item_i2doc_affine(item));
width = b.dimensions()[NR::X];
height = b.dimensions()[NR::Y];
row = cnt / NoOfCols;
index 64c348be5a9fcde4bb9b7ebe066a315910438a08..f067aef5f85601ca55833f6f857fe7e964602afb 100644 (file)
--- a/src/dialogs/unclump.cpp
+++ b/src/dialogs/unclump.cpp
return i->second;
}
- NR::Rect const r = item->invokeBbox(sp_item_i2d_affine(item));
+ NR::Rect const r = item->getBounds(sp_item_i2d_affine(item));
NR::Point const c = r.midpoint();
c_cache[SP_OBJECT_ID(item)] = c;
return c;
if ( i != wh_cache.end() ) {
wh = i->second;
} else {
- NR::Rect const r = item->invokeBbox(sp_item_i2d_affine(item));
+ NR::Rect const r = item->getBounds(sp_item_i2d_affine(item));
wh = r.dimensions();
wh_cache[SP_OBJECT_ID(item)] = wh;
}
index f55694fcf05a29e5539209bcb9eb292331dd5fd3..1a161b2010047b8d69c4bcb4e69db3388539da7e 100644 (file)
// calculate the bbox of the item
sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
- NR::Rect const bbox = item->invokeBbox(NR::identity()); // we need "true" bbox without item_i2d_affine
+ NR::Rect const bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine
NR::Coord const width = bbox.dimensions()[NR::X];
NR::Coord const height = bbox.dimensions()[NR::Y];
gr->gradientTransform = squeeze;
{
- gchar *c=sp_svg_transform_write(gr->gradientTransform);
- SP_OBJECT_REPR(gr)->setAttribute("gradientTransform", c);
- g_free(c);
+ gchar c[256];
+ if (sp_svg_transform_write(c, 256, gr->gradientTransform)) {
+ SP_OBJECT_REPR(gr)->setAttribute("gradientTransform", c);
+ } else {
+ SP_OBJECT_REPR(gr)->setAttribute("gradientTransform", NULL);
+ }
}
} else {
sp_repr_set_svg_double(repr, "x1", (center - NR::Point(width/2, 0))[NR::X]);
@@ -316,7 +319,7 @@ sp_gradient_convert_to_userspace(SPGradient *gr, SPItem *item, gchar const *prop
// calculate the bbox of the item
sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
- NR::Rect const bbox = item->invokeBbox(NR::identity()); // we need "true" bbox without item_i2d_affine
+ NR::Rect const bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine
NR::Matrix bbox2user(bbox.dimensions()[NR::X], 0,
0, bbox.dimensions()[NR::Y],
bbox.min()[NR::X], bbox.min()[NR::Y]);
@@ -347,9 +350,12 @@ sp_gradient_convert_to_userspace(SPGradient *gr, SPItem *item, gchar const *prop
// apply skew to the gradient
gr->gradientTransform = skew;
{
- gchar *c=sp_svg_transform_write(gr->gradientTransform);
- SP_OBJECT_REPR(gr)->setAttribute("gradientTransform", c);
- g_free(c);
+ gchar c[256];
+ if (sp_svg_transform_write(c, 256, gr->gradientTransform)) {
+ SP_OBJECT_REPR(gr)->setAttribute("gradientTransform", c);
+ } else {
+ SP_OBJECT_REPR(gr)->setAttribute("gradientTransform", NULL);
+ }
}
// Matrix to convert points to userspace coords; postmultiply by inverse of skew so
@@ -417,9 +423,12 @@ sp_gradient_transform_multiply(SPGradient *gradient, NR::Matrix postmul, bool se
}
gradient->gradientTransform_set = TRUE;
- gchar *c=sp_svg_transform_write(gradient->gradientTransform);
- SP_OBJECT_REPR(gradient)->setAttribute("gradientTransform", c);
- g_free(c);
+ gchar c[256];
+ if (sp_svg_transform_write(c, 256, gradient->gradientTransform)) {
+ SP_OBJECT_REPR(gradient)->setAttribute("gradientTransform", c);
+ } else {
+ SP_OBJECT_REPR(gradient)->setAttribute("gradientTransform", NULL);
+ }
}
SPGradient *
@@ -916,9 +925,12 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
gradient->gradientTransform = new_transform;
gradient->gradientTransform_set = TRUE;
if (write_repr) {
- gchar *s=sp_svg_transform_write(gradient->gradientTransform);
- SP_OBJECT_REPR(gradient)->setAttribute("gradientTransform", s);
- g_free(s);
+ gchar s[256];
+ if (sp_svg_transform_write(s, 256, gradient->gradientTransform)) {
+ SP_OBJECT_REPR(gradient)->setAttribute("gradientTransform", s);
+ } else {
+ SP_OBJECT_REPR(gradient)->setAttribute("gradientTransform", NULL);
+ }
} else {
SP_OBJECT (gradient)->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
@@ -1010,7 +1022,7 @@ sp_item_gradient_get_coords (SPItem *item, guint point_type, guint point_i, bool
if (SP_GRADIENT(gradient)->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
- NR::Rect const bbox = item->invokeBbox(NR::identity()); // we need "true" bbox without item_i2d_affine
+ NR::Rect const bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine
p *= NR::Matrix(bbox.dimensions()[NR::X], 0,
0, bbox.dimensions()[NR::Y],
bbox.min()[NR::X], bbox.min()[NR::Y]);
diff --git a/src/main.cpp b/src/main.cpp
index f7be7d9400d86f3a4a1a044972d0d8d1c7726f30..c5d9256bfb8329310dce3df1c105ff58d32f57a3 100644 (file)
--- a/src/main.cpp
+++ b/src/main.cpp
#include "application/application.h"
-#include "main-cmdlineact.h"
-
enum {
SP_ARG_NONE,
SP_ARG_NOGUI,
SP_ARG_QUERY_ID,
SP_ARG_VERSION,
SP_ARG_VACUUM_DEFS,
- SP_ARG_VERB_LIST,
- SP_ARG_VERB,
- SP_ARG_SELECT,
SP_ARG_LAST
};
N_("Remove unused definitions from the defs section(s) of the document"),
NULL},
- {"verb-list", 0,
- POPT_ARG_NONE, NULL, SP_ARG_VERB_LIST,
- N_("List the IDs of all the verbs in Inkscape"),
- NULL},
-
- {"verb", 0,
- POPT_ARG_STRING, NULL, SP_ARG_VERB,
- N_("Verb to call when Inkscape opens."),
- N_("VERB-ID")},
-
- {"select", 0,
- POPT_ARG_STRING, NULL, SP_ARG_SELECT,
- N_("Object ID to select when Inkscape opens."),
- N_("OBJECT-ID")},
-
POPT_AUTOHELP POPT_TABLEEND
};
}
}
- Glib::signal_idle().connect(sigc::ptr_fun(&Inkscape::CmdLineAction::idle));
main_instance.run();
#ifdef WIN32
do_query_dimension (doc, false, sp_query_x? NR::X : NR::Y, sp_query_id);
}
}
-
fl = g_slist_remove(fl, fl->data);
}
@@ -789,7 +767,7 @@ do_query_dimension (SPDocument *doc, bool extent, NR::Dim2 const axis, const gch
if (o) {
sp_document_ensure_up_to_date (doc);
SPItem *item = ((SPItem *) o);
- NR::Rect area = item->invokeBbox(sp_item_i2doc_affine(item)); // "true" SVG bbox for scripting
+ NR::Rect area = item->getBounds(sp_item_i2doc_affine(item)); // "true" SVG bbox for scripting
Inkscape::SVGOStringStream os;
if (extent) {
exit(0);
break;
}
- case SP_ARG_VERB_LIST: {
- // This really shouldn't go here, we should init the app.
- // But, since we're just exiting in this path, there is
- // no harm, and this is really a better place to put
- // everything else.
- Inkscape::Extension::init();
- Inkscape::Verb::list();
- exit(0);
- break;
- }
- case SP_ARG_VERB:
- case SP_ARG_SELECT: {
- gchar const *arg = poptGetOptArg(ctx);
- if (arg != NULL) {
- // printf("Adding in: %s\n", arg);
- new Inkscape::CmdLineAction((a == SP_ARG_VERB), arg);
- }
- break;
- }
default: {
break;
}
index 40f939e25a596eb92492de255bbf774d42bd3e38..25466a4a4d5de6daf4af48c497801f7ca039737a 100644 (file)
--- a/src/sp-conn-end-pair.cpp
+++ b/src/sp-conn-end-pair.cpp
for (unsigned h = 0; h < 2; ++h) {
if ( h2attItem[h] ) {
- NR::Rect const bbox = h2attItem[h]->invokeBbox(sp_item_i2doc_affine(h2attItem[h]));
+ NR::Rect const bbox = h2attItem[h]->getBounds(sp_item_i2doc_affine(h2attItem[h]));
endPts[h] = bbox.midpoint();
}
else
diff --git a/src/sp-conn-end.cpp b/src/sp-conn-end.cpp
index 536addf4e6b860ccbff0afe6fa585fd02a547ae4..7c0d9650615c7cae9045bcb76c0f0cad29952bd6 100644 (file)
--- a/src/sp-conn-end.cpp
+++ b/src/sp-conn-end.cpp
SPPath *const path,
bool const updatePathRepr = true)
{
- // TODO: SPItem::invokeBbox gives the wrong result for some objects
+ // TODO: SPItem::getBounds gives the wrong result for some objects
// that have internal representations that are updated later
// by the sp_*_update functions, e.g., text.
sp_document_ensure_up_to_date(path->document);
NR::Point h2endPt_icoordsys[2];
NR::Matrix h2i2anc[2];
NR::Rect h2bbox_icoordsys[2] = {
- h2attItem[0]->invokeBbox(NR::identity()),
- h2attItem[1]->invokeBbox(NR::identity())
+ h2attItem[0]->getBounds(NR::identity()),
+ h2attItem[1]->getBounds(NR::identity())
};
NR::Point last_seg_endPt[2] = {
sp_curve_second_point(path->curve),
NR::Rect otherpt_rect = NR::Rect(other_endpt, other_endpt);
NR::Rect h2bbox_icoordsys[2] = { otherpt_rect, otherpt_rect };
- h2bbox_icoordsys[ind] = h2attItem[ind]->invokeBbox(NR::identity());
+ h2bbox_icoordsys[ind] = h2attItem[ind]->getBounds(NR::identity());
h2i2anc = i2anc_affine(h2attItem[ind], ancestor);
h2endPt_icoordsys[ind] = h2bbox_icoordsys[ind].midpoint();
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index f94a5e404b2970629d14ccaef471df041bc0e9ef..c2ef93714a985cb27712a966b8b8396879b0e0ee 100644 (file)
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
*/
void
SPItem::setCenter(NR::Point object_centre) {
- NR::Rect bbox = invokeBbox(sp_item_i2d_affine(this));
+ NR::Rect bbox = getBounds(sp_item_i2d_affine(this));
if (!bbox.isEmpty()) {
transform_center_x = object_centre[NR::X] - bbox.midpoint()[NR::X];
if (fabs(transform_center_x) < 1e-5) // rounding error
}
NR::Point SPItem::getCenter() {
- NR::Rect bbox = invokeBbox(sp_item_i2d_affine(this));
+ NR::Rect bbox = getBounds(sp_item_i2d_affine(this));
if (!bbox.isEmpty()) {
return bbox.midpoint() + NR::Point (this->transform_center_x, this->transform_center_y);
} else {
return repr;
}
-NR::Rect SPItem::invokeBbox(NR::Matrix const &transform) const
-{
- NRRect r;
- sp_item_invoke_bbox_full(this, &r, transform, 0, TRUE);
- return NR::Rect(r);
-}
-
-NR::Maybe<NR::Rect> SPItem::getBBox(NR::Matrix const &transform,
- SPItem::BBoxType type,
- unsigned int dkey) const
+NR::Maybe<NR::Rect> SPItem::getBounds(NR::Matrix const &transform,
+ SPItem::BBoxType type,
+ unsigned int dkey) const
{
NRRect r;
sp_item_invoke_bbox_full(this, &r, transform, 0, TRUE);
static void sp_item_private_snappoints(SPItem const *item, SnapPointsIter p)
{
- NR::Rect const bbox = item->invokeBbox(sp_item_i2d_affine(item));
+ NR::Rect const bbox = item->getBounds(sp_item_i2d_affine(item));
/* Just a pair of opposite corners of the bounding box suffices given that we don't yet
support angled guide lines. */
diff --git a/src/sp-item.h b/src/sp-item.h
index 5596942763b697693202476c19eea54358a37fdb..9aee4b30af63b415f403f387276797144aff4e4b 100644 (file)
--- a/src/sp-item.h
+++ b/src/sp-item.h
void raiseToTop();
void lowerToBottom();
- NR::Rect invokeBbox(NR::Matrix const &transform) const;
- NR::Maybe<NR::Rect> getBBox(NR::Matrix const &transform, BBoxType type=APPROXIMATE_BBOX, unsigned int dkey=0) const;
+ NR::Maybe<NR::Rect> getBounds(NR::Matrix const &transform, BBoxType type=APPROXIMATE_BBOX, unsigned int dkey=0) const;
sigc::connection _clip_ref_connection;
sigc::connection _mask_ref_connection;
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index a38a10b4d954286dcd4cd1f79f2c346463d0bc3e..7d472088cced680b2a39b28aeb9244564f6af584 100644 (file)
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_PARENT_MODIFIED_FLAG)) {
/* This is suboptimal, because changing parent style schedules recalculation */
/* But on the other hand - how can we know that parent does not tie style and transform */
- NR::Rect const paintbox = SP_ITEM(object)->invokeBbox(NR::identity());
+ NR::Rect const paintbox = SP_ITEM(object)->getBounds(NR::identity());
for (SPItemView *v = SP_ITEM (shape)->display; v != NULL; v = v->next) {
NRArenaShape * const s = NR_ARENA_SHAPE(v->arenaitem);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
@@ -753,7 +753,7 @@ sp_shape_show (SPItem *item, NRArena *arena, unsigned int key, unsigned int flag
NRArenaShape * const s = NR_ARENA_SHAPE(arenaitem);
nr_arena_shape_set_style(s, object->style);
nr_arena_shape_set_path(s, shape->curve, false);
- NR::Rect const paintbox = item->invokeBbox(NR::identity());
+ NR::Rect const paintbox = item->getBounds(NR::identity());
s->setPaintBox(paintbox);
if (sp_shape_has_markers (shape)) {
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index e5154c130b3bd504988d7a12de0f054ace327639..ecafd2f04e9eeee17d22d58608f8943bf2d77e9d 100644 (file)
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
@@ -474,7 +474,11 @@ sp_selected_path_boolop(bool_op bop, const unsigned int verb, const Glib::ustrin
// premultiply by the inverse of parent's repr
SPItem *parent_item = SP_ITEM(sp_desktop_document(desktop)->getObjectByRepr(parent));
NR::Matrix local = sp_item_i2doc_affine(parent_item);
- gchar *transform = sp_svg_transform_write(local);
+ gchar affinestr[80];
+ gchar *transform = NULL;
+ if (!local.test_identity() && sp_svg_transform_write(affinestr, 79, local.inverse())) {
+ transform = affinestr;
+ }
// now that we have the result, add it on the canvas
if ( bop == bool_op_cut || bop == bool_op_slice ) {
@@ -571,8 +575,6 @@ sp_selected_path_boolop(bool_op bop, const unsigned int verb, const Glib::ustrin
Inkscape::GC::release(repr);
}
- g_free(transform);
-
sp_document_done(sp_desktop_document(desktop), verb, description);
delete res;
continue;
if (simplifyIndividualPaths) {
- NR::Rect itemBbox = item->invokeBbox(sp_item_i2d_affine(item));
+ NR::Rect itemBbox = item->getBounds(sp_item_i2d_affine(item));
simplifySize = L2(itemBbox.dimensions());
}
bpath=SP_CURVE_BPATH(curve);
}
- Path *dest = bpath_to_Path(bpath);
-
- if ( doTransformation ) {
- if ( bpath ) g_free(bpath);
- } else {
- sp_curve_unref(curve);
- }
- return dest;
-}
-
-Path *bpath_to_Path(NArtBpath const *bpath) {
Path *dest = new Path;
dest->SetBackData(false);
{
if (closed)
dest->Close();
}
+
+ if ( doTransformation ) {
+ if ( bpath ) g_free(bpath);
+ } else {
+ sp_curve_unref(curve);
+ }
return dest;
}
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp
index 4506a3c6a0f1db2311c753cb7ac87bcd8c648c3c..85666f76c5b04f3eb733b278b9f3b69936957e15 100644 (file)
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
int const x1 = std::min(area->x + area->width, widget.allocation.x + padx + static_cast<int>(icon->psize) );
int const y1 = std::min(area->y + area->height, widget.allocation.y + pady + static_cast<int>(icon->psize) );
- int width = x1 - x0;
- int height = y1 - y0;
- // Limit drawing to when we actually have something. Avoids some crashes.
- if ( (width > 0) && (height > 0) ) {
- gdk_draw_pixbuf(GDK_DRAWABLE(widget.window), NULL, image,
- x0 - widget.allocation.x - padx,
- y0 - widget.allocation.y - pady,
- x0, y0,
- width, height,
- GDK_RGB_DITHER_NORMAL, x0, y0);
- }
+ gdk_draw_pixbuf(GDK_DRAWABLE(widget.window), NULL, image,
+ x0 - widget.allocation.x - padx,
+ y0 - widget.allocation.y - pady,
+ x0, y0,
+ x1 - x0, y1 - y0,
+ GDK_RGB_DITHER_NORMAL, x0, y0);
}
}
if (object && SP_IS_ITEM(object)) {
/* Find bbox in document */
NR::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object)));
- NR::Rect dbox = SP_ITEM(object)->invokeBbox(i2doc);
+ NR::Rect dbox = SP_ITEM(object)->getBounds(i2doc);
if ( SP_OBJECT_PARENT(object) == NULL )
{
px + 4 * psize * (ua.y0 - area.y0) +
4 * (ua.x0 - area.x0),
4 * psize, FALSE, FALSE );
- nr_arena_item_invoke_render(NULL, root, &ua, &B,
+ nr_arena_item_invoke_render( root, &ua, &B,
NR_ARENA_ITEM_RENDER_NO_CACHE );
nr_pixblock_release(&B);