am f441557d: Merge "Fix frame-allocated path lifecycles" into lmp-mr1-dev
* commit 'f441557d89cab8885940bb63a27159f576749f96': Fix frame-allocated path lifecycles
This commit is contained in:
@@ -325,6 +325,7 @@ void AmbientShadow::createAmbientShadow(bool isCasterOpaque,
|
|||||||
// At the end, update the real index and vertex buffer size.
|
// At the end, update the real index and vertex buffer size.
|
||||||
shadowVertexBuffer.updateVertexCount(vertexBufferIndex);
|
shadowVertexBuffer.updateVertexCount(vertexBufferIndex);
|
||||||
shadowVertexBuffer.updateIndexCount(indexBufferIndex);
|
shadowVertexBuffer.updateIndexCount(indexBufferIndex);
|
||||||
|
shadowVertexBuffer.computeBounds<AlphaVertex>();
|
||||||
|
|
||||||
ShadowTessellator::checkOverflow(vertexBufferIndex, totalVertexCount, "Ambient Vertex Buffer");
|
ShadowTessellator::checkOverflow(vertexBufferIndex, totalVertexCount, "Ambient Vertex Buffer");
|
||||||
ShadowTessellator::checkOverflow(indexBufferIndex, totalIndexCount, "Ambient Index Buffer");
|
ShadowTessellator::checkOverflow(indexBufferIndex, totalIndexCount, "Ambient Index Buffer");
|
||||||
|
|||||||
@@ -77,18 +77,14 @@ public:
|
|||||||
OpenGLRenderer& mRenderer;
|
OpenGLRenderer& mRenderer;
|
||||||
const int mReplayFlags;
|
const int mReplayFlags;
|
||||||
|
|
||||||
// Allocator with the lifetime of a single frame.
|
// Allocator with the lifetime of a single frame. replay uses an Allocator owned by the struct,
|
||||||
// replay uses an Allocator owned by the struct, while defer shares the DeferredDisplayList's Allocator
|
// while defer shares the DeferredDisplayList's Allocator
|
||||||
|
// TODO: move this allocator to be owned by object with clear frame lifecycle
|
||||||
LinearAllocator * const mAllocator;
|
LinearAllocator * const mAllocator;
|
||||||
|
|
||||||
SkPath* allocPathForFrame() {
|
SkPath* allocPathForFrame() {
|
||||||
mTempPaths.push_back();
|
return mRenderer.allocPathForFrame();
|
||||||
return &mTempPaths.back();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
// Paths kept alive for the duration of the frame
|
|
||||||
std::vector<SkPath> mTempPaths;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DeferStateStruct : public PlaybackStateStruct {
|
class DeferStateStruct : public PlaybackStateStruct {
|
||||||
|
|||||||
@@ -311,6 +311,11 @@ void OpenGLRenderer::finish() {
|
|||||||
renderOverdraw();
|
renderOverdraw();
|
||||||
endTiling();
|
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
|
// When finish() is invoked on FBO 0 we've reached the end
|
||||||
// of the current frame
|
// of the current frame
|
||||||
if (getTargetFbo() == 0) {
|
if (getTargetFbo() == 0) {
|
||||||
|
|||||||
@@ -342,6 +342,12 @@ public:
|
|||||||
uint8_t getAmbientShadowAlpha() const { return mAmbientShadowAlpha; }
|
uint8_t getAmbientShadowAlpha() const { return mAmbientShadowAlpha; }
|
||||||
uint8_t getSpotShadowAlpha() const { return mSpotShadowAlpha; }
|
uint8_t getSpotShadowAlpha() const { return mSpotShadowAlpha; }
|
||||||
|
|
||||||
|
SkPath* allocPathForFrame() {
|
||||||
|
SkPath* path = new SkPath();
|
||||||
|
mTempPaths.push_back(path);
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Perform the setup specific to a frame. This method does not
|
* Perform the setup specific to a frame. This method does not
|
||||||
@@ -1014,6 +1020,9 @@ private:
|
|||||||
uint8_t mAmbientShadowAlpha;
|
uint8_t mAmbientShadowAlpha;
|
||||||
uint8_t mSpotShadowAlpha;
|
uint8_t mSpotShadowAlpha;
|
||||||
|
|
||||||
|
// Paths kept alive for the duration of the frame
|
||||||
|
std::vector<SkPath*> mTempPaths;
|
||||||
|
|
||||||
friend class Layer;
|
friend class Layer;
|
||||||
friend class TextSetupFunctor;
|
friend class TextSetupFunctor;
|
||||||
friend class DrawBitmapOp;
|
friend class DrawBitmapOp;
|
||||||
|
|||||||
Reference in New Issue
Block a user