diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2010-06-29 22:41:48 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2010-06-29 22:41:48 +0000 |
| commit | 13b15b7b977eecbededd1734f5ab001f0c44d21f (patch) | |
| tree | f4e1d29f1f5deafa0c5ed2b17c88c1682a378194 /src/display/nr-arena-shape.cpp | |
| parent | Fix icons (diff) | |
| download | inkscape-13b15b7b977eecbededd1734f5ab001f0c44d21f.tar.gz inkscape-13b15b7b977eecbededd1734f5ab001f0c44d21f.zip | |
Consolidate Cairo utils in display/cairo-utils.h. Fix icons harder.
(bzr r9508.1.8)
Diffstat (limited to 'src/display/nr-arena-shape.cpp')
| -rw-r--r-- | src/display/nr-arena-shape.cpp | 155 |
1 files changed, 18 insertions, 137 deletions
diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp index f0a621bf0..de9a0c0fd 100644 --- a/src/display/nr-arena-shape.cpp +++ b/src/display/nr-arena-shape.cpp @@ -12,38 +12,31 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <cairo.h> +#include <fenv.h> +#include <glib.h> +#include <typeinfo> + +#include <2geom/curves.h> +#include <2geom/pathvector.h> #include <2geom/svg-path.h> #include <2geom/svg-path-parser.h> -#include <display/canvas-arena.h> -#include <display/nr-arena.h> -#include <display/nr-arena-shape.h> +#include "display/cairo-utils.h" +#include "display/canvas-arena.h" #include "display/curve.h" -#include <libnr/nr-pixops.h> -#include <libnr/nr-blit.h> -#include <libnr/nr-convert2geom.h> -#include <2geom/pathvector.h> -#include <2geom/curves.h> -#include <livarot/Shape.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 "display/nr-arena.h" +#include "display/nr-arena-shape.h" +#include "display/nr-filter.h" #include "helper/geom-curves.h" +#include "helper/geom.h" +#include "libnr/nr-blit.h" +#include "libnr/nr-convert2geom.h" +#include "libnr/nr-pixops.h" +#include "preferences.h" #include "sp-filter.h" #include "sp-filter-reference.h" -#include "display/nr-filter.h" -#include <typeinfo> -#include <cairo.h> -#include "preferences.h" - -#include <glib.h> +#include "style.h" #include "svg/svg.h" -#include <fenv.h> - -//int showRuns=0; -void nr_pixblock_render_shape_mask_or(NRPixBlock &m,Shape* theS); static void nr_arena_shape_class_init(NRArenaShapeClass *klass); static void nr_arena_shape_init(NRArenaShape *shape); @@ -613,118 +606,6 @@ void NRArenaShape::setPaintBox(Geom::Rect const &pbox) nr_arena_item_request_update(this, NR_ARENA_ITEM_STATE_ALL, FALSE); } -static void -shape_run_A8_OR(raster_info &dest,void */*data*/,int st,float vst,int en,float ven) -{ - if ( st >= en ) return; - if ( vst < 0 ) vst=0; - if ( vst > 1 ) vst=1; - if ( ven < 0 ) ven=0; - if ( ven > 1 ) ven=1; - float sv=vst; - float dv=ven-vst; - int len=en-st; - unsigned char* d=(unsigned char*)dest.buffer; - d+=(st-dest.startPix); - if ( fabs(dv) < 0.001 ) { - if ( vst > 0.999 ) { - /* Simple copy */ - while (len > 0) { - d[0] = 255; - d += 1; - len -= 1; - } - } else { - sv*=256; - unsigned int c0_24=(int)sv; - c0_24&=0xFF; - while (len > 0) { - /* Draw */ - d[0] = NR_COMPOSEA_111(c0_24,d[0]); - d += 1; - len -= 1; - } - } - } else { - if ( en <= st+1 ) { - sv=0.5*(vst+ven); - sv*=256; - unsigned int c0_24=(int)sv; - c0_24&=0xFF; - /* Draw */ - d[0] = NR_COMPOSEA_111(c0_24,d[0]); - } else { - dv/=len; - sv+=0.5*dv; // correction trapezoidale - sv*=16777216; - dv*=16777216; - int c0_24 = static_cast<int>(CLAMP(sv, 0, 16777216)); - int s0_24 = static_cast<int>(dv); - while (len > 0) { - unsigned int ca; - /* Draw */ - ca = c0_24 >> 16; - if ( ca > 255 ) ca=255; - d[0] = NR_COMPOSEA_111(ca,d[0]); - d += 1; - c0_24 += s0_24; - c0_24 = CLAMP(c0_24, 0, 16777216); - len -= 1; - } - } - } -} - -void nr_pixblock_render_shape_mask_or(NRPixBlock &m,Shape* theS) -{ - theS->CalcBBox(); - float l = theS->leftX, r = theS->rightX, t = theS->topY, b = theS->bottomY; - int il,ir,it,ib; - il=(int)floor(l); - ir=(int)ceil(r); - it=(int)floor(t); - ib=(int)ceil(b); - - if ( il >= m.area.x1 || ir <= m.area.x0 || it >= m.area.y1 || ib <= m.area.y0 ) return; - if ( il < m.area.x0 ) il=m.area.x0; - if ( it < m.area.y0 ) it=m.area.y0; - if ( ir > m.area.x1 ) ir=m.area.x1; - if ( ib > m.area.y1 ) ib=m.area.y1; - - /* This is the FloatLigne version. See svn (prior to Apr 2006) for versions using BitLigne or direct BitLigne. */ - int curPt; - float curY; - theS->BeginQuickRaster(curY, curPt); - - FloatLigne *theI = new FloatLigne(); - IntLigne *theIL = new IntLigne(); - - theS->DirectQuickScan(curY, curPt, (float) it, true, 1.0); - - char *mdata = (char*)m.data.px; - if ( m.size == NR_PIXBLOCK_SIZE_TINY ) mdata=(char*)m.data.p; - uint32_t *ligStart = ((uint32_t*)(mdata + ((il - m.area.x0) + m.rs * (it - m.area.y0)))); - for (int y = it; y < ib; y++) { - theI->Reset(); - theS->QuickScan(curY, curPt, ((float)(y+1)), theI, 1.0); - theI->Flatten(); - theIL->Copy(theI); - - raster_info dest; - dest.startPix=il; - dest.endPix=ir; - dest.sth=il; - dest.stv=y; - dest.buffer=ligStart; - theIL->Raster(dest, NULL, shape_run_A8_OR); - ligStart=((uint32_t*)(((char*)ligStart)+m.rs)); - } - theS->EndQuickRaster(); - delete theI; - delete theIL; -} - - /* Local Variables: mode:c++ |
