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/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp
index 7928164..98cc75b 100644
--- a/src/gpu/GrTextureProxy.cpp
+++ b/src/gpu/GrTextureProxy.cpp
@@ -21,17 +21,17 @@
GrTextureProxy::GrTextureProxy(sk_sp<GrSurface> surf)
: INHERITED(std::move(surf), SkBackingFit::kExact)
, fIsMipMapped(fTarget->asTexture()->texturePriv().hasMipMaps())
- , fMipColorMode(fTarget->asTexture()->texturePriv().mipColorMode()) {}
+ , fMipColorMode(fTarget->asTexture()->texturePriv().mipColorMode()) {
+}
-GrSurface* GrTextureProxy::instantiate(GrResourceProvider* resourceProvider) {
- GrSurface* surf =
- this->instantiateImpl(resourceProvider, 0, kNone_GrSurfaceFlags, fIsMipMapped,
- fMipColorMode);
- if (!surf) {
- return nullptr;
+bool GrTextureProxy::instantiate(GrResourceProvider* resourceProvider) {
+ if (!this->instantiateImpl(resourceProvider, 0, kNone_GrSurfaceFlags, fIsMipMapped,
+ fMipColorMode)) {
+ return false;
}
- SkASSERT(surf->asTexture());
- return surf;
+
+ SkASSERT(fTarget->asTexture());
+ return true;
}
void GrTextureProxy::setMipColorMode(SkDestinationSurfaceColorMode colorMode) {