Make instantiate return a Boolean
From an off-line conversation:
The longer term idea will be to create a helper class isolates the
ability to instantiate proxies until flush time. The peek* methods
could then be moved to GrSurfaceProxy.
Change-Id: I8e8c02c098475b77d515791c0d6b81f7e4a327dd
Reviewed-on: https://skia-review.googlesource.com/18076
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp
index be8258a..78f6ba4 100644
--- a/src/gpu/GrDrawOpAtlas.cpp
+++ b/src/gpu/GrDrawOpAtlas.cpp
@@ -207,10 +207,10 @@
// MDB TODO: this is currently fine since the atlas' proxy is always pre-instantiated.
// Once it is deferred more care must be taken upon instantiation failure.
- GrTexture* texture = fProxy->instantiateTexture(fContext->resourceProvider());
- if (!texture) {
+ if (!fProxy->instantiate(fContext->resourceProvider())) {
return false;
}
+ GrTexture* texture = fProxy->priv().peekTexture();
GrDrawOpUploadToken lastUploadToken = target->addAsapUpload(
[plotsp, texture] (GrDrawOp::WritePixelsFn& writePixels) {
@@ -286,10 +286,10 @@
sk_sp<Plot> plotsp(SkRef(newPlot.get()));
// MDB TODO: this is currently fine since the atlas' proxy is always pre-instantiated.
// Once it is deferred more care must be taken upon instantiation failure.
- GrTexture* texture = fProxy->instantiateTexture(fContext->resourceProvider());
- if (!texture) {
+ if (!fProxy->instantiate(fContext->resourceProvider())) {
return false;
}
+ GrTexture* texture = fProxy->priv().peekTexture();
GrDrawOpUploadToken lastUploadToken = target->addInlineUpload(
[plotsp, texture] (GrDrawOp::WritePixelsFn& writePixels) {