summaryrefslogtreecommitdiff
path: root/libs/hwui/OpenGLRenderer.h
diff options
context:
space:
mode:
author Chris Craik <ccraik@google.com> 2014-12-09 16:54:03 -0800
committer Chris Craik <ccraik@google.com> 2014-12-10 12:27:08 -0800
commit4ac36f80beb958c77a92a3e1a235f6ed9daaa510 (patch)
treeb555302a34a4a81cb32699aa3b987536c6ab2982 /libs/hwui/OpenGLRenderer.h
parent596d4e7230ae1858aaafbae7987e46d65181f1bd (diff)
Fix frame-allocated path lifecycles
bug:18667472 Previously, we were allocating per-frame temporary paths within the PlaybackStateStruct, but these are not safe as layers allocate these transiently. Instead, move these to the OpenGLRenderer, which has better define lifecycle. Additionally, don't store SkPath objects directly in vector, since they are then subject to relocation. Change-Id: I8187ef542fcd5b030502bb75eb123ee26c0daa96
Diffstat (limited to 'libs/hwui/OpenGLRenderer.h')
-rwxr-xr-xlibs/hwui/OpenGLRenderer.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index e1c3d10fc9c9..5eee2e2318af 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;