diff options
| author | Jasper van de Gronde <jasper.vandegronde@gmail.com> | 2008-03-21 19:53:10 +0000 |
|---|---|---|
| committer | jaspervdg <jaspervdg@users.sourceforge.net> | 2008-03-21 19:53:10 +0000 |
| commit | 40a243a7a5e67d4f09a82bfbee5babe40ec924b7 (patch) | |
| tree | 5f43830b59a1c448f880a39cd2d23b8cc1058d97 /src/display | |
| parent | Start working toward multiple inheritance (diff) | |
| download | inkscape-40a243a7a5e67d4f09a82bfbee5babe40ec924b7.tar.gz inkscape-40a243a7a5e67d4f09a82bfbee5babe40ec924b7.zip | |
No more NRMatrix or NRPoint.
(bzr r5149)
Diffstat (limited to 'src/display')
| -rw-r--r-- | src/display/nr-arena-glyphs.cpp | 38 | ||||
| -rw-r--r-- | src/display/nr-arena-glyphs.h | 8 | ||||
| -rw-r--r-- | src/display/nr-arena-group.cpp | 12 | ||||
| -rw-r--r-- | src/display/nr-arena-group.h | 4 | ||||
| -rw-r--r-- | src/display/nr-arena-image.cpp | 18 | ||||
| -rw-r--r-- | src/display/nr-arena-item.cpp | 19 | ||||
| -rw-r--r-- | src/display/nr-arena-item.h | 6 | ||||
| -rw-r--r-- | src/display/nr-arena-shape.cpp | 20 | ||||
| -rw-r--r-- | src/display/nr-filter-displacement-map.cpp | 5 | ||||
| -rw-r--r-- | src/display/nr-filter-gaussian.cpp | 9 | ||||
| -rw-r--r-- | src/display/nr-filter-image.cpp | 5 | ||||
| -rw-r--r-- | src/display/nr-filter-units.cpp | 5 | ||||
| -rw-r--r-- | src/display/nr-filter.cpp | 2 | ||||
| -rw-r--r-- | src/display/sp-ctrlline.cpp | 16 | ||||
| -rw-r--r-- | src/display/sp-ctrlline.h | 2 |
15 files changed, 88 insertions, 81 deletions
diff --git a/src/display/nr-arena-glyphs.cpp b/src/display/nr-arena-glyphs.cpp index ca4e781a9..9456e8a7e 100644 --- a/src/display/nr-arena-glyphs.cpp +++ b/src/display/nr-arena-glyphs.cpp @@ -85,7 +85,7 @@ static void nr_arena_glyphs_init(NRArenaGlyphs *glyphs) { glyphs->style = NULL; - nr_matrix_set_identity(&glyphs->g_transform); + glyphs->g_transform.set_identity(); glyphs->font = NULL; glyphs->glyph = 0; @@ -138,15 +138,15 @@ nr_arena_glyphs_update(NRArenaItem *item, NRRectL */*area*/, NRGC *gc, guint /*s bbox.x0 = bbox.y0 = NR_HUGE; bbox.x1 = bbox.y1 = -NR_HUGE; - float const scale = NR_MATRIX_DF_EXPANSION(&gc->transform); + float const scale = NR::expansion(gc->transform); if (!glyphs->style->fill.isNone()) { - NRMatrix t; - nr_matrix_multiply(&t, &glyphs->g_transform, &gc->transform); - glyphs->x = t.c[4]; - glyphs->y = t.c[5]; - t.c[4]=0; - t.c[5]=0; + NR::Matrix t; + t = glyphs->g_transform * gc->transform; + glyphs->x = t[4]; + glyphs->y = t[5]; + t[4]=0; + t[5]=0; rfont = glyphs->font->RasterFont(t, 0); if (glyphs->rfont) glyphs->rfont->Unref(); glyphs->rfont = rfont; @@ -163,12 +163,12 @@ nr_arena_glyphs_update(NRArenaItem *item, NRRectL */*area*/, NRGC *gc, guint /*s if (!glyphs->style->stroke.isNone()) { /* Build state data */ - NRMatrix t; - nr_matrix_multiply(&t, &glyphs->g_transform, &gc->transform); - glyphs->x = t.c[4]; - glyphs->y = t.c[5]; - t.c[4]=0; - t.c[5]=0; + NR::Matrix t; + t = glyphs->g_transform * gc->transform; + glyphs->x = t[4]; + glyphs->y = t[5]; + t[4]=0; + t[5]=0; if ( fabs(glyphs->style->stroke_width.computed * scale) > 0.01 ) { // sinon c'est 0=oon veut pas de bord font_style nstyl; @@ -251,7 +251,7 @@ nr_arena_glyphs_pick(NRArenaItem *item, NR::Point p, gdouble /*delta*/, unsigned } void -nr_arena_glyphs_set_path(NRArenaGlyphs *glyphs, SPCurve */*curve*/, unsigned int /*lieutenant*/, font_instance *font, gint glyph, NRMatrix const *transform) +nr_arena_glyphs_set_path(NRArenaGlyphs *glyphs, SPCurve */*curve*/, unsigned int /*lieutenant*/, font_instance *font, gint glyph, NR::Matrix const *transform) { nr_return_if_fail(glyphs != NULL); nr_return_if_fail(NR_IS_ARENA_GLYPHS(glyphs)); @@ -261,7 +261,7 @@ nr_arena_glyphs_set_path(NRArenaGlyphs *glyphs, SPCurve */*curve*/, unsigned int if (transform) { glyphs->g_transform = *transform; } else { - nr_matrix_set_identity(&glyphs->g_transform); + glyphs->g_transform.set_identity(); } if (font) font->Ref(); @@ -410,14 +410,14 @@ nr_arena_glyphs_group_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint s item->render_opacity = TRUE; if (group->style->fill.isPaintserver()) { group->fill_painter = sp_paint_server_painter_new(SP_STYLE_FILL_SERVER(group->style), - NR::Matrix(&gc->transform), NR::Matrix(&gc->parent->transform), + gc->transform, gc->parent->transform, &group->paintbox); item->render_opacity = FALSE; } if (group->style->stroke.isPaintserver()) { group->stroke_painter = sp_paint_server_painter_new(SP_STYLE_STROKE_SERVER(group->style), - NR::Matrix(&gc->transform), NR::Matrix(&gc->parent->transform), + gc->transform, gc->parent->transform, &group->paintbox); item->render_opacity = FALSE; } @@ -603,7 +603,7 @@ nr_arena_glyphs_group_clear(NRArenaGlyphsGroup *sg) } void -nr_arena_glyphs_group_add_component(NRArenaGlyphsGroup *sg, font_instance *font, int glyph, NRMatrix const *transform) +nr_arena_glyphs_group_add_component(NRArenaGlyphsGroup *sg, font_instance *font, int glyph, NR::Matrix const *transform) { NRArenaGroup *group; NRBPath bpath; diff --git a/src/display/nr-arena-glyphs.h b/src/display/nr-arena-glyphs.h index a2dda988b..0c0121160 100644 --- a/src/display/nr-arena-glyphs.h +++ b/src/display/nr-arena-glyphs.h @@ -33,7 +33,7 @@ NRType nr_arena_glyphs_get_type (void); struct NRArenaGlyphs : public NRArenaItem { /* Glyphs data */ SPStyle *style; - NRMatrix g_transform; + NR::Matrix g_transform; font_instance *font; gint glyph; @@ -41,7 +41,7 @@ struct NRArenaGlyphs : public NRArenaItem { raster_font *sfont; float x, y; -// NRMatrix cached_tr; +// NR::Matrix cached_tr; // Shape *cached_shp; // bool cached_shp_dirty; // bool cached_style_dirty; @@ -62,7 +62,7 @@ struct NRArenaGlyphsClass { void nr_arena_glyphs_set_path (NRArenaGlyphs *glyphs, SPCurve *curve, unsigned int lieutenant, font_instance *font, int glyph, - const NRMatrix *transform); + const NR::Matrix *transform); void nr_arena_glyphs_set_style (NRArenaGlyphs *glyphs, SPStyle *style); /* Integrated group of component glyphss */ @@ -100,7 +100,7 @@ struct NRArenaGlyphsGroupClass { void nr_arena_glyphs_group_clear (NRArenaGlyphsGroup *group); -void nr_arena_glyphs_group_add_component (NRArenaGlyphsGroup *group, font_instance *font, int glyph, const NRMatrix *transform); +void nr_arena_glyphs_group_add_component (NRArenaGlyphsGroup *group, font_instance *font, int glyph, const NR::Matrix *transform); void nr_arena_glyphs_group_set_style (NRArenaGlyphsGroup *group, SPStyle *style); diff --git a/src/display/nr-arena-group.cpp b/src/display/nr-arena-group.cpp index fcce681a8..51f1c6b2f 100644 --- a/src/display/nr-arena-group.cpp +++ b/src/display/nr-arena-group.cpp @@ -22,6 +22,8 @@ #include "sp-gaussian-blur.h" #include "sp-feblend.h" #include "display/nr-filter-blend.h" +#include "libnr/nr-matrix-fns.h" +#include "libnr/nr-matrix-ops.h" static void nr_arena_group_class_init (NRArenaGroupClass *klass); static void nr_arena_group_init (NRArenaGroup *group); @@ -85,7 +87,7 @@ nr_arena_group_init (NRArenaGroup *group) group->children = NULL; group->last = NULL; group->style = NULL; - nr_matrix_set_identity (&group->child_transform); + group->child_transform.set_identity(); } static NRArenaItem * @@ -171,7 +173,7 @@ nr_arena_group_update (NRArenaItem *item, NRRectL *area, NRGC *gc, unsigned int for (NRArenaItem *child = group->children; child != NULL; child = child->next) { NRGC cgc(gc); - nr_matrix_multiply (&cgc.transform, &group->child_transform, &gc->transform); + cgc.transform = group->child_transform * gc->transform; newstate = nr_arena_item_invoke_update (child, area, &cgc, state, reset); beststate = beststate & newstate; } @@ -271,15 +273,15 @@ nr_arena_group_set_transparent (NRArenaGroup *group, unsigned int transparent) void nr_arena_group_set_child_transform(NRArenaGroup *group, NR::Matrix const &t) { - NRMatrix nt(t); + NR::Matrix nt(t); nr_arena_group_set_child_transform(group, &nt); } -void nr_arena_group_set_child_transform(NRArenaGroup *group, NRMatrix const *t) +void nr_arena_group_set_child_transform(NRArenaGroup *group, NR::Matrix const *t) { if (!t) t = &NR_MATRIX_IDENTITY; - if (!NR_MATRIX_DF_TEST_CLOSE (t, &group->child_transform, NR_EPSILON)) { + if (!NR::matrix_equalp(*t, group->child_transform, NR_EPSILON)) { nr_arena_item_request_render (NR_ARENA_ITEM (group)); group->child_transform = *t; nr_arena_item_request_update (NR_ARENA_ITEM (group), NR_ARENA_ITEM_STATE_ALL, TRUE); diff --git a/src/display/nr-arena-group.h b/src/display/nr-arena-group.h index 1b699fd04..ff3ec02dd 100644 --- a/src/display/nr-arena-group.h +++ b/src/display/nr-arena-group.h @@ -26,7 +26,7 @@ struct NRArenaGroup : public NRArenaItem{ unsigned int transparent : 1; NRArenaItem *children; NRArenaItem *last; - NRMatrix child_transform; + NR::Matrix child_transform; SPStyle *style; static NRArenaGroup *create(NRArena *arena) { @@ -43,7 +43,7 @@ struct NRArenaGroupClass { void nr_arena_group_set_transparent(NRArenaGroup *group, unsigned int transparent); void nr_arena_group_set_child_transform(NRArenaGroup *group, NR::Matrix const &t); -void nr_arena_group_set_child_transform(NRArenaGroup *group, NRMatrix const *t); +void nr_arena_group_set_child_transform(NRArenaGroup *group, NR::Matrix const *t); void nr_arena_group_set_style(NRArenaGroup *group, SPStyle *style); #endif diff --git a/src/display/nr-arena-image.cpp b/src/display/nr-arena-image.cpp index c0c53f0ee..a2050f75c 100644 --- a/src/display/nr-arena-image.cpp +++ b/src/display/nr-arena-image.cpp @@ -93,7 +93,7 @@ nr_arena_image_init (NRArenaImage *image) image->width = 256.0; image->height = 256.0; - nr_matrix_set_identity (&image->grid2px); + image->grid2px.set_identity(); image->style = 0; } @@ -111,7 +111,7 @@ nr_arena_image_finalize (NRObject *object) static unsigned int nr_arena_image_update( NRArenaItem *item, NRRectL */*area*/, NRGC *gc, unsigned int /*state*/, unsigned int /*reset*/ ) { - NRMatrix grid2px; + NR::Matrix grid2px; NRArenaImage *image = NR_ARENA_IMAGE (item); @@ -119,7 +119,7 @@ nr_arena_image_update( NRArenaItem *item, NRRectL */*area*/, NRGC *gc, unsigned nr_arena_item_request_render (item); /* Copy affine */ - nr_matrix_invert (&grid2px, &gc->transform); + grid2px = gc->transform.inverse(); double hscale, vscale; // todo: replace with NR::scale if (image->px) { hscale = image->pxw / image->width; @@ -129,12 +129,12 @@ nr_arena_image_update( NRArenaItem *item, NRRectL */*area*/, NRGC *gc, unsigned vscale = 1.0; } - image->grid2px[0] = grid2px.c[0] * hscale; - image->grid2px[2] = grid2px.c[2] * hscale; - image->grid2px[4] = grid2px.c[4] * hscale; - image->grid2px[1] = grid2px.c[1] * vscale; - image->grid2px[3] = grid2px.c[3] * vscale; - image->grid2px[5] = grid2px.c[5] * vscale; + image->grid2px[0] = grid2px[0] * hscale; + image->grid2px[2] = grid2px[2] * hscale; + image->grid2px[4] = grid2px[4] * hscale; + image->grid2px[1] = grid2px[1] * vscale; + image->grid2px[3] = grid2px[3] * vscale; + image->grid2px[5] = grid2px[5] * vscale; image->grid2px[4] -= image->x * hscale; image->grid2px[5] -= image->y * vscale; diff --git a/src/display/nr-arena-item.cpp b/src/display/nr-arena-item.cpp index 95b0c0eae..f04146f20 100644 --- a/src/display/nr-arena-item.cpp +++ b/src/display/nr-arena-item.cpp @@ -20,6 +20,8 @@ #include <libnr/nr-blit.h> #include <libnr/nr-pixops.h> +#include <libnr/nr-matrix-ops.h> +#include <libnr/nr-matrix-fns.h> #include "nr-arena.h" #include "nr-arena-item.h" #include "gc-core.h" @@ -245,8 +247,7 @@ nr_arena_item_invoke_update (NRArenaItem *item, NRRectL *area, NRGC *gc, /* Set up local gc */ childgc = *gc; if (item->transform) { - nr_matrix_multiply (&childgc.transform, item->transform, - &childgc.transform); + childgc.transform = (*item->transform) * childgc.transform; } /* Remember the transformation matrix */ item->ctm = childgc.transform; @@ -710,12 +711,12 @@ nr_arena_item_append_child (NRArenaItem *parent, NRArenaItem *child) void nr_arena_item_set_transform (NRArenaItem *item, NR::Matrix const &transform) { - NRMatrix const t (transform); + NR::Matrix const t (transform); nr_arena_item_set_transform (item, &t); } void -nr_arena_item_set_transform (NRArenaItem *item, NRMatrix const *transform) +nr_arena_item_set_transform (NRArenaItem *item, NR::Matrix const *transform) { nr_return_if_fail (item != NULL); nr_return_if_fail (NR_IS_ARENA_ITEM (item)); @@ -723,17 +724,17 @@ nr_arena_item_set_transform (NRArenaItem *item, NRMatrix const *transform) if (!transform && !item->transform) return; - const NRMatrix *md = (item->transform) ? item->transform : &NR_MATRIX_IDENTITY; - const NRMatrix *ms = (transform) ? transform : &NR_MATRIX_IDENTITY; + const NR::Matrix *md = (item->transform) ? item->transform : &NR_MATRIX_IDENTITY; + const NR::Matrix *ms = (transform) ? transform : &NR_MATRIX_IDENTITY; - if (!NR_MATRIX_DF_TEST_CLOSE (md, ms, NR_EPSILON)) { + if (!NR::matrix_equalp(*md, *ms, NR_EPSILON)) { nr_arena_item_request_render (item); - if (!transform || nr_matrix_test_identity (transform, NR_EPSILON)) { + if (!transform || transform->test_identity()) { /* Set to identity affine */ item->transform = NULL; } else { if (!item->transform) - item->transform = new (GC::ATOMIC) NRMatrix (); + item->transform = new (GC::ATOMIC) NR::Matrix (); *item->transform = *transform; } nr_arena_item_request_update (item, NR_ARENA_ITEM_STATE_ALL, TRUE); diff --git a/src/display/nr-arena-item.h b/src/display/nr-arena-item.h index 6ca1564a1..c62c9a6ca 100644 --- a/src/display/nr-arena-item.h +++ b/src/display/nr-arena-item.h @@ -64,7 +64,7 @@ struct NRGC { NRGC(NRGC const *p) : parent(p) {} NRGC const *parent; - NRMatrix transform; + NR::Matrix transform; }; struct NRArenaItem : public NRObject { @@ -93,7 +93,7 @@ struct NRArenaItem : public NRObject { * specified in SVG standard. Required by filters. */ NR::Maybe<NR::Rect> item_bbox; /* Our affine */ - NRMatrix *transform; + NR::Matrix *transform; /* Clip item */ NRArenaItem *clip; /* Mask item */ @@ -170,7 +170,7 @@ NRArenaItem *nr_arena_item_unparent (NRArenaItem *item); void nr_arena_item_append_child (NRArenaItem *parent, NRArenaItem *child); void nr_arena_item_set_transform(NRArenaItem *item, NR::Matrix const &transform); -void nr_arena_item_set_transform(NRArenaItem *item, NRMatrix const *transform); +void nr_arena_item_set_transform(NRArenaItem *item, NR::Matrix const *transform); void nr_arena_item_set_opacity (NRArenaItem *item, double opacity); void nr_arena_item_set_sensitive (NRArenaItem *item, unsigned int sensitive); void nr_arena_item_set_visible (NRArenaItem *item, unsigned int visible); diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp index 9150b419f..8e53e7262 100644 --- a/src/display/nr-arena-shape.cpp +++ b/src/display/nr-arena-shape.cpp @@ -106,7 +106,7 @@ nr_arena_shape_init(NRArenaShape *shape) shape->paintbox.x0 = shape->paintbox.y0 = 0.0F; shape->paintbox.x1 = shape->paintbox.y1 = 256.0F; - nr_matrix_set_identity(&shape->ctm); + shape->ctm.set_identity(); shape->fill_painter = NULL; shape->stroke_painter = NULL; shape->cached_fill = NULL; @@ -120,8 +120,8 @@ nr_arena_shape_init(NRArenaShape *shape) shape->approx_bbox.x0 = shape->approx_bbox.y0 = 0; shape->approx_bbox.x1 = shape->approx_bbox.y1 = 0; - nr_matrix_set_identity(&shape->cached_fctm); - nr_matrix_set_identity(&shape->cached_sctm); + shape->cached_fctm.set_identity(); + shape->cached_sctm.set_identity(); shape->markers = NULL; @@ -284,7 +284,7 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g nr_path_matrix_bbox_union(&bp, gc->transform, &bbox); if (shape->_stroke.paint.type() != NRArenaShape::Paint::NONE || outline) { float width, scale; - scale = NR_MATRIX_DF_EXPANSION(&gc->transform); + scale = NR::expansion(gc->transform); width = MAX(0.125, shape->_stroke.width * scale); if ( fabs(shape->_stroke.width * scale) > 0.01 ) { // sinon c'est 0=oon veut pas de bord bbox.x0-=width; @@ -311,7 +311,7 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g if ( area && nr_rect_l_test_intersect(area, &shape->approx_bbox) ) shape->delayed_shp=false; /* Release state data */ - if (TRUE || !nr_matrix_test_transform_equal(&gc->transform, &shape->ctm, NR_EPSILON)) { + if (TRUE || !NR::transform_equalp(gc->transform, shape->ctm, NR_EPSILON)) { /* Concept test */ if (shape->fill_shp) { delete shape->fill_shp; @@ -369,7 +369,7 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g if ( shape->_fill.paint.type() == NRArenaShape::Paint::SERVER ) { if (gc && gc->parent) { shape->fill_painter = sp_paint_server_painter_new(shape->_fill.paint.server(), - NR::Matrix(&gc->transform), NR::Matrix(&gc->parent->transform), + gc->transform, gc->parent->transform, &shape->paintbox); } item->render_opacity = FALSE; @@ -377,7 +377,7 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g if ( shape->_stroke.paint.type() == NRArenaShape::Paint::SERVER ) { if (gc && gc->parent) { shape->stroke_painter = sp_paint_server_painter_new(shape->_stroke.paint.server(), - NR::Matrix(&gc->transform), NR::Matrix(&gc->parent->transform), + gc->transform, gc->parent->transform, &shape->paintbox); } item->render_opacity = FALSE; @@ -519,7 +519,7 @@ nr_arena_shape_update_stroke(NRArenaShape *shape,NRGC* gc, NRRectL *area) { SPStyle* style = shape->style; - float const scale = NR_MATRIX_DF_EXPANSION(&gc->transform); + float const scale = NR::expansion(gc->transform); bool outline = (NR_ARENA_ITEM(shape)->arena->rendermode == RENDERMODE_OUTLINE); @@ -763,7 +763,7 @@ cairo_arena_shape_render_stroke(NRArenaItem *item, NRRectL *area, NRPixBlock *pb NRArenaShape *shape = NR_ARENA_SHAPE(item); SPStyle const *style = shape->style; - float const scale = NR_MATRIX_DF_EXPANSION(shape->ctm); + float const scale = NR::expansion(shape->ctm); if (fabs(shape->_stroke.width * scale) < 0.01) return; @@ -1095,7 +1095,7 @@ nr_arena_shape_pick(NRArenaItem *item, NR::Point p, double delta, unsigned int / if (outline) { width = 0.5; } else if (shape->_stroke.paint.type() != NRArenaShape::Paint::NONE && shape->_stroke.opacity > 1e-3) { - float const scale = NR_MATRIX_DF_EXPANSION(&shape->ctm); + float const scale = NR::expansion(shape->ctm); width = MAX(0.125, shape->_stroke.width * scale) / 2; } else { width = 0; diff --git a/src/display/nr-filter-displacement-map.cpp b/src/display/nr-filter-displacement-map.cpp index ecf0e8def..886ee118e 100644 --- a/src/display/nr-filter-displacement-map.cpp +++ b/src/display/nr-filter-displacement-map.cpp @@ -13,6 +13,7 @@ #include "display/nr-filter-types.h" #include "display/nr-filter-units.h" #include "libnr/nr-blit.h" +#include "libnr/nr-matrix-fns.h" #include "libnr/nr-pixops.h" namespace NR { @@ -77,8 +78,8 @@ int FilterDisplacementMap::render(FilterSlot &slot, FilterUnits const &units) { double coordx, coordy; Matrix trans = units.get_matrix_primitiveunits2pb(); - double scalex = scale*trans.expansionX(); - double scaley = scale*trans.expansionY(); + double scalex = scale*NR::expansionX(trans); + double scaley = scale*NR::expansionY(trans); for (x=0; x < out_w; x++){ for (y=0; y < out_h; y++){ diff --git a/src/display/nr-filter-gaussian.cpp b/src/display/nr-filter-gaussian.cpp index b4d1fb00d..5ef430394 100644 --- a/src/display/nr-filter-gaussian.cpp +++ b/src/display/nr-filter-gaussian.cpp @@ -28,6 +28,7 @@ #include "display/nr-filter-units.h" #include "libnr/nr-pixblock.h" #include "libnr/nr-matrix.h" +#include "libnr/nr-matrix-fns.h" #include "util/fixed_point.h" #include "prefs-utils.h" @@ -539,8 +540,8 @@ int FilterGaussian::render(FilterSlot &slot, FilterUnits const &units) // Some common constants int const width_org = in->area.x1-in->area.x0, height_org = in->area.y1-in->area.y0; - double const deviation_x_org = _deviation_x * trans.expansionX(); - double const deviation_y_org = _deviation_y * trans.expansionY(); + double const deviation_x_org = _deviation_x * NR::expansionX(trans); + double const deviation_y_org = _deviation_y * NR::expansionY(trans); int const PC = NR_PIXBLOCK_BPP(in); // Subsampling constants @@ -774,8 +775,8 @@ int FilterGaussian::render(FilterSlot &slot, FilterUnits const &units) void FilterGaussian::area_enlarge(NRRectL &area, Matrix const &trans) { - int area_x = _effect_area_scr(_deviation_x * trans.expansionX()); - int area_y = _effect_area_scr(_deviation_y * trans.expansionY()); + int area_x = _effect_area_scr(_deviation_x * NR::expansionX(trans)); + int area_y = _effect_area_scr(_deviation_y * NR::expansionY(trans)); // maximum is used because rotations can mix up these directions // TODO: calculate a more tight-fitting rendering area int area_max = std::max(area_x, area_y); diff --git a/src/display/nr-filter-image.cpp b/src/display/nr-filter-image.cpp index 42b78fa16..1eeb3e8c6 100644 --- a/src/display/nr-filter-image.cpp +++ b/src/display/nr-filter-image.cpp @@ -80,10 +80,9 @@ int FilterImage::render(FilterSlot &slot, FilterUnits const &units) { NRGC gc(NULL); /* Update to renderable state */ double sf = 1.0; - NRMatrix t; - nr_matrix_set_scale(&t, sf, sf); + NR::Matrix t(NR::scale(sf, sf)); nr_arena_item_set_transform(ai, &t); - nr_matrix_set_identity(&gc.transform); + gc.transform.set_identity(); nr_arena_item_invoke_update( ai, NULL, &gc, NR_ARENA_ITEM_STATE_ALL, NR_ARENA_ITEM_STATE_NONE ); diff --git a/src/display/nr-filter-units.cpp b/src/display/nr-filter-units.cpp index 5b7bcdd4e..6836e39af 100644 --- a/src/display/nr-filter-units.cpp +++ b/src/display/nr-filter-units.cpp @@ -13,6 +13,9 @@ #include "display/nr-filter-units.h" #include "libnr/nr-matrix.h" +#include "libnr/nr-matrix-fns.h" +#include "libnr/nr-matrix-ops.h" +#include "libnr/nr-matrix-scale-ops.h" #include "libnr/nr-rect.h" #include "libnr/nr-rect-l.h" #include "libnr/nr-scale.h" @@ -139,7 +142,7 @@ Matrix FilterUnits::get_matrix_user2units(SPFilterUnits units) const { 0, scale_y, min[X] * scale_x, min[Y] * scale_y); } else if (units == SP_FILTER_UNITS_USERSPACEONUSE) { - return Matrix(NULL); + return identity(); } else { g_warning("Error in NR::FilterUnits::get_matrix_user2units: unrecognized unit type (%d)", units); return Matrix(); diff --git a/src/display/nr-filter.cpp b/src/display/nr-filter.cpp index 6027b5f27..7423bb7f3 100644 --- a/src/display/nr-filter.cpp +++ b/src/display/nr-filter.cpp @@ -111,7 +111,7 @@ int Filter::render(NRArenaItem const *item, NRPixBlock *pb) return 1; } - Matrix trans = *item->ctm; + Matrix trans = item->ctm; FilterSlot slot(_slot_count, item); Rect item_bbox; diff --git a/src/display/sp-ctrlline.cpp b/src/display/sp-ctrlline.cpp index e94805831..a3c7839c7 100644 --- a/src/display/sp-ctrlline.cpp +++ b/src/display/sp-ctrlline.cpp @@ -76,7 +76,7 @@ static void sp_ctrlline_init (SPCtrlLine *ctrlline) { ctrlline->rgba = 0x0000ff7f; - ctrlline->s.x = ctrlline->s.y = ctrlline->e.x = ctrlline->e.y = 0.0; + ctrlline->s[NR::X] = ctrlline->s[NR::Y] = ctrlline->e[NR::X] = ctrlline->e[NR::Y] = 0.0; ctrlline->shp=NULL; ctrlline->item=NULL; } @@ -180,8 +180,8 @@ sp_ctrlline_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int f cl->shp = NULL; } Path* thePath = new Path; - thePath->MoveTo(NR::Point(cl->s.x, cl->s.y) * affine); - thePath->LineTo(NR::Point(cl->e.x, cl->e.y) * affine); + thePath->MoveTo(NR::Point(cl->s[NR::X], cl->s[NR::Y]) * affine); + thePath->LineTo(NR::Point(cl->e[NR::X], cl->e[NR::Y]) * affine); NRRectL area; area.x0=(NR::ICoord)(double)item->x1; @@ -236,11 +236,11 @@ sp_ctrlline_set_coords (SPCtrlLine *cl, gdouble x0, gdouble y0, gdouble x1, gdou g_return_if_fail (cl != NULL); g_return_if_fail (SP_IS_CTRLLINE (cl)); - if (DIFFER (x0, cl->s.x) || DIFFER (y0, cl->s.y) || DIFFER (x1, cl->e.x) || DIFFER (y1, cl->e.y)) { - cl->s.x = x0; - cl->s.y = y0; - cl->e.x = x1; - cl->e.y = y1; + if (DIFFER (x0, cl->s[NR::X]) || DIFFER (y0, cl->s[NR::Y]) || DIFFER (x1, cl->e[NR::X]) || DIFFER (y1, cl->e[NR::Y])) { + cl->s[NR::X] = x0; + cl->s[NR::Y] = y0; + cl->e[NR::X] = x1; + cl->e[NR::Y] = y1; sp_canvas_item_request_update (SP_CANVAS_ITEM (cl)); } } diff --git a/src/display/sp-ctrlline.h b/src/display/sp-ctrlline.h index d7863bf19..3c83388d8 100644 --- a/src/display/sp-ctrlline.h +++ b/src/display/sp-ctrlline.h @@ -27,7 +27,7 @@ struct SPItem; struct SPCtrlLine : public SPCanvasItem{ SPItem *item; // the item to which this line belongs in some sense; may be NULL for some users guint32 rgba; - NRPoint s, e; + NR::Point s, e; Shape* shp; }; struct SPCtrlLineClass : public SPCanvasItemClass{}; |
