summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2007-02-04 15:10:56 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2007-02-04 15:10:56 +0000
commit9a2bcb294fb75bdfe1c4af93795ca874d1bbca87 (patch)
tree89ff55dcc4e183fd5e6ac4be3e4276b7c6ac8989 /src
parentremove rudimental general-purpose clipart, add some Inkscape-related graphics... (diff)
downloadinkscape-9a2bcb294fb75bdfe1c4af93795ca874d1bbca87.tar.gz
inkscape-9a2bcb294fb75bdfe1c4af93795ca874d1bbca87.zip
Unions Are Evil! When pixblock size is TINY, it stores data right in the data.px field (as data.p) and clears it, so when read as data.px it yields NULL. This fixes the problems with the dropper tool (which uses tiny buffers)
(bzr r2325)
Diffstat (limited to 'src')
-rw-r--r--src/display/nr-arena-glyphs.cpp4
-rw-r--r--src/display/nr-arena-item.cpp4
-rw-r--r--src/display/nr-arena-shape.cpp6
-rw-r--r--src/display/nr-arena.cpp2
-rw-r--r--src/display/nr-filter-gaussian.cpp4
-rw-r--r--src/display/nr-filter.cpp6
6 files changed, 13 insertions, 13 deletions
diff --git a/src/display/nr-arena-glyphs.cpp b/src/display/nr-arena-glyphs.cpp
index bd6a5707a..b9f962284 100644
--- a/src/display/nr-arena-glyphs.cpp
+++ b/src/display/nr-arena-glyphs.cpp
@@ -442,7 +442,7 @@ nr_arena_glyphs_group_render(NRArenaItem *item, NRRectL *area, NRPixBlock *pb, u
nr_pixblock_setup_fast(&m, NR_PIXBLOCK_MODE_A8, area->x0, area->y0, area->x1, area->y1, TRUE);
// if memory allocation failed, abort
- if (m.data.px == NULL) {
+ if (m.size != NR_PIXBLOCK_SIZE_TINY && m.data.px == NULL) {
nr_pixblock_release (&m);
return (item->state);
}
@@ -489,7 +489,7 @@ nr_arena_glyphs_group_render(NRArenaItem *item, NRRectL *area, NRPixBlock *pb, u
nr_pixblock_setup_fast(&m, NR_PIXBLOCK_MODE_A8, area->x0, area->y0, area->x1, area->y1, TRUE);
// if memory allocation failed, abort
- if (m.data.px == NULL) {
+ if (m.size != NR_PIXBLOCK_SIZE_TINY && m.data.px == NULL) {
nr_pixblock_release (&m);
return (item->state);
}
diff --git a/src/display/nr-arena-item.cpp b/src/display/nr-arena-item.cpp
index e7eab8b85..68e4d3c9e 100644
--- a/src/display/nr-arena-item.cpp
+++ b/src/display/nr-arena-item.cpp
@@ -377,7 +377,7 @@ nr_arena_item_invoke_render (NRArenaItem *item, NRRectL const *area,
TRUE);
// if memory allocation failed, abort render
- if (ipb.data.px == NULL) {
+ if (ipb.size != NR_PIXBLOCK_SIZE_TINY && ipb.data.px == NULL) {
nr_pixblock_release (&ipb);
return (item->state);
}
@@ -836,7 +836,7 @@ nr_arena_item_get_background (NRArenaItem const *item, int depth)
item->background_pb->area.y0,
item->background_pb->area.x1,
item->background_pb->area.y1, true);
- if (pb->data.px == NULL) // allocation failed
+ if (pb->size != NR_PIXBLOCK_SIZE_TINY && pb->data.px == NULL) // allocation failed
return NULL;
} else if (item->parent) {
pb = nr_arena_item_get_background (item->parent, depth + 1);
diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp
index b2003b9e1..d539d0f13 100644
--- a/src/display/nr-arena-shape.cpp
+++ b/src/display/nr-arena-shape.cpp
@@ -756,7 +756,7 @@ nr_arena_shape_render(NRArenaItem *item, NRRectL *area, NRPixBlock *pb, unsigned
nr_pixblock_setup_fast(&m, NR_PIXBLOCK_MODE_A8, area->x0, area->y0, area->x1, area->y1, TRUE);
// if memory allocation failed, abort render
- if (m.data.px == NULL) {
+ if (m.size != NR_PIXBLOCK_SIZE_TINY && m.data.px == NULL) {
nr_pixblock_release (&m);
return (item->state);
}
@@ -794,7 +794,7 @@ nr_arena_shape_render(NRArenaItem *item, NRRectL *area, NRPixBlock *pb, unsigned
nr_pixblock_setup_fast(&m, NR_PIXBLOCK_MODE_A8, area->x0, area->y0, area->x1, area->y1, TRUE);
// if memory allocation failed, abort render
- if (m.data.px == NULL) {
+ if (m.size != NR_PIXBLOCK_SIZE_TINY && m.data.px == NULL) {
nr_pixblock_release (&m);
return (item->state);
}
@@ -859,7 +859,7 @@ nr_arena_shape_clip(NRArenaItem *item, NRRectL *area, NRPixBlock *pb)
nr_pixblock_setup_fast(&m, NR_PIXBLOCK_MODE_A8, area->x0, area->y0, area->x1, area->y1, TRUE);
// if memory allocation failed, abort
- if (m.data.px == NULL) {
+ if (m.size != NR_PIXBLOCK_SIZE_TINY && m.data.px == NULL) {
nr_pixblock_release (&m);
return (item->state);
}
diff --git a/src/display/nr-arena.cpp b/src/display/nr-arena.cpp
index ba845d1a2..e6d0105fb 100644
--- a/src/display/nr-arena.cpp
+++ b/src/display/nr-arena.cpp
@@ -111,7 +111,7 @@ nr_arena_render_paintserver_fill (NRPixBlock *pb, NRRectL *area, SPPainter *pain
nr_pixblock_setup_fast (&cb_opa, NR_PIXBLOCK_MODE_R8G8B8A8N, area->x0, area->y0, area->x1, area->y1, TRUE);
// if memory allocation failed, abort
- if (cb.data.px == NULL || cb_opa.data.px == NULL) {
+ if ((cb.size != NR_PIXBLOCK_SIZE_TINY && cb.data.px == NULL) || (cb_opa.size != NR_PIXBLOCK_SIZE_TINY && cb_opa.data.px == NULL)) {
return;
}
diff --git a/src/display/nr-filter-gaussian.cpp b/src/display/nr-filter-gaussian.cpp
index 22e0aaedd..7187dd29e 100644
--- a/src/display/nr-filter-gaussian.cpp
+++ b/src/display/nr-filter-gaussian.cpp
@@ -318,7 +318,7 @@ int FilterGaussian::render(FilterSlot &slot, Matrix const &trans_)
// set up subsampled buffers
nr_pixblock_setup_fast(bufx, in->mode, xd0, yd0, xd1, yd1, true);
nr_pixblock_setup_fast(bufy, in->mode, xd0, yd0, xd1, yd1, true);
- if (bufx->data.px == NULL || bufy->data.px == NULL) { // no memory
+ if ((bufx->size != NR_PIXBLOCK_SIZE_TINY && bufx->data.px == NULL) || (bufy->size != NR_PIXBLOCK_SIZE_TINY && bufy->data.px == NULL)) { // no memory
return 0;
}
@@ -474,7 +474,7 @@ int FilterGaussian::render(FilterSlot &slot, Matrix const &trans_)
NRPixBlock *out = new NRPixBlock;
nr_pixblock_setup_fast(out, in->mode, in->area.x0, in->area.y0,
in->area.x1, in->area.y1, true);
- if (out->data.px == NULL) {
+ if (out->size != NR_PIXBLOCK_SIZE_TINY && out->data.px == NULL) {
// alas, we've accomplished a lot, but ran out of memory - so abort
return 0;
}
diff --git a/src/display/nr-filter.cpp b/src/display/nr-filter.cpp
index f00a1ef6b..a720050c9 100644
--- a/src/display/nr-filter.cpp
+++ b/src/display/nr-filter.cpp
@@ -161,7 +161,7 @@ int Filter::render(NRArenaItem const *item, NRPixBlock *pb)
nr_pixblock_setup_fast(in, pb->mode,
min_x, min_y,
max_x, max_y, true);
- if (in->data.px == NULL) // memory allocation failed
+ if (in->size != NR_PIXBLOCK_SIZE_TINY && in->data.px == NULL) // memory allocation failed
return 0;
transform_nearest(in, pb, itrans);
} else if (_x_pixels >= 0) {
@@ -191,7 +191,7 @@ int Filter::render(NRArenaItem const *item, NRPixBlock *pb)
}
if (y_len < 1) y_len = 1;
nr_pixblock_setup_fast(in, pb->mode, 0, 0, x_len, y_len, true);
- if (in->data.px == NULL) // memory allocation failed
+ if (in->size != NR_PIXBLOCK_SIZE_TINY && in->data.px == NULL) // memory allocation failed
return 0;
scale_bicubic(in, pb);
scale res_scaling(x_len / (double)(pb->area.x1 - pb->area.x0),
@@ -202,7 +202,7 @@ int Filter::render(NRArenaItem const *item, NRPixBlock *pb)
nr_pixblock_setup_fast(in, pb->mode,
pb->area.x0, pb->area.y0,
pb->area.x1, pb->area.y1, true);
- if (in->data.px == NULL) // memory allocation failed
+ if (in->size != NR_PIXBLOCK_SIZE_TINY && in->data.px == NULL) // memory allocation failed
return 0;
nr_blit_pixblock_pixblock(in, pb);
}