diff options
Diffstat (limited to 'tests/HwAccelerationTest/src/com/google/android/test/hwui/HwUiActivity.java')
-rw-r--r-- | tests/HwAccelerationTest/src/com/google/android/test/hwui/HwUiActivity.java | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/HwUiActivity.java b/tests/HwAccelerationTest/src/com/google/android/test/hwui/HwUiActivity.java index d24f027..81b9357 100644 --- a/tests/HwAccelerationTest/src/com/google/android/test/hwui/HwUiActivity.java +++ b/tests/HwAccelerationTest/src/com/google/android/test/hwui/HwUiActivity.java @@ -18,14 +18,13 @@ package com.google.android.test.hwui; import android.app.Activity; import android.content.Context; -import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; import android.os.Bundle; +import android.util.Log; import android.view.View; -import static android.util.Log.d; - +@SuppressWarnings({"UnusedDeclaration"}) public class HwUiActivity extends Activity { private static final String LOG_TAG = "HwUi"; @@ -42,15 +41,47 @@ public class HwUiActivity extends Activity { } static class DirtyBitmapView extends View { + private final Paint mPaint; + DirtyBitmapView(Context c) { super(c); + mPaint = new Paint(); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); - canvas.drawRGB(255, 0, 0); + canvas.drawRGB(255, 255, 255); + + mPaint.setColor(0xffff0000); + canvas.drawRect(200.0f, 0.0f, 220.0f, 20.0f, mPaint); + + canvas.save(); + canvas.clipRect(20.0f, 0.0f, 40.0f, 20.0f); + Log.d(LOG_TAG, "clipRect = " + canvas.getClipBounds()); + canvas.restore(); + + canvas.save(); + canvas.scale(2.0f, 2.0f); + canvas.clipRect(20.0f, 0.0f, 40.0f, 20.0f); + Log.d(LOG_TAG, "clipRect = " + canvas.getClipBounds()); + canvas.restore(); + + canvas.save(); + canvas.translate(20.0f, 20.0f); + canvas.clipRect(20.0f, 0.0f, 40.0f, 20.0f); + Log.d(LOG_TAG, "clipRect = " + canvas.getClipBounds()); + canvas.restore(); + + canvas.scale(2.0f, 2.0f); + canvas.clipRect(20.0f, 0.0f, 40.0f, 20.0f); + + mPaint.setColor(0xff00ff00); + canvas.drawRect(0.0f, 0.0f, 20.0f, 20.0f, mPaint); + + mPaint.setColor(0xff0000ff); + canvas.drawRect(20.0f, 0.0f, 40.0f, 20.0f, mPaint); } } } |