summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2014-12-10 20:53:45 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-12-10 20:53:46 +0000
commitf441557d89cab8885940bb63a27159f576749f96 (patch)
tree973c3538adb320a1b2a77d2f52954cf4d7f3e714
parenta96ba381cf7ecbed31da94b8ebc93da3c42151ad (diff)
parent4ac36f80beb958c77a92a3e1a235f6ed9daaa510 (diff)
downloadframeworks_base-f441557d89cab8885940bb63a27159f576749f96.zip
frameworks_base-f441557d89cab8885940bb63a27159f576749f96.tar.gz
frameworks_base-f441557d89cab8885940bb63a27159f576749f96.tar.bz2
Merge "Fix frame-allocated path lifecycles" into lmp-mr1-dev
-rw-r--r--libs/hwui/AmbientShadow.cpp1
-rw-r--r--libs/hwui/DisplayList.h12
-rwxr-xr-xlibs/hwui/OpenGLRenderer.cpp5
-rwxr-xr-xlibs/hwui/OpenGLRenderer.h9
4 files changed, 19 insertions, 8 deletions
diff --git a/libs/hwui/AmbientShadow.cpp b/libs/hwui/AmbientShadow.cpp
index 21c869b..b2dba00 100644
--- a/libs/hwui/AmbientShadow.cpp
+++ b/libs/hwui/AmbientShadow.cpp
@@ -325,6 +325,7 @@ void AmbientShadow::createAmbientShadow(bool isCasterOpaque,
// At the end, update the real index and vertex buffer size.
shadowVertexBuffer.updateVertexCount(vertexBufferIndex);
shadowVertexBuffer.updateIndexCount(indexBufferIndex);
+ shadowVertexBuffer.computeBounds<AlphaVertex>();
ShadowTessellator::checkOverflow(vertexBufferIndex, totalVertexCount, "Ambient Vertex Buffer");
ShadowTessellator::checkOverflow(indexBufferIndex, totalIndexCount, "Ambient Index Buffer");
diff --git a/libs/hwui/DisplayList.h b/libs/hwui/DisplayList.h
index cb8a8d1..7a43a2a 100644
--- a/libs/hwui/DisplayList.h
+++ b/libs/hwui/DisplayList.h
@@ -77,18 +77,14 @@ public:
OpenGLRenderer& mRenderer;
const int mReplayFlags;
- // Allocator with the lifetime of a single frame.
- // replay uses an Allocator owned by the struct, while defer shares the DeferredDisplayList's Allocator
+ // Allocator with the lifetime of a single frame. replay uses an Allocator owned by the struct,
+ // while defer shares the DeferredDisplayList's Allocator
+ // TODO: move this allocator to be owned by object with clear frame lifecycle
LinearAllocator * const mAllocator;
SkPath* allocPathForFrame() {
- mTempPaths.push_back();
- return &mTempPaths.back();
+ return mRenderer.allocPathForFrame();
}
-
-private:
- // Paths kept alive for the duration of the frame
- std::vector<SkPath> mTempPaths;
};
class DeferStateStruct : public PlaybackStateStruct {
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 075f2c5..96257e4 100755
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -311,6 +311,11 @@ void OpenGLRenderer::finish() {
renderOverdraw();
endTiling();
+ for (size_t i = 0; i < mTempPaths.size(); i++) {
+ delete mTempPaths[i];
+ }
+ mTempPaths.clear();
+
// When finish() is invoked on FBO 0 we've reached the end
// of the current frame
if (getTargetFbo() == 0) {
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index e1c3d10..5eee2e2 100755
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -342,6 +342,12 @@ public:
uint8_t getAmbientShadowAlpha() const { return mAmbientShadowAlpha; }
uint8_t getSpotShadowAlpha() const { return mSpotShadowAlpha; }
+ SkPath* allocPathForFrame() {
+ SkPath* path = new SkPath();
+ mTempPaths.push_back(path);
+ return path;
+ }
+
protected:
/**
* Perform the setup specific to a frame. This method does not
@@ -1014,6 +1020,9 @@ private:
uint8_t mAmbientShadowAlpha;
uint8_t mSpotShadowAlpha;
+ // Paths kept alive for the duration of the frame
+ std::vector<SkPath*> mTempPaths;
+
friend class Layer;
friend class TextSetupFunctor;
friend class DrawBitmapOp;