changeset 513:6394a1e33b2f Android_Skia

Rewind/reset path and subpath. In previously, only path was reseted for a new path. But, subpath should also be reseted/rewinded for first relative moveto.
author Thinker K.F. Li <thinker@branda.to>
date Tue, 01 Dec 2009 22:55:27 +0800
parents d186d1e24458
children 663d361eb3b8
files src/graph_engine_skia.cpp
diffstat 1 files changed, 16 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/graph_engine_skia.cpp	Tue Dec 01 22:55:27 2009 +0800
+++ b/src/graph_engine_skia.cpp	Tue Dec 01 22:55:27 2009 +0800
@@ -584,7 +584,8 @@
 }
 
 void mbe_new_path(mbe_t *canvas) {
-    canvas->subpath->reset();
+    canvas->subpath->rewind();
+    canvas->path->rewind();
 }
 
 void mbe_curve_to(mbe_t *canvas, co_aix x1, co_aix y1,
@@ -650,7 +651,8 @@
 
     _finish_paint(canvas);
 
-    path->reset();
+    path->rewind();
+    canvas->subpath->rewind();
 }
 
 /*! \brief Create a mbe from a SkCanvas.
@@ -771,7 +773,8 @@
 
 void mbe_fill(mbe_t *canvas) {
     mbe_fill_preserve(canvas);
-    canvas->path->reset();
+    canvas->path->rewind();
+    canvas->subpath->rewind();
 }
 
 void mbe_clip(mbe_t *canvas) {
@@ -779,7 +782,8 @@
 	_update_path(canvas);
     
     canvas->canvas->clipPath(*canvas->path, SkRegion::kIntersect_Op);
-    canvas->path->reset();
+    canvas->path->rewind();
+    canvas->subpath->rewind();
 }
 
 mbe_font_face_t * mbe_query_font_face(const char *family,
@@ -794,24 +798,19 @@
 
 void mbe_copy_source(mbe_t *src, mbe_t *dst) {
     SkPaint *paint = dst->paint;
-    SkShader *shader;
-    SkBitmap *bmap;
+    const SkBitmap *bmap;
     SkXfermode *mode;
 
-    _prepare_paint(dst, SkPaint::kFill_Style);
+    /* _prepare_paint(dst, SkPaint::kFill_Style); */
     mode = SkPorterDuff::CreateXfermode(SkPorterDuff::kSrc_Mode);
     paint->setXfermode(mode);
+    bmap = &src->canvas->getDevice()->accessBitmap(false);
+
+    dst->canvas->drawBitmap(*bmap, 0, 0, paint);
+    
+    paint->reset();
     mode->unref();
-    bmap = &src->canvas->getDevice()->accessBitmap(false);
-    shader = SkShader::CreateBitmapShader(*bmap,
-					  SkShader::kClamp_TileMode ,
-					  SkShader::kClamp_TileMode);
-    paint->setShader(shader);
-    shader->unref();
-
-    dst->canvas->drawPaint(*paint);
-    
-    _finish_paint(canvas);
+    /* _finish_paint(dst); */
 }
 
 void mbe_transform(mbe_t *mbe, co_aix matrix[6]) {