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

Unified Diff: include/gpu/GrContext.h

Issue 1375153007: Dynamically allocate the GrDrawContexts (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix more bugs 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 59ce867efdbcc9b79a77dc6365db12b7e4298457..51879e06268be0d920449da7d7ef81d6704d56c5 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -183,6 +183,10 @@ public:
return fDrawingMgr.drawContext(surfaceProps);
}
+ GrTextContext* textContext(const SkSurfaceProps& surfaceProps, GrRenderTarget* rt) {
bsalomon 2015/10/06 13:42:42 Should we be using the GrContext to get the text c
robertphillips 2015/10/06 13:50:58 draw contexts come and go now so the text contexts
+ return fDrawingMgr.textContext(surfaceProps, rt);
+ }
+
///////////////////////////////////////////////////////////////////////////
// Misc.
@@ -410,17 +414,19 @@ private:
GrContext(); // init must be called after the constructor.
bool init(GrBackend, GrBackendContext, const GrContextOptions& options);
- // Currently the DrawingMgr stores a separate GrDrawContext for each
+ // Currently the DrawingMgr creates a separate GrTextContext for each
// combination of text drawing options (pixel geometry x DFT use)
- // and hands the appropriate one back given the user's request.
- // All of the GrDrawContexts still land in the same GrDrawTarget!
+ // and hands the appropriate one back given the DrawContext's request.
+ //
+ // It allocates a new GrDrawContext for each GrRenderTarget
+ // but all of them still land in the same GrDrawTarget!
//
// In the future this class will allocate a new GrDrawContext for
// each GrRenderTarget/GrDrawTarget and manage the DAG.
class DrawingMgr {
public:
- DrawingMgr() : fDrawTarget(NULL) {
- sk_bzero(fDrawContext, sizeof(fDrawContext));
+ DrawingMgr() : fDrawTarget(nullptr), fNVPRTextContext(nullptr) {
+ sk_bzero(fTextContexts, sizeof(fTextContexts));
}
~DrawingMgr();
@@ -433,10 +439,12 @@ private:
void reset();
void flush();
- // Callers should take a ref if they rely on the GrDrawContext sticking around.
+ // Callers assume the creation ref of the drawContext!
// NULL will be returned if the context has been abandoned.
GrDrawContext* drawContext(const SkSurfaceProps* surfaceProps);
+ GrTextContext* textContext(const SkSurfaceProps& props, GrRenderTarget* rt);
+
private:
void cleanup();
@@ -448,7 +456,8 @@ private:
GrContext* fContext;
GrDrawTarget* fDrawTarget;
- GrDrawContext* fDrawContext[kNumPixelGeometries][kNumDFTOptions];
+ GrTextContext* fNVPRTextContext;
+ GrTextContext* fTextContexts[kNumPixelGeometries][kNumDFTOptions];
};
DrawingMgr fDrawingMgr;
« 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