summaryrefslogtreecommitdiffstats
path: root/tests/HwAccelerationTest
diff options
context:
space:
mode:
authorLeon Scroggins III <scroggo@google.com>2014-07-09 16:44:35 -0400
committerLeon Scroggins III <scroggo@google.com>2014-07-10 18:01:22 -0400
commitab87983a11e0bd2e08d752d86d5e945ea7d39a04 (patch)
tree4e05141a491cdaabed0c6ba820b3aa07bbc2cb8a /tests/HwAccelerationTest
parent3ff3db5f5c222af0ddd588cee41efc70ddf2b0c3 (diff)
downloadframeworks_base-ab87983a11e0bd2e08d752d86d5e945ea7d39a04.zip
frameworks_base-ab87983a11e0bd2e08d752d86d5e945ea7d39a04.tar.gz
frameworks_base-ab87983a11e0bd2e08d752d86d5e945ea7d39a04.tar.bz2
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
Diffstat (limited to 'tests/HwAccelerationTest')
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java
index 90db818..fbe7856 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java
@@ -223,12 +223,11 @@ public class GradientsActivity extends Activity {
float left = 40.0f;
float bottom = 40.0f + mDrawHeight;
- mPaint.setShader(mGradient);
-
mMatrix.setScale(1, mDrawWidth);
mMatrix.postRotate(90);
mMatrix.postTranslate(right, top);
mGradient.setLocalMatrix(mMatrix);
+ mPaint.setShader(mGradient);
canvas.drawRect(right - mDrawWidth, top, right, top + mDrawHeight, mPaint);
top += 40.0f + mDrawHeight;
@@ -237,6 +236,7 @@ public class GradientsActivity extends Activity {
mMatrix.setScale(1, mDrawHeight);
mMatrix.postTranslate(left, top);
mGradient.setLocalMatrix(mMatrix);
+ mPaint.setShader(mGradient);
canvas.drawRect(left, top, right, top + mDrawHeight, mPaint);
left += 40.0f + mDrawWidth;
@@ -248,6 +248,7 @@ public class GradientsActivity extends Activity {
mMatrix.postRotate(180);
mMatrix.postTranslate(left, bottom);
mGradient.setLocalMatrix(mMatrix);
+ mPaint.setShader(mGradient);
canvas.drawRect(left, bottom - mDrawHeight, right, bottom, mPaint);
top += 40.0f + mDrawHeight;
@@ -257,6 +258,7 @@ public class GradientsActivity extends Activity {
mMatrix.postRotate(-90);
mMatrix.postTranslate(left, top);
mGradient.setLocalMatrix(mMatrix);
+ mPaint.setShader(mGradient);
canvas.drawRect(left, top, left + mDrawWidth, bottom, mPaint);
right = left + mDrawWidth;
@@ -264,12 +266,11 @@ public class GradientsActivity extends Activity {
top = bottom + 20.0f;
bottom = top + 50.0f;
- mPaint.setShader(mGradientStops);
-
mMatrix.setScale(1, mDrawWidth);
mMatrix.postRotate(90);
mMatrix.postTranslate(right, top);
mGradientStops.setLocalMatrix(mMatrix);
+ mPaint.setShader(mGradientStops);
canvas.drawRect(left, top, right, bottom, mPaint);
canvas.restore();