1 #include "SkLayerRasterizer.h" 2 #include <jni.h> 3 4 class SkLayerRasterizerGlue { 5 public: 6 static SkRasterizer* create(JNIEnv* env, jobject) { 7 return new SkLayerRasterizer(); 8 } 9 10 static void addLayer(JNIEnv* env, jobject, SkLayerRasterizer* layer, const SkPaint* paint, float dx, float dy) { 11 SkASSERT(layer); 12 SkASSERT(paint); 13 layer->addLayer(*paint, SkFloatToScalar(dx), SkFloatToScalar(dy)); 14 } 15 }; 16 17 ///////////////////////////////////////////////////////////////////////////////////////// 18 19 #include <android_runtime/AndroidRuntime.h> 20 21 static JNINativeMethod gLayerRasterizerMethods[] = { 22 { "nativeConstructor", "()I", (void*)SkLayerRasterizerGlue::create }, 23 { "nativeAddLayer", "(IIFF)V", (void*)SkLayerRasterizerGlue::addLayer } 24 }; 25 26 int register_android_graphics_LayerRasterizer(JNIEnv* env); 27 int register_android_graphics_LayerRasterizer(JNIEnv* env) 28 { 29 return android::AndroidRuntime::registerNativeMethods(env, 30 "android/graphics/LayerRasterizer", 31 gLayerRasterizerMethods, 32 SK_ARRAY_COUNT(gLayerRasterizerMethods)); 33 } 34 35