diff options
author | Khushal <khushalsagar@chromium.org> | 2018-06-26 14:38:34 -0700 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-27 01:08:45 +0000 |
commit | c421ca1d6e41214f09c0e6311c8519a15e44edd4 (patch) | |
tree | ae029083d130acb979f9e1c15c862f6436908d7b /src | |
parent | ef12509ff2668027664308653ced36039af800ad (diff) |
gpu: Expose GrContextPriv::abandoned in the public API.
TBR=bsalomon@google.com
Bug: 854416
Change-Id: Iab71ca6e4724a925b0b9791267aac5ddc34f5b15
Reviewed-on: https://skia-review.googlesource.com/137692
Reviewed-by: Khusal Sagar <khushalsagar@chromium.org>
Commit-Queue: Khusal Sagar <khushalsagar@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkSpecialImage.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrAHardwareBufferImageGenerator.cpp | 3 | ||||
-rw-r--r-- | src/gpu/GrBlurUtils.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrContext.cpp | 12 | ||||
-rw-r--r-- | src/gpu/GrContextPriv.h | 2 | ||||
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 2 | ||||
-rw-r--r-- | src/gpu/text/GrTextContext.cpp | 4 | ||||
-rw-r--r-- | src/image/SkImage.cpp | 2 | ||||
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 2 |
9 files changed, 14 insertions, 17 deletions
diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp index 0c6ec5c484..75946d0ffc 100644 --- a/src/core/SkSpecialImage.cpp +++ b/src/core/SkSpecialImage.cpp @@ -511,7 +511,7 @@ sk_sp<SkSpecialImage> SkSpecialImage::MakeDeferredFromGpu(GrContext* context, sk_sp<SkColorSpace> colorSpace, const SkSurfaceProps* props, SkAlphaType at) { - if (!context || context->contextPriv().abandoned() || !proxy) { + if (!context || context->abandoned() || !proxy) { return nullptr; } SkASSERT_RELEASE(rect_fits(subset, proxy->width(), proxy->height())); diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp index ea1da11ab0..e3ae782d9a 100644 --- a/src/gpu/GrAHardwareBufferImageGenerator.cpp +++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp @@ -144,8 +144,7 @@ sk_sp<GrTextureProxy> GrAHardwareBufferImageGenerator::onGenerateTexture( } sk_sp<GrTextureProxy> GrAHardwareBufferImageGenerator::makeProxy(GrContext* context) { - if (context->contextPriv().abandoned() || - kOpenGL_GrBackend != context->contextPriv().getBackend()) { + if (context->abandoned() || kOpenGL_GrBackend != context->contextPriv().getBackend()) { // Check if GrContext is not abandoned and the backend is GL. return nullptr; } diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp index cc59c02843..c651c4848b 100644 --- a/src/gpu/GrBlurUtils.cpp +++ b/src/gpu/GrBlurUtils.cpp @@ -273,7 +273,7 @@ void GrBlurUtils::drawPathWithMaskFilter(GrContext* context, const SkMatrix* prePathMatrix, const SkIRect& clipBounds, bool pathIsMutable) { - if (context->contextPriv().abandoned()) { + if (context->abandoned()) { return; } diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index b4387e21a1..a34ee88a33 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -255,6 +255,11 @@ void GrContext::abandonContext() { fTextBlobCache->freeAll(); } +bool GrContext::abandoned() const { + ASSERT_SINGLE_OWNER + return fDrawingManager->wasAbandoned(); +} + void GrContext::releaseResourcesAndAbandonContext() { ASSERT_SINGLE_OWNER @@ -1010,7 +1015,7 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeDeferredRenderTargetContext( const SkSurfaceProps* surfaceProps, SkBudgeted budgeted) { SkASSERT(sampleCnt > 0); - if (this->abandoned()) { + if (fContext->abandoned()) { return nullptr; } @@ -1044,11 +1049,6 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeDeferredRenderTargetContext( return renderTargetContext; } -bool GrContextPriv::abandoned() const { - ASSERT_SINGLE_OWNER_PRIV - return fContext->fDrawingManager->wasAbandoned(); -} - std::unique_ptr<GrFragmentProcessor> GrContext::createPMToUPMEffect( std::unique_ptr<GrFragmentProcessor> fp, bool useConfigConversionEffect) { ASSERT_SINGLE_OWNER diff --git a/src/gpu/GrContextPriv.h b/src/gpu/GrContextPriv.h index 8d4b1ed28f..4f392f88b3 100644 --- a/src/gpu/GrContextPriv.h +++ b/src/gpu/GrContextPriv.h @@ -246,8 +246,6 @@ public: const SkSurfaceProps* surfaceProps = nullptr, SkBudgeted budgeted = SkBudgeted::kYes); - bool abandoned() const; - /** Reset GPU stats */ void resetGpuStats() const ; diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index ca3d559e36..819acd2ef8 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -1041,7 +1041,7 @@ void SkGpuDevice::drawSprite(const SkBitmap& bitmap, ASSERT_SINGLE_OWNER GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawSprite", fContext.get()); - if (fContext->contextPriv().abandoned()) { + if (fContext->abandoned()) { return; } diff --git a/src/gpu/text/GrTextContext.cpp b/src/gpu/text/GrTextContext.cpp index 6da4c0d014..a20ba4424a 100644 --- a/src/gpu/text/GrTextContext.cpp +++ b/src/gpu/text/GrTextContext.cpp @@ -103,7 +103,7 @@ void GrTextContext::drawTextBlob(GrContext* context, GrTextUtils::Target* target const SkTextBlob* blob, SkScalar x, SkScalar y, SkDrawFilter* drawFilter, const SkIRect& clipBounds) { // If we have been abandoned, then don't draw - if (context->contextPriv().abandoned()) { + if (context->abandoned()) { return; } @@ -316,7 +316,7 @@ void GrTextContext::drawPosText(GrContext* context, GrTextUtils::Target* target, int scalarsPerPosition, const SkPoint& offset, const SkIRect& regionClipBounds) { GrTextUtils::Paint paint(&skPaint, &target->colorSpaceInfo()); - if (context->contextPriv().abandoned()) { + if (context->abandoned()) { return; } diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp index ee0eff08a9..43c4cbaa39 100644 --- a/src/image/SkImage.cpp +++ b/src/image/SkImage.cpp @@ -163,7 +163,7 @@ GrBackendTexture SkImage::getBackendTexture(bool flushPendingGrContextIO, } bool SkImage::isValid(GrContext* context) const { - if (context && context->contextPriv().abandoned()) { + if (context && context->abandoned()) { return false; } return as_IB(this)->onIsValid(context); diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 670b41ffe5..8a7a789ec9 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -1019,7 +1019,7 @@ sk_sp<SkImage> SkImage_Gpu::onMakeColorSpace(sk_sp<SkColorSpace> target, SkColor bool SkImage_Gpu::onIsValid(GrContext* context) const { // The base class has already checked that context isn't abandoned (if it's not nullptr) - if (fContext->contextPriv().abandoned()) { + if (fContext->abandoned()) { return false; } |