Loading core/java/android/view/GLES20Canvas.java +12 −12 Original line number Diff line number Diff line Loading @@ -149,43 +149,44 @@ class GLES20Canvas extends Canvas { @Override public boolean clipRect(float left, float top, float right, float bottom) { return nClipRect(mRenderer, left, top, right, bottom); return nClipRect(mRenderer, left, top, right, bottom, Region.Op.INTERSECT.nativeInt); } private native boolean nClipRect(int renderer, float left, float top, float right, float bottom); private native boolean nClipRect(int renderer, float left, float top, float right, float bottom, int op); @Override public boolean clipRect(float left, float top, float right, float bottom, Region.Op op) { throw new UnsupportedOperationException(); return nClipRect(mRenderer, left, top, right, bottom, op.nativeInt); } @Override public boolean clipRect(int left, int top, int right, int bottom) { return nClipRect(mRenderer, left, top, right, bottom); return nClipRect(mRenderer, left, top, right, bottom, Region.Op.INTERSECT.nativeInt); } private native boolean nClipRect(int renderer, int left, int top, int right, int bottom); private native boolean nClipRect(int renderer, int left, int top, int right, int bottom, int op); @Override public boolean clipRect(Rect rect) { return clipRect(rect.left, rect.top, rect.right, rect.bottom); return nClipRect(mRenderer, rect.left, rect.top, rect.right, rect.bottom, Region.Op.INTERSECT.nativeInt); } @Override public boolean clipRect(Rect rect, Region.Op op) { // TODO: Implement throw new UnsupportedOperationException(); return nClipRect(mRenderer, rect.left, rect.top, rect.right, rect.bottom, op.nativeInt); } @Override public boolean clipRect(RectF rect) { return clipRect(rect.left, rect.top, rect.right, rect.bottom); return nClipRect(mRenderer, rect.left, rect.top, rect.right, rect.bottom, Region.Op.INTERSECT.nativeInt); } @Override public boolean clipRect(RectF rect, Region.Op op) { // TODO: Implement throw new UnsupportedOperationException(); return nClipRect(mRenderer, rect.left, rect.top, rect.right, rect.bottom, op.nativeInt); } @Override Loading Loading @@ -347,7 +348,6 @@ class GLES20Canvas extends Canvas { @Override public void setDrawFilter(DrawFilter filter) { // Don't crash, but ignore the draw filter // TODO: Implement PaintDrawFilter mFilter = filter; } Loading core/jni/android_view_GLES20Canvas.cpp +9 −6 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include <SkCanvas.h> #include <SkMatrix.h> #include <SkPaint.h> #include <SkRegion.h> #include <SkXfermode.h> #include <OpenGLRenderer.h> Loading Loading @@ -120,13 +121,15 @@ static bool android_view_GLES20Canvas_quickReject(JNIEnv* env, jobject canvas, } static bool android_view_GLES20Canvas_clipRectF(JNIEnv* env, jobject canvas, OpenGLRenderer* renderer, jfloat left, jfloat top, jfloat right, jfloat bottom) { return renderer->clipRect(left, top, right, bottom); OpenGLRenderer* renderer, jfloat left, jfloat top, jfloat right, jfloat bottom, SkRegion::Op op) { return renderer->clipRect(left, top, right, bottom, op); } static bool android_view_GLES20Canvas_clipRect(JNIEnv* env, jobject canvas, OpenGLRenderer* renderer, jint left, jint top, jint right, jint bottom) { return renderer->clipRect(float(left), float(top), float(right), float(bottom)); OpenGLRenderer* renderer, jint left, jint top, jint right, jint bottom, SkRegion::Op op) { return renderer->clipRect(float(left), float(top), float(right), float(bottom), op); } static bool android_view_GLES20Canvas_getClipBounds(JNIEnv* env, jobject canvas, Loading Loading @@ -257,8 +260,8 @@ static JNINativeMethod gMethods[] = { { "nSaveLayerAlpha", "(IFFFFII)I", (void*) android_view_GLES20Canvas_saveLayerAlpha }, { "nQuickReject", "(IFFFFI)Z", (void*) android_view_GLES20Canvas_quickReject }, { "nClipRect", "(IFFFF)Z", (void*) android_view_GLES20Canvas_clipRectF }, { "nClipRect", "(IIIII)Z", (void*) android_view_GLES20Canvas_clipRect }, { "nClipRect", "(IFFFFI)Z", (void*) android_view_GLES20Canvas_clipRectF }, { "nClipRect", "(IIIIII)Z", (void*) android_view_GLES20Canvas_clipRect }, { "nTranslate", "(IFF)V", (void*) android_view_GLES20Canvas_translate }, { "nRotate", "(IF)V", (void*) android_view_GLES20Canvas_rotate }, Loading graphics/java/android/graphics/Region.java +5 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,11 @@ public class Region implements Parcelable { Op(int nativeInt) { this.nativeInt = nativeInt; } final int nativeInt; /** * @hide */ public final int nativeInt; } /** Create an empty region Loading libs/hwui/Matrix.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,25 @@ void Matrix4::copyTo(SkMatrix& v) const { v.set(SkMatrix::kMPersp2, data[15]); } void Matrix4::loadInverse(const Matrix4& v) { double scale = 1.0 / (v.data[0] * ((double) v.data[5] * v.data[15] - (double) v.data[13] * v.data[7]) + v.data[4] * ((double) v.data[13] * v.data[3] - (double) v.data[1] * v.data[15]) + v.data[12] * ((double) v.data[1] * v.data[7] - (double) v.data[5] * v.data[3])); data[0] = (v.data[5] * v.data[15] - v.data[13] * v.data[7]) * scale; data[4] = (v.data[12] * v.data[7] - v.data[4] * v.data[15]) * scale; data[12] = (v.data[4] * v.data[13] - v.data[12] * v.data[5]) * scale; data[1] = (v.data[13] * v.data[3] - v.data[1] * v.data[15]) * scale; data[5] = (v.data[0] * v.data[15] - v.data[12] * v.data[3]) * scale; data[13] = (v.data[12] * v.data[1] - v.data[0] * v.data[13]) * scale; data[3] = (v.data[1] * v.data[7] - v.data[5] * v.data[3]) * scale; data[7] = (v.data[4] * v.data[3] - v.data[0] * v.data[7]) * scale; data[15] = (v.data[0] * v.data[5] - v.data[4] * v.data[1]) * scale; } void Matrix4::copyTo(float* v) const { memcpy(v, data, sizeof(data)); } Loading libs/hwui/Matrix.h +2 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,8 @@ public: void load(const Matrix4& v); void load(const SkMatrix& v); void loadInverse(const Matrix4& v); void loadTranslate(float x, float y, float z); void loadScale(float sx, float sy, float sz); void loadRotate(float angle, float x, float y, float z); Loading Loading
core/java/android/view/GLES20Canvas.java +12 −12 Original line number Diff line number Diff line Loading @@ -149,43 +149,44 @@ class GLES20Canvas extends Canvas { @Override public boolean clipRect(float left, float top, float right, float bottom) { return nClipRect(mRenderer, left, top, right, bottom); return nClipRect(mRenderer, left, top, right, bottom, Region.Op.INTERSECT.nativeInt); } private native boolean nClipRect(int renderer, float left, float top, float right, float bottom); private native boolean nClipRect(int renderer, float left, float top, float right, float bottom, int op); @Override public boolean clipRect(float left, float top, float right, float bottom, Region.Op op) { throw new UnsupportedOperationException(); return nClipRect(mRenderer, left, top, right, bottom, op.nativeInt); } @Override public boolean clipRect(int left, int top, int right, int bottom) { return nClipRect(mRenderer, left, top, right, bottom); return nClipRect(mRenderer, left, top, right, bottom, Region.Op.INTERSECT.nativeInt); } private native boolean nClipRect(int renderer, int left, int top, int right, int bottom); private native boolean nClipRect(int renderer, int left, int top, int right, int bottom, int op); @Override public boolean clipRect(Rect rect) { return clipRect(rect.left, rect.top, rect.right, rect.bottom); return nClipRect(mRenderer, rect.left, rect.top, rect.right, rect.bottom, Region.Op.INTERSECT.nativeInt); } @Override public boolean clipRect(Rect rect, Region.Op op) { // TODO: Implement throw new UnsupportedOperationException(); return nClipRect(mRenderer, rect.left, rect.top, rect.right, rect.bottom, op.nativeInt); } @Override public boolean clipRect(RectF rect) { return clipRect(rect.left, rect.top, rect.right, rect.bottom); return nClipRect(mRenderer, rect.left, rect.top, rect.right, rect.bottom, Region.Op.INTERSECT.nativeInt); } @Override public boolean clipRect(RectF rect, Region.Op op) { // TODO: Implement throw new UnsupportedOperationException(); return nClipRect(mRenderer, rect.left, rect.top, rect.right, rect.bottom, op.nativeInt); } @Override Loading Loading @@ -347,7 +348,6 @@ class GLES20Canvas extends Canvas { @Override public void setDrawFilter(DrawFilter filter) { // Don't crash, but ignore the draw filter // TODO: Implement PaintDrawFilter mFilter = filter; } Loading
core/jni/android_view_GLES20Canvas.cpp +9 −6 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include <SkCanvas.h> #include <SkMatrix.h> #include <SkPaint.h> #include <SkRegion.h> #include <SkXfermode.h> #include <OpenGLRenderer.h> Loading Loading @@ -120,13 +121,15 @@ static bool android_view_GLES20Canvas_quickReject(JNIEnv* env, jobject canvas, } static bool android_view_GLES20Canvas_clipRectF(JNIEnv* env, jobject canvas, OpenGLRenderer* renderer, jfloat left, jfloat top, jfloat right, jfloat bottom) { return renderer->clipRect(left, top, right, bottom); OpenGLRenderer* renderer, jfloat left, jfloat top, jfloat right, jfloat bottom, SkRegion::Op op) { return renderer->clipRect(left, top, right, bottom, op); } static bool android_view_GLES20Canvas_clipRect(JNIEnv* env, jobject canvas, OpenGLRenderer* renderer, jint left, jint top, jint right, jint bottom) { return renderer->clipRect(float(left), float(top), float(right), float(bottom)); OpenGLRenderer* renderer, jint left, jint top, jint right, jint bottom, SkRegion::Op op) { return renderer->clipRect(float(left), float(top), float(right), float(bottom), op); } static bool android_view_GLES20Canvas_getClipBounds(JNIEnv* env, jobject canvas, Loading Loading @@ -257,8 +260,8 @@ static JNINativeMethod gMethods[] = { { "nSaveLayerAlpha", "(IFFFFII)I", (void*) android_view_GLES20Canvas_saveLayerAlpha }, { "nQuickReject", "(IFFFFI)Z", (void*) android_view_GLES20Canvas_quickReject }, { "nClipRect", "(IFFFF)Z", (void*) android_view_GLES20Canvas_clipRectF }, { "nClipRect", "(IIIII)Z", (void*) android_view_GLES20Canvas_clipRect }, { "nClipRect", "(IFFFFI)Z", (void*) android_view_GLES20Canvas_clipRectF }, { "nClipRect", "(IIIIII)Z", (void*) android_view_GLES20Canvas_clipRect }, { "nTranslate", "(IFF)V", (void*) android_view_GLES20Canvas_translate }, { "nRotate", "(IF)V", (void*) android_view_GLES20Canvas_rotate }, Loading
graphics/java/android/graphics/Region.java +5 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,11 @@ public class Region implements Parcelable { Op(int nativeInt) { this.nativeInt = nativeInt; } final int nativeInt; /** * @hide */ public final int nativeInt; } /** Create an empty region Loading
libs/hwui/Matrix.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,25 @@ void Matrix4::copyTo(SkMatrix& v) const { v.set(SkMatrix::kMPersp2, data[15]); } void Matrix4::loadInverse(const Matrix4& v) { double scale = 1.0 / (v.data[0] * ((double) v.data[5] * v.data[15] - (double) v.data[13] * v.data[7]) + v.data[4] * ((double) v.data[13] * v.data[3] - (double) v.data[1] * v.data[15]) + v.data[12] * ((double) v.data[1] * v.data[7] - (double) v.data[5] * v.data[3])); data[0] = (v.data[5] * v.data[15] - v.data[13] * v.data[7]) * scale; data[4] = (v.data[12] * v.data[7] - v.data[4] * v.data[15]) * scale; data[12] = (v.data[4] * v.data[13] - v.data[12] * v.data[5]) * scale; data[1] = (v.data[13] * v.data[3] - v.data[1] * v.data[15]) * scale; data[5] = (v.data[0] * v.data[15] - v.data[12] * v.data[3]) * scale; data[13] = (v.data[12] * v.data[1] - v.data[0] * v.data[13]) * scale; data[3] = (v.data[1] * v.data[7] - v.data[5] * v.data[3]) * scale; data[7] = (v.data[4] * v.data[3] - v.data[0] * v.data[7]) * scale; data[15] = (v.data[0] * v.data[5] - v.data[4] * v.data[1]) * scale; } void Matrix4::copyTo(float* v) const { memcpy(v, data, sizeof(data)); } Loading
libs/hwui/Matrix.h +2 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,8 @@ public: void load(const Matrix4& v); void load(const SkMatrix& v); void loadInverse(const Matrix4& v); void loadTranslate(float x, float y, float z); void loadScale(float sx, float sy, float sz); void loadRotate(float angle, float x, float y, float z); Loading