Loading graphics/java/android/graphics/Canvas.java +5 −1 Original line number Diff line number Diff line Loading @@ -1240,7 +1240,11 @@ public class Canvas { VertexMode(int nativeInt) { this.nativeInt = nativeInt; } final int nativeInt; /** * @hide */ public final int nativeInt; } /** Loading libs/hwui/DisplayListRenderer.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -325,6 +325,7 @@ void DisplayList::replay(OpenGLRenderer& renderer, uint32_t level) { renderer.drawBitmapMesh(bitmap, meshWidth, meshHeight, vertices, colors, getPaint()); } break; case DrawPatch: { int32_t* xDivs = NULL; int32_t* yDivs = NULL; Loading libs/hwui/OpenGLRenderer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -1094,10 +1094,10 @@ void OpenGLRenderer::drawBitmapMesh(SkBitmap* bitmap, int meshWidth, int meshHei SkXfermode::Mode mode; getAlphaAndMode(paint, &alpha, &mode); // TODO: Support the colors array const uint32_t count = meshWidth * meshHeight * 6; TextureVertex mesh[count]; // TODO: Support the colors array TextureVertex mesh[count]; TextureVertex* vertex = mesh; for (int32_t y = 0; y < meshHeight; y++) { for (int32_t x = 0; x < meshWidth; x++) { Loading tests/HwAccelerationTest/src/com/android/test/hwui/BitmapMeshActivity.java +23 −11 Original line number Diff line number Diff line Loading @@ -22,10 +22,7 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffXfermode; import android.os.Bundle; import android.util.Log; import android.view.View; @SuppressWarnings({"UnusedDeclaration"}) Loading @@ -41,11 +38,30 @@ public class BitmapMeshActivity extends Activity { static class BitmapMeshView extends View { private Paint mBitmapPaint; private final Bitmap mBitmap1; private float[] mVertices; private int[] mColors; BitmapMeshView(Context c) { super(c); mBitmap1 = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset1); final float width = mBitmap1.getWidth() / 3.0f; final float height = mBitmap1.getHeight() / 3.0f; mVertices = new float[] { 0.0f, 0.0f, width, 0.0f, width * 2, 0.0f, width * 3, 0.0f, 0.0f, height, width, height, width * 2, height, width * 4, height, 0.0f, height * 2, width, height * 2, width * 2, height * 2, width * 3, height * 2, 0.0f, height * 4, width, height * 4, width * 2, height * 4, width * 4, height * 4, }; mColors = new int[] { 0xffff0000, 0xff00ff00, 0xff0000ff, 0xffff0000, 0xff0000ff, 0xffff0000, 0xff00ff00, 0xff00ff00, 0xff00ff00, 0xff0000ff, 0xffff0000, 0xff00ff00, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00ff0000, }; } @Override Loading @@ -54,14 +70,10 @@ public class BitmapMeshActivity extends Activity { canvas.drawARGB(255, 255, 255, 255); canvas.translate(100, 100); final float width = mBitmap1.getWidth() / 3.0f; final float height = mBitmap1.getHeight() / 3.0f; canvas.drawBitmapMesh(mBitmap1, 3, 3, new float[] { 0.0f, 0.0f, width, 0.0f, width * 2, 0.0f, width * 3, 0.0f, 0.0f, height, width, height, width * 2, height, width * 4, height, 0.0f, height * 2, width, height * 2, width * 2, height * 2, width * 3, height * 2, 0.0f, height * 4, width, height * 4, width * 2, height * 4, width * 4, height * 4, }, 0, null, 0, null); canvas.drawBitmapMesh(mBitmap1, 3, 3, mVertices, 0, null, 0, null); canvas.translate(400, 0); canvas.drawBitmapMesh(mBitmap1, 3, 3, mVertices, 0, mColors, 0, null); } } } Loading
graphics/java/android/graphics/Canvas.java +5 −1 Original line number Diff line number Diff line Loading @@ -1240,7 +1240,11 @@ public class Canvas { VertexMode(int nativeInt) { this.nativeInt = nativeInt; } final int nativeInt; /** * @hide */ public final int nativeInt; } /** Loading
libs/hwui/DisplayListRenderer.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -325,6 +325,7 @@ void DisplayList::replay(OpenGLRenderer& renderer, uint32_t level) { renderer.drawBitmapMesh(bitmap, meshWidth, meshHeight, vertices, colors, getPaint()); } break; case DrawPatch: { int32_t* xDivs = NULL; int32_t* yDivs = NULL; Loading
libs/hwui/OpenGLRenderer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -1094,10 +1094,10 @@ void OpenGLRenderer::drawBitmapMesh(SkBitmap* bitmap, int meshWidth, int meshHei SkXfermode::Mode mode; getAlphaAndMode(paint, &alpha, &mode); // TODO: Support the colors array const uint32_t count = meshWidth * meshHeight * 6; TextureVertex mesh[count]; // TODO: Support the colors array TextureVertex mesh[count]; TextureVertex* vertex = mesh; for (int32_t y = 0; y < meshHeight; y++) { for (int32_t x = 0; x < meshWidth; x++) { Loading
tests/HwAccelerationTest/src/com/android/test/hwui/BitmapMeshActivity.java +23 −11 Original line number Diff line number Diff line Loading @@ -22,10 +22,7 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffXfermode; import android.os.Bundle; import android.util.Log; import android.view.View; @SuppressWarnings({"UnusedDeclaration"}) Loading @@ -41,11 +38,30 @@ public class BitmapMeshActivity extends Activity { static class BitmapMeshView extends View { private Paint mBitmapPaint; private final Bitmap mBitmap1; private float[] mVertices; private int[] mColors; BitmapMeshView(Context c) { super(c); mBitmap1 = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset1); final float width = mBitmap1.getWidth() / 3.0f; final float height = mBitmap1.getHeight() / 3.0f; mVertices = new float[] { 0.0f, 0.0f, width, 0.0f, width * 2, 0.0f, width * 3, 0.0f, 0.0f, height, width, height, width * 2, height, width * 4, height, 0.0f, height * 2, width, height * 2, width * 2, height * 2, width * 3, height * 2, 0.0f, height * 4, width, height * 4, width * 2, height * 4, width * 4, height * 4, }; mColors = new int[] { 0xffff0000, 0xff00ff00, 0xff0000ff, 0xffff0000, 0xff0000ff, 0xffff0000, 0xff00ff00, 0xff00ff00, 0xff00ff00, 0xff0000ff, 0xffff0000, 0xff00ff00, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00ff0000, }; } @Override Loading @@ -54,14 +70,10 @@ public class BitmapMeshActivity extends Activity { canvas.drawARGB(255, 255, 255, 255); canvas.translate(100, 100); final float width = mBitmap1.getWidth() / 3.0f; final float height = mBitmap1.getHeight() / 3.0f; canvas.drawBitmapMesh(mBitmap1, 3, 3, new float[] { 0.0f, 0.0f, width, 0.0f, width * 2, 0.0f, width * 3, 0.0f, 0.0f, height, width, height, width * 2, height, width * 4, height, 0.0f, height * 2, width, height * 2, width * 2, height * 2, width * 3, height * 2, 0.0f, height * 4, width, height * 4, width * 2, height * 4, width * 4, height * 4, }, 0, null, 0, null); canvas.drawBitmapMesh(mBitmap1, 3, 3, mVertices, 0, null, 0, null); canvas.translate(400, 0); canvas.drawBitmapMesh(mBitmap1, 3, 3, mVertices, 0, mColors, 0, null); } } }