summaryrefslogtreecommitdiffstats
path: root/tests/HwAccelerationTest/src/com/android/test/hwui/ThinPatchesActivity.java
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2011-05-26 18:39:34 -0700
committerRomain Guy <romainguy@google.com>2011-05-26 18:39:34 -0700
commit1e59f9d10d164f156221f6d34b932f06cdd29f1f (patch)
treebf37ea0028b41c83646021e90b11a9536909bae2 /tests/HwAccelerationTest/src/com/android/test/hwui/ThinPatchesActivity.java
parentf504a2fa144504ca1efd39a4ef9208e3d4d336c5 (diff)
downloadframeworks_base-1e59f9d10d164f156221f6d34b932f06cdd29f1f.zip
frameworks_base-1e59f9d10d164f156221f6d34b932f06cdd29f1f.tar.gz
frameworks_base-1e59f9d10d164f156221f6d34b932f06cdd29f1f.tar.bz2
Fix texture coordinates for sub-bitmap rendering.
Change-Id: I05a31775e03f5b223a55a5144d420351abac89be
Diffstat (limited to 'tests/HwAccelerationTest/src/com/android/test/hwui/ThinPatchesActivity.java')
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/ThinPatchesActivity.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/ThinPatchesActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/ThinPatchesActivity.java
index 4f605fa..cfad6da 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/ThinPatchesActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/ThinPatchesActivity.java
@@ -18,7 +18,10 @@ package com.android.test.hwui;
import android.app.Activity;
import android.content.res.Resources;
+import android.graphics.Bitmap;
import android.graphics.Canvas;
+import android.graphics.Rect;
+import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
@@ -42,6 +45,7 @@ public class ThinPatchesActivity extends Activity {
private class PatchView extends View {
private Drawable mPatch1, mPatch2;
+ private Bitmap mTexture;
public PatchView(Activity activity) {
super(activity);
@@ -49,6 +53,20 @@ public class ThinPatchesActivity extends Activity {
final Resources resources = activity.getResources();
mPatch1 = resources.getDrawable(R.drawable.patch);
mPatch2 = resources.getDrawable(R.drawable.btn_toggle_on);
+
+ mTexture = Bitmap.createBitmap(4, 3, Bitmap.Config.ARGB_8888);
+ mTexture.setPixel(0, 0, 0xffff0000);
+ mTexture.setPixel(1, 0, 0xffffffff);
+ mTexture.setPixel(2, 0, 0xff000000);
+ mTexture.setPixel(3, 0, 0xffff0000);
+ mTexture.setPixel(0, 1, 0xffff0000);
+ mTexture.setPixel(1, 1, 0xff000000);
+ mTexture.setPixel(2, 1, 0xffffffff);
+ mTexture.setPixel(3, 1, 0xffff0000);
+ mTexture.setPixel(0, 2, 0xffff0000);
+ mTexture.setPixel(1, 2, 0xffff0000);
+ mTexture.setPixel(2, 2, 0xffff0000);
+ mTexture.setPixel(3, 2, 0xffff0000);
}
@Override
@@ -62,10 +80,17 @@ public class ThinPatchesActivity extends Activity {
mPatch1.setBounds(left, top, left + width, top + height);
mPatch1.draw(canvas);
+ canvas.save();
canvas.translate(0.0f, height + 20.0f);
mPatch2.setBounds(left, top, left + width, top + height);
mPatch2.draw(canvas);
+
+ canvas.restore();
+
+// Rect src = new Rect(1, 0, 3, 2);
+// RectF dst = new RectF(0, 0, getWidth(), getHeight());
+// canvas.drawBitmap(mTexture, src, dst, null);
}
}
}