Code

get rid of a lot of no longer needed "libnr/nr-..." includes.
[inkscape.git] / src / display / nr-arena-glyphs.cpp
index 9295beccdf63ae539666dd91a278f7cade6ddaf3..802fe448c75a952bdc844360436cff7f96d01888 100644 (file)
 # include <config.h>
 #endif
 #include <libnr/nr-blit.h>
-#include <libnr/nr-path.h>
-#include <libnr/n-art-bpath.h>
-#include <libnr/nr-matrix-ops.h>
-#include <libnr/nr-matrix-fns.h>
 #include <libnr/nr-convert2geom.h>
 #include <2geom/matrix.h>
 #include "../style.h"
@@ -49,7 +45,7 @@ static void nr_arena_glyphs_finalize(NRObject *object);
 
 static guint nr_arena_glyphs_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, guint reset);
 static guint nr_arena_glyphs_clip(NRArenaItem *item, NRRectL *area, NRPixBlock *pb);
-static NRArenaItem *nr_arena_glyphs_pick(NRArenaItem *item, NR::Point p, double delta, unsigned int sticky);
+static NRArenaItem *nr_arena_glyphs_pick(NRArenaItem *item, Geom::Point p, double delta, unsigned int sticky);
 
 static NRArenaItemClass *glyphs_parent_class;
 
@@ -91,7 +87,7 @@ static void
 nr_arena_glyphs_init(NRArenaGlyphs *glyphs)
 {
     glyphs->style = NULL;
-    glyphs->g_transform.set_identity();
+    glyphs->g_transform.setIdentity();
     glyphs->font = NULL;
     glyphs->glyph = 0;
 
@@ -144,10 +140,10 @@ 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::expansion(gc->transform);
+    float const scale = gc->transform.descrim();
 
     if (!glyphs->style->fill.isNone()) {
-        NR::Matrix t;
+        Geom::Matrix t;
         t = glyphs->g_transform * gc->transform;
         glyphs->x = t[4];
         glyphs->y = t[5];
@@ -169,7 +165,7 @@ nr_arena_glyphs_update(NRArenaItem *item, NRRectL */*area*/, NRGC *gc, guint /*s
 
     if (!glyphs->style->stroke.isNone()) {
         /* Build state data */
-        NR::Matrix t;
+        Geom::Matrix t;
         t = glyphs->g_transform * gc->transform;
         glyphs->x = t[4];
         glyphs->y = t[5];
@@ -213,7 +209,7 @@ nr_arena_glyphs_update(NRArenaItem *item, NRRectL */*area*/, NRGC *gc, guint /*s
             bbox.y1 = narea.y1 + glyphs->y;
         }
     }
-    if (nr_rect_d_test_empty(&bbox)) return NR_ARENA_ITEM_STATE_ALL;
+    if (nr_rect_d_test_empty(bbox)) return NR_ARENA_ITEM_STATE_ALL;
 
     item->bbox.x0 = (gint32)(bbox.x0 - 1.0);
     item->bbox.y0 = (gint32)(bbox.y0 - 1.0);
@@ -239,7 +235,7 @@ nr_arena_glyphs_clip(NRArenaItem *item, NRRectL */*area*/, NRPixBlock */*pb*/)
 }
 
 static NRArenaItem *
-nr_arena_glyphs_pick(NRArenaItem *item, NR::Point p, gdouble /*delta*/, unsigned int /*sticky*/)
+nr_arena_glyphs_pick(NRArenaItem *item, Geom::Point p, gdouble /*delta*/, unsigned int /*sticky*/)
 {
     NRArenaGlyphs *glyphs;
 
@@ -248,8 +244,8 @@ nr_arena_glyphs_pick(NRArenaItem *item, NR::Point p, gdouble /*delta*/, unsigned
     if (!glyphs->font ) return NULL;
     if (!glyphs->style) return NULL;
 
-    double const x = p[NR::X];
-    double const y = p[NR::Y];
+    double const x = p[Geom::X];
+    double const y = p[Geom::Y];
     /* With text we take a simple approach: pick if the point is in a characher bbox */
     if ((x >= item->bbox.x0) && (y >= item->bbox.y0) && (x <= item->bbox.x1) && (y <= item->bbox.y1)) return item;
 
@@ -257,7 +253,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, NR::Matrix const *transform)
+nr_arena_glyphs_set_path(NRArenaGlyphs *glyphs, SPCurve */*curve*/, unsigned int /*lieutenant*/, font_instance *font, gint glyph, Geom::Matrix const *transform)
 {
     nr_return_if_fail(glyphs != NULL);
     nr_return_if_fail(NR_IS_ARENA_GLYPHS(glyphs));
@@ -267,7 +263,7 @@ nr_arena_glyphs_set_path(NRArenaGlyphs *glyphs, SPCurve */*curve*/, unsigned int
     if (transform) {
         glyphs->g_transform = *transform;
     } else {
-        glyphs->g_transform.set_identity();
+        glyphs->g_transform.setIdentity();
     }
 
     if (font) font->Ref();
@@ -298,9 +294,9 @@ nr_arena_glyphs_fill_mask(NRArenaGlyphs *glyphs, NRRectL *area, NRPixBlock *m)
 
     NRArenaItem *item = NR_ARENA_ITEM(glyphs);
 
-    if (glyphs->rfont && nr_rect_l_test_intersect(area, &item->bbox)) {
+    if (glyphs->rfont && nr_rect_l_test_intersect_ptr(area, &item->bbox)) {
         raster_glyph *g = glyphs->rfont->GetGlyph(glyphs->glyph);
-        if ( g ) g->Blit(NR::Point(glyphs->x, glyphs->y), *m);
+        if ( g ) g->Blit(Geom::Point(glyphs->x, glyphs->y), *m);
     }
 
     return item->state;
@@ -310,9 +306,9 @@ static guint
 nr_arena_glyphs_stroke_mask(NRArenaGlyphs *glyphs, NRRectL *area, NRPixBlock *m)
 {
     NRArenaItem *item = NR_ARENA_ITEM(glyphs);
-    if (glyphs->sfont && nr_rect_l_test_intersect(area, &item->bbox)) {
+    if (glyphs->sfont && nr_rect_l_test_intersect_ptr(area, &item->bbox)) {
         raster_glyph *g=glyphs->sfont->GetGlyph(glyphs->glyph);
-        if ( g ) g->Blit(NR::Point(glyphs->x, glyphs->y),*m);
+        if ( g ) g->Blit(Geom::Point(glyphs->x, glyphs->y),*m);
     }
 
     return item->state;
@@ -325,7 +321,7 @@ static void nr_arena_glyphs_group_finalize(NRObject *object);
 static guint nr_arena_glyphs_group_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, guint reset);
 static unsigned int nr_arena_glyphs_group_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPixBlock *pb, unsigned int flags);
 static unsigned int nr_arena_glyphs_group_clip(NRArenaItem *item, NRRectL *area, NRPixBlock *pb);
-static NRArenaItem *nr_arena_glyphs_group_pick(NRArenaItem *item, NR::Point p, gdouble delta, unsigned int sticky);
+static NRArenaItem *nr_arena_glyphs_group_pick(NRArenaItem *item, Geom::Point p, gdouble delta, unsigned int sticky);
 
 static NRArenaGroupClass *group_parent_class;
 
@@ -467,8 +463,8 @@ nr_arena_glyphs_group_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPi
             Geom::PathVector const * pathv = g->font->PathVector(g->glyph);
 
             cairo_new_path(ct);
-            Geom::Matrix transform = to_2geom(g->g_transform * group->ctm);
-            feed_pathvector_to_cairo (ct, *pathv, transform, (pb->area).upgrade(), false, 0);
+            Geom::Matrix transform = g->g_transform * group->ctm;
+            feed_pathvector_to_cairo (ct, *pathv, transform, to_2geom((pb->area).upgrade()), false, 0);
             cairo_fill(ct);
             pb->empty = FALSE;
         }
@@ -584,7 +580,7 @@ nr_arena_glyphs_group_clip(NRArenaItem *item, NRRectL *area, NRPixBlock *pb)
 }
 
 static NRArenaItem *
-nr_arena_glyphs_group_pick(NRArenaItem *item, NR::Point p, gdouble delta, unsigned int sticky)
+nr_arena_glyphs_group_pick(NRArenaItem *item, Geom::Point p, gdouble delta, unsigned int sticky)
 {
     NRArenaItem *picked = NULL;
 
@@ -609,7 +605,7 @@ nr_arena_glyphs_group_clear(NRArenaGlyphsGroup *sg)
 }
 
 void
-nr_arena_glyphs_group_add_component(NRArenaGlyphsGroup *sg, font_instance *font, int glyph, NR::Matrix const *transform)
+nr_arena_glyphs_group_add_component(NRArenaGlyphsGroup *sg, font_instance *font, int glyph, Geom::Matrix const &transform)
 {
     NRArenaGroup *group;
 
@@ -624,7 +620,7 @@ nr_arena_glyphs_group_add_component(NRArenaGlyphsGroup *sg, font_instance *font,
         NRArenaItem *new_arena = NRArenaGlyphs::create(group->arena);
         nr_arena_item_append_child(NR_ARENA_ITEM(group), new_arena);
         nr_arena_item_unref(new_arena);
-        nr_arena_glyphs_set_path(NR_ARENA_GLYPHS(new_arena), NULL, FALSE, font, glyph, transform);
+        nr_arena_glyphs_set_path(NR_ARENA_GLYPHS(new_arena), NULL, FALSE, font, glyph, &transform);
         nr_arena_glyphs_set_style(NR_ARENA_GLYPHS(new_arena), sg->style);
     }
 }