Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Unified Diff: include/gpu/GrContext.h

Issue 1406173003: Loosen requirement that there be only one GrDrawTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix comment Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/gpu/GrDrawContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrContext.h
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 91ae2d1001f64a06fae5bfd932d59d059cdd5f45..904a0413ec7af72f0d8784cc61adeb1f65b7b57b 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];
« no previous file with comments | « no previous file | include/gpu/GrDrawContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698