summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 67c7525)
raw | patch | inline | side by side (parent: 67c7525)
author | scislac <scislac@users.sourceforge.net> | |
Sun, 4 Oct 2009 21:03:42 +0000 (21:03 +0000) | ||
committer | scislac <scislac@users.sourceforge.net> | |
Sun, 4 Oct 2009 21:03:42 +0000 (21:03 +0000) |
src/helper/pixbuf-ops.cpp | patch | blob | history |
index f41342e42271ce41712884e8eca1ff49f63b689a..1e43df5f38b804556cfec1bcd6398cb798781e53 100644 (file)
{
-
GdkPixbuf* pixbuf = NULL;
/* Create new arena for offscreen rendering*/
NRArena *arena = NRArena::create();
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)
{
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 );
}
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);