aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-01-31 18:24:12 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-01 14:57:43 +0000
commit77b3f32936dd069fa6a27f870b3b30035733d940 (patch)
tree1c0ed6fd03db22b05758a5d88e7a312970bfc5f9 /src/gpu
parent6520a69e6455afe371d647e033aa3ae5dabf6010 (diff)
Broaden checking of GrSurfaceProxy::MakeDeferred's return value
We now expect MakeDeferred to baulk if the ultimate texture/rendertarget will not be instantiable. Added checks for MakeWrapped too since, technically, it too can baulk. BUG=676753 Change-Id: I3e052ebf98303fc46124272082c10f303d89da27 Reviewed-on: https://skia-review.googlesource.com/7830 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrContext.cpp21
-rw-r--r--src/gpu/text/GrAtlasGlyphCache.cpp3
2 files changed, 24 insertions, 0 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index aeab9d10c3..b5586b4de8 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -591,6 +591,9 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeWrappedRenderTargetContext(
ASSERT_SINGLE_OWNER_PRIV
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(rt)));
+ if (!proxy) {
+ return nullptr;
+ }
return this->drawingManager()->makeRenderTargetContext(std::move(proxy),
std::move(colorSpace),
@@ -614,6 +617,9 @@ sk_sp<GrSurfaceContext> GrContextPriv::makeWrappedSurfaceContext(sk_sp<GrSurface
ASSERT_SINGLE_OWNER_PRIV
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface)));
+ if (!proxy) {
+ return nullptr;
+ }
return this->makeWrappedSurfaceContext(std::move(proxy), nullptr);
}
@@ -624,6 +630,9 @@ sk_sp<GrSurfaceContext> GrContextPriv::makeDeferredSurfaceContext(const GrSurfac
sk_sp<GrSurfaceProxy> proxy = GrSurfaceProxy::MakeDeferred(*fContext->caps(), dstDesc,
fit, isDstBudgeted);
+ if (!proxy) {
+ return nullptr;
+ }
return this->makeWrappedSurfaceContext(std::move(proxy), nullptr);
}
@@ -639,6 +648,9 @@ sk_sp<GrSurfaceContext> GrContextPriv::makeBackendSurfaceContext(const GrBackend
}
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface)));
+ if (!proxy) {
+ return nullptr;
+ }
return this->makeWrappedSurfaceContext(std::move(proxy), std::move(colorSpace));
}
@@ -657,6 +669,9 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureRenderTargetContex
}
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface)));
+ if (!proxy) {
+ return nullptr;
+ }
return this->drawingManager()->makeRenderTargetContext(std::move(proxy),
std::move(colorSpace), props);
@@ -674,6 +689,9 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendRenderTargetRenderTargetC
}
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(rt)));
+ if (!proxy) {
+ return nullptr;
+ }
return this->drawingManager()->makeRenderTargetContext(std::move(proxy),
std::move(colorSpace),
@@ -693,6 +711,9 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureAsRenderTargetRend
}
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface)));
+ if (!proxy) {
+ return nullptr;
+ }
return this->drawingManager()->makeRenderTargetContext(std::move(proxy),
std::move(colorSpace),
diff --git a/src/gpu/text/GrAtlasGlyphCache.cpp b/src/gpu/text/GrAtlasGlyphCache.cpp
index 58e78c1d3a..95cadd86df 100644
--- a/src/gpu/text/GrAtlasGlyphCache.cpp
+++ b/src/gpu/text/GrAtlasGlyphCache.cpp
@@ -119,6 +119,9 @@ void GrAtlasGlyphCache::HandleEviction(GrDrawOpAtlas::AtlasID id, void* ptr) {
* @param filename Full path to desired file
*/
static bool save_pixels(GrContext* context, GrSurfaceProxy* sProxy, const char* filename) {
+ if (!sProxy) {
+ return false;
+ }
SkImageInfo ii = SkImageInfo::Make(sProxy->width(), sProxy->height(),
kRGBA_8888_SkColorType, kPremul_SkAlphaType);