From: robertphillips Date: Tue, 26 Jul 2016 14:41:00 +0000 (-0700) Subject: Move prepareForExternalIO from GrRenderTarget to GrDrawContext X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~116^2~602 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8c523e0f3ffa66eefd70f893e9f863b7d9ea3dc9;p=platform%2Fupstream%2FlibSkiaSharp.git Move prepareForExternalIO from GrRenderTarget to GrDrawContext This is part of the push to remove GrRenderTarget from SkGpuDevice GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2182543003 Review-Url: https://codereview.chromium.org/2182543003 --- diff --git a/include/gpu/GrDrawContext.h b/include/gpu/GrDrawContext.h index 3cc57b5..01f4ac9 100644 --- a/include/gpu/GrDrawContext.h +++ b/include/gpu/GrDrawContext.h @@ -253,6 +253,12 @@ public: const SkIRect& center, const SkRect& dst); + /** + * After this returns any pending surface IO will be issued to the backend 3D API and + * if the surface has MSAA it will be resolved. + */ + void prepareForExternalIO(); + bool isStencilBufferMultisampled() const { return fRenderTarget->isStencilBufferMultisampled(); } diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h index 8e8eb0f..e002765 100644 --- a/include/gpu/GrSurface.h +++ b/include/gpu/GrSurface.h @@ -114,13 +114,6 @@ public: */ void flushWrites(); - - /** - * After this returns any pending surface IO will be issued to the backend 3D API and - * if the surface has MSAA it will be resolved. - */ - void prepareForExternalIO(); - /** Access methods that are only to be used within Skia code. */ inline GrSurfacePriv surfacePriv(); inline const GrSurfacePriv surfacePriv() const; diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp index 48242e2..e6bc55b 100644 --- a/src/gpu/GrDrawContext.cpp +++ b/src/gpu/GrDrawContext.cpp @@ -980,6 +980,16 @@ void GrDrawContext::drawImageNine(const GrClip& clip, this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); } +void GrDrawContext::prepareForExternalIO() { + ASSERT_SINGLE_OWNER + RETURN_IF_ABANDONED + SkDEBUGCODE(this->validate();) + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::prepareForExternalIO"); + + ASSERT_OWNED_RESOURCE(fRenderTarget); + + fDrawingManager->getContext()->prepareSurfaceForExternalIO(fRenderTarget.get()); +} void GrDrawContext::drawNonAAFilledRect(const GrClip& clip, const GrPaint& paint, diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp index 6dc90a3..824a6a2 100644 --- a/src/gpu/GrSurface.cpp +++ b/src/gpu/GrSurface.cpp @@ -149,12 +149,6 @@ void GrSurface::flushWrites() { } } -void GrSurface::prepareForExternalIO() { - if (!this->wasDestroyed()) { - this->getContext()->prepareSurfaceForExternalIO(this); - } -} - bool GrSurface::hasPendingRead() const { const GrTexture* thisTex = this->asTexture(); if (thisTex && thisTex->internalHasPendingRead()) { diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 5bc347c..116d3c6 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -1727,7 +1727,7 @@ bool SkGpuDevice::onShouldDisableLCD(const SkPaint& paint) const { void SkGpuDevice::flush() { ASSERT_SINGLE_OWNER - fRenderTarget->prepareForExternalIO(); + fDrawContext->prepareForExternalIO(); } ///////////////////////////////////////////////////////////////////////////////