summaryrefslogtreecommitdiffstats
path: root/src/display
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2010-07-04 00:56:02 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2010-07-04 00:56:02 +0000
commite83b5a202a9e028e3407123cddafa06510756b66 (patch)
treea88567777b48211e823b92d397a7b104925026aa /src/display
parentFix PNG export (diff)
downloadinkscape-e83b5a202a9e028e3407123cddafa06510756b66.tar.gz
inkscape-e83b5a202a9e028e3407123cddafa06510756b66.zip
Remove some cruft
(bzr r9508.1.10)
Diffstat (limited to 'src/display')
-rw-r--r--src/display/canvas-arena.cpp12
-rw-r--r--src/display/nr-arena-glyphs.cpp6
-rw-r--r--src/display/nr-arena-image.cpp4
-rw-r--r--src/display/nr-arena-item.cpp1
-rw-r--r--src/display/nr-arena-item.h45
-rw-r--r--src/display/nr-arena-shape.cpp7
-rw-r--r--src/display/nr-arena-shape.h2
-rw-r--r--src/display/sp-canvas-util.cpp4
-rw-r--r--src/display/sp-canvas.cpp11
9 files changed, 30 insertions, 62 deletions
diff --git a/src/display/canvas-arena.cpp b/src/display/canvas-arena.cpp
index 086c0a27d..db8e1757c 100644
--- a/src/display/canvas-arena.cpp
+++ b/src/display/canvas-arena.cpp
@@ -203,7 +203,6 @@ sp_canvas_arena_render (SPCanvasItem *item, SPCanvasBuf *buf)
if ((bw < 1) || (bh < 1)) return;
NRRectL area;
- NRPixBlock cb;
area.x0 = buf->rect.x0;
area.y0 = buf->rect.y0;
@@ -212,16 +211,7 @@ sp_canvas_arena_render (SPCanvasItem *item, SPCanvasBuf *buf)
sp_canvas_prepare_buffer(buf);
- nr_pixblock_setup_extern (&cb, NR_PIXBLOCK_MODE_R8G8B8A8P, area.x0, area.y0, area.x1, area.y1,
- buf->buf,
- buf->buf_rowstride,
- FALSE, FALSE);
-
- cb.visible_area = buf->visible_rect;
-
- nr_arena_item_invoke_render (buf->ct, arena->root, &area, &cb, 0);
-
- nr_pixblock_release (&cb);
+ nr_arena_item_invoke_render (buf->ct, arena->root, &area, NULL, 0);
}
static double
diff --git a/src/display/nr-arena-glyphs.cpp b/src/display/nr-arena-glyphs.cpp
index 84aa1c231..ad3006950 100644
--- a/src/display/nr-arena-glyphs.cpp
+++ b/src/display/nr-arena-glyphs.cpp
@@ -304,6 +304,9 @@ nr_arena_glyphs_group_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPi
cairo_set_source_rgba(ct, SP_RGBA32_B_F(rgba), SP_RGBA32_G_F(rgba), SP_RGBA32_R_F(rgba), SP_RGBA32_A_F(rgba));
cairo_set_tolerance(ct, 1.25); // low quality, but good enough for outline mode
+ NRRect temp(area->x0, area->y0, area->x1, area->y1);
+ Geom::OptRect area_2geom = temp.upgrade_2geom();
+
for (child = group->children; child != NULL; child = child->next) {
NRArenaGlyphs *g = NR_ARENA_GLYPHS(child);
@@ -311,9 +314,8 @@ nr_arena_glyphs_group_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPi
cairo_new_path(ct);
Geom::Matrix transform = g->g_transform * group->ctm;
- feed_pathvector_to_cairo (ct, *pathv, transform, to_2geom((pb->area).upgrade()), false, 0);
+ feed_pathvector_to_cairo (ct, *pathv, transform, area_2geom, false, 0);
cairo_fill(ct);
- pb->empty = FALSE;
}
return item->state;
diff --git a/src/display/nr-arena-image.cpp b/src/display/nr-arena-image.cpp
index ec0a2ab02..9f883a77c 100644
--- a/src/display/nr-arena-image.cpp
+++ b/src/display/nr-arena-image.cpp
@@ -210,7 +210,7 @@ nr_arena_image_render( cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPixBlock
cairo_set_line_width(ct, 0.5);
cairo_new_path(ct);
- Geom::Point shift(pb->area.x0, pb->area.y0);
+ Geom::Point shift(area->x0, area->y0);
Geom::Point c00 = image->c00 - shift;
Geom::Point c01 = image->c01 - shift;
Geom::Point c11 = image->c11 - shift;
@@ -229,8 +229,6 @@ nr_arena_image_render( cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPixBlock
cairo_line_to (ct, c01[Geom::X], c01[Geom::Y]);
cairo_stroke(ct);
-
- pb->empty = FALSE;
}
return item->state;
}
diff --git a/src/display/nr-arena-item.cpp b/src/display/nr-arena-item.cpp
index ca9528f16..08fbe1f1c 100644
--- a/src/display/nr-arena-item.cpp
+++ b/src/display/nr-arena-item.cpp
@@ -85,6 +85,7 @@ nr_arena_item_init (NRArenaItem *item)
memset (&item->bbox, 0, sizeof (item->bbox));
memset (&item->drawbox, 0, sizeof (item->drawbox));
item->transform = NULL;
+ item->ctm.setIdentity();
item->opacity = 255;
item->render_opacity = FALSE;
diff --git a/src/display/nr-arena-item.h b/src/display/nr-arena-item.h
index 035013cd8..468d352bc 100644
--- a/src/display/nr-arena-item.h
+++ b/src/display/nr-arena-item.h
@@ -84,35 +84,22 @@ struct NRArenaItem : public NRObject {
/* Opacity itself */
unsigned int opacity : 8;
- /* Key for secondary rendering */
- unsigned int key;
-
- /* BBox in grid coordinates */
- NRRectL bbox;
- /* Redraw area in grid coordinates = bbox filter-enlarged and clipped/masked */
- NRRectL drawbox;
- /* BBox in item coordinates - this should be a bounding box as
- * specified in SVG standard. Required by filters. */
- Geom::OptRect item_bbox;
- /* Our affine */
- Geom::Matrix *transform;
- /* Clip item */
- NRArenaItem *clip;
- /* Mask item */
- NRArenaItem *mask;
- /* Filter to be applied after rendering this object, NULL if none */
- Inkscape::Filters::Filter *filter;
- /* Rendered buffer */
- unsigned char *px;
-
- /* Single data member */
- void *data;
-
- /* Current Transformation Matrix */
- Geom::Matrix ctm;
-
- /* These hold background buffer state for filter rendering */
- NRPixBlock *background_pb;
+ unsigned int key; ///< Some SPItems can have more than one NRArenaItem,
+ ///this value is a hack used to distinguish between them
+
+ NRRectL bbox; ///< Bounding box in pixel grid coordinates; (0,0) is at page origin
+ NRRectL drawbox; ///< Bounding box enlarged by filters, shrinked by clips and masks
+ Geom::OptRect item_bbox; ///< Bounding box in item coordinates, required by filters
+ Geom::Matrix *transform; ///< Incremental transform of this item, as given by the transform= attribute
+ Geom::Matrix ctm; ///< Total transform from pixel grid to item coords
+ NRArenaItem *clip; ///< Clipping path
+ NRArenaItem *mask; ///< Mask
+ Inkscape::Filters::Filter *filter; ///< Filter
+ unsigned char *px; ///< Render cache; unused
+
+ void *data; ///< Anonymous data member - this is used to associate SPItems with arena items
+
+ NRPixBlock *background_pb; ///< Background for filters; unused
bool background_new;
void init(NRArena *arena) {
diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp
index de9a0c0fd..3f673c944 100644
--- a/src/display/nr-arena-shape.cpp
+++ b/src/display/nr-arena-shape.cpp
@@ -104,7 +104,6 @@ nr_arena_shape_init(NRArenaShape *shape)
shape->style = NULL;
shape->paintbox.x0 = shape->paintbox.y0 = 0.0F;
shape->paintbox.x1 = shape->paintbox.y1 = 256.0F;
- shape->ctm.setIdentity();
shape->delayed_shp = false;
shape->path = NULL;
@@ -223,7 +222,6 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g
if (!(state & NR_ARENA_ITEM_STATE_RENDER)) {
/* We do not have to create rendering structures */
- shape->ctm = gc->transform;
if (state & NR_ARENA_ITEM_STATE_BBOX) {
if (shape->curve) {
boundingbox = bounds_exact_transformed(shape->curve->get_pathvector(), gc->transform);
@@ -246,7 +244,6 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g
}
shape->delayed_shp=true;
- shape->ctm = gc->transform;
boundingbox = Geom::OptRect();
bool outline = (NR_ARENA_ITEM(shape)->arena->rendermode == Inkscape::RENDERMODE_OUTLINE);
@@ -358,8 +355,8 @@ nr_arena_shape_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPixBlock
if (outline) { // cairo outline rendering
- pb->empty = FALSE;
- unsigned int ret = cairo_arena_shape_render_outline (ct, item, to_2geom((&pb->area)->upgrade()));
+ NRRect temp(area->x0, area->y0, area->x1, area->y1);
+ unsigned int ret = cairo_arena_shape_render_outline (ct, item, temp.upgrade_2geom());
if (ret & NR_ARENA_ITEM_STATE_INVALID) return ret;
} else {
diff --git a/src/display/nr-arena-shape.h b/src/display/nr-arena-shape.h
index 66c8bc344..2e917bb46 100644
--- a/src/display/nr-arena-shape.h
+++ b/src/display/nr-arena-shape.h
@@ -31,8 +31,6 @@ struct NRArenaShape : public NRArenaItem {
SPStyle *style;
NRStyle nrstyle;
NRRect paintbox;
- /* State data */
- Geom::Matrix ctm;
cairo_path_t *path;
diff --git a/src/display/sp-canvas-util.cpp b/src/display/sp-canvas-util.cpp
index 970fea0e5..83604a1bf 100644
--- a/src/display/sp-canvas-util.cpp
+++ b/src/display/sp-canvas-util.cpp
@@ -42,13 +42,13 @@ sp_canvas_item_reset_bounds (SPCanvasItem *item)
void
sp_canvas_prepare_buffer (SPCanvasBuf *buf)
{
- if (buf->is_empty) {
+ /*if (buf->is_empty) {
int y;
for (y = buf->rect.y0; y < buf->rect.y1; y++) {
memset (buf->buf + (y - buf->rect.y0) * buf->buf_rowstride, 0, 4 * (buf->rect.x1 - buf->rect.x0));
}
buf->is_empty = false;
- }
+ }*/
}
Geom::Matrix sp_canvas_item_i2p_affine (SPCanvasItem * item)
diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp
index 571b573e1..4c74af6d9 100644
--- a/src/display/sp-canvas.cpp
+++ b/src/display/sp-canvas.cpp
@@ -1630,17 +1630,12 @@ sp_canvas_paint_single_buffer (SPCanvas *canvas, int x0, int y0, int x1, int y1,
{
GtkWidget *widget = GTK_WIDGET (canvas);
- SPCanvasBuf buf;
- if (canvas->rendermode != Inkscape::RENDERMODE_OUTLINE) {
- buf.buf = nr_pixelstore_256K_new (FALSE, 0);
- } else {
- buf.buf = nr_pixelstore_1M_new (FALSE, 0);
- }
-
// Mark the region clean
sp_canvas_mark_rect(canvas, x0, y0, x1, y1, 0);
- buf.buf_rowstride = sw * 4;
+ SPCanvasBuf buf;
+ buf.buf = NULL;
+ buf.buf_rowstride = 0;
buf.rect.x0 = x0;
buf.rect.y0 = y0;
buf.rect.x1 = x1;