Code

Fixed problem when swatches were larger than provided area
[inkscape.git] / src / display / nr-arena-shape.cpp
1 #define __NR_ARENA_SHAPE_C__
3 /*
4  * RGBA display list system for inkscape
5  *
6  * Author:
7  *   Lauris Kaplinski <lauris@kaplinski.com>
8  *
9  * Copyright (C) 2001-2002 Lauris Kaplinski
10  * Copyright (C) 2001 Ximian, Inc.
11  *
12  * Released under GNU GPL, read the file 'COPYING' for more information
13  */
17 #include <display/nr-arena.h>
18 #include <display/nr-arena-shape.h>
19 #include <libnr/n-art-bpath.h>
20 #include <libnr/nr-path.h>
21 #include <libnr/nr-pixops.h>
22 #include <libnr/nr-matrix-ops.h>
23 #include <libnr/nr-blit.h>
24 #include <livarot/Path.h>
25 #include <livarot/float-line.h>
26 #include <livarot/int-line.h>
27 #include <style.h>
29 //int  showRuns=0;
30 void nr_pixblock_render_shape_mask_or(NRPixBlock &m,Shape* theS);
32 static void nr_arena_shape_class_init(NRArenaShapeClass *klass);
33 static void nr_arena_shape_init(NRArenaShape *shape);
34 static void nr_arena_shape_finalize(NRObject *object);
36 static NRArenaItem *nr_arena_shape_children(NRArenaItem *item);
37 static void nr_arena_shape_add_child(NRArenaItem *item, NRArenaItem *child, NRArenaItem *ref);
38 static void nr_arena_shape_remove_child(NRArenaItem *item, NRArenaItem *child);
39 static void nr_arena_shape_set_child_position(NRArenaItem *item, NRArenaItem *child, NRArenaItem *ref);
41 static guint nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, guint reset);
42 static unsigned int nr_arena_shape_render(NRArenaItem *item, NRRectL *area, NRPixBlock *pb, unsigned int flags);
43 static guint nr_arena_shape_clip(NRArenaItem *item, NRRectL *area, NRPixBlock *pb);
44 static NRArenaItem *nr_arena_shape_pick(NRArenaItem *item, NR::Point p, double delta, unsigned int sticky);
46 static NRArenaItemClass *shape_parent_class;
48 NRType
49 nr_arena_shape_get_type(void)
50 {
51     static NRType type = 0;
52     if (!type) {
53         type = nr_object_register_type(NR_TYPE_ARENA_ITEM,
54                                        "NRArenaShape",
55                                        sizeof(NRArenaShapeClass),
56                                        sizeof(NRArenaShape),
57                                        (void (*)(NRObjectClass *)) nr_arena_shape_class_init,
58                                        (void (*)(NRObject *)) nr_arena_shape_init);
59     }
60     return type;
61 }
63 static void
64 nr_arena_shape_class_init(NRArenaShapeClass *klass)
65 {
66     NRObjectClass *object_class;
67     NRArenaItemClass *item_class;
69     object_class = (NRObjectClass *) klass;
70     item_class = (NRArenaItemClass *) klass;
72     shape_parent_class = (NRArenaItemClass *)  ((NRObjectClass *) klass)->parent;
74     object_class->finalize = nr_arena_shape_finalize;
75     object_class->cpp_ctor = NRObject::invoke_ctor<NRArenaShape>;
77     item_class->children = nr_arena_shape_children;
78     item_class->add_child = nr_arena_shape_add_child;
79     item_class->set_child_position = nr_arena_shape_set_child_position;
80     item_class->remove_child = nr_arena_shape_remove_child;
81     item_class->update = nr_arena_shape_update;
82     item_class->render = nr_arena_shape_render;
83     item_class->clip = nr_arena_shape_clip;
84     item_class->pick = nr_arena_shape_pick;
85 }
87 static void
88 nr_arena_shape_init(NRArenaShape *shape)
89 {
90     shape->curve = NULL;
91     shape->style = NULL;
92     shape->paintbox.x0 = shape->paintbox.y0 = 0.0F;
93     shape->paintbox.x1 = shape->paintbox.y1 = 256.0F;
95     nr_matrix_set_identity(&shape->ctm);
96     shape->fill_painter = NULL;
97     shape->stroke_painter = NULL;
98     shape->cached_fill = NULL;
99     shape->cached_stroke = NULL;
100     shape->fill_shp = NULL;
101     shape->stroke_shp = NULL;
103     shape->delayed_shp = false;
105     shape->approx_bbox.x0 = shape->approx_bbox.y0 = 0;
106     shape->approx_bbox.x1 = shape->approx_bbox.y1 = 0;
107     nr_matrix_set_identity(&shape->cached_fctm);
108     nr_matrix_set_identity(&shape->cached_sctm);
110     shape->markers = NULL;
113 static void
114 nr_arena_shape_finalize(NRObject *object)
116     NRArenaShape *shape = (NRArenaShape *) object;
118     if (shape->fill_shp) delete shape->fill_shp;
119     if (shape->stroke_shp) delete shape->stroke_shp;
120     if (shape->cached_fill) delete shape->cached_fill;
121     if (shape->cached_stroke) delete shape->cached_stroke;
122     if (shape->fill_painter) sp_painter_free(shape->fill_painter);
123     if (shape->stroke_painter) sp_painter_free(shape->stroke_painter);
125     if (shape->style) sp_style_unref(shape->style);
126     if (shape->curve) sp_curve_unref(shape->curve);
128     ((NRObjectClass *) shape_parent_class)->finalize(object);
131 static NRArenaItem *
132 nr_arena_shape_children(NRArenaItem *item)
134     NRArenaShape *shape = (NRArenaShape *) item;
136     return shape->markers;
139 static void
140 nr_arena_shape_add_child(NRArenaItem *item, NRArenaItem *child, NRArenaItem *ref)
142     NRArenaShape *shape = (NRArenaShape *) item;
144     if (!ref) {
145         shape->markers = nr_arena_item_attach_ref(item, child, NULL, shape->markers);
146     } else {
147         ref->next = nr_arena_item_attach_ref(item, child, ref, ref->next);
148     }
150     nr_arena_item_request_update(item, NR_ARENA_ITEM_STATE_ALL, FALSE);
153 static void
154 nr_arena_shape_remove_child(NRArenaItem *item, NRArenaItem *child)
156     NRArenaShape *shape = (NRArenaShape *) item;
158     if (child->prev) {
159         nr_arena_item_detach_unref(item, child);
160     } else {
161         shape->markers = nr_arena_item_detach_unref(item, child);
162     }
164     nr_arena_item_request_update(item, NR_ARENA_ITEM_STATE_ALL, FALSE);
167 static void
168 nr_arena_shape_set_child_position(NRArenaItem *item, NRArenaItem *child, NRArenaItem *ref)
170     NRArenaShape *shape = (NRArenaShape *) item;
172     if (child->prev) {
173         nr_arena_item_detach_unref(item, child);
174     } else {
175         shape->markers = nr_arena_item_detach_unref(item, child);
176     }
178     if (!ref) {
179         shape->markers = nr_arena_item_attach_ref(item, child, NULL, shape->markers);
180     } else {
181         ref->next = nr_arena_item_attach_ref(item, child, ref, ref->next);
182     }
184     nr_arena_item_request_render(child);
187 void nr_arena_shape_update_stroke(NRArenaShape *shape,NRGC* gc);
188 void nr_arena_shape_update_fill(NRArenaShape *shape, NRGC *gc, bool force_shape = false);
189 void nr_arena_shape_add_bboxes(NRArenaShape* shape,NRRect &bbox);
191 static guint
192 nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, guint reset)
194     NRRect bbox;
196     NRArenaShape *shape = NR_ARENA_SHAPE(item);
198     unsigned int beststate = NR_ARENA_ITEM_STATE_ALL;
200     unsigned int newstate;
201     for (NRArenaItem *child = shape->markers; child != NULL; child = child->next) {
202         newstate = nr_arena_item_invoke_update(child, area, gc, state, reset);
203         beststate = beststate & newstate;
204     }
206     if (!(state & NR_ARENA_ITEM_STATE_RENDER)) {
207         /* We do not have to create rendering structures */
208         shape->ctm = gc->transform;
209         if (state & NR_ARENA_ITEM_STATE_BBOX) {
210             if (shape->curve) {
211                 NRBPath bp;
212                 /* fixme: */
213                 bbox.x0 = bbox.y0 = NR_HUGE;
214                 bbox.x1 = bbox.y1 = -NR_HUGE;
215                 bp.path = shape->curve->bpath;
216                 nr_path_matrix_bbox_union(&bp, gc->transform, &bbox);
217                 item->bbox.x0 = (gint32)(bbox.x0 - 1.0F);
218                 item->bbox.y0 = (gint32)(bbox.y0 - 1.0F);
219                 item->bbox.x1 = (gint32)(bbox.x1 + 1.9999F);
220                 item->bbox.y1 = (gint32)(bbox.y1 + 1.9999F);
221             }
222             if (beststate & NR_ARENA_ITEM_STATE_BBOX) {
223                 for (NRArenaItem *child = shape->markers; child != NULL; child = child->next) {
224                     nr_rect_l_union(&item->bbox, &item->bbox, &child->bbox);
225                 }
226             }
227         }
228         return (state | item->state);
229     }
231     shape->delayed_shp=true;
232     shape->ctm = gc->transform;
233     bbox.x0 = bbox.y0 = NR_HUGE;
234     bbox.x1 = bbox.y1 = -NR_HUGE;
236     if (shape->curve) {
237         NRBPath bp;
238         /* fixme: */
239         bbox.x0 = bbox.y0 = NR_HUGE;
240         bbox.x1 = bbox.y1 = -NR_HUGE;
241         bp.path = shape->curve->bpath;
242         nr_path_matrix_bbox_union(&bp, gc->transform, &bbox);
243         if (shape->_stroke.paint.type() != NRArenaShape::Paint::NONE) {
244             float width, scale;
245             scale = NR_MATRIX_DF_EXPANSION(&gc->transform);
246             width = MAX(0.125, shape->_stroke.width * scale);
247             if ( fabs(shape->_stroke.width * scale) > 0.01 ) { // sinon c'est 0=oon veut pas de bord
248                 bbox.x0-=width;
249                 bbox.x1+=width;
250                 bbox.y0-=width;
251                 bbox.y1+=width;
252             }
253             // those pesky miters, now
254             float miterMax=width*shape->_stroke.mitre_limit;
255             if ( miterMax > 0.01 ) {
256                 // grunt mode. we should compute the various miters instead (one for each point on the curve)
257                 bbox.x0-=miterMax;
258                 bbox.x1+=miterMax;
259                 bbox.y0-=miterMax;
260                 bbox.y1+=miterMax;
261             }
262         }
263     } else {
264     }
265     shape->approx_bbox.x0 = (gint32)(bbox.x0 - 1.0F);
266     shape->approx_bbox.y0 = (gint32)(bbox.y0 - 1.0F);
267     shape->approx_bbox.x1 = (gint32)(bbox.x1 + 1.9999F);
268     shape->approx_bbox.y1 = (gint32)(bbox.y1 + 1.9999F);
269     if ( area && nr_rect_l_test_intersect(area, &shape->approx_bbox) ) shape->delayed_shp=false;
271     /* Release state data */
272     if (TRUE || !nr_matrix_test_transform_equal(&gc->transform, &shape->ctm, NR_EPSILON)) {
273         /* Concept test */
274         if (shape->fill_shp) {
275             delete shape->fill_shp;
276             shape->fill_shp = NULL;
277         }
278     }
279     if (shape->stroke_shp) {
280         delete shape->stroke_shp;
281         shape->stroke_shp = NULL;
282     }
283     if (shape->fill_painter) {
284         sp_painter_free(shape->fill_painter);
285         shape->fill_painter = NULL;
286     }
287     if (shape->stroke_painter) {
288         sp_painter_free(shape->stroke_painter);
289         shape->stroke_painter = NULL;
290     }
292     if (!shape->curve || !shape->style) return NR_ARENA_ITEM_STATE_ALL;
293     if (sp_curve_is_empty(shape->curve)) return NR_ARENA_ITEM_STATE_ALL;
294     if ( ( shape->_fill.paint.type() == NRArenaShape::Paint::NONE ) &&
295          ( shape->_stroke.paint.type() == NRArenaShape::Paint::NONE ) )
296     {
297         return NR_ARENA_ITEM_STATE_ALL;
298     }
300     /* Build state data */
301     if ( shape->delayed_shp ) {
302         item->bbox=shape->approx_bbox;
303     } else {
304         nr_arena_shape_update_stroke(shape,gc);
305         nr_arena_shape_update_fill(shape,gc);
307         bbox.x0 = bbox.y0 = bbox.x1 = bbox.y1 = 0.0;
308         nr_arena_shape_add_bboxes(shape,bbox);
310         shape->approx_bbox.x0 = (gint32)(bbox.x0 - 1.0F);
311         shape->approx_bbox.y0 = (gint32)(bbox.y0 - 1.0F);
312         shape->approx_bbox.x1 = (gint32)(bbox.x1 + 1.9999F);
313         shape->approx_bbox.y1 = (gint32)(bbox.y1 + 1.9999F);
314     }
316     if (nr_rect_d_test_empty(&bbox)) return NR_ARENA_ITEM_STATE_ALL;
318     item->bbox.x0 = (gint32)(bbox.x0 - 1.0F);
319     item->bbox.y0 = (gint32)(bbox.y0 - 1.0F);
320     item->bbox.x1 = (gint32)(bbox.x1 + 1.0F);
321     item->bbox.y1 = (gint32)(bbox.y1 + 1.0F);
322     nr_arena_request_render_rect(item->arena, &item->bbox);
324     item->render_opacity = TRUE;
325     if ( shape->_fill.paint.type() == NRArenaShape::Paint::SERVER ) {
326         if (gc && gc->parent) {
327             shape->fill_painter = sp_paint_server_painter_new(shape->_fill.paint.server(),
328                                                               NR::Matrix(&gc->transform), NR::Matrix(&gc->parent->transform),
329                                                               &shape->paintbox);
330         }
331         item->render_opacity = FALSE;
332     }
333     if ( shape->_stroke.paint.type() == NRArenaShape::Paint::SERVER ) {
334         if (gc && gc->parent) {
335             shape->stroke_painter = sp_paint_server_painter_new(shape->_stroke.paint.server(),
336                                                                 NR::Matrix(&gc->transform), NR::Matrix(&gc->parent->transform),
337                                                                 &shape->paintbox);
338         }
339         item->render_opacity = FALSE;
340     }
341     if ( item->render_opacity == TRUE
342          && shape->_fill.paint.type()   != NRArenaShape::Paint::NONE
343          && shape->_stroke.paint.type() != NRArenaShape::Paint::NONE )
344     {
345         // don't merge item opacity with paint opacity if there is a stroke on the fill
346         item->render_opacity = FALSE;
347     }
349     if (beststate & NR_ARENA_ITEM_STATE_BBOX) {
350         for (NRArenaItem *child = shape->markers; child != NULL; child = child->next) {
351             nr_rect_l_union(&item->bbox, &item->bbox, &child->bbox);
352         }
353     }
355     return NR_ARENA_ITEM_STATE_ALL;
358 int matrix_is_isometry(NR::Matrix p) {
359     NR::Matrix   tp;
360     // transposition
361     tp[0]=p[0];
362     tp[1]=p[2];
363     tp[2]=p[1];
364     tp[3]=p[3];
365     for (int i = 4; i < 6; i++) // shut valgrind up :)
366         tp[i] = p[i] = 0;
367     NR::Matrix   isom = tp*p; // A^T * A = adjunct?
368     // Is the adjunct nearly an identity function?
369     if (isom.is_translation(0.01)) {
370         // the transformation is an isometry -> no need to recompute
371         // the uncrossed polygon
372         if ( p.det() < 0 )
373             return -1;
374         else
375             return 1;
376     }
377     return 0;
380 /** force_shape is used for clipping paths, when we need the shape for clipping even if it's not filled */
381 void
382 nr_arena_shape_update_fill(NRArenaShape *shape, NRGC *gc, bool force_shape)
384     shape->delayed_shp = false;
385     if ((shape->_fill.paint.type() != NRArenaShape::Paint::NONE || force_shape) &&
386         ((shape->curve->end > 2) || (shape->curve->bpath[1].code == NR_CURVETO)) ) {
387         if (TRUE || !shape->fill_shp) {
388             NR::Matrix  cached_to_new;
389             int isometry = 0;
390             if ( shape->cached_fill ) {
391                 cached_to_new = shape->cached_fctm.inverse()*gc->transform;
392                 isometry = matrix_is_isometry(cached_to_new);
393             }
394             if ( isometry == 0 ) {
395                 if ( shape->cached_fill == NULL ) shape->cached_fill=new Shape;
396                 shape->cached_fill->Reset();
398                 Path*  thePath=new Path;
399                 Shape* theShape=new Shape;
400                 {
401                     NR::Matrix   tempMat(gc->transform);
402                     thePath->LoadArtBPath(shape->curve->bpath,tempMat,true);
403                 }
405                 thePath->Convert(1.0);
407                 thePath->Fill(theShape, 0);
409                 if ( shape->_fill.rule == NRArenaShape::EVEN_ODD ) {
410                     shape->cached_fill->ConvertToShape(theShape, fill_oddEven);
411                     // alternatively, this speeds up rendering of oddeven shapes but disables AA :(
412                     //shape->cached_fill->Copy(theShape);
413                 } else {
414                     shape->cached_fill->ConvertToShape(theShape, fill_nonZero);
415                 }
416                 shape->cached_fctm=gc->transform;
417                 delete theShape;
418                 delete thePath;
419                 if ( shape->fill_shp == NULL )
420                     shape->fill_shp = new Shape;
422                 shape->fill_shp->Copy(shape->cached_fill);
424             } else {
426                 if ( shape->fill_shp == NULL )
427                     shape->fill_shp = new Shape;
429                 shape->fill_shp->Reset(shape->cached_fill->numberOfPoints(),
430                                        shape->cached_fill->numberOfEdges());
431                 for (int i = 0; i < shape->cached_fill->numberOfPoints(); i++)
432                     shape->fill_shp->AddPoint(shape->cached_fill->getPoint(i).x * cached_to_new);
433                 if ( isometry == 1 ) {
434                     for (int i = 0; i < shape->cached_fill->numberOfEdges(); i++)
435                         shape->fill_shp->AddEdge(shape->cached_fill->getEdge(i).st,
436                                                  shape->cached_fill->getEdge(i).en);
437                 } else if ( isometry == -1 ) { // need to flip poly.
438                     for (int i = 0; i < shape->cached_fill->numberOfEdges(); i++)
439                         shape->fill_shp->AddEdge(shape->cached_fill->getEdge(i).en,
440                                                  shape->cached_fill->getEdge(i).st);
441                 }
442                 shape->fill_shp->ForceToPolygon();
443                 shape->fill_shp->needPointsSorting();
444                 shape->fill_shp->needEdgesSorting();
445             }
446         }
447     }
450 void
451 nr_arena_shape_update_stroke(NRArenaShape *shape,NRGC* gc)
453     SPStyle* style = shape->style;
455     shape->delayed_shp = false;
457     float const scale = NR_MATRIX_DF_EXPANSION(&gc->transform);
459     if (NR_ARENA_ITEM(shape)->arena->rendermode == RENDERMODE_OUTLINE ||
460         ((shape->_stroke.paint.type() != NRArenaShape::Paint::NONE) &&
461          ( fabs(shape->_stroke.width * scale) > 0.01 ))) { // sinon c'est 0=oon veut pas de bord
463         float width = MAX(0.125, shape->_stroke.width * scale);
464         if (NR_ARENA_ITEM(shape)->arena->rendermode == RENDERMODE_OUTLINE)
465             width = 0.5; // 1 pixel wide, independent of zoom
467         NR::Matrix cached_to_new;
469         int isometry = 0;
470         if ( shape->cached_stroke ) {
471             cached_to_new = shape->cached_sctm.inverse() * gc->transform;
472             isometry = matrix_is_isometry(cached_to_new);
473         }
475         if ( isometry == 0 ) {
476             if ( shape->cached_stroke == NULL ) shape->cached_stroke=new Shape;
477             shape->cached_stroke->Reset();
478             Path*  thePath = new Path;
479             Shape* theShape = new Shape;
480             {
481                 NR::Matrix   tempMat(gc->transform);
482                 thePath->LoadArtBPath(shape->curve->bpath, tempMat, true);
483             }
485             if (NR_ARENA_ITEM(shape)->arena->rendermode != RENDERMODE_OUTLINE)
486                 thePath->Convert(1.0);
487             else
488                 thePath->Convert(4.0); // slightly rougher & faster
490             if (style->stroke_dash.n_dash && NR_ARENA_ITEM(shape)->arena->rendermode != RENDERMODE_OUTLINE) {
491                 double dlen = 0.0;
492                 for (int i = 0; i < style->stroke_dash.n_dash; i++) {
493                     dlen += style->stroke_dash.dash[i] * scale;
494                 }
495                 if (dlen >= 1.0) {
496                     NRVpathDash dash;
497                     dash.offset = style->stroke_dash.offset * scale;
498                     dash.n_dash = style->stroke_dash.n_dash;
499                     dash.dash = g_new(double, dash.n_dash);
500                     for (int i = 0; i < dash.n_dash; i++) {
501                         dash.dash[i] = style->stroke_dash.dash[i] * scale;
502                     }
503                     int    nbD=dash.n_dash;
504                     float  *dashs=(float*)malloc((nbD+1)*sizeof(float));
505                     while ( dash.offset >= dlen ) dash.offset-=dlen;
506                     dashs[0]=dash.dash[0];
507                     for (int i=1; i<nbD; i++) {
508                         dashs[i]=dashs[i-1]+dash.dash[i];
509                     }
510                     // modulo dlen
511                     thePath->DashPolyline(0.0,0.0,dlen,nbD,dashs,true,dash.offset);
512                     free(dashs);
513                     g_free(dash.dash);
514                 }
515             }
516             ButtType butt=butt_straight;
517             switch (shape->_stroke.cap) {
518                 case NRArenaShape::BUTT_CAP:
519                     butt = butt_straight;
520                     break;
521                 case NRArenaShape::ROUND_CAP:
522                     butt = butt_round;
523                     break;
524                 case NRArenaShape::SQUARE_CAP:
525                     butt = butt_square;
526                     break;
527             }
528             JoinType join=join_straight;
529             switch (shape->_stroke.join) {
530                 case NRArenaShape::MITRE_JOIN:
531                     join = join_pointy;
532                     break;
533                 case NRArenaShape::ROUND_JOIN:
534                     join = join_round;
535                     break;
536                 case NRArenaShape::BEVEL_JOIN:
537                     join = join_straight;
538                     break;
539             }
541             if (NR_ARENA_ITEM(shape)->arena->rendermode == RENDERMODE_OUTLINE) {
542                 butt = butt_straight;
543                 join = join_straight;
544             }
546             thePath->Stroke(theShape, false, 0.5*width, join, butt,
547                             0.5*width*shape->_stroke.mitre_limit);
550             if (NR_ARENA_ITEM(shape)->arena->rendermode == RENDERMODE_OUTLINE) {
551                 // speeds it up, but uses evenodd for the stroke shape (which does not matter for 1-pixel wide outline)
552                 shape->cached_stroke->Copy(theShape);
553             } else {
554                 shape->cached_stroke->ConvertToShape(theShape, fill_nonZero);
555             }
557             shape->cached_sctm=gc->transform;
558             delete thePath;
559             delete theShape;
560             if ( shape->stroke_shp == NULL ) shape->stroke_shp=new Shape;
562             shape->stroke_shp->Copy(shape->cached_stroke);
564         } else {
566             if ( shape->stroke_shp == NULL )
567                 shape->stroke_shp=new Shape;
568             shape->stroke_shp->Reset(shape->cached_stroke->numberOfPoints(), shape->cached_stroke->numberOfEdges());
569             for (int i = 0; i < shape->cached_stroke->numberOfPoints(); i++)
570                 shape->stroke_shp->AddPoint(shape->cached_stroke->getPoint(i).x * cached_to_new);
571             if ( isometry == 1 ) {
572                 for (int i = 0; i < shape->cached_stroke->numberOfEdges(); i++)
573                     shape->stroke_shp->AddEdge(shape->cached_stroke->getEdge(i).st,
574                                                shape->cached_stroke->getEdge(i).en);
575             } else if ( isometry == -1 ) {
576                 for (int i = 0; i < shape->cached_stroke->numberOfEdges(); i++)
577                     shape->stroke_shp->AddEdge(shape->cached_stroke->getEdge(i).en,
578                                                shape->cached_stroke->getEdge(i).st);
579             }
580             shape->stroke_shp->ForceToPolygon();
581             shape->stroke_shp->needPointsSorting();
582             shape->stroke_shp->needEdgesSorting();
583         }
584     }
588 void
589 nr_arena_shape_add_bboxes(NRArenaShape* shape, NRRect &bbox)
591     if ( shape->stroke_shp ) {
592         shape->stroke_shp->CalcBBox();
593         shape->stroke_shp->leftX=floor(shape->stroke_shp->leftX);
594         shape->stroke_shp->rightX=ceil(shape->stroke_shp->rightX);
595         shape->stroke_shp->topY=floor(shape->stroke_shp->topY);
596         shape->stroke_shp->bottomY=ceil(shape->stroke_shp->bottomY);
597         if ( bbox.x0 >= bbox.x1 ) {
598             if ( shape->stroke_shp->leftX < shape->stroke_shp->rightX ) {
599                 bbox.x0=shape->stroke_shp->leftX;
600                 bbox.x1=shape->stroke_shp->rightX;
601             }
602         } else {
603             if ( shape->stroke_shp->leftX < bbox.x0 )
604                 bbox.x0=shape->stroke_shp->leftX;
605             if ( shape->stroke_shp->rightX > bbox.x1 )
606                 bbox.x1=shape->stroke_shp->rightX;
607         }
608         if ( bbox.y0 >= bbox.y1 ) {
609             if ( shape->stroke_shp->topY < shape->stroke_shp->bottomY ) {
610                 bbox.y0=shape->stroke_shp->topY;
611                 bbox.y1=shape->stroke_shp->bottomY;
612             }
613         } else {
614             if ( shape->stroke_shp->topY < bbox.y0 )
615                 bbox.y0=shape->stroke_shp->topY;
616             if ( shape->stroke_shp->bottomY > bbox.y1 )
617                 bbox.y1=shape->stroke_shp->bottomY;
618         }
619     }
620     if ( shape->fill_shp ) {
621         shape->fill_shp->CalcBBox();
622         shape->fill_shp->leftX=floor(shape->fill_shp->leftX);
623         shape->fill_shp->rightX=ceil(shape->fill_shp->rightX);
624         shape->fill_shp->topY=floor(shape->fill_shp->topY);
625         shape->fill_shp->bottomY=ceil(shape->fill_shp->bottomY);
626         if ( bbox.x0 >= bbox.x1 ) {
627             if ( shape->fill_shp->leftX < shape->fill_shp->rightX ) {
628                 bbox.x0=shape->fill_shp->leftX;
629                 bbox.x1=shape->fill_shp->rightX;
630             }
631         } else {
632             if ( shape->fill_shp->leftX < bbox.x0 ) bbox.x0=shape->fill_shp->leftX;
633             if ( shape->fill_shp->rightX > bbox.x1 ) bbox.x1=shape->fill_shp->rightX;
634         }
635         if ( bbox.y0 >= bbox.y1 ) {
636             if ( shape->fill_shp->topY < shape->fill_shp->bottomY ) {
637                 bbox.y0=shape->fill_shp->topY;
638                 bbox.y1=shape->fill_shp->bottomY;
639             }
640         } else {
641             if ( shape->fill_shp->topY < bbox.y0 ) bbox.y0=shape->fill_shp->topY;
642             if ( shape->fill_shp->bottomY > bbox.y1 ) bbox.y1=shape->fill_shp->bottomY;
643         }
644     }
646 static unsigned int
647 nr_arena_shape_render(NRArenaItem *item, NRRectL *area, NRPixBlock *pb, unsigned int flags)
649     NRArenaShape *shape = NR_ARENA_SHAPE(item);
651     if (!shape->curve) return item->state;
652     if (!shape->style) return item->state;
654     if ( shape->delayed_shp ) {
655         if ( nr_rect_l_test_intersect(area, &item->bbox) ) {
656             NRGC   tempGC(NULL);
657             tempGC.transform=shape->ctm;
658             nr_arena_shape_update_stroke(shape,&tempGC);
659             nr_arena_shape_update_fill(shape,&tempGC);
660 /*      NRRect bbox;
661         bbox.x0 = bbox.y0 = bbox.x1 = bbox.y1 = 0.0;
662         nr_arena_shape_add_bboxes(shape,bbox);
663         item->bbox.x0 = (gint32)(bbox.x0 - 1.0F);
664         item->bbox.y0 = (gint32)(bbox.y0 - 1.0F);
665         item->bbox.x1 = (gint32)(bbox.x1 + 1.0F);
666         item->bbox.y1 = (gint32)(bbox.y1 + 1.0F);
667         shape->approx_bbox=item->bbox;*/
668         }
669     }
671     SPStyle const *style = shape->style;
672     if ( shape->fill_shp && NR_ARENA_ITEM(shape)->arena->rendermode != RENDERMODE_OUTLINE) {
673         NRPixBlock m;
674         guint32 rgba;
676         nr_pixblock_setup_fast(&m, NR_PIXBLOCK_MODE_A8, area->x0, area->y0, area->x1, area->y1, TRUE);
677         nr_pixblock_render_shape_mask_or(m,shape->fill_shp);
678         m.empty = FALSE;
680         if (shape->_fill.paint.type() == NRArenaShape::Paint::NONE) {
681             // do not render fill in any way
682         } else if (shape->_fill.paint.type() == NRArenaShape::Paint::COLOR) {
683             if ( item->render_opacity ) {
684                 rgba = sp_color_get_rgba32_falpha(&shape->_fill.paint.color(),
685                                                   shape->_fill.opacity *
686                                                   SP_SCALE24_TO_FLOAT(style->opacity.value));
687             } else {
688                 rgba = sp_color_get_rgba32_falpha(&shape->_fill.paint.color(),
689                                                   shape->_fill.opacity);
690             }
691             nr_blit_pixblock_mask_rgba32(pb, &m, rgba);
692             pb->empty = FALSE;
693         } else if (shape->_fill.paint.type() == NRArenaShape::Paint::SERVER) {
694             if (shape->fill_painter) {
695                 nr_arena_render_paintserver_fill(pb, area, shape->fill_painter, shape->_fill.opacity, &m);
696             }
697         }
699         nr_pixblock_release(&m);
700     }
702     if ( shape->stroke_shp ) {
703         NRPixBlock m;
704         guint32 rgba;
706         nr_pixblock_setup_fast(&m, NR_PIXBLOCK_MODE_A8, area->x0, area->y0, area->x1, area->y1, TRUE);
707         nr_pixblock_render_shape_mask_or(m, shape->stroke_shp);
708         m.empty = FALSE;
710         if (shape->_stroke.paint.type() == NRArenaShape::Paint::COLOR ||
711             NR_ARENA_ITEM(shape)->arena->rendermode == RENDERMODE_OUTLINE) {
712             if ( NR_ARENA_ITEM(shape)->arena->rendermode == RENDERMODE_OUTLINE) {
713                 rgba = NR_ARENA_ITEM(shape)->arena->outlinecolor;
714             } else if ( item->render_opacity ) {
715                 rgba = sp_color_get_rgba32_falpha(&shape->_stroke.paint.color(),
716                                                   shape->_stroke.opacity *
717                                                   SP_SCALE24_TO_FLOAT(style->opacity.value));
718             } else {
719                 rgba = sp_color_get_rgba32_falpha(&shape->_stroke.paint.color(),
720                                                   shape->_stroke.opacity);
721             }
722             nr_blit_pixblock_mask_rgba32(pb, &m, rgba);
723             pb->empty = FALSE;
724         } else if (shape->_stroke.paint.type() == NRArenaShape::Paint::SERVER) {
725             if (shape->stroke_painter) {
726                 nr_arena_render_paintserver_fill(pb, area, shape->stroke_painter, shape->_stroke.opacity, &m);
727             }
728         }
730         nr_pixblock_release(&m);
731     }
733     /* Just compose children into parent buffer */
734     for (NRArenaItem *child = shape->markers; child != NULL; child = child->next) {
735         unsigned int ret;
736         ret = nr_arena_item_invoke_render(child, area, pb, flags);
737         if (ret & NR_ARENA_ITEM_STATE_INVALID) return ret;
738     }
740     return item->state;
743 static guint
744 nr_arena_shape_clip(NRArenaItem *item, NRRectL *area, NRPixBlock *pb)
746     NRArenaShape *shape = NR_ARENA_SHAPE(item);
747     if (!shape->curve) return item->state;
749     if ( shape->delayed_shp || shape->fill_shp == NULL) { // we need a fill shape no matter what
750         if ( nr_rect_l_test_intersect(area, &item->bbox) ) {
751             NRGC   tempGC(NULL);
752             tempGC.transform=shape->ctm;
753             nr_arena_shape_update_fill(shape, &tempGC, true);
754         }
755     }
757     if ( shape->fill_shp ) {
758         NRPixBlock m;
760         /* fixme: We can OR in one step (Lauris) */
761         nr_pixblock_setup_fast(&m, NR_PIXBLOCK_MODE_A8, area->x0, area->y0, area->x1, area->y1, TRUE);
762         nr_pixblock_render_shape_mask_or(m,shape->fill_shp);
764         for (int y = area->y0; y < area->y1; y++) {
765             unsigned char *s, *d;
766             s = NR_PIXBLOCK_PX(&m) + (y - area->y0) * m.rs;
767             d = NR_PIXBLOCK_PX(pb) + (y - area->y0) * pb->rs;
768             for (int x = area->x0; x < area->x1; x++) {
769                 *d = NR_A7_NORMALIZED(*s,*d);
770                 d ++;
771                 s ++;
772             }
773         }
774         nr_pixblock_release(&m);
775         pb->empty = FALSE;
776     }
778     return item->state;
781 static NRArenaItem *
782 nr_arena_shape_pick(NRArenaItem *item, NR::Point p, double delta, unsigned int /*sticky*/)
784     NRArenaShape *shape = NR_ARENA_SHAPE(item);
786     if (!shape->curve) return NULL;
787     if (!shape->style) return NULL;
788     if ( shape->delayed_shp ) {
789         NRRectL  area;
790         area.x0=(int)floor(p[NR::X]);
791         area.x1=(int)ceil(p[NR::X]);
792         area.y0=(int)floor(p[NR::Y]);
793         area.y1=(int)ceil(p[NR::Y]);
794         int idelta = (int)ceil(delta) + 1;
795         // njh: inset rect
796         area.x0-=idelta;
797         area.x1+=idelta;
798         area.y0-=idelta;
799         area.y1+=idelta;
800         if ( nr_rect_l_test_intersect(&area, &item->bbox) ) {
801             NRGC   tempGC(NULL);
802             tempGC.transform=shape->ctm;
803             nr_arena_shape_update_stroke(shape,&tempGC);
804             nr_arena_shape_update_fill(shape,&tempGC);
805             /*      NRRect bbox;
806                     bbox.x0 = bbox.y0 = bbox.x1 = bbox.y1 = 0.0;
807                     nr_arena_shape_add_bboxes(shape,bbox);
808                     item->bbox.x0 = (gint32)(bbox.x0 - 1.0F);
809                     item->bbox.y0 = (gint32)(bbox.y0 - 1.0F);
810                     item->bbox.x1 = (gint32)(bbox.x1 + 1.0F);
811                     item->bbox.y1 = (gint32)(bbox.y1 + 1.0F);
812                     shape->approx_bbox=item->bbox;*/
813         }
814     }
816     if (item->state & NR_ARENA_ITEM_STATE_RENDER) {
817         if (shape->fill_shp && (shape->_fill.paint.type() != NRArenaShape::Paint::NONE)) {
818             if (shape->fill_shp->PtWinding(p) > 0 ) return item;
819         }
820         if (shape->stroke_shp && (shape->_stroke.paint.type() != NRArenaShape::Paint::NONE)) {
821             if (shape->stroke_shp->PtWinding(p) > 0 ) return item;
822         }
823         if (delta > 1e-3) {
824             if (shape->fill_shp && (shape->_fill.paint.type() != NRArenaShape::Paint::NONE)) {
825                 if (distanceLessThanOrEqual(shape->fill_shp, p, delta)) return item;
826             }
827             if (shape->stroke_shp && (shape->_stroke.paint.type() != NRArenaShape::Paint::NONE)) {
828                 if (distanceLessThanOrEqual(shape->stroke_shp, p, delta)) return item;
829             }
830         }
831     } else {
832         NRBPath bp;
833         bp.path = shape->curve->bpath;
834         double dist = NR_HUGE;
835         int wind = 0;
836         nr_path_matrix_point_bbox_wind_distance(&bp, shape->ctm, p, NULL, &wind, &dist, NR_EPSILON);
837         if (shape->_fill.paint.type() != NRArenaShape::Paint::NONE) {
838             if (!shape->style->fill_rule.computed) {
839                 if (wind != 0) return item;
840             } else {
841                 if (wind & 0x1) return item;
842             }
843         }
844         if (shape->_stroke.paint.type() != NRArenaShape::Paint::NONE) {
845             /* fixme: We do not take stroke width into account here (Lauris) */
846             if (dist < delta) return item;
847         }
848     }
850     return NULL;
853 /**
854  *
855  *  Requests a render of the shape, then if the shape is already a curve it
856  *  unrefs the old curve; if the new curve is valid it creates a copy of the
857  *  curve and adds it to the shape.  Finally, it requests an update of the
858  *  arena for the shape.
859  */
860 void nr_arena_shape_set_path(NRArenaShape *shape, SPCurve *curve,bool justTrans)
862     g_return_if_fail(shape != NULL);
863     g_return_if_fail(NR_IS_ARENA_SHAPE(shape));
865     if ( justTrans == false ) {
866         // dirty cached versions
867         if ( shape->cached_fill ) {
868             delete shape->cached_fill;
869             shape->cached_fill=NULL;
870         }
871         if ( shape->cached_stroke ) {
872             delete shape->cached_stroke;
873             shape->cached_stroke=NULL;
874         }
875     }
877     nr_arena_item_request_render(NR_ARENA_ITEM(shape));
879     if (shape->curve) {
880         sp_curve_unref(shape->curve);
881         shape->curve = NULL;
882     }
884     if (curve) {
885         shape->curve = curve;
886         sp_curve_ref(curve);
887     }
889     nr_arena_item_request_update(NR_ARENA_ITEM(shape), NR_ARENA_ITEM_STATE_ALL, FALSE);
892 void NRArenaShape::setFill(SPPaintServer *server) {
893     _fill.paint.set(server);
894     _invalidateCachedFill();
897 void NRArenaShape::setFill(SPColor const &color) {
898     _fill.paint.set(color);
899     _invalidateCachedFill();
902 void NRArenaShape::setFillOpacity(double opacity) {
903     _fill.opacity = opacity;
904     _invalidateCachedFill();
907 void NRArenaShape::setFillRule(NRArenaShape::FillRule rule) {
908     _fill.rule = rule;
909     _invalidateCachedFill();
912 void NRArenaShape::setStroke(SPPaintServer *server) {
913     _stroke.paint.set(server);
914     _invalidateCachedStroke();
917 void NRArenaShape::setStroke(SPColor const &color) {
918     _stroke.paint.set(color);
919     _invalidateCachedStroke();
922 void NRArenaShape::setStrokeOpacity(double opacity) {
923     _stroke.opacity = opacity;
924     _invalidateCachedStroke();
927 void NRArenaShape::setStrokeWidth(double width) {
928     _stroke.width = width;
929     _invalidateCachedStroke();
932 void NRArenaShape::setMitreLimit(double limit) {
933     _stroke.mitre_limit = limit;
934     _invalidateCachedStroke();
937 void NRArenaShape::setLineCap(NRArenaShape::CapType cap) {
938     _stroke.cap = cap;
939     _invalidateCachedStroke();
942 void NRArenaShape::setLineJoin(NRArenaShape::JoinType join) {
943     _stroke.join = join;
944     _invalidateCachedStroke();
947 /** nr_arena_shape_set_style
948  *
949  * Unrefs any existing style and ref's to the given one, then requests an update of the arena
950  */
951 void
952 nr_arena_shape_set_style(NRArenaShape *shape, SPStyle *style)
954     g_return_if_fail(shape != NULL);
955     g_return_if_fail(NR_IS_ARENA_SHAPE(shape));
957     if (style) sp_style_ref(style);
958     if (shape->style) sp_style_unref(shape->style);
959     shape->style = style;
961     switch (style->fill.type) {
962         case SP_PAINT_TYPE_NONE: {
963             shape->setFill(NULL);
964             break;
965         }
966         case SP_PAINT_TYPE_COLOR: {
967             shape->setFill(style->fill.value.color);
968             break;
969         }
970         case SP_PAINT_TYPE_PAINTSERVER: {
971             shape->setFill(style->fill.value.paint.server);
972             break;
973         }
974         default: {
975             g_assert_not_reached();
976         }
977     }
978     shape->setFillOpacity(SP_SCALE24_TO_FLOAT(style->fill_opacity.value));
979     switch (style->fill_rule.computed) {
980         case SP_WIND_RULE_EVENODD: {
981             shape->setFillRule(NRArenaShape::EVEN_ODD);
982             break;
983         }
984         case SP_WIND_RULE_NONZERO: {
985             shape->setFillRule(NRArenaShape::NONZERO);
986             break;
987         }
988         default: {
989             g_assert_not_reached();
990         }
991     }
993     switch (style->stroke.type) {
994         case SP_PAINT_TYPE_NONE: {
995             shape->setStroke(NULL);
996             break;
997         }
998         case SP_PAINT_TYPE_COLOR: {
999             shape->setStroke(style->stroke.value.color);
1000             break;
1001         }
1002         case SP_PAINT_TYPE_PAINTSERVER: {
1003             shape->setStroke(style->stroke.value.paint.server);
1004             break;
1005         }
1006         default: {
1007             g_assert_not_reached();
1008         }
1009     }
1010     shape->setStrokeWidth(style->stroke_width.computed);
1011     shape->setStrokeOpacity(SP_SCALE24_TO_FLOAT(style->stroke_opacity.value));
1012     switch (style->stroke_linecap.computed) {
1013         case SP_STROKE_LINECAP_ROUND: {
1014             shape->setLineCap(NRArenaShape::ROUND_CAP);
1015             break;
1016         }
1017         case SP_STROKE_LINECAP_SQUARE: {
1018             shape->setLineCap(NRArenaShape::SQUARE_CAP);
1019             break;
1020         }
1021         case SP_STROKE_LINECAP_BUTT: {
1022             shape->setLineCap(NRArenaShape::BUTT_CAP);
1023             break;
1024         }
1025         default: {
1026             g_assert_not_reached();
1027         }
1028     }
1029     switch (style->stroke_linejoin.computed) {
1030         case SP_STROKE_LINEJOIN_ROUND: {
1031             shape->setLineJoin(NRArenaShape::ROUND_JOIN);
1032             break;
1033         }
1034         case SP_STROKE_LINEJOIN_BEVEL: {
1035             shape->setLineJoin(NRArenaShape::BEVEL_JOIN);
1036             break;
1037         }
1038         case SP_STROKE_LINEJOIN_MITER: {
1039             shape->setLineJoin(NRArenaShape::MITRE_JOIN);
1040             break;
1041         }
1042         default: {
1043             g_assert_not_reached();
1044         }
1045     }
1046     shape->setMitreLimit(style->stroke_miterlimit.value);
1048     nr_arena_item_request_update(shape, NR_ARENA_ITEM_STATE_ALL, FALSE);
1051 void
1052 nr_arena_shape_set_paintbox(NRArenaShape *shape, NRRect const *pbox)
1054     g_return_if_fail(shape != NULL);
1055     g_return_if_fail(NR_IS_ARENA_SHAPE(shape));
1056     g_return_if_fail(pbox != NULL);
1058     if ((pbox->x0 < pbox->x1) && (pbox->y0 < pbox->y1)) {
1059         shape->paintbox = *pbox;
1060     } else {
1061         /* fixme: We kill warning, although not sure what to do here (Lauris) */
1062         shape->paintbox.x0 = shape->paintbox.y0 = 0.0F;
1063         shape->paintbox.x1 = shape->paintbox.y1 = 256.0F;
1064     }
1066     nr_arena_item_request_update(shape, NR_ARENA_ITEM_STATE_ALL, FALSE);
1069 void NRArenaShape::setPaintBox(NR::Rect const &pbox)
1071     paintbox.x0 = pbox.min()[NR::X];
1072     paintbox.y0 = pbox.min()[NR::Y];
1073     paintbox.x1 = pbox.max()[NR::X];
1074     paintbox.y1 = pbox.max()[NR::Y];
1076     nr_arena_item_request_update(this, NR_ARENA_ITEM_STATE_ALL, FALSE);
1079 static void
1080 shape_run_A8_OR(raster_info &dest,void */*data*/,int st,float vst,int en,float ven)
1082     if ( st >= en ) return;
1083     if ( vst < 0 ) vst=0;
1084     if ( vst > 1 ) vst=1;
1085     if ( ven < 0 ) ven=0;
1086     if ( ven > 1 ) ven=1;
1087     float   sv=vst;
1088     float   dv=ven-vst;
1089     int     len=en-st;
1090     unsigned char*   d=(unsigned char*)dest.buffer;
1091     d+=(st-dest.startPix);
1092     if ( fabs(dv) < 0.001 ) {
1093         if ( vst > 0.999 ) {
1094             /* Simple copy */
1095             while (len > 0) {
1096                 d[0] = 255;
1097                 d += 1;
1098                 len -= 1;
1099             }
1100         } else {
1101             sv*=256;
1102             unsigned int c0_24=(int)sv;
1103             c0_24&=0xFF;
1104             while (len > 0) {
1105                 unsigned int da;
1106                 /* Draw */
1107                 da = NR_A7(c0_24,d[0]);
1108                 d[0] = NR_PREMUL_SINGLE(da);
1109                 d += 1;
1110                 len -= 1;
1111             }
1112         }
1113     } else {
1114         if ( en <= st+1 ) {
1115             sv=0.5*(vst+ven);
1116             sv*=256;
1117             unsigned int c0_24=(int)sv;
1118             c0_24&=0xFF;
1119             unsigned int da;
1120             /* Draw */
1121             da = NR_A7(c0_24,d[0]);
1122             d[0] = NR_PREMUL_SINGLE(da);
1123         } else {
1124             dv/=len;
1125             sv+=0.5*dv; // correction trapezoidale
1126             sv*=16777216;
1127             dv*=16777216;
1128             int c0_24 = static_cast<int>(CLAMP(sv, 0, 16777216));
1129             int s0_24 = static_cast<int>(dv);
1130             while (len > 0) {
1131                 unsigned int ca, da;
1132                 /* Draw */
1133                 ca = c0_24 >> 16;
1134                 if ( ca > 255 ) ca=255;
1135                 da = NR_A7(ca,d[0]);
1136                 d[0] = NR_PREMUL_SINGLE(da);
1137                 d += 1;
1138                 c0_24 += s0_24;
1139                 c0_24 = CLAMP(c0_24, 0, 16777216);
1140                 len -= 1;
1141             }
1142         }
1143     }
1146 void nr_pixblock_render_shape_mask_or(NRPixBlock &m,Shape* theS)
1148     theS->CalcBBox();
1149     float l = theS->leftX, r = theS->rightX, t = theS->topY, b = theS->bottomY;
1150     int    il,ir,it,ib;
1151     il=(int)floor(l);
1152     ir=(int)ceil(r);
1153     it=(int)floor(t);
1154     ib=(int)ceil(b);
1156     if ( il >= m.area.x1 || ir <= m.area.x0 || it >= m.area.y1 || ib <= m.area.y0 ) return;
1157     if ( il < m.area.x0 ) il=m.area.x0;
1158     if ( it < m.area.y0 ) it=m.area.y0;
1159     if ( ir > m.area.x1 ) ir=m.area.x1;
1160     if ( ib > m.area.y1 ) ib=m.area.y1;
1162     /* This is the FloatLigne version.  See svn (prior to Apr 2006) for versions using BitLigne or direct BitLigne. */
1163     int    curPt;
1164     float  curY;
1165     theS->BeginQuickRaster(curY, curPt);
1167     FloatLigne *theI = new FloatLigne();
1168     IntLigne *theIL = new IntLigne();
1170     theS->DirectQuickScan(curY, curPt, (float) it, true, 1.0);
1172     char *mdata = (char*)m.data.px;
1173     if ( m.size == NR_PIXBLOCK_SIZE_TINY ) mdata=(char*)m.data.p;
1174     uint32_t *ligStart = ((uint32_t*)(mdata + ((il - m.area.x0) + m.rs * (it - m.area.y0))));
1175     for (int y = it; y < ib; y++) {
1176         theI->Reset();
1177         theS->QuickScan(curY, curPt, ((float)(y+1)), theI, 1.0);
1178         theI->Flatten();
1179         theIL->Copy(theI);
1181         raster_info  dest;
1182         dest.startPix=il;
1183         dest.endPix=ir;
1184         dest.sth=il;
1185         dest.stv=y;
1186         dest.buffer=ligStart;
1187         theIL->Raster(dest, NULL, shape_run_A8_OR);
1188         ligStart=((uint32_t*)(((char*)ligStart)+m.rs));
1189     }
1190     theS->EndQuickRaster();
1191     delete theI;
1192     delete theIL;
1196 /*
1197   Local Variables:
1198   mode:c++
1199   c-file-style:"stroustrup"
1200   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
1201   indent-tabs-mode:nil
1202   fill-column:99
1203   End:
1204 */
1205 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :