Mercurial > MadButterfly
diff src/graph_engine_skia.cpp @ 586:b42d69ab8857 openvg
Replace mbe_clip() with mbe_scissoring()
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Wed, 30 Jun 2010 13:28:53 +0800 |
parents | 663d361eb3b8 |
children | ac2e6468a22a |
line wrap: on
line diff
--- a/src/graph_engine_skia.cpp Wed Jun 30 09:52:22 2010 +0800 +++ b/src/graph_engine_skia.cpp Wed Jun 30 13:28:53 2010 +0800 @@ -556,7 +556,7 @@ canvas->states->ptn = source; } -void mbe_reset_clip(mbe_t *canvas) { +void mbe_reset_scissoring(mbe_t *canvas) { SkRegion clip; _canvas_device_region(canvas->canvas, &clip); @@ -780,13 +780,23 @@ canvas->subpath->rewind(); } -void mbe_clip(mbe_t *canvas) { - if(!canvas->subpath->isEmpty()) - _update_path(canvas); +void mbe_scissoring(mbe_t *canvas, int n_areas, area_t **areas) { + int i; + area_t *area; + SkPath *path; + + mbe_new_path(canvas); - canvas->canvas->clipPath(*canvas->path, SkRegion::kIntersect_Op); - canvas->path->rewind(); - canvas->subpath->rewind(); + path = canvas->path; + for(i = 0; i < n_areas; i++) { + area = areas[i]; + path->addRect(CO_AIX_2_SKSCALAR(area->x), CO_AIX_2_SKSCALAR(area->y), + CO_AIX_2_SKSCALAR(area->x + area->width), + CO_AIX_2_SKSCALAR(area->y + area->height)); + } + + canvas->canvas->clipPath(*path, SkRegion::kIntersect_Op); + path->rewind(); } mbe_font_face_t * mbe_query_font_face(const char *family,