summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3e54f20)
raw | patch | inline | side by side (parent: 3e54f20)
author | mental <mental@users.sourceforge.net> | |
Sat, 17 Mar 2007 19:00:45 +0000 (19:00 +0000) | ||
committer | mental <mental@users.sourceforge.net> | |
Sat, 17 Mar 2007 19:00:45 +0000 (19:00 +0000) |
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 668d46b31cfbca8505ba3302202ed1c85df40517..9658f00b71e1a0b03a882c4e4b66018be69f7ec7 100644 (file)
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
NR::Rect d(NR::Point(0, 0),
NR::Point(sp_document_width(doc()), sp_document_height(doc())));
- if (d.dimensions()[NR::X] < 1.0 || d.dimensions()[NR::Y] < 1.0) {
+ if (d.isEmpty(1.0)) {
return;
}
{
NR::Maybe<NR::Rect> const d = selection->bounds();
- if ( !d || d->dimensions()[NR::X] < 0.1 || d->dimensions()[NR::Y] < 0.1) {
+ if ( !d || d->isEmpty(0.1) ) {
return;
}
/* Note that the second condition here indicates that
** there are no items in the drawing.
*/
- if ( !d || d->dimensions()[NR::X] < 1.0 || d->dimensions()[NR::Y] < 1.0 ) {
+ if ( !d || d->isEmpty(1.0) ) {
return;
}
index 5521f91cb994fd5fb6a2e9b7a2865497d86ec72c..82a88faa3047d5fc18f7897a28ea9658c73a853e 100644 (file)
sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
NR::Maybe<NR::Rect> bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine
- g_assert( bbox );
+ g_assert( bbox && !bbox->isEmpty() );
NR::Coord const width = bbox->dimensions()[NR::X];
NR::Coord const height = bbox->dimensions()[NR::Y];
@@ -318,7 +318,7 @@ sp_gradient_convert_to_userspace(SPGradient *gr, SPItem *item, gchar const *prop
sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
NR::Matrix bbox2user;
NR::Maybe<NR::Rect> bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine
- if ( bbox ) {
+ if ( bbox && !bbox->isEmpty() ) {
bbox2user = NR::Matrix(bbox->dimensions()[NR::X], 0,
0, bbox->dimensions()[NR::Y],
bbox->min()[NR::X], bbox->min()[NR::Y]);
index b2ba56f620e53ea6173ccccf2dda36b5022a24de..1fe70b896cdfd351e22e0f8d9ed6ac1290376f04 100644 (file)
}
NR::Maybe<NR::Rect> current = selection->bounds();
- if ( !current || current->extent(NR::X) < 1e-6 || current->extent(NR::Y) < 1e-6 ) {
+ if ( !current || current->isEmpty() ) {
return;
}
SPItem *item = SP_ITEM(l->data);
NR::Maybe<NR::Rect> current = sp_item_bbox_desktop(item);
- if ( !current || current->extent(NR::X) < 1e-6 || current->extent(NR::Y) < 1e-6 ) {
+ if ( !current || current->isEmpty() ) {
continue;
}
return;
NR::Maybe<NR::Rect> const bbox(selection->bounds());
- if ( !bbox ) {
+ if ( !bbox || bbox->isEmpty() ) {
return;
}
@@ -1550,7 +1550,7 @@ void sp_selection_scale_relative(Inkscape::Selection *selection, NR::Point const
NR::Maybe<NR::Rect> const bbox(selection->bounds());
- if ( !bbox ) {
+ if ( !bbox || bbox->isEmpty() ) {
return;
}
sp_document_ensure_up_to_date(document);
NR::Maybe<NR::Rect> r = selection->bounds();
- if ( !r ) {
+ if ( !r || r->isEmpty() ) {
return;
}
index 72a7c39e61f633358f33764f9e4df99550d2aee8..10eba684885302e37b62c971a14a2a53c567ec8c 100644 (file)
@@ -103,7 +103,7 @@ get_scale_transform_with_stroke (NR::Rect &bbox_param, gdouble strokewidth, bool
gdouble h1 = y1 - y0;
gdouble r0 = strokewidth;
- if (bbox.extent(NR::X) < 1e-06 || bbox.extent(NR::Y) < 1e-06) {
+ if (bbox.isEmpty()) {
NR::Matrix move = NR::Matrix(NR::translate(x0 - bbox.min()[NR::X], y0 - bbox.min()[NR::Y]));
return (move); // cannot scale from empty boxes at all, so only translate
}
diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp
index ed4db90b773f57cd1dc888dbdbc70defeb1468a6..e682f394bb74c41029ce91c6aec088aa84c729ba 100644 (file)
--- a/src/sp-offset.cpp
+++ b/src/sp-offset.cpp
SPItem *item = shape;
NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop (item);
- if ( bbox ) {
+ if ( bbox && !bbox->isEmpty() ) {
gdouble size = L2(bbox->dimensions());
gdouble const exp = NR::expansion(item->transform);
if (exp != 0)
index 99fd2fb8020bd416997165be65ed62e9295e11de..79258283d176410516b3dd9ac0328c829c19bb67 100644 (file)
NR::Rect d(NR::Point(0, 0),
NR::Point(sp_document_width(_desktop->doc()), sp_document_height(_desktop->doc())));
- if (fabs(d.dimensions()[NR::X]) < 1.0 || fabs(d.dimensions()[NR::Y]) < 1.0) {
+ if (d.isEmpty(1.0)) {
return;
}
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp
index b9ed94c0ce0369d7b1e0a931722402ed45be1dab..9be74a556f9151431dee10c24372351cd6702599 100644 (file)
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
}
/* This is in document coordinates, i.e. pixels */
- if ( dbox ) {
+ if ( dbox && !dbox->isEmpty() ) {
NRGC gc(NULL);
/* Update to renderable state */
double sf = 1.0;
index fce5ff9b9d2d1a299e0a4702f32bffd12ec8070d..0d64409cc1ec959fba58b8d7ef4d63f528c58b02 100644 (file)
using NR::Y;
if ( sel && !sel->isEmpty() ) {
NR::Maybe<NR::Rect> const bbox(sel->bounds());
- if ( bbox && ( bbox->extent(X) > 1e-6 || bbox->extent(Y) > 1e-6 ) ) {
+ if ( bbox && !bbox->isEmpty() ) {
GtkWidget *us = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(spw), "units");
SPUnit const &unit = *sp_unit_selector_get_unit(SP_UNIT_SELECTOR(us));
sp_document_ensure_up_to_date (document);
NR::Maybe<NR::Rect> bbox = selection->bounds();
- if ( !bbox || bbox->extent(NR::X) < 1e-6 || bbox->extent(NR::Y) < 1e-6 ) {
+ if ( !bbox || bbox->isEmpty() ) {
return;
}