summaryrefslogtreecommitdiffstats
path: root/libs/hwui/DisplayListRenderer.cpp
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2011-01-20 19:09:30 -0800
committerRomain Guy <romainguy@google.com>2011-01-20 19:09:30 -0800
commit5a7b466a2b4b7ced739bd5c31e022de61650545a (patch)
tree1eef540913ce3a131019586f9187bc8e66f59caa /libs/hwui/DisplayListRenderer.cpp
parentc8219299b0003793cee8049b96a3bf7530765eea (diff)
downloadframeworks_base-5a7b466a2b4b7ced739bd5c31e022de61650545a.zip
frameworks_base-5a7b466a2b4b7ced739bd5c31e022de61650545a.tar.gz
frameworks_base-5a7b466a2b4b7ced739bd5c31e022de61650545a.tar.bz2
Add support for drawBitmapMesh().
Change-Id: Ic77f9c534bb90dc7b9458299544bd50b8b6ae6a5
Diffstat (limited to 'libs/hwui/DisplayListRenderer.cpp')
-rw-r--r--libs/hwui/DisplayListRenderer.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index a74a95f..bdf056c 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -100,6 +100,7 @@ const char* DisplayList::OP_NAMES[] = {
"DrawBitmap",
"DrawBitmapMatrix",
"DrawBitmapRect",
+ "DrawBitmapMesh",
"DrawPatch",
"DrawColor",
"DrawRect",
@@ -308,6 +309,19 @@ void DisplayList::replay(OpenGLRenderer& renderer, uint32_t level) {
getFloat(), getFloat(), getFloat(), getFloat(), getPaint());
}
break;
+ case DrawBitmapMesh: {
+ int verticesCount = 0;
+ uint32_t colorsCount = 0;
+
+ SkBitmap* bitmap = getBitmap();
+ uint32_t meshWidth = getInt();
+ uint32_t meshHeight = getInt();
+ float* vertices = getFloats(verticesCount);
+ bool hasColors = getInt();
+ int* colors = hasColors ? getInts(colorsCount) : NULL;
+
+ renderer.drawBitmapMesh(bitmap, meshWidth, meshHeight, vertices, colors, getPaint());
+ }
case DrawPatch: {
int32_t* xDivs = NULL;
int32_t* yDivs = NULL;
@@ -587,6 +601,22 @@ void DisplayListRenderer::drawBitmap(SkBitmap* bitmap, float srcLeft, float srcT
addPaint(paint);
}
+void DisplayListRenderer::drawBitmapMesh(SkBitmap* bitmap, int meshWidth, int meshHeight,
+ float* vertices, int* colors, SkPaint* paint) {
+ addOp(DisplayList::DrawBitmapMesh);
+ addBitmap(bitmap);
+ addInt(meshWidth);
+ addInt(meshHeight);
+ addFloats(vertices, (meshWidth + 1) * (meshHeight + 1) * 2);
+ if (colors) {
+ addInt(1);
+ addInts(colors, (meshWidth + 1) * (meshHeight + 1));
+ } else {
+ addInt(0);
+ }
+ addPaint(paint);
+}
+
void DisplayListRenderer::drawPatch(SkBitmap* bitmap, const int32_t* xDivs, const int32_t* yDivs,
const uint32_t* colors, uint32_t width, uint32_t height, int8_t numColors,
float left, float top, float right, float bottom, SkPaint* paint) {