ccpr: Delete the stashed atlas texture before allocating a new one

Bug: skia:
Change-Id: I13c13c73f6065f2eababb174361f8bfa9e62b7e2
Reviewed-on: https://skia-review.googlesource.com/c/160200
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
Chris Dalton 2018-10-05 14:03:19 -06:00 committed by Skia Commit-Bot
parent d037f4d204
commit 29b11d605f

View File

@ -411,9 +411,12 @@ bool GrCCPerFlushResources::finalize(GrOnFlushResourceProvider* onFlushRP,
if (stashedAtlasProxy && atlas->currentWidth() == stashedAtlasProxy->width() &&
atlas->currentHeight() == stashedAtlasProxy->height()) {
backingTexture = sk_ref_sp(stashedAtlasProxy->peekTexture());
stashedAtlasProxy = nullptr;
}
// Delete the stashed proxy here. That way, if we can't recycle the stashed atlas texture,
// we free this memory prior to allocating a new backing texture.
stashedAtlasProxy = nullptr;
if (auto rtc = atlas->makeRenderTargetContext(onFlushRP, std::move(backingTexture))) {
auto op = RenderAtlasOp::Make(rtc->surfPriv().getContext(), sk_ref_sp(this),
atlas->getFillBatchID(), atlas->getStrokeBatchID(),