X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fdisplay%2Fnr-arena-shape.cpp;h=6f38fd97d8d018d57a57af5bae793749235b0246;hb=98df3a354fa3c80ac0111cbb7a077b422da9bdb8;hp=e2a9e958064128a00df160849ce4fba434611b56;hpb=eb4f7092b0b8482c042370d8c6520d4b05997afe;p=inkscape.git diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp index e2a9e9580..6f38fd97d 100644 --- a/src/display/nr-arena-shape.cpp +++ b/src/display/nr-arena-shape.cpp @@ -1,5 +1,3 @@ -#define __NR_ARENA_SHAPE_C__ - /* * RGBA display list system for inkscape * @@ -12,34 +10,36 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include +#include +#include +#include + #include <2geom/svg-path.h> #include <2geom/svg-path-parser.h> -#include -#include -#include -#include "display/curve.h" -#include -#include -#include #include <2geom/pathvector.h> #include <2geom/curves.h> -#include -#include -#include -#include +#include "display/sp-canvas.h" +#include "display/canvas-arena.h" +#include "display/nr-arena.h" +#include "display/nr-arena-shape.h" +#include "display/curve.h" +#include "libnr/nr-pixops.h" +#include "libnr/nr-blit.h" +#include "libnr/nr-convert2geom.h" +#include "livarot/Path.h" +#include "livarot/float-line.h" +#include "livarot/int-line.h" +#include "style.h" #include "inkscape-cairo.h" #include "helper/geom.h" #include "helper/geom-curves.h" #include "sp-filter.h" #include "sp-filter-reference.h" #include "display/nr-filter.h" -#include -#include #include "preferences.h" -#include #include "svg/svg.h" -#include //int showRuns=0; void nr_pixblock_render_shape_mask_or(NRPixBlock &m,Shape* theS); @@ -254,12 +254,11 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g if (state & NR_ARENA_ITEM_STATE_BBOX) { if (shape->curve) { boundingbox = bounds_exact_transformed(shape->curve->get_pathvector(), gc->transform); - /// \todo just write item->bbox = boundingbox if (boundingbox) { - item->bbox.x0 = (gint32)((*boundingbox)[0][0] - 1.0F); - item->bbox.y0 = (gint32)((*boundingbox)[1][0] - 1.0F); - item->bbox.x1 = (gint32)((*boundingbox)[0][1] + 1.9999F); - item->bbox.y1 = (gint32)((*boundingbox)[1][1] + 1.9999F); + item->bbox.x0 = static_cast(floor((*boundingbox)[0][0])); // Floor gives the coordinate in which the point resides + item->bbox.y0 = static_cast(floor((*boundingbox)[1][0])); + item->bbox.x1 = static_cast(ceil ((*boundingbox)[0][1])); // Ceil gives the first coordinate beyond the point + item->bbox.y1 = static_cast(ceil ((*boundingbox)[1][1])); } else { item->bbox = NR_RECT_L_EMPTY; } @@ -300,10 +299,10 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g /// \todo just write item->bbox = boundingbox if (boundingbox) { - shape->approx_bbox.x0 = (gint32)((*boundingbox)[0][0] - 1.0F); - shape->approx_bbox.y0 = (gint32)((*boundingbox)[1][0] - 1.0F); - shape->approx_bbox.x1 = (gint32)((*boundingbox)[0][1] + 1.9999F); - shape->approx_bbox.y1 = (gint32)((*boundingbox)[1][1] + 1.9999F); + shape->approx_bbox.x0 = static_cast(floor((*boundingbox)[0][0])); + shape->approx_bbox.y0 = static_cast(floor((*boundingbox)[1][0])); + shape->approx_bbox.x1 = static_cast(ceil ((*boundingbox)[0][1])); + shape->approx_bbox.y1 = static_cast(ceil ((*boundingbox)[1][1])); } else { shape->approx_bbox = NR_RECT_L_EMPTY; } @@ -349,10 +348,10 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g /// \todo just write shape->approx_bbox = boundingbox if (boundingbox) { - shape->approx_bbox.x0 = (gint32)((*boundingbox)[0][0] - 1.0F); - shape->approx_bbox.y0 = (gint32)((*boundingbox)[1][0] - 1.0F); - shape->approx_bbox.x1 = (gint32)((*boundingbox)[0][1] + 1.9999F); - shape->approx_bbox.y1 = (gint32)((*boundingbox)[1][1] + 1.9999F); + shape->approx_bbox.x0 = static_cast(floor((*boundingbox)[0][0])); + shape->approx_bbox.y0 = static_cast(floor((*boundingbox)[1][0])); + shape->approx_bbox.x1 = static_cast(ceil ((*boundingbox)[0][1])); + shape->approx_bbox.y1 = static_cast(ceil ((*boundingbox)[1][1])); } else { shape->approx_bbox = NR_RECT_L_EMPTY; } @@ -362,10 +361,10 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g return NR_ARENA_ITEM_STATE_ALL; /// \todo just write item->bbox = boundingbox - item->bbox.x0 = (gint32)((*boundingbox)[0][0] - 1.0F); - item->bbox.y0 = (gint32)((*boundingbox)[1][0] - 1.0F); - item->bbox.x1 = (gint32)((*boundingbox)[0][1] + 1.0F); - item->bbox.y1 = (gint32)((*boundingbox)[1][1] + 1.0F); + item->bbox.x0 = static_cast(floor((*boundingbox)[0][0])); + item->bbox.y0 = static_cast(floor((*boundingbox)[1][0])); + item->bbox.x1 = static_cast(ceil ((*boundingbox)[0][1])); + item->bbox.y1 = static_cast(ceil ((*boundingbox)[1][1])); item->render_opacity = TRUE; if ( shape->_fill.paint.type() == NRArenaShape::Paint::SERVER ) { @@ -1509,4 +1508,4 @@ void nr_pixblock_render_shape_mask_or(NRPixBlock &m,Shape* theS) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :