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

Unified Diff: src/gpu/GrSWMaskHelper.cpp

Issue 638403003: Remove uses of GrAutoScratchTexture. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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/GrSWMaskHelper.h ('k') | src/gpu/GrSoftwarePathRenderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrSWMaskHelper.cpp
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index 90aab9030faf358410ea5bff1d9eca57994b7ad3..e66f91cb89c157a7785cd912e47992774fecebca 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -228,9 +228,8 @@ bool GrSWMaskHelper::init(const SkIRect& resultBounds,
/**
* Get a texture (from the texture cache) of the correct size & format.
- * Return true on success; false on failure.
*/
-bool GrSWMaskHelper::getTexture(GrAutoScratchTexture* texture) {
+GrTexture* GrSWMaskHelper::createTexture() {
GrTextureDesc desc;
desc.fWidth = fBM.width();
desc.fHeight = fBM.height();
@@ -249,8 +248,7 @@ bool GrSWMaskHelper::getTexture(GrAutoScratchTexture* texture) {
SkASSERT(fContext->getGpu()->caps()->isConfigTexturable(desc.fConfig));
}
- texture->set(fContext, desc);
- return SkToBool(texture->texture());
+ return fContext->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch);
}
void GrSWMaskHelper::sendTextureData(GrTexture *texture, const GrTextureDesc& desc,
@@ -337,14 +335,14 @@ GrTexture* GrSWMaskHelper::DrawPathMaskToTexture(GrContext* context,
helper.draw(path, stroke, SkRegion::kReplace_Op, antiAlias, 0xFF);
- GrAutoScratchTexture ast;
- if (!helper.getTexture(&ast)) {
+ GrTexture* texture(helper.createTexture());
+ if (!texture) {
return NULL;
}
- helper.toTexture(ast.texture());
+ helper.toTexture(texture);
- return ast.detach();
+ return texture;
}
void GrSWMaskHelper::DrawToTargetWithPathMask(GrTexture* texture,
« no previous file with comments | « src/gpu/GrSWMaskHelper.h ('k') | src/gpu/GrSoftwarePathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698