diff options
author | 2015-10-16 09:07:06 -0700 | |
---|---|---|
committer | 2015-10-16 09:07:06 -0700 | |
commit | a106c627532ad669cf7d879955ae8ea6a53233c1 (patch) | |
tree | efc00396b82cb530b9069c084c6173e69b75b20b /include/gpu/GrContext.h | |
parent | 26ad22ab61539e3d3b6bc5e0da8dcebbd52a53de (diff) |
Loosen requirement that there be only one GrDrawTarget
BUG=skia:4094
Review URL: https://codereview.chromium.org/1406173003
Diffstat (limited to 'include/gpu/GrContext.h')
-rw-r--r-- | include/gpu/GrContext.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index 91ae2d1001..904a0413ec 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -188,6 +188,12 @@ public: return fDrawingMgr.textContext(surfaceProps, rt); } + // The caller automatically gets a ref on the returned drawTarget. It must + // be balanced by an unref call. + GrDrawTarget* newDrawTarget(GrRenderTarget* rt) { + return fDrawingMgr.newDrawTarget(rt); + } + /////////////////////////////////////////////////////////////////////////// // Misc. @@ -426,7 +432,10 @@ private: // each GrRenderTarget/GrDrawTarget and manage the DAG. class DrawingMgr { public: - DrawingMgr() : fDrawTarget(nullptr), fNVPRTextContext(nullptr) { + DrawingMgr() + : fContext(nullptr) + , fAbandoned(false) + , fNVPRTextContext(nullptr) { sk_bzero(fTextContexts, sizeof(fTextContexts)); } @@ -435,7 +444,7 @@ private: void init(GrContext* context); void abandon(); - bool abandoned() const { return NULL == fDrawTarget; } + bool abandoned() const { return fAbandoned; } void reset(); void flush(); @@ -445,6 +454,8 @@ private: GrDrawContext* drawContext(GrRenderTarget* rt, const SkSurfaceProps* surfaceProps); GrTextContext* textContext(const SkSurfaceProps& props, GrRenderTarget* rt); + + GrDrawTarget* newDrawTarget(GrRenderTarget* rt); private: void cleanup(); @@ -455,7 +466,9 @@ private: static const int kNumDFTOptions = 2; // DFT or no DFT GrContext* fContext; - GrDrawTarget* fDrawTarget; + + bool fAbandoned; + SkTDArray<GrDrawTarget*> fDrawTargets; GrTextContext* fNVPRTextContext; GrTextContext* fTextContexts[kNumPixelGeometries][kNumDFTOptions]; |