diff options
author | 2018-04-02 16:15:31 -0400 | |
---|---|---|
committer | 2018-04-03 11:34:12 +0000 | |
commit | fd88fe4d57c7ecde652cb8ae07dfe6f47bd13b78 (patch) | |
tree | d773c7f9263024439890cc54d7c18a2cb3f19a36 /src/core | |
parent | c0528e2418e09765807f1db510733c573232f7e2 (diff) |
Speculative fix for crbug.com/823920
Bug: chromium:823920
Change-Id: I679cdf848280a26b8e353b51750823f497e50a67
Reviewed-on: https://skia-review.googlesource.com/117861
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkSpecialImage.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp index 61acd3fc69..85a8d46bd7 100644 --- a/src/core/SkSpecialImage.cpp +++ b/src/core/SkSpecialImage.cpp @@ -169,7 +169,6 @@ sk_sp<SkImage> SkSpecialImage::asImage(const SkIRect* subset) const { } -#ifdef SK_DEBUG static bool rect_fits(const SkIRect& rect, int width, int height) { if (0 == width && 0 == height) { SkASSERT(0 == rect.fLeft && 0 == rect.fRight && 0 == rect.fTop && 0 == rect.fBottom); @@ -181,7 +180,6 @@ static bool rect_fits(const SkIRect& rect, int width, int height) { rect.fTop >= 0 && rect.fTop < height && rect.fTop < rect.fBottom && rect.fBottom >= 0 && rect.fBottom <= height; } -#endif sk_sp<SkSpecialImage> SkSpecialImage::MakeFromImage(const SkIRect& subset, sk_sp<SkImage> image, @@ -512,7 +510,10 @@ sk_sp<SkSpecialImage> SkSpecialImage::MakeDeferredFromGpu(GrContext* context, sk_sp<SkColorSpace> colorSpace, const SkSurfaceProps* props, SkAlphaType at) { - SkASSERT(rect_fits(subset, proxy->width(), proxy->height())); + if (!context || context->contextPriv().abandoned() || !proxy) { + return nullptr; + } + SkASSERT_RELEASE(rect_fits(subset, proxy->width(), proxy->height())); return sk_make_sp<SkSpecialImage_Gpu>(context, subset, uniqueID, std::move(proxy), at, std::move(colorSpace), props); } |