From 53933f5fea9d07d1ba6304b88439fba257ee8c34 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Wed, 2 Feb 2011 22:24:36 +0100 Subject: update to latest 2geom ! (bzr r10025) --- src/sp-text.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/sp-text.cpp') diff --git a/src/sp-text.cpp b/src/sp-text.cpp index 80eb786f2..3abeadaee 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -27,7 +27,7 @@ # include "config.h" #endif -#include <2geom/matrix.h> +#include <2geom/affine.h> #include #include #include @@ -72,12 +72,12 @@ static void sp_text_update (SPObject *object, SPCtx *ctx, guint flags); static void sp_text_modified (SPObject *object, guint flags); static Inkscape::XML::Node *sp_text_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_text_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags); +static void sp_text_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const &transform, unsigned const flags); static NRArenaItem *sp_text_show (SPItem *item, NRArena *arena, unsigned key, unsigned flags); static void sp_text_hide (SPItem *item, unsigned key); static char *sp_text_description (SPItem *item); static void sp_text_snappoints(SPItem const *item, std::vector &p, Inkscape::SnapPreferences const *snapprefs); -static Geom::Matrix sp_text_set_transform(SPItem *item, Geom::Matrix const &xform); +static Geom::Affine sp_text_set_transform(SPItem *item, Geom::Affine const &xform); static void sp_text_print (SPItem *item, SPPrintContext *gpc); static SPItemClass *text_parent_class; @@ -363,7 +363,7 @@ static Inkscape::XML::Node *sp_text_write(SPObject *object, Inkscape::XML::Docum } static void -sp_text_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const /*flags*/) +sp_text_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const &transform, unsigned const /*flags*/) { SP_TEXT(item)->layout.getBoundingBox(bbox, transform); @@ -456,8 +456,8 @@ static void sp_text_snappoints(SPItem const *item, std::vectorgetWidth (); dbox.y1 = SP_OBJECT_DOCUMENT (item)->getHeight (); - Geom::Matrix const ctm (item->i2d_affine()); + Geom::Affine const ctm (item->i2d_affine()); group->layout.print(ctx,&pbox,&dbox,&bbox,ctm); } @@ -642,7 +642,7 @@ void SPText::_adjustFontsizeRecursive(SPItem *item, double ex, bool is_root) } } -void SPText::_adjustCoordsRecursive(SPItem *item, Geom::Matrix const &m, double ex, bool is_root) +void SPText::_adjustCoordsRecursive(SPItem *item, Geom::Affine const &m, double ex, bool is_root) { if (SP_IS_TSPAN(item)) SP_TSPAN(item)->attributes.transform(m, ex, ex, is_root); @@ -903,7 +903,7 @@ void TextTagAttributes::joinSingleAttribute(std::vector *dest_vector, } } -void TextTagAttributes::transform(Geom::Matrix const &matrix, double scale_x, double scale_y, bool extend_zero_length) +void TextTagAttributes::transform(Geom::Affine const &matrix, double scale_x, double scale_y, bool extend_zero_length) { SVGLength zero_length; zero_length = 0.0; -- cgit v1.2.3 From ccba415bc620a21239f11361078c8c30006106c7 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 20 Feb 2011 23:59:34 -0800 Subject: Finished cleanup of outated SP_OBJECT_DOCUMENT C macro. (bzr r10060) --- src/sp-text.cpp | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'src/sp-text.cpp') diff --git a/src/sp-text.cpp b/src/sp-text.cpp index 3abeadaee..57f9dd14e 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -227,18 +227,18 @@ static void sp_text_update(SPObject *object, SPCtx *ctx, guint flags) // Create temporary list of children GSList *l = NULL; for (SPObject *child = object->firstChild() ; child ; child = child->getNext() ) { - sp_object_ref (SP_OBJECT (child), object); + sp_object_ref(child, object); l = g_slist_prepend (l, child); } l = g_slist_reverse (l); while (l) { - SPObject *child = SP_OBJECT (l->data); + SPObject *child = reinterpret_cast(l->data); // We just built this list, so cast is safe. l = g_slist_remove (l, child); if (cflags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { /* fixme: Do we need transform? */ child->updateDisplay(ctx, cflags); } - sp_object_unref (SP_OBJECT (child), object); + sp_object_unref(child, object); } if (flags & ( SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG | @@ -253,7 +253,7 @@ static void sp_text_update(SPObject *object, SPCtx *ctx, guint flags) text->invoke_bbox( &paintbox, Geom::identity(), TRUE); for (SPItemView* v = text->display; v != NULL; v = v->next) { text->_clearFlow(NR_ARENA_GROUP(v->arenaitem)); - nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), SP_OBJECT_STYLE(object)); + nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), object->style); // pass the bbox of the text object as paintbox (used for paintserver fills) text->layout.show(NR_ARENA_GROUP(v->arenaitem), &paintbox); } @@ -281,7 +281,7 @@ static void sp_text_modified(SPObject *object, guint flags) text->invoke_bbox( &paintbox, Geom::identity(), TRUE); for (SPItemView* v = text->display; v != NULL; v = v->next) { text->_clearFlow(NR_ARENA_GROUP(v->arenaitem)); - nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), SP_OBJECT_STYLE(object)); + nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), object->style); text->layout.show(NR_ARENA_GROUP(v->arenaitem), &paintbox); } } @@ -289,17 +289,17 @@ static void sp_text_modified(SPObject *object, guint flags) // Create temporary list of children GSList *l = NULL; for (SPObject *child = object->firstChild() ; child ; child = child->getNext() ) { - sp_object_ref (SP_OBJECT (child), object); + sp_object_ref(child, object); l = g_slist_prepend (l, child); } l = g_slist_reverse (l); while (l) { - SPObject *child = SP_OBJECT (l->data); + SPObject *child = reinterpret_cast(l->data); // We just built this list, so cast is safe. l = g_slist_remove (l, child); if (cflags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { child->emitModified(cflags); } - sp_object_unref (SP_OBJECT (child), object); + sp_object_unref(child, object); } } @@ -337,7 +337,7 @@ static Inkscape::XML::Node *sp_text_write(SPObject *object, Inkscape::XML::Docum continue; } if (SP_IS_STRING(child)) { - SP_OBJECT_REPR(child)->setContent(SP_STRING(child)->string.c_str()); + child->getRepr()->setContent(SP_STRING(child)->string.c_str()); } else { child->updateRepr(flags); } @@ -350,9 +350,9 @@ static Inkscape::XML::Node *sp_text_write(SPObject *object, Inkscape::XML::Docum if (text->style->line_height.set && !text->style->line_height.inherit && !text->style->line_height.normal && text->style->line_height.unit == SP_CSS_UNIT_PERCENT) { Inkscape::SVGOStringStream os; os << (text->style->line_height.value * 100.0) << "%"; - SP_OBJECT_REPR(text)->setAttribute("sodipodi:linespacing", os.str().c_str()); + text->getRepr()->setAttribute("sodipodi:linespacing", os.str().c_str()); } else { - SP_OBJECT_REPR(text)->setAttribute("sodipodi:linespacing", NULL); + text->getRepr()->setAttribute("sodipodi:linespacing", NULL); } if (((SPObjectClass *) (text_parent_class))->write) { @@ -368,7 +368,7 @@ sp_text_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const &transform, un SP_TEXT(item)->layout.getBoundingBox(bbox, transform); // Add stroke width - SPStyle* style=SP_OBJECT_STYLE (item); + SPStyle* style = item->style; if (!style->stroke.isNone()) { double const scale = transform.descrim(); if ( fabs(style->stroke_width.computed * scale) > 0.01 ) { // sinon c'est 0=oon veut pas de bord @@ -409,11 +409,10 @@ sp_text_hide(SPItem *item, unsigned key) ((SPItemClass *) text_parent_class)->hide (item, key); } -static char * -sp_text_description(SPItem *item) +static char * sp_text_description(SPItem *item) { - SPText *text = (SPText *) item; - SPStyle *style = SP_OBJECT_STYLE(text); + SPText *text = reinterpret_cast(item); + SPStyle *style = text->style; font_instance *tf = font_factory::Default()->FaceFromStyle(style); @@ -515,8 +514,8 @@ sp_text_print (SPItem *item, SPPrintContext *ctx) item->getBboxDesktop (&bbox); dbox.x0 = 0.0; dbox.y0 = 0.0; - dbox.x1 = SP_OBJECT_DOCUMENT (item)->getWidth (); - dbox.y1 = SP_OBJECT_DOCUMENT (item)->getHeight (); + dbox.x1 = item->document->getWidth(); + dbox.y1 = item->document->getHeight(); Geom::Affine const ctm (item->i2d_affine()); group->layout.print(ctx,&pbox,&dbox,&bbox,ctm); @@ -623,7 +622,7 @@ void SPText::rebuildLayout() void SPText::_adjustFontsizeRecursive(SPItem *item, double ex, bool is_root) { - SPStyle *style = SP_OBJECT_STYLE (item); + SPStyle *style = item->style; if (style && !NR_DF_TEST_CLOSE (ex, 1.0, NR_EPSILON)) { if (!style->font_size.set && is_root) { -- cgit v1.2.3