summaryrefslogtreecommitdiff
path: root/libs/hwui/VertexBuffer.h
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2014-07-23 17:21:25 -0700
committerChris Craik <ccraik@google.com>2014-07-24 17:49:23 +0000
commit9a89bc6524620c87c7a321433470c668e2b95d69 (patch)
tree56330712c30ea18aee3843316a33d7084f4d297f /libs/hwui/VertexBuffer.h
parent1b1f1b611c8e648b9737e7930e6982cf117134ce (diff)
Compute layer bounds over subset of VertexBuffer verts
bug:15538815 Change-Id: I0dbb54f656a6ae99a87c5734761107e1c2351b65
Diffstat (limited to 'libs/hwui/VertexBuffer.h')
-rw-r--r--libs/hwui/VertexBuffer.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/libs/hwui/VertexBuffer.h b/libs/hwui/VertexBuffer.h
index 5875f25aa514..3837f88e0153 100644
--- a/libs/hwui/VertexBuffer.h
+++ b/libs/hwui/VertexBuffer.h
@@ -62,7 +62,6 @@ public:
mVertexCount = vertexCount;
mByteCount = mVertexCount * sizeof(TYPE);
mReallocBuffer = mBuffer = (void*)new TYPE[vertexCount];
- memset(mBuffer, 0, sizeof(TYPE) * vertexCount);
mCleanupMethod = &(cleanup<TYPE>);
@@ -86,13 +85,17 @@ public:
* vertex buffer can't determine bounds more simply/efficiently
*/
template <class TYPE>
- void computeBounds() {
+ void computeBounds(int vertexCount = 0) {
if (!mVertexCount) {
mBounds.setEmpty();
return;
}
+
+ // default: compute over every vertex
+ if (vertexCount == 0) vertexCount = mVertexCount;
+
TYPE* current = (TYPE*)mBuffer;
- TYPE* end = current + mVertexCount;
+ TYPE* end = current + vertexCount;
mBounds.set(current->x, current->y, current->x, current->y);
for (; current < end; current++) {
mBounds.expandToCoverVertex(current->x, current->y);