Canvas fastjni -> @FastNative
Just the basic cleanup first, will follow-up with a more
comprehensive update later
Test: builds & boots, refactor no behavior change
Change-Id: Ie3a7144b5fefdfda085e2ab50da8b0e627a1ecb8
diff --git a/core/java/android/view/DisplayListCanvas.java b/core/java/android/view/DisplayListCanvas.java
index 44d7a86..872303a 100644
--- a/core/java/android/view/DisplayListCanvas.java
+++ b/core/java/android/view/DisplayListCanvas.java
@@ -24,6 +24,8 @@
import android.graphics.Paint;
import android.util.Pools.SynchronizedPool;
+import dalvik.annotation.optimization.FastNative;
+
/**
* A Canvas implementation that records view system drawing operations for deferred rendering.
* This is intended for use with a DisplayList. This class keeps a list of all the Paint and
@@ -83,9 +85,6 @@
mDensity = 0; // disable bitmap density scaling
}
- private static native long nCreateDisplayListCanvas(int width, int height);
- private static native void nResetDisplayListCanvas(long canvas, int width, int height);
-
///////////////////////////////////////////////////////////////////////////
// Canvas management
///////////////////////////////////////////////////////////////////////////
@@ -131,9 +130,6 @@
return nGetMaximumTextureHeight();
}
- private static native int nGetMaximumTextureWidth();
- private static native int nGetMaximumTextureHeight();
-
///////////////////////////////////////////////////////////////////////////
// Setup
///////////////////////////////////////////////////////////////////////////
@@ -148,8 +144,6 @@
nInsertReorderBarrier(mNativeCanvasWrapper, false);
}
- private static native void nInsertReorderBarrier(long renderer, boolean enableReorder);
-
///////////////////////////////////////////////////////////////////////////
// Functor
///////////////////////////////////////////////////////////////////////////
@@ -180,15 +174,10 @@
nCallDrawGLFunction(mNativeCanvasWrapper, drawGLFunctor, releasedCallback);
}
- private static native void nCallDrawGLFunction(long renderer,
- long drawGLFunction, Runnable releasedCallback);
-
///////////////////////////////////////////////////////////////////////////
// Display list
///////////////////////////////////////////////////////////////////////////
- protected static native long nFinishRecording(long renderer);
-
/**
* Draws the specified display list onto this canvas. The display list can only
* be drawn if {@link android.view.RenderNode#isValid()} returns true.
@@ -199,8 +188,6 @@
nDrawRenderNode(mNativeCanvasWrapper, renderNode.getNativeDisplayList());
}
- private static native void nDrawRenderNode(long renderer, long renderNode);
-
///////////////////////////////////////////////////////////////////////////
// Hardware layer
///////////////////////////////////////////////////////////////////////////
@@ -214,8 +201,6 @@
nDrawLayer(mNativeCanvasWrapper, layer.getLayerHandle());
}
- private static native void nDrawLayer(long renderer, long layer);
-
///////////////////////////////////////////////////////////////////////////
// Drawing
///////////////////////////////////////////////////////////////////////////
@@ -226,9 +211,6 @@
radius.getNativeContainer(), paint.getNativeContainer());
}
- private static native void nDrawCircle(long renderer, long propCx,
- long propCy, long propRadius, long propPaint);
-
public void drawRoundRect(CanvasProperty<Float> left, CanvasProperty<Float> top,
CanvasProperty<Float> right, CanvasProperty<Float> bottom, CanvasProperty<Float> rx,
CanvasProperty<Float> ry, CanvasProperty<Paint> paint) {
@@ -238,9 +220,6 @@
paint.getNativeContainer());
}
- private static native void nDrawRoundRect(long renderer, long propLeft, long propTop,
- long propRight, long propBottom, long propRx, long propRy, long propPaint);
-
@Override
protected void throwIfCannotDraw(Bitmap bitmap) {
super.throwIfCannotDraw(bitmap);
@@ -250,4 +229,30 @@
"Canvas: trying to draw too large(" + bitmapSize + "bytes) bitmap.");
}
}
+
+ @FastNative
+ private static native long nCreateDisplayListCanvas(int width, int height);
+ @FastNative
+ private static native void nResetDisplayListCanvas(long canvas, int width, int height);
+ @FastNative
+ private static native int nGetMaximumTextureWidth();
+ @FastNative
+ private static native int nGetMaximumTextureHeight();
+ @FastNative
+ private static native void nInsertReorderBarrier(long renderer, boolean enableReorder);
+ @FastNative
+ private static native void nCallDrawGLFunction(long renderer,
+ long drawGLFunction, Runnable releasedCallback);
+ @FastNative
+ private static native long nFinishRecording(long renderer);
+ @FastNative
+ private static native void nDrawRenderNode(long renderer, long renderNode);
+ @FastNative
+ private static native void nDrawLayer(long renderer, long layer);
+ @FastNative
+ private static native void nDrawCircle(long renderer, long propCx,
+ long propCy, long propRadius, long propPaint);
+ @FastNative
+ private static native void nDrawRoundRect(long renderer, long propLeft, long propTop,
+ long propRight, long propBottom, long propRx, long propRy, long propPaint);
}
diff --git a/core/jni/android_graphics_Canvas.cpp b/core/jni/android_graphics_Canvas.cpp
index d5a7a90..a2bd2f8 100644
--- a/core/jni/android_graphics_Canvas.cpp
+++ b/core/jni/android_graphics_Canvas.cpp
@@ -575,59 +575,61 @@
static const JNINativeMethod gMethods[] = {
{"getNativeFinalizer", "()J", (void*) CanvasJNI::getNativeFinalizer},
{"initRaster", "(Landroid/graphics/Bitmap;)J", (void*) CanvasJNI::initRaster},
- {"native_setBitmap", "!(JLandroid/graphics/Bitmap;)V", (void*) CanvasJNI::setBitmap},
- {"native_isOpaque","!(J)Z", (void*) CanvasJNI::isOpaque},
- {"native_getWidth","!(J)I", (void*) CanvasJNI::getWidth},
- {"native_getHeight","!(J)I", (void*) CanvasJNI::getHeight},
- {"native_setHighContrastText","!(JZ)V", (void*) CanvasJNI::setHighContrastText},
- {"native_save","!(JI)I", (void*) CanvasJNI::save},
- {"native_saveLayer","!(JFFFFJI)I", (void*) CanvasJNI::saveLayer},
- {"native_saveLayerAlpha","!(JFFFFII)I", (void*) CanvasJNI::saveLayerAlpha},
- {"native_getSaveCount","!(J)I", (void*) CanvasJNI::getSaveCount},
- {"native_restore","!(JZ)V", (void*) CanvasJNI::restore},
- {"native_restoreToCount","!(JIZ)V", (void*) CanvasJNI::restoreToCount},
- {"native_getCTM", "!(JJ)V", (void*)CanvasJNI::getCTM},
- {"native_setMatrix","!(JJ)V", (void*) CanvasJNI::setMatrix},
- {"native_concat","!(JJ)V", (void*) CanvasJNI::concat},
- {"native_rotate","!(JF)V", (void*) CanvasJNI::rotate},
- {"native_scale","!(JFF)V", (void*) CanvasJNI::scale},
- {"native_skew","!(JFF)V", (void*) CanvasJNI::skew},
- {"native_translate","!(JFF)V", (void*) CanvasJNI::translate},
- {"native_getClipBounds","!(JLandroid/graphics/Rect;)Z", (void*) CanvasJNI::getClipBounds},
- {"native_quickReject","!(JJ)Z", (void*) CanvasJNI::quickRejectPath},
- {"native_quickReject","!(JFFFF)Z", (void*)CanvasJNI::quickRejectRect},
- {"native_clipRect","!(JFFFFI)Z", (void*) CanvasJNI::clipRect},
- {"native_clipPath","!(JJI)Z", (void*) CanvasJNI::clipPath},
- {"native_clipRegion","!(JJI)Z", (void*) CanvasJNI::clipRegion},
- {"native_drawColor","!(JII)V", (void*) CanvasJNI::drawColor},
- {"native_drawPaint","!(JJ)V", (void*) CanvasJNI::drawPaint},
- {"native_drawPoint", "!(JFFJ)V", (void*) CanvasJNI::drawPoint},
- {"native_drawPoints", "!(J[FIIJ)V", (void*) CanvasJNI::drawPoints},
- {"native_drawLine", "!(JFFFFJ)V", (void*) CanvasJNI::drawLine},
- {"native_drawLines", "!(J[FIIJ)V", (void*) CanvasJNI::drawLines},
- {"native_drawRect","!(JFFFFJ)V", (void*) CanvasJNI::drawRect},
- {"native_drawRegion", "!(JJJ)V", (void*) CanvasJNI::drawRegion },
- {"native_drawRoundRect","!(JFFFFFFJ)V", (void*) CanvasJNI::drawRoundRect},
- {"native_drawCircle","!(JFFFJ)V", (void*) CanvasJNI::drawCircle},
- {"native_drawOval","!(JFFFFJ)V", (void*) CanvasJNI::drawOval},
- {"native_drawArc","!(JFFFFFFZJ)V", (void*) CanvasJNI::drawArc},
- {"native_drawPath","!(JJJ)V", (void*) CanvasJNI::drawPath},
- {"nativeDrawVertices", "!(JII[FI[FI[II[SIIJ)V", (void*)CanvasJNI::drawVertices},
- {"native_drawNinePatch", "!(JJJFFFFJII)V", (void*)CanvasJNI::drawNinePatch},
+ {"freeCaches", "()V", (void*) CanvasJNI::freeCaches},
+ {"freeTextLayoutCaches", "()V", (void*) CanvasJNI::freeTextLayoutCaches},
{"native_drawBitmap","(JLandroid/graphics/Bitmap;FFJIII)V", (void*) CanvasJNI::drawBitmap},
- {"nativeDrawBitmapMatrix", "!(JLandroid/graphics/Bitmap;JJ)V", (void*)CanvasJNI::drawBitmapMatrix},
{"native_drawBitmap","(JLandroid/graphics/Bitmap;FFFFFFFFJII)V", (void*) CanvasJNI::drawBitmapRect},
{"native_drawBitmap", "(J[IIIFFIIZJ)V", (void*)CanvasJNI::drawBitmapArray},
- {"nativeDrawBitmapMesh", "!(JLandroid/graphics/Bitmap;II[FI[IIJ)V", (void*)CanvasJNI::drawBitmapMesh},
- {"native_drawText","!(J[CIIFFIJJ)V", (void*) CanvasJNI::drawTextChars},
- {"native_drawText","!(JLjava/lang/String;IIFFIJJ)V", (void*) CanvasJNI::drawTextString},
- {"native_drawTextRun","!(J[CIIIIFFZJJ)V", (void*) CanvasJNI::drawTextRunChars},
- {"native_drawTextRun","!(JLjava/lang/String;IIIIFFZJJ)V", (void*) CanvasJNI::drawTextRunString},
- {"native_drawTextOnPath","!(J[CIIJFFIJJ)V", (void*) CanvasJNI::drawTextOnPathChars},
- {"native_drawTextOnPath","!(JLjava/lang/String;JFFIJJ)V", (void*) CanvasJNI::drawTextOnPathString},
- {"nativeSetDrawFilter", "!(JJ)V", (void*) CanvasJNI::setDrawFilter},
- {"freeCaches", "()V", (void*) CanvasJNI::freeCaches},
- {"freeTextLayoutCaches", "()V", (void*) CanvasJNI::freeTextLayoutCaches}
+
+ // ------------ @FastNative ----------------
+ {"native_setBitmap", "(JLandroid/graphics/Bitmap;)V", (void*) CanvasJNI::setBitmap},
+ {"native_isOpaque","(J)Z", (void*) CanvasJNI::isOpaque},
+ {"native_getWidth","(J)I", (void*) CanvasJNI::getWidth},
+ {"native_getHeight","(J)I", (void*) CanvasJNI::getHeight},
+ {"native_setHighContrastText","(JZ)V", (void*) CanvasJNI::setHighContrastText},
+ {"native_save","(JI)I", (void*) CanvasJNI::save},
+ {"native_saveLayer","(JFFFFJI)I", (void*) CanvasJNI::saveLayer},
+ {"native_saveLayerAlpha","(JFFFFII)I", (void*) CanvasJNI::saveLayerAlpha},
+ {"native_getSaveCount","(J)I", (void*) CanvasJNI::getSaveCount},
+ {"native_restore","(JZ)V", (void*) CanvasJNI::restore},
+ {"native_restoreToCount","(JIZ)V", (void*) CanvasJNI::restoreToCount},
+ {"native_getCTM", "(JJ)V", (void*)CanvasJNI::getCTM},
+ {"native_setMatrix","(JJ)V", (void*) CanvasJNI::setMatrix},
+ {"native_concat","(JJ)V", (void*) CanvasJNI::concat},
+ {"native_rotate","(JF)V", (void*) CanvasJNI::rotate},
+ {"native_scale","(JFF)V", (void*) CanvasJNI::scale},
+ {"native_skew","(JFF)V", (void*) CanvasJNI::skew},
+ {"native_translate","(JFF)V", (void*) CanvasJNI::translate},
+ {"native_getClipBounds","(JLandroid/graphics/Rect;)Z", (void*) CanvasJNI::getClipBounds},
+ {"native_quickReject","(JJ)Z", (void*) CanvasJNI::quickRejectPath},
+ {"native_quickReject","(JFFFF)Z", (void*)CanvasJNI::quickRejectRect},
+ {"native_clipRect","(JFFFFI)Z", (void*) CanvasJNI::clipRect},
+ {"native_clipPath","(JJI)Z", (void*) CanvasJNI::clipPath},
+ {"native_clipRegion","(JJI)Z", (void*) CanvasJNI::clipRegion},
+ {"native_drawColor","(JII)V", (void*) CanvasJNI::drawColor},
+ {"native_drawPaint","(JJ)V", (void*) CanvasJNI::drawPaint},
+ {"native_drawPoint", "(JFFJ)V", (void*) CanvasJNI::drawPoint},
+ {"native_drawPoints", "(J[FIIJ)V", (void*) CanvasJNI::drawPoints},
+ {"native_drawLine", "(JFFFFJ)V", (void*) CanvasJNI::drawLine},
+ {"native_drawLines", "(J[FIIJ)V", (void*) CanvasJNI::drawLines},
+ {"native_drawRect","(JFFFFJ)V", (void*) CanvasJNI::drawRect},
+ {"native_drawRegion", "(JJJ)V", (void*) CanvasJNI::drawRegion },
+ {"native_drawRoundRect","(JFFFFFFJ)V", (void*) CanvasJNI::drawRoundRect},
+ {"native_drawCircle","(JFFFJ)V", (void*) CanvasJNI::drawCircle},
+ {"native_drawOval","(JFFFFJ)V", (void*) CanvasJNI::drawOval},
+ {"native_drawArc","(JFFFFFFZJ)V", (void*) CanvasJNI::drawArc},
+ {"native_drawPath","(JJJ)V", (void*) CanvasJNI::drawPath},
+ {"nativeDrawVertices", "(JII[FI[FI[II[SIIJ)V", (void*)CanvasJNI::drawVertices},
+ {"native_drawNinePatch", "(JJJFFFFJII)V", (void*)CanvasJNI::drawNinePatch},
+ {"nativeDrawBitmapMatrix", "(JLandroid/graphics/Bitmap;JJ)V", (void*)CanvasJNI::drawBitmapMatrix},
+ {"nativeDrawBitmapMesh", "(JLandroid/graphics/Bitmap;II[FI[IIJ)V", (void*)CanvasJNI::drawBitmapMesh},
+ {"native_drawText","(J[CIIFFIJJ)V", (void*) CanvasJNI::drawTextChars},
+ {"native_drawText","(JLjava/lang/String;IIFFIJJ)V", (void*) CanvasJNI::drawTextString},
+ {"native_drawTextRun","(J[CIIIIFFZJJ)V", (void*) CanvasJNI::drawTextRunChars},
+ {"native_drawTextRun","(JLjava/lang/String;IIIIFFZJJ)V", (void*) CanvasJNI::drawTextRunString},
+ {"native_drawTextOnPath","(J[CIIJFFIJJ)V", (void*) CanvasJNI::drawTextOnPathChars},
+ {"native_drawTextOnPath","(JLjava/lang/String;JFFIJJ)V", (void*) CanvasJNI::drawTextOnPathString},
+ {"nativeSetDrawFilter", "(JJ)V", (void*) CanvasJNI::setDrawFilter},
};
int register_android_graphics_Canvas(JNIEnv* env) {
diff --git a/core/jni/android_view_DisplayListCanvas.cpp b/core/jni/android_view_DisplayListCanvas.cpp
index edc0da3..8d2a058 100644
--- a/core/jni/android_view_DisplayListCanvas.cpp
+++ b/core/jni/android_view_DisplayListCanvas.cpp
@@ -215,24 +215,27 @@
const char* const kClassPathName = "android/view/DisplayListCanvas";
static JNINativeMethod gMethods[] = {
- { "nInsertReorderBarrier","!(JZ)V", (void*) android_view_DisplayListCanvas_insertReorderBarrier },
- { "nCallDrawGLFunction", "!(JJLjava/lang/Runnable;)V",
+ // ------------ @FastNative ------------------
+
+ { "nInsertReorderBarrier","(JZ)V", (void*) android_view_DisplayListCanvas_insertReorderBarrier },
+
+ { "nCallDrawGLFunction", "(JJLjava/lang/Runnable;)V",
(void*) android_view_DisplayListCanvas_callDrawGLFunction },
- { "nDrawRoundRect", "!(JJJJJJJJ)V", (void*) android_view_DisplayListCanvas_drawRoundRectProps },
- { "nDrawCircle", "!(JJJJJ)V", (void*) android_view_DisplayListCanvas_drawCircleProps },
+ { "nDrawRoundRect", "(JJJJJJJJ)V", (void*) android_view_DisplayListCanvas_drawRoundRectProps },
+ { "nDrawCircle", "(JJJJJ)V", (void*) android_view_DisplayListCanvas_drawCircleProps },
- { "nFinishRecording", "!(J)J", (void*) android_view_DisplayListCanvas_finishRecording },
- { "nDrawRenderNode", "!(JJ)V", (void*) android_view_DisplayListCanvas_drawRenderNode },
+ { "nFinishRecording", "(J)J", (void*) android_view_DisplayListCanvas_finishRecording },
+ { "nDrawRenderNode", "(JJ)V", (void*) android_view_DisplayListCanvas_drawRenderNode },
- { "nCreateDisplayListCanvas", "!(II)J", (void*) android_view_DisplayListCanvas_createDisplayListCanvas },
- { "nResetDisplayListCanvas", "!(JII)V", (void*) android_view_DisplayListCanvas_resetDisplayListCanvas },
+ { "nCreateDisplayListCanvas", "(II)J", (void*) android_view_DisplayListCanvas_createDisplayListCanvas },
+ { "nResetDisplayListCanvas", "(JII)V", (void*) android_view_DisplayListCanvas_resetDisplayListCanvas },
- { "nDrawLayer", "!(JJ)V", (void*) android_view_DisplayListCanvas_drawLayer },
+ { "nDrawLayer", "(JJ)V", (void*) android_view_DisplayListCanvas_drawLayer },
- { "nGetMaximumTextureWidth", "!()I", (void*) android_view_DisplayListCanvas_getMaxTextureWidth },
- { "nGetMaximumTextureHeight", "!()I", (void*) android_view_DisplayListCanvas_getMaxTextureHeight },
+ { "nGetMaximumTextureWidth", "()I", (void*) android_view_DisplayListCanvas_getMaxTextureWidth },
+ { "nGetMaximumTextureHeight", "()I", (void*) android_view_DisplayListCanvas_getMaxTextureHeight },
};
static JNINativeMethod gActivityThreadMethods[] = {
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index d29005c..0692a09 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -26,13 +26,15 @@
import android.text.SpannedString;
import android.text.TextUtils;
+import dalvik.annotation.optimization.FastNative;
+
+import libcore.util.NativeAllocationRegistry;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import javax.microedition.khronos.opengles.GL;
-import libcore.util.NativeAllocationRegistry;
-
/**
* The Canvas class holds the "draw" calls. To draw something, you need
* 4 basic components: A Bitmap to hold the pixels, a Canvas to host
@@ -2008,155 +2010,201 @@
public static native void freeTextLayoutCaches();
private static native long initRaster(Bitmap bitmap);
- private static native void native_setBitmap(long canvasHandle,
- Bitmap bitmap);
- private static native boolean native_isOpaque(long canvasHandle);
- private static native void native_setHighContrastText(long renderer, boolean highContrastText);
- private static native int native_getWidth(long canvasHandle);
- private static native int native_getHeight(long canvasHandle);
+ private static native long getNativeFinalizer();
- private static native int native_save(long canvasHandle, int saveFlags);
- private static native int native_saveLayer(long nativeCanvas, float l,
- float t, float r, float b,
- long nativePaint,
- int layerFlags);
- private static native int native_saveLayerAlpha(long nativeCanvas, float l,
- float t, float r, float b,
- int alpha, int layerFlags);
- private static native void native_restore(long canvasHandle, boolean tolerateUnderflow);
- private static native void native_restoreToCount(long canvasHandle,
- int saveCount,
- boolean tolerateUnderflow);
- private static native int native_getSaveCount(long canvasHandle);
-
- private static native void native_translate(long canvasHandle,
- float dx, float dy);
- private static native void native_scale(long canvasHandle,
- float sx, float sy);
- private static native void native_rotate(long canvasHandle, float degrees);
- private static native void native_skew(long canvasHandle,
- float sx, float sy);
- private static native void native_concat(long nativeCanvas,
- long nativeMatrix);
- private static native void native_setMatrix(long nativeCanvas,
- long nativeMatrix);
- private static native boolean native_clipRect(long nativeCanvas,
- float left, float top,
- float right, float bottom,
- int regionOp);
- private static native boolean native_clipPath(long nativeCanvas,
- long nativePath,
- int regionOp);
- private static native boolean native_clipRegion(long nativeCanvas,
- long nativeRegion,
- int regionOp);
- private static native void nativeSetDrawFilter(long nativeCanvas,
- long nativeFilter);
- private static native boolean native_getClipBounds(long nativeCanvas,
- Rect bounds);
- private static native void native_getCTM(long nativeCanvas,
- long nativeMatrix);
- private static native boolean native_quickReject(long nativeCanvas,
- long nativePath);
- private static native boolean native_quickReject(long nativeCanvas,
- float left, float top,
- float right, float bottom);
- private static native void native_drawColor(long nativeCanvas, int color,
- int mode);
- private static native void native_drawPaint(long nativeCanvas,
- long nativePaint);
- private static native void native_drawPoint(long canvasHandle, float x, float y,
- long paintHandle);
- private static native void native_drawPoints(long canvasHandle, float[] pts,
- int offset, int count,
- long paintHandle);
- private static native void native_drawLine(long nativeCanvas, float startX,
- float startY, float stopX,
- float stopY, long nativePaint);
- private static native void native_drawLines(long canvasHandle, float[] pts,
- int offset, int count,
- long paintHandle);
- private static native void native_drawRect(long nativeCanvas, float left,
- float top, float right,
- float bottom,
- long nativePaint);
- private static native void native_drawOval(long nativeCanvas, float left, float top,
- float right, float bottom, long nativePaint);
- private static native void native_drawCircle(long nativeCanvas, float cx,
- float cy, float radius,
- long nativePaint);
- private static native void native_drawArc(long nativeCanvas, float left, float top,
- float right, float bottom,
- float startAngle, float sweep, boolean useCenter,
- long nativePaint);
- private static native void native_drawRoundRect(long nativeCanvas,
- float left, float top, float right, float bottom,
- float rx, float ry, long nativePaint);
- private static native void native_drawPath(long nativeCanvas,
- long nativePath,
- long nativePaint);
- private static native void native_drawRegion(long nativeCanvas,
- long nativeRegion, long nativePaint);
- private native void native_drawNinePatch(long nativeCanvas, long nativeBitmap,
- long ninePatch, float dstLeft, float dstTop, float dstRight, float dstBottom,
- long nativePaintOrZero, int screenDensity, int bitmapDensity);
- private native void native_drawBitmap(long nativeCanvas, Bitmap bitmap,
- float left, float top,
- long nativePaintOrZero,
- int canvasDensity,
- int screenDensity,
- int bitmapDensity);
+ private native void native_drawBitmap(long nativeCanvas, Bitmap bitmap, float left, float top,
+ long nativePaintOrZero, int canvasDensity, int screenDensity, int bitmapDensity);
private native void native_drawBitmap(long nativeCanvas, Bitmap bitmap,
float srcLeft, float srcTop, float srcRight, float srcBottom,
float dstLeft, float dstTop, float dstRight, float dstBottom,
long nativePaintOrZero, int screenDensity, int bitmapDensity);
private static native void native_drawBitmap(long nativeCanvas, int[] colors,
- int offset, int stride, float x,
- float y, int width, int height,
- boolean hasAlpha,
- long nativePaintOrZero);
+ int offset, int stride, float x, float y, int width, int height,
+ boolean hasAlpha, long nativePaintOrZero);
+
+ // ---------------- @FastNative -------------------
+
+ @FastNative
+ private static native void native_setBitmap(long canvasHandle,
+ Bitmap bitmap);
+ @FastNative
+ private static native boolean native_isOpaque(long canvasHandle);
+ @FastNative
+ private static native void native_setHighContrastText(long renderer, boolean highContrastText);
+ @FastNative
+ private static native int native_getWidth(long canvasHandle);
+ @FastNative
+ private static native int native_getHeight(long canvasHandle);
+
+ @FastNative
+ private static native int native_save(long canvasHandle, int saveFlags);
+ @FastNative
+ private static native int native_saveLayer(long nativeCanvas, float l,
+ float t, float r, float b,
+ long nativePaint,
+ int layerFlags);
+ @FastNative
+ private static native int native_saveLayerAlpha(long nativeCanvas, float l,
+ float t, float r, float b,
+ int alpha, int layerFlags);
+ @FastNative
+ private static native void native_restore(long canvasHandle, boolean tolerateUnderflow);
+ @FastNative
+ private static native void native_restoreToCount(long canvasHandle,
+ int saveCount,
+ boolean tolerateUnderflow);
+ @FastNative
+ private static native int native_getSaveCount(long canvasHandle);
+
+ @FastNative
+ private static native void native_translate(long canvasHandle,
+ float dx, float dy);
+ @FastNative
+ private static native void native_scale(long canvasHandle,
+ float sx, float sy);
+ @FastNative
+ private static native void native_rotate(long canvasHandle, float degrees);
+ @FastNative
+ private static native void native_skew(long canvasHandle,
+ float sx, float sy);
+ @FastNative
+ private static native void native_concat(long nativeCanvas,
+ long nativeMatrix);
+ @FastNative
+ private static native void native_setMatrix(long nativeCanvas,
+ long nativeMatrix);
+ @FastNative
+ private static native boolean native_clipRect(long nativeCanvas,
+ float left, float top,
+ float right, float bottom,
+ int regionOp);
+ @FastNative
+ private static native boolean native_clipPath(long nativeCanvas,
+ long nativePath,
+ int regionOp);
+ @FastNative
+ private static native boolean native_clipRegion(long nativeCanvas,
+ long nativeRegion,
+ int regionOp);
+ @FastNative
+ private static native void nativeSetDrawFilter(long nativeCanvas,
+ long nativeFilter);
+ @FastNative
+ private static native boolean native_getClipBounds(long nativeCanvas,
+ Rect bounds);
+ @FastNative
+ private static native void native_getCTM(long nativeCanvas,
+ long nativeMatrix);
+ @FastNative
+ private static native boolean native_quickReject(long nativeCanvas,
+ long nativePath);
+ @FastNative
+ private static native boolean native_quickReject(long nativeCanvas,
+ float left, float top,
+ float right, float bottom);
+ @FastNative
+ private static native void native_drawColor(long nativeCanvas, int color,
+ int mode);
+ @FastNative
+ private static native void native_drawPaint(long nativeCanvas,
+ long nativePaint);
+ @FastNative
+ private static native void native_drawPoint(long canvasHandle, float x, float y,
+ long paintHandle);
+ @FastNative
+ private static native void native_drawPoints(long canvasHandle, float[] pts,
+ int offset, int count,
+ long paintHandle);
+ @FastNative
+ private static native void native_drawLine(long nativeCanvas, float startX,
+ float startY, float stopX,
+ float stopY, long nativePaint);
+ @FastNative
+ private static native void native_drawLines(long canvasHandle, float[] pts,
+ int offset, int count,
+ long paintHandle);
+ @FastNative
+ private static native void native_drawRect(long nativeCanvas, float left,
+ float top, float right,
+ float bottom,
+ long nativePaint);
+ @FastNative
+ private static native void native_drawOval(long nativeCanvas, float left, float top,
+ float right, float bottom, long nativePaint);
+ @FastNative
+ private static native void native_drawCircle(long nativeCanvas, float cx,
+ float cy, float radius,
+ long nativePaint);
+ @FastNative
+ private static native void native_drawArc(long nativeCanvas, float left, float top,
+ float right, float bottom,
+ float startAngle, float sweep, boolean useCenter,
+ long nativePaint);
+ @FastNative
+ private static native void native_drawRoundRect(long nativeCanvas,
+ float left, float top, float right, float bottom,
+ float rx, float ry, long nativePaint);
+ @FastNative
+ private static native void native_drawPath(long nativeCanvas,
+ long nativePath,
+ long nativePaint);
+ @FastNative
+ private static native void native_drawRegion(long nativeCanvas,
+ long nativeRegion, long nativePaint);
+ @FastNative
+ private static native void native_drawNinePatch(long nativeCanvas, long nativeBitmap,
+ long ninePatch, float dstLeft, float dstTop, float dstRight, float dstBottom,
+ long nativePaintOrZero, int screenDensity, int bitmapDensity);
+ @FastNative
private static native void nativeDrawBitmapMatrix(long nativeCanvas,
Bitmap bitmap,
long nativeMatrix,
long nativePaint);
+ @FastNative
private static native void nativeDrawBitmapMesh(long nativeCanvas,
Bitmap bitmap,
int meshWidth, int meshHeight,
float[] verts, int vertOffset,
int[] colors, int colorOffset,
long nativePaint);
+ @FastNative
private static native void nativeDrawVertices(long nativeCanvas, int mode, int n,
float[] verts, int vertOffset, float[] texs, int texOffset,
int[] colors, int colorOffset, short[] indices,
int indexOffset, int indexCount, long nativePaint);
+ @FastNative
private static native void native_drawText(long nativeCanvas, char[] text,
int index, int count, float x,
float y, int flags, long nativePaint,
long nativeTypeface);
+ @FastNative
private static native void native_drawText(long nativeCanvas, String text,
int start, int end, float x,
float y, int flags, long nativePaint,
long nativeTypeface);
+ @FastNative
private static native void native_drawTextRun(long nativeCanvas, String text,
int start, int end, int contextStart, int contextEnd,
float x, float y, boolean isRtl, long nativePaint, long nativeTypeface);
+ @FastNative
private static native void native_drawTextRun(long nativeCanvas, char[] text,
int start, int count, int contextStart, int contextCount,
float x, float y, boolean isRtl, long nativePaint, long nativeTypeface);
+ @FastNative
private static native void native_drawTextOnPath(long nativeCanvas,
char[] text, int index,
int count, long nativePath,
float hOffset,
float vOffset, int bidiFlags,
long nativePaint, long nativeTypeface);
+ @FastNative
private static native void native_drawTextOnPath(long nativeCanvas,
String text, long nativePath,
float hOffset,
float vOffset,
int flags, long nativePaint, long nativeTypeface);
- private static native long getNativeFinalizer();
}