diff options
| author | John Bintz <me@johnbintz.com> | 2007-02-25 16:33:09 +0000 |
|---|---|---|
| committer | johncoswell <johncoswell@users.sourceforge.net> | 2007-02-25 16:33:09 +0000 |
| commit | c9eb07a89eba6c682caf1232d23b89e7da2537c9 (patch) | |
| tree | b9fa56801d2993ce90e1ce990c170e46caee8f52 /src/flood-context.cpp | |
| parent | Fix g_free crash (diff) | |
| download | inkscape-c9eb07a89eba6c682caf1232d23b89e7da2537c9.tar.gz inkscape-c9eb07a89eba6c682caf1232d23b89e7da2537c9.zip | |
Fix some memory issues with food fill
(bzr r2438)
Diffstat (limited to 'src/flood-context.cpp')
| -rw-r--r-- | src/flood-context.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/flood-context.cpp b/src/flood-context.cpp index 88435cfd1..4530aa453 100644 --- a/src/flood-context.cpp +++ b/src/flood-context.cpp @@ -370,7 +370,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even /* Create ArenaItems and set transform */ NRArenaItem *root = sp_item_invoke_show(SP_ITEM(sp_document_root(document)), arena, dkey, SP_ITEM_SHOW_DISPLAY); - nr_arena_item_set_transform(root, affine); + nr_arena_item_set_transform(NR_ARENA_ITEM(root), affine); NRGC gc(NULL); nr_matrix_set_identity(&gc.transform); @@ -383,21 +383,20 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even nr_arena_item_invoke_update(root, &final_bbox, &gc, NR_ARENA_ITEM_STATE_ALL, NR_ARENA_ITEM_STATE_NONE); -// /* Set up pixblocks */ guchar *px = g_new(guchar, 4 * width * height); memset(px, 0x00, 4 * width * height); - guchar *trace_px = g_new(guchar, 4 * width * height); - memset(trace_px, 0x00, 4 * width * height); - NRPixBlock B; nr_pixblock_setup_extern( &B, NR_PIXBLOCK_MODE_R8G8B8A8N, final_bbox.x0, final_bbox.y0, final_bbox.x1, final_bbox.y1, px, 4 * width, FALSE, FALSE ); nr_arena_item_invoke_render( root, &final_bbox, &B, NR_ARENA_ITEM_RENDER_NO_CACHE ); - nr_pixblock_release(&B); + + // Hide items + sp_item_invoke_hide(SP_ITEM(sp_document_root(document)), dkey); + nr_arena_item_unref(root); nr_object_unref((NRObject *) arena); @@ -408,6 +407,9 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even pw[NR::X] = (int)MIN(width - 1, MAX(0, pw[NR::X])); pw[NR::Y] = (int)MIN(height - 1, MAX(0, pw[NR::Y])); + guchar *trace_px = g_new(guchar, 4 * width * height); + memset(trace_px, 0x00, 4 * width * height); + std::queue<NR::Point> fill_queue; fill_queue.push(pw); @@ -501,7 +503,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even do_trace(pixbuf, desktop, inverted_affine); g_free(trace_px); - + sp_document_done(document, SP_VERB_CONTEXT_FLOOD, _("Flood fill")); } |
