Update 9patch structure when rendering with different divs/colors.
Bug #3221488
Change-Id: Ifc9e42a991d630feadc9e8032322f37504d09d6d
diff --git a/libs/hwui/PatchCache.cpp b/libs/hwui/PatchCache.cpp
index 71bab91..9702c3d 100644
--- a/libs/hwui/PatchCache.cpp
+++ b/libs/hwui/PatchCache.cpp
@@ -87,8 +87,9 @@
width, height, pixelWidth, pixelHeight, bitmapWidth, bitmapHeight);
mesh = new Patch(width, height, transparentQuads);
- mesh->updateVertices(bitmapWidth, bitmapHeight, 0.0f, 0.0f,
- pixelWidth, pixelHeight, xDivs, yDivs, width, height, colorKey);
+ mesh->updateColorKey(colorKey);
+ mesh->copy(xDivs, yDivs);
+ mesh->updateVertices(bitmapWidth, bitmapHeight, 0.0f, 0.0f, pixelWidth, pixelHeight);
if (mCache.size() >= mMaxEntries) {
delete mCache.valueAt(mCache.size() - 1);
@@ -96,6 +97,9 @@
}
mCache.add(description, mesh);
+ } else if (!mesh->matches(xDivs, yDivs, colorKey)) {
+ PATCH_LOGD("Patch mesh does not match, refreshing vertices");
+ mesh->updateVertices(bitmapWidth, bitmapHeight, 0.0f, 0.0f, pixelWidth, pixelHeight);
}
return mesh;