Loading core/java/android/view/View.java +4 −0 Original line number Diff line number Diff line Loading @@ -14948,6 +14948,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, matrix.setScale(1, fadeHeight * topFadeStrength); matrix.postTranslate(left, top); fade.setLocalMatrix(matrix); p.setShader(fade); canvas.drawRect(left, top, right, top + length, p); } Loading @@ -14956,6 +14957,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, matrix.postRotate(180); matrix.postTranslate(left, bottom); fade.setLocalMatrix(matrix); p.setShader(fade); canvas.drawRect(left, bottom - length, right, bottom, p); } Loading @@ -14964,6 +14966,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, matrix.postRotate(-90); matrix.postTranslate(left, top); fade.setLocalMatrix(matrix); p.setShader(fade); canvas.drawRect(left, top, left + length, bottom, p); } Loading @@ -14972,6 +14975,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, matrix.postRotate(90); matrix.postTranslate(right, top); fade.setLocalMatrix(matrix); p.setShader(fade); canvas.drawRect(right - length, top, right, bottom, p); } core/jni/android/graphics/Shader.cpp +7 −6 Original line number Diff line number Diff line Loading @@ -56,19 +56,20 @@ static void Shader_destructor(JNIEnv* env, jobject o, jlong shaderHandle) SkSafeUnref(shader); } static void Shader_setLocalMatrix(JNIEnv* env, jobject o, jlong shaderHandle, static jlong Shader_setLocalMatrix(JNIEnv* env, jobject o, jlong shaderHandle, jlong matrixHandle) { SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle); const SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle); if (shader) { if (NULL == matrix) { shader->resetLocalMatrix(); } else { shader->setLocalMatrix(*matrix); matrix = &SkMatrix::I(); } SkShader* newShader = SkShader::CreateLocalMatrixShader(shader, *matrix); shader->unref(); shader = newShader; } return reinterpret_cast<jlong>(shader); } /////////////////////////////////////////////////////////////////////////////////////////////// Loading Loading @@ -239,7 +240,7 @@ static JNINativeMethod gColorMethods[] = { static JNINativeMethod gShaderMethods[] = { { "nativeDestructor", "(J)V", (void*)Shader_destructor }, { "nativeSetLocalMatrix", "(JJ)V", (void*)Shader_setLocalMatrix } { "nativeSetLocalMatrix", "(JJ)J", (void*)Shader_setLocalMatrix } }; static JNINativeMethod gBitmapShaderMethods[] = { Loading graphics/java/android/graphics/Shader.java +8 −3 Original line number Diff line number Diff line Loading @@ -69,12 +69,17 @@ public class Shader { /** * Set the shader's local matrix. Passing null will reset the shader's * matrix to identity * matrix to identity. * * Starting with {@link android.os.Build.VERSION_CODES#L}, this does not * modify any Paints which use this Shader. In order to modify the Paint, * you need to call {@link Paint#setShader} again. * * @param localM The shader's new local matrix, or null to specify identity */ public void setLocalMatrix(Matrix localM) { mLocalMatrix = localM; nativeSetLocalMatrix(native_instance, native_instance = nativeSetLocalMatrix(native_instance, localM == null ? 0 : localM.native_instance); } Loading Loading @@ -109,6 +114,6 @@ public class Shader { } private static native void nativeDestructor(long native_shader); private static native void nativeSetLocalMatrix(long native_shader, private static native long nativeSetLocalMatrix(long native_shader, long matrix_instance); } graphics/java/android/graphics/drawable/BitmapDrawable.java +4 −0 Original line number Diff line number Diff line Loading @@ -467,10 +467,12 @@ public class BitmapDrawable extends Drawable { if (needMirroring()) { updateMirrorMatrix(bounds.right - bounds.left); shader.setLocalMatrix(mMirrorMatrix); mBitmapState.mPaint.setShader(shader); } else { if (mMirrorMatrix != null) { mMirrorMatrix = null; shader.setLocalMatrix(Matrix.IDENTITY_MATRIX); mBitmapState.mPaint.setShader(shader); } } } Loading Loading @@ -547,10 +549,12 @@ public class BitmapDrawable extends Drawable { // Mirror the bitmap updateMirrorMatrix(mDstRect.right - mDstRect.left); shader.setLocalMatrix(mMirrorMatrix); paint.setShader(shader); } else { if (mMirrorMatrix != null) { mMirrorMatrix = null; shader.setLocalMatrix(Matrix.IDENTITY_MATRIX); paint.setShader(shader); } } Loading packages/SystemUI/src/com/android/systemui/recent/FadedEdgeDrawHelper.java +4 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ public class FadedEdgeDrawHelper { mFadeMatrix.setScale(1, fadeHeight * topFadeStrength); mFadeMatrix.postTranslate(left, top); mFade.setLocalMatrix(mFadeMatrix); mFadePaint.setShader(mFade); canvas.drawRect(left, top, right, top + length, mFadePaint); if (mBlackPaint == null) { Loading @@ -157,6 +158,7 @@ public class FadedEdgeDrawHelper { mFadeMatrix.postRotate(180); mFadeMatrix.postTranslate(left, bottom); mFade.setLocalMatrix(mFadeMatrix); mFadePaint.setShader(mFade); canvas.drawRect(left, bottom - length, right, bottom, mFadePaint); } Loading @@ -165,6 +167,7 @@ public class FadedEdgeDrawHelper { mFadeMatrix.postRotate(-90); mFadeMatrix.postTranslate(left, top); mFade.setLocalMatrix(mFadeMatrix); mFadePaint.setShader(mFade); canvas.drawRect(left, top, left + length, bottom, mFadePaint); } Loading @@ -173,6 +176,7 @@ public class FadedEdgeDrawHelper { mFadeMatrix.postRotate(90); mFadeMatrix.postTranslate(right, top); mFade.setLocalMatrix(mFadeMatrix); mFadePaint.setShader(mFade); canvas.drawRect(right - length, top, right, bottom, mFadePaint); } } Loading Loading
core/java/android/view/View.java +4 −0 Original line number Diff line number Diff line Loading @@ -14948,6 +14948,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, matrix.setScale(1, fadeHeight * topFadeStrength); matrix.postTranslate(left, top); fade.setLocalMatrix(matrix); p.setShader(fade); canvas.drawRect(left, top, right, top + length, p); } Loading @@ -14956,6 +14957,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, matrix.postRotate(180); matrix.postTranslate(left, bottom); fade.setLocalMatrix(matrix); p.setShader(fade); canvas.drawRect(left, bottom - length, right, bottom, p); } Loading @@ -14964,6 +14966,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, matrix.postRotate(-90); matrix.postTranslate(left, top); fade.setLocalMatrix(matrix); p.setShader(fade); canvas.drawRect(left, top, left + length, bottom, p); } Loading @@ -14972,6 +14975,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, matrix.postRotate(90); matrix.postTranslate(right, top); fade.setLocalMatrix(matrix); p.setShader(fade); canvas.drawRect(right - length, top, right, bottom, p); }
core/jni/android/graphics/Shader.cpp +7 −6 Original line number Diff line number Diff line Loading @@ -56,19 +56,20 @@ static void Shader_destructor(JNIEnv* env, jobject o, jlong shaderHandle) SkSafeUnref(shader); } static void Shader_setLocalMatrix(JNIEnv* env, jobject o, jlong shaderHandle, static jlong Shader_setLocalMatrix(JNIEnv* env, jobject o, jlong shaderHandle, jlong matrixHandle) { SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle); const SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle); if (shader) { if (NULL == matrix) { shader->resetLocalMatrix(); } else { shader->setLocalMatrix(*matrix); matrix = &SkMatrix::I(); } SkShader* newShader = SkShader::CreateLocalMatrixShader(shader, *matrix); shader->unref(); shader = newShader; } return reinterpret_cast<jlong>(shader); } /////////////////////////////////////////////////////////////////////////////////////////////// Loading Loading @@ -239,7 +240,7 @@ static JNINativeMethod gColorMethods[] = { static JNINativeMethod gShaderMethods[] = { { "nativeDestructor", "(J)V", (void*)Shader_destructor }, { "nativeSetLocalMatrix", "(JJ)V", (void*)Shader_setLocalMatrix } { "nativeSetLocalMatrix", "(JJ)J", (void*)Shader_setLocalMatrix } }; static JNINativeMethod gBitmapShaderMethods[] = { Loading
graphics/java/android/graphics/Shader.java +8 −3 Original line number Diff line number Diff line Loading @@ -69,12 +69,17 @@ public class Shader { /** * Set the shader's local matrix. Passing null will reset the shader's * matrix to identity * matrix to identity. * * Starting with {@link android.os.Build.VERSION_CODES#L}, this does not * modify any Paints which use this Shader. In order to modify the Paint, * you need to call {@link Paint#setShader} again. * * @param localM The shader's new local matrix, or null to specify identity */ public void setLocalMatrix(Matrix localM) { mLocalMatrix = localM; nativeSetLocalMatrix(native_instance, native_instance = nativeSetLocalMatrix(native_instance, localM == null ? 0 : localM.native_instance); } Loading Loading @@ -109,6 +114,6 @@ public class Shader { } private static native void nativeDestructor(long native_shader); private static native void nativeSetLocalMatrix(long native_shader, private static native long nativeSetLocalMatrix(long native_shader, long matrix_instance); }
graphics/java/android/graphics/drawable/BitmapDrawable.java +4 −0 Original line number Diff line number Diff line Loading @@ -467,10 +467,12 @@ public class BitmapDrawable extends Drawable { if (needMirroring()) { updateMirrorMatrix(bounds.right - bounds.left); shader.setLocalMatrix(mMirrorMatrix); mBitmapState.mPaint.setShader(shader); } else { if (mMirrorMatrix != null) { mMirrorMatrix = null; shader.setLocalMatrix(Matrix.IDENTITY_MATRIX); mBitmapState.mPaint.setShader(shader); } } } Loading Loading @@ -547,10 +549,12 @@ public class BitmapDrawable extends Drawable { // Mirror the bitmap updateMirrorMatrix(mDstRect.right - mDstRect.left); shader.setLocalMatrix(mMirrorMatrix); paint.setShader(shader); } else { if (mMirrorMatrix != null) { mMirrorMatrix = null; shader.setLocalMatrix(Matrix.IDENTITY_MATRIX); paint.setShader(shader); } } Loading
packages/SystemUI/src/com/android/systemui/recent/FadedEdgeDrawHelper.java +4 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ public class FadedEdgeDrawHelper { mFadeMatrix.setScale(1, fadeHeight * topFadeStrength); mFadeMatrix.postTranslate(left, top); mFade.setLocalMatrix(mFadeMatrix); mFadePaint.setShader(mFade); canvas.drawRect(left, top, right, top + length, mFadePaint); if (mBlackPaint == null) { Loading @@ -157,6 +158,7 @@ public class FadedEdgeDrawHelper { mFadeMatrix.postRotate(180); mFadeMatrix.postTranslate(left, bottom); mFade.setLocalMatrix(mFadeMatrix); mFadePaint.setShader(mFade); canvas.drawRect(left, bottom - length, right, bottom, mFadePaint); } Loading @@ -165,6 +167,7 @@ public class FadedEdgeDrawHelper { mFadeMatrix.postRotate(-90); mFadeMatrix.postTranslate(left, top); mFade.setLocalMatrix(mFadeMatrix); mFadePaint.setShader(mFade); canvas.drawRect(left, top, left + length, bottom, mFadePaint); } Loading @@ -173,6 +176,7 @@ public class FadedEdgeDrawHelper { mFadeMatrix.postRotate(90); mFadeMatrix.postTranslate(right, top); mFade.setLocalMatrix(mFadeMatrix); mFadePaint.setShader(mFade); canvas.drawRect(right - length, top, right, bottom, mFadePaint); } } Loading