summaryrefslogtreecommitdiffstats
path: root/src/flood-context.cpp
diff options
context:
space:
mode:
authorJohn Bintz <me@johnbintz.com>2007-03-02 03:00:25 +0000
committerjohncoswell <johncoswell@users.sourceforge.net>2007-03-02 03:00:25 +0000
commit8064fb09a0785b87d4578e0809c0af1b7d47aacd (patch)
tree63aab9f78fc81e27b994da3cc5e990645149bea9 /src/flood-context.cpp
parentRemove some unnecessary code (diff)
downloadinkscape-8064fb09a0785b87d4578e0809c0af1b7d47aacd.tar.gz
inkscape-8064fb09a0785b87d4578e0809c0af1b7d47aacd.zip
Allow for filling of only visible parts of the bounded area, presenting a warning when this occurs
(bzr r2493)
Diffstat (limited to 'src/flood-context.cpp')
-rw-r--r--src/flood-context.cpp30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/flood-context.cpp b/src/flood-context.cpp
index fc6628f46..f58f70940 100644
--- a/src/flood-context.cpp
+++ b/src/flood-context.cpp
@@ -421,6 +421,8 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
int tolerance = (255 * prefs_get_int_attribute_limited("tools.paintbucket", "tolerance", 1, 0, 100)) / 100;
+ bool reached_screen_boundary = false;
+
while (!fill_queue.empty() && !aborted) {
NR::Point cp = fill_queue.front();
fill_queue.pop();
@@ -439,12 +441,20 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
if (y > 0) {
top_fill = try_add_to_queue(&fill_queue, px, trace_px, orig_color, x, y - 1, width, tolerance, top_fill);
} else {
- aborted = true; break;
+ if (bbox.min()[NR::Y] > screen.min()[NR::Y]) {
+ aborted = true; break;
+ } else {
+ reached_screen_boundary = true;
+ }
}
if (y < y_limit) {
bottom_fill = try_add_to_queue(&fill_queue, px, trace_px, orig_color, x, y + 1, width, tolerance, bottom_fill);
} else {
- aborted = true; break;
+ if (bbox.max()[NR::Y] < screen.max()[NR::Y]) {
+ aborted = true; break;
+ } else {
+ reached_screen_boundary = true;
+ }
}
bool default_top_fill = top_fill;
@@ -467,7 +477,11 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
left--; ok = true;
}
} else {
- aborted = true; break;
+ if (bbox.min()[NR::X] > screen.min()[NR::X]) {
+ aborted = true; break;
+ } else {
+ reached_screen_boundary = true;
+ }
}
} while (ok);
@@ -488,7 +502,11 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
right++; ok = true;
}
} else {
- aborted = true; break;
+ if (bbox.max()[NR::X] < screen.max()[NR::X]) {
+ aborted = true; break;
+ } else {
+ reached_screen_boundary = true;
+ }
}
} while (ok);
}
@@ -502,6 +520,10 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
return;
}
+ if (reached_screen_boundary) {
+ desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("<b>Only the visible part of the bounded area was filled.</b> If you want to fill all of the area, undo, zoom out, and fill again."));
+ }
+
GdkPixbuf* pixbuf = gdk_pixbuf_new_from_data(trace_px,
GDK_COLORSPACE_RGB,
TRUE,