diff options
| author | Ted Gould <ted@gould.cx> | 2009-11-29 19:01:07 +0000 |
|---|---|---|
| committer | Ted Gould <ted@gould.cx> | 2009-11-29 19:01:07 +0000 |
| commit | 29d3c0b15028e61f176df3a75189bf0959d0d03e (patch) | |
| tree | 727afe596c693a9bdd098d72618abd9ceb0d1969 /src/helper | |
| parent | Add the build dir dbus directory to grab some headerfiles for distcheck. (diff) | |
| parent | hopefully fix build on linux (diff) | |
| download | inkscape-29d3c0b15028e61f176df3a75189bf0959d0d03e.tar.gz inkscape-29d3c0b15028e61f176df3a75189bf0959d0d03e.zip | |
Merging in from trunk
(bzr r8254.1.37)
Diffstat (limited to 'src/helper')
| -rw-r--r-- | src/helper/action.h | 2 | ||||
| -rw-r--r-- | src/helper/pixbuf-ops.cpp | 16 | ||||
| -rw-r--r-- | src/helper/png-write.cpp | 21 |
3 files changed, 14 insertions, 25 deletions
diff --git a/src/helper/action.h b/src/helper/action.h index 4c99e31d8..c4367df62 100644 --- a/src/helper/action.h +++ b/src/helper/action.h @@ -26,7 +26,7 @@ #include "forward.h" #include <glibmm/ustring.h> -//class Inkscape::UI::View::View; +//class Inkscape::UI::View::View; namespace Inkscape { class Verb; diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp index f41342e42..1e43df5f3 100644 --- a/src/helper/pixbuf-ops.cpp +++ b/src/helper/pixbuf-ops.cpp @@ -98,7 +98,6 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/, { - GdkPixbuf* pixbuf = NULL; /* Create new arena for offscreen rendering*/ NRArena *arena = NRArena::create(); @@ -141,7 +140,12 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/, nr_arena_item_invoke_update(root, &final_bbox, &gc, NR_ARENA_ITEM_STATE_ALL, NR_ARENA_ITEM_STATE_NONE); - guchar *px = g_try_new(guchar, 4L * width * height); + guchar *px = NULL; + guint64 size = 4L * (guint64)width * (guint64)height; + if(size < (guint64)G_MAXSIZE) { + // g_try_new is limited to g_size type which is defined as unisgned int. Need to test for very large nubers + px = g_try_new(guchar, size); + } if(px != NULL) { @@ -158,15 +162,15 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/, dtc[2] = NR_RGBA32_B(bgcolor); dtc[3] = NR_RGBA32_A(bgcolor); - for (unsigned int fy = 0; fy < height; fy++) { - guchar *p = NR_PIXBLOCK_PX(&B) + fy * B.rs; + for (gsize fy = 0; fy < height; fy++) { + guchar *p = NR_PIXBLOCK_PX(&B) + fy * (gsize)B.rs; for (unsigned int fx = 0; fx < width; fx++) { for (int i = 0; i < 4; i++) { *p++ = dtc[i]; } } } - + nr_arena_item_invoke_render(NULL, root, &final_bbox, &B, NR_ARENA_ITEM_RENDER_NO_CACHE ); @@ -178,7 +182,7 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/, } else { - g_warning("sp_generate_internal_bitmap: not enough memory to create pixel buffer. Need %ld.", 4L * width * height); + g_warning("sp_generate_internal_bitmap: not enough memory to create pixel buffer. Need %lld.", size); } sp_item_invoke_hide (SP_ITEM(sp_document_root(doc)), dkey); nr_object_unref((NRObject *) arena); diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp index 3ac900680..b1c135db0 100644 --- a/src/helper/png-write.cpp +++ b/src/helper/png-write.cpp @@ -414,20 +414,7 @@ sp_export_png_file(SPDocument *doc, gchar const *filename, g_return_val_if_fail(height >= 1, false); g_return_val_if_fail(!area.hasZeroArea(), false); - //Make relative paths absolute, if possible: - gchar *path = 0; - if (!g_path_is_absolute(filename) && doc->uri) { - gchar *dirname = g_path_get_dirname(doc->uri); - if (dirname) { - path = g_build_filename(dirname, filename, NULL); - g_free(dirname); - } - } - if (!path) { - path = g_strdup(filename); - } - - if (!force_overwrite && !sp_ui_overwrite_file(path)) { + if (!force_overwrite && !sp_ui_overwrite_file(filename)) { /* Remark: We return true so as not to invoke an error dialog in case export is cancelled by the user; currently this is safe because the callers only act when false is returned. If this changes in the future we need better distinction of return types (e.g., use int) @@ -493,12 +480,12 @@ sp_export_png_file(SPDocument *doc, gchar const *filename, if ((width < 256) || ((width * height) < 32768)) { ebp.px = nr_pixelstore_64K_new(FALSE, 0); ebp.sheight = 65536 / (4 * width); - write_status = sp_png_write_rgba_striped(doc, path, width, height, xdpi, ydpi, sp_export_get_rows, &ebp); + write_status = sp_png_write_rgba_striped(doc, filename, width, height, xdpi, ydpi, sp_export_get_rows, &ebp); nr_pixelstore_64K_free(ebp.px); } else { ebp.sheight = 64; ebp.px = g_try_new(guchar, 4 * ebp.sheight * width); - write_status = sp_png_write_rgba_striped(doc, path, width, height, xdpi, ydpi, sp_export_get_rows, &ebp); + write_status = sp_png_write_rgba_striped(doc, filename, width, height, xdpi, ydpi, sp_export_get_rows, &ebp); g_free(ebp.px); } @@ -508,8 +495,6 @@ sp_export_png_file(SPDocument *doc, gchar const *filename, /* Free arena */ nr_object_unref((NRObject *) arena); - g_free(path); - return write_status; } |
