Simplify Shader.setLocalMatrix.

Previously, calling setLocalMatrix updated any Paint that had the
Shader attached. This depended on deprecated behavior in Skia. Use
new Skia APIs, and do not modify any Paints that use the Shader.

In addition, update callers to call setShader (again) after modifying
the Shader.

Sample app at ag/499573 for testing.

Depends on I673801444f0a8fd4f192b5b7effdde1aa83e702b in external/skia.

BUG:14315916
Change-Id: I3c3316377874e89fccc85afb864bc038b0ef3890
This commit is contained in:
Leon Scroggins III
2014-07-09 16:44:35 -04:00
parent 3ff3db5f5c
commit ab87983a11
6 changed files with 32 additions and 13 deletions

View File

@@ -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);
}
}
}
@@ -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);
}
}