am 42773328: Merge "Refactor Canvas.drawPicture() to delegate to Picture" into klp-dev
* commit '427733280b85663587bf0e61174103b0a3423691': Refactor Canvas.drawPicture() to delegate to Picture
This commit is contained in:
@@ -35,8 +35,6 @@
|
|||||||
|
|
||||||
#include <utils/Log.h>
|
#include <utils/Log.h>
|
||||||
|
|
||||||
#define TIME_DRAWx
|
|
||||||
|
|
||||||
static uint32_t get_thread_msec() {
|
static uint32_t get_thread_msec() {
|
||||||
#if defined(HAVE_POSIX_CLOCKS)
|
#if defined(HAVE_POSIX_CLOCKS)
|
||||||
struct timespec tm;
|
struct timespec tm;
|
||||||
@@ -463,20 +461,6 @@ public:
|
|||||||
canvas->drawPath(*path, *paint);
|
canvas->drawPath(*path, *paint);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawPicture(JNIEnv* env, jobject, SkCanvas* canvas,
|
|
||||||
SkPicture* picture) {
|
|
||||||
SkASSERT(canvas);
|
|
||||||
SkASSERT(picture);
|
|
||||||
|
|
||||||
#ifdef TIME_DRAW
|
|
||||||
SkMSec now = get_thread_msec(); //SkTime::GetMSecs();
|
|
||||||
#endif
|
|
||||||
canvas->drawPicture(*picture);
|
|
||||||
#ifdef TIME_DRAW
|
|
||||||
ALOGD("---- picture playback %d ms\n", get_thread_msec() - now);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static void drawBitmap__BitmapFFPaint(JNIEnv* env, jobject jcanvas,
|
static void drawBitmap__BitmapFFPaint(JNIEnv* env, jobject jcanvas,
|
||||||
SkCanvas* canvas, SkBitmap* bitmap,
|
SkCanvas* canvas, SkBitmap* bitmap,
|
||||||
jfloat left, jfloat top,
|
jfloat left, jfloat top,
|
||||||
@@ -1103,7 +1087,6 @@ static JNINativeMethod gCanvasMethods[] = {
|
|||||||
(void*) SkCanvasGlue::drawTextOnPath___CIIPathFFPaint},
|
(void*) SkCanvasGlue::drawTextOnPath___CIIPathFFPaint},
|
||||||
{"native_drawTextOnPath","(ILjava/lang/String;IFFII)V",
|
{"native_drawTextOnPath","(ILjava/lang/String;IFFII)V",
|
||||||
(void*) SkCanvasGlue::drawTextOnPath__StringPathFFPaint},
|
(void*) SkCanvasGlue::drawTextOnPath__StringPathFFPaint},
|
||||||
{"native_drawPicture", "(II)V", (void*) SkCanvasGlue::drawPicture},
|
|
||||||
|
|
||||||
{"freeCaches", "()V", (void*) SkCanvasGlue::freeCaches},
|
{"freeCaches", "()V", (void*) SkCanvasGlue::freeCaches},
|
||||||
|
|
||||||
|
|||||||
@@ -1646,7 +1646,9 @@ public class Canvas {
|
|||||||
*/
|
*/
|
||||||
public void drawPicture(Picture picture) {
|
public void drawPicture(Picture picture) {
|
||||||
picture.endRecording();
|
picture.endRecording();
|
||||||
native_drawPicture(mNativeCanvas, picture.ni());
|
int restoreCount = save();
|
||||||
|
picture.draw(this);
|
||||||
|
restoreToCount(restoreCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1831,7 +1833,5 @@ public class Canvas {
|
|||||||
float hOffset,
|
float hOffset,
|
||||||
float vOffset,
|
float vOffset,
|
||||||
int flags, int paint);
|
int flags, int paint);
|
||||||
private static native void native_drawPicture(int nativeCanvas,
|
|
||||||
int nativePicture);
|
|
||||||
private static native void finalizer(int nativeCanvas);
|
private static native void finalizer(int nativeCanvas);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1147,14 +1147,6 @@ public final class Canvas_Delegate {
|
|||||||
"Canvas.drawTextOnPath is not supported.", null, null /*data*/);
|
"Canvas.drawTextOnPath is not supported.", null, null /*data*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LayoutlibDelegate
|
|
||||||
/*package*/ static void native_drawPicture(int nativeCanvas,
|
|
||||||
int nativePicture) {
|
|
||||||
// FIXME
|
|
||||||
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
|
|
||||||
"Canvas.drawPicture is not supported.", null, null /*data*/);
|
|
||||||
}
|
|
||||||
|
|
||||||
@LayoutlibDelegate
|
@LayoutlibDelegate
|
||||||
/*package*/ static void finalizer(int nativeCanvas) {
|
/*package*/ static void finalizer(int nativeCanvas) {
|
||||||
// get the delegate from the native int so that it can be disposed.
|
// get the delegate from the native int so that it can be disposed.
|
||||||
|
|||||||
Reference in New Issue
Block a user