Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Unified Diff: src/gpu/GrClipMaskManager.cpp

Issue 663583002: Remove AutoScratchTexture (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix tabbing Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrClipMaskManager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrClipMaskManager.cpp
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index 3ecc922999d34d139c2b82303b8b8da28ad183a1..1d055655e56ca18c41501bcbc53f3fc6a02f22fe 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -485,21 +485,14 @@ void GrClipMaskManager::mergeMask(GrTexture* dstMask,
fGpu->drawSimpleRect(SkRect::Make(dstBound));
}
-// get a texture to act as a temporary buffer for AA clip boolean operations
-// TODO: given the expense of createTexture we may want to just cache this too
-void GrClipMaskManager::getTemp(int width, int height, GrAutoScratchTexture* temp) {
- if (temp->texture()) {
- // we've already allocated the temp texture
- return;
- }
-
+GrTexture* GrClipMaskManager::createTempMask(int width, int height) {
GrTextureDesc desc;
desc.fFlags = kRenderTarget_GrTextureFlagBit|kNoStencil_GrTextureFlagBit;
desc.fWidth = width;
desc.fHeight = height;
desc.fConfig = kAlpha_8_GrPixelConfig;
- temp->set(this->getContext(), desc);
+ return fGpu->getContext()->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch);
}
////////////////////////////////////////////////////////////////////////////////
@@ -593,7 +586,7 @@ GrTexture* GrClipMaskManager::createAlphaClipMask(int32_t elementsGenID,
GrDrawTarget::AutoClipRestore acr(fGpu, maskSpaceIBounds);
drawState->enableState(GrDrawState::kClip_StateBit);
- GrAutoScratchTexture temp;
+ SkAutoTUnref<GrTexture> temp;
// walk through each clip element and perform its set op
for (ElementList::Iter iter = elements.headIter(); iter.get(); iter.next()) {
const Element* element = iter.get();
@@ -619,12 +612,15 @@ GrTexture* GrClipMaskManager::createAlphaClipMask(int32_t elementsGenID,
elementBounds.roundOut(&maskSpaceElementIBounds);
}
- this->getTemp(maskSpaceIBounds.fRight, maskSpaceIBounds.fBottom, &temp);
- if (NULL == temp.texture()) {
- fAACache.reset();
- return NULL;
+ if (!temp) {
+ temp.reset(this->createTempMask(maskSpaceIBounds.fRight,
+ maskSpaceIBounds.fBottom));
+ if (!temp) {
+ fAACache.reset();
+ return NULL;
+ }
}
- dst = temp.texture();
+ dst = temp;
// clear the temp target and set blend to replace
fGpu->clear(&maskSpaceElementIBounds,
invert ? 0xffffffff : 0x00000000,
@@ -658,7 +654,7 @@ GrTexture* GrClipMaskManager::createAlphaClipMask(int32_t elementsGenID,
// Now draw into the accumulator using the real operation and the temp buffer as a
// texture
this->mergeMask(result,
- temp.texture(),
+ temp,
op,
maskSpaceIBounds,
maskSpaceElementIBounds);
« no previous file with comments | « src/gpu/GrClipMaskManager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698