summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMenTaLguY <mental@rydia.net>2007-03-17 19:00:45 +0000
committermental <mental@users.sourceforge.net>2007-03-17 19:00:45 +0000
commit70dcb712d89b98453c4ea6e4868c88af8d2887e4 (patch)
treec19680dd8b7c41260a6224b54f3e1712a1da08da /src
parentclean up rect mess a bit before start working on other stuff (diff)
downloadinkscape-70dcb712d89b98453c4ea6e4868c88af8d2887e4.tar.gz
inkscape-70dcb712d89b98453c4ea6e4868c88af8d2887e4.zip
re-introduce isEmpty tests
(bzr r2679)
Diffstat (limited to 'src')
-rw-r--r--src/desktop.cpp6
-rw-r--r--src/gradient-chemistry.cpp4
-rw-r--r--src/selection-chemistry.cpp10
-rw-r--r--src/sp-item-transform.cpp2
-rw-r--r--src/sp-offset.cpp2
-rw-r--r--src/ui/view/edit-widget.cpp2
-rw-r--r--src/widgets/icon.cpp2
-rw-r--r--src/widgets/select-toolbar.cpp4
8 files changed, 16 insertions, 16 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 668d46b31..9658f00b7 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -826,7 +826,7 @@ SPDesktop::zoom_page()
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;
}
@@ -859,7 +859,7 @@ SPDesktop::zoom_selection()
{
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;
}
@@ -890,7 +890,7 @@ SPDesktop::zoom_drawing()
/* 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;
}
diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp
index 5521f91cb..82a88faa3 100644
--- a/src/gradient-chemistry.cpp
+++ b/src/gradient-chemistry.cpp
@@ -260,7 +260,7 @@ sp_gradient_reset_to_userspace (SPGradient *gr, SPItem *item)
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]);
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index b2ba56f62..1fe70b896 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -1195,7 +1195,7 @@ void sp_selection_paste_size (bool apply_x, bool apply_y)
}
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;
}
@@ -1234,7 +1234,7 @@ void sp_selection_paste_size_separately (bool apply_x, bool apply_y)
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;
}
@@ -1527,7 +1527,7 @@ sp_selection_scale_absolute(Inkscape::Selection *selection,
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;
}
@@ -2202,7 +2202,7 @@ sp_selection_tile(bool apply)
sp_document_ensure_up_to_date(document);
NR::Maybe<NR::Rect> r = selection->bounds();
- if ( !r ) {
+ if ( !r || r->isEmpty() ) {
return;
}
diff --git a/src/sp-item-transform.cpp b/src/sp-item-transform.cpp
index 72a7c39e6..10eba6848 100644
--- a/src/sp-item-transform.cpp
+++ b/src/sp-item-transform.cpp
@@ -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 ed4db90b7..e682f394b 100644
--- a/src/sp-offset.cpp
+++ b/src/sp-offset.cpp
@@ -585,7 +585,7 @@ sp_offset_set_shape(SPShape *shape)
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)
diff --git a/src/ui/view/edit-widget.cpp b/src/ui/view/edit-widget.cpp
index 99fd2fb80..79258283d 100644
--- a/src/ui/view/edit-widget.cpp
+++ b/src/ui/view/edit-widget.cpp
@@ -1630,7 +1630,7 @@ EditWidget::onWindowRealize()
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 b9ed94c0c..9be74a556 100644
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
@@ -623,7 +623,7 @@ sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root,
}
/* 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;
diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp
index fce5ff9b9..0d64409cc 100644
--- a/src/widgets/select-toolbar.cpp
+++ b/src/widgets/select-toolbar.cpp
@@ -59,7 +59,7 @@ sp_selection_layout_widget_update(SPWidget *spw, Inkscape::Selection *sel)
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));
@@ -141,7 +141,7 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw)
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;
}