diff src/graph_engine_skia.cpp @ 479:9a867333018b Android_Skia

mbe_create() and mbe_destroy() pass the compilation. This is the first time that MadButterfly Skia backend can be built without error.
author Thinker K.F. Li <thinker@branda.to>
date Sun, 15 Nov 2009 16:21:09 +0800
parents ba64f928542b
children d38aca825822
line wrap: on
line diff
--- a/src/graph_engine_skia.cpp	Thu Nov 12 21:34:31 2009 +0800
+++ b/src/graph_engine_skia.cpp	Sun Nov 15 16:21:09 2009 +0800
@@ -1,5 +1,5 @@
 #include <stdio.h>
-#include <SkCanva.h>
+#include <SkCanvas.h>
 #include <SkBitmap.h>
 #include <SkShader.h>
 
@@ -15,7 +15,7 @@
     struct _mb_font_face_t *face;
     co_aix fnt_mtx[6];
     co_aix ctm[6];
-}
+};
 struct _mbe_font_face_t {};
 struct _mbe_t {
     SkCanvas *canvas;
@@ -98,12 +98,18 @@
 
 mbe_t *mbe_create(mbe_surface_t *target) {
     mbe_t *mbe;
+    SkBitmap *bitmap = (SkBitmap *)target;
 
-    mbe = malloc(sizeof(_mbe_t));
+    mbe = (mbe_t *)malloc(sizeof(mbe_t));
     if(mbe == NULL)
 	return NULL;
     
-    mbe->canvas = new SkCanvas(target);
+    mbe->canvas = new SkCanvas(*bitmap);
+    if(mbe->canvas == NULL) {
+	free(mbe);
+	return NULL;
+    }
+    
     mbe->shader = NULL;
     mbe->shader_owned = 0;
 
@@ -111,9 +117,9 @@
 }
 
 void mbe_destroy(mbe_t *canvas) {
-    delete cnavas->canvas;
-    if(cnavas->shader && cnavas->shader_owned)
-	delete cnavas->shader;
+    delete canvas->canvas;
+    if(canvas->shader && canvas->shader_owned)
+	delete canvas->shader;
     free(canvas);
 }