Loading libs/hwui/OpenGLRenderer.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -1369,10 +1369,10 @@ void OpenGLRenderer::drawBitmap(SkBitmap* bitmap, const float width = texture->width; const float height = texture->height; const float u1 = srcLeft / width; const float v1 = srcTop / height; const float u2 = srcRight / width; const float v2 = srcBottom / height; const float u1 = (srcLeft + 0.5f) / width; const float v1 = (srcTop + 0.5f) / height; const float u2 = (srcRight - 0.5f) / width; const float v2 = (srcBottom - 0.5f) / height; mCaches.unbindMeshBuffer(); resetDrawTextureTexCoords(u1, v1, u2, v2); Loading tests/HwAccelerationTest/res/drawable-hdpi/patch.9.png 0 → 100644 +2.8 KiB Loading image diff... tests/HwAccelerationTest/src/com/android/test/hwui/ThinPatchesActivity.java +25 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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); Loading @@ -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 Loading @@ -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); } } } Loading
libs/hwui/OpenGLRenderer.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -1369,10 +1369,10 @@ void OpenGLRenderer::drawBitmap(SkBitmap* bitmap, const float width = texture->width; const float height = texture->height; const float u1 = srcLeft / width; const float v1 = srcTop / height; const float u2 = srcRight / width; const float v2 = srcBottom / height; const float u1 = (srcLeft + 0.5f) / width; const float v1 = (srcTop + 0.5f) / height; const float u2 = (srcRight - 0.5f) / width; const float v2 = (srcBottom - 0.5f) / height; mCaches.unbindMeshBuffer(); resetDrawTextureTexCoords(u1, v1, u2, v2); Loading
tests/HwAccelerationTest/src/com/android/test/hwui/ThinPatchesActivity.java +25 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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); Loading @@ -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 Loading @@ -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); } } }