diff options
author | Romain Guy <romainguy@google.com> | 2010-10-25 18:03:28 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2010-10-25 18:03:28 -0700 |
commit | 8164c2d338781c3a3c4a443941070dca5d88f2a7 (patch) | |
tree | 22f218c64471d29d1cfbc9a55cb8bb530cf78714 /tests | |
parent | c361da845a205ac35e724c0ca436744d483de7aa (diff) | |
download | frameworks_base-8164c2d338781c3a3c4a443941070dca5d88f2a7.zip frameworks_base-8164c2d338781c3a3c4a443941070dca5d88f2a7.tar.gz frameworks_base-8164c2d338781c3a3c4a443941070dca5d88f2a7.tar.bz2 |
Don't change textures wrap modes on every draw.
Change-Id: If6d3f313778cc7f3e803a063338539c8b3e165e3
Diffstat (limited to 'tests')
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/ShadersActivity.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/ShadersActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/ShadersActivity.java index 2db1071..02eaa7c 100644 --- a/tests/HwAccelerationTest/src/com/android/test/hwui/ShadersActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/ShadersActivity.java @@ -51,27 +51,28 @@ public class ShadersActivity extends Activity { private LinearGradient mHorGradient; private LinearGradient mDiagGradient; private LinearGradient mVertGradient; + private Bitmap mTexture; ShadersView(Context c) { super(c); - Bitmap texture = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset1); - mTexWidth = texture.getWidth(); - mTexHeight = texture.getHeight(); + mTexture = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset1); + mTexWidth = mTexture.getWidth(); + mTexHeight = mTexture.getHeight(); mDrawWidth = mTexWidth * 2.2f; mDrawHeight = mTexHeight * 1.2f; - mRepeatShader = new BitmapShader(texture, Shader.TileMode.REPEAT, + mRepeatShader = new BitmapShader(mTexture, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT); - mTranslatedShader = new BitmapShader(texture, Shader.TileMode.REPEAT, + mTranslatedShader = new BitmapShader(mTexture, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT); Matrix m1 = new Matrix(); m1.setTranslate(mTexWidth / 2.0f, mTexHeight / 2.0f); m1.postRotate(45, 0, 0); mTranslatedShader.setLocalMatrix(m1); - mScaledShader = new BitmapShader(texture, Shader.TileMode.MIRROR, + mScaledShader = new BitmapShader(mTexture, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR); Matrix m2 = new Matrix(); m2.setScale(0.5f, 0.5f); @@ -98,6 +99,7 @@ public class ShadersActivity extends Activity { protected void onDraw(Canvas canvas) { super.onDraw(canvas); //canvas.drawRGB(255, 255, 255); + canvas.drawBitmap(mTexture, 0.0f, 0.0f, null); // Bitmap shaders canvas.save(); |