Move prepareForExternalIO from GrRenderTarget to GrDrawContext
authorrobertphillips <robertphillips@google.com>
Tue, 26 Jul 2016 14:41:00 +0000 (07:41 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 26 Jul 2016 14:41:01 +0000 (07:41 -0700)
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

include/gpu/GrDrawContext.h
include/gpu/GrSurface.h
src/gpu/GrDrawContext.cpp
src/gpu/GrSurface.cpp
src/gpu/SkGpuDevice.cpp

index 3cc57b5..01f4ac9 100644 (file)
@@ -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();
     }
index 8e8eb0f..e002765 100644 (file)
@@ -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;
index 48242e2..e6bc55b 100644 (file)
@@ -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,
index 6dc90a3..824a6a2 100644 (file)
@@ -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()) {
index 5bc347c..116d3c6 100644 (file)
@@ -1727,7 +1727,7 @@ bool SkGpuDevice::onShouldDisableLCD(const SkPaint& paint) const {
 void SkGpuDevice::flush() {
     ASSERT_SINGLE_OWNER
 
-    fRenderTarget->prepareForExternalIO();
+    fDrawContext->prepareForExternalIO();
 }
 
 ///////////////////////////////////////////////////////////////////////////////