aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrContext.h2
-rw-r--r--include/gpu/GrDrawContext.h10
2 files changed, 8 insertions, 4 deletions
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index d59b2a28f0..087d821beb 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -192,7 +192,7 @@ public:
*
* @return a draw context
*/
- GrDrawContext* drawContext(GrRenderTarget* rt, const SkSurfaceProps* surfaceProps = NULL);
+ sk_sp<GrDrawContext> drawContext(sk_sp<GrRenderTarget> rt, const SkSurfaceProps* = nullptr);
///////////////////////////////////////////////////////////////////////////
// Misc.
diff --git a/include/gpu/GrDrawContext.h b/include/gpu/GrDrawContext.h
index 61b39079b0..7bb9aafc78 100644
--- a/include/gpu/GrDrawContext.h
+++ b/include/gpu/GrDrawContext.h
@@ -278,14 +278,18 @@ public:
int numColorSamples() const { return fRenderTarget->numColorSamples(); }
bool isGammaCorrect() const { return fSurfaceProps.isGammaCorrect(); }
- GrRenderTarget* accessRenderTarget() { return fRenderTarget; }
+ GrRenderTarget* accessRenderTarget() { return fRenderTarget.get(); }
+
+ sk_sp<GrRenderTarget> renderTarget() { return fRenderTarget; }
+
+ sk_sp<GrTexture> asTexture() { return sk_ref_sp(fRenderTarget->asTexture()); }
// Provides access to functions that aren't part of the public API.
GrDrawContextPriv drawContextPriv();
const GrDrawContextPriv drawContextPriv() const;
protected:
- GrDrawContext(GrContext*, GrDrawingManager*, GrRenderTarget*,
+ GrDrawContext(GrContext*, GrDrawingManager*, sk_sp<GrRenderTarget>,
const SkSurfaceProps* surfaceProps, GrAuditTrail*, GrSingleOwner*);
GrDrawingManager* drawingManager() { return fDrawingManager; }
@@ -323,7 +327,7 @@ private:
GrDrawTarget* getDrawTarget();
GrDrawingManager* fDrawingManager;
- GrRenderTarget* fRenderTarget;
+ sk_sp<GrRenderTarget> fRenderTarget;
// In MDB-mode the drawTarget can be closed by some other drawContext that has picked
// it up. For this reason, the drawTarget should only ever be accessed via 'getDrawTarget'.