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

Unified Diff: include/gpu/GrContext.h

Issue 1413673002: Remove DrawingMgr shims from GrContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix names in comments 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 904a0413ec7af72f0d8784cc61adeb1f65b7b57b..7136ce4ff5c93196d107d3512c82b924682f7ab7 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -23,6 +23,7 @@ struct GrBatchAtlasConfig;
class GrBatchFontCache;
class GrCaps;
struct GrContextOptions;
+class GrDrawingManager;
class GrDrawContext;
class GrDrawTarget;
class GrFragmentProcessor;
@@ -172,7 +173,7 @@ public:
/**
* Returns a helper object to orchestrate draws.
- * 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.
*
* @param rt the render target receiving the draws
@@ -180,19 +181,7 @@ public:
*
* @return a draw context
*/
- GrDrawContext* drawContext(GrRenderTarget* rt, const SkSurfaceProps* surfaceProps = NULL) {
- return fDrawingMgr.drawContext(rt, surfaceProps);
- }
-
- GrTextContext* textContext(const SkSurfaceProps& surfaceProps, GrRenderTarget* rt) {
- 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);
- }
+ GrDrawContext* drawContext(GrRenderTarget* rt, const SkSurfaceProps* surfaceProps = NULL);
///////////////////////////////////////////////////////////////////////////
// Misc.
@@ -336,7 +325,7 @@ public:
GrBatchFontCache* getBatchFontCache() { return fBatchFontCache; }
GrLayerCache* getLayerCache() { return fLayerCache.get(); }
GrTextBlobCache* getTextBlobCache() { return fTextBlobCache; }
- bool abandoned() const { return fDrawingMgr.abandoned(); }
+ bool abandoned() const;
GrResourceProvider* resourceProvider() { return fResourceProvider; }
const GrResourceProvider* resourceProvider() const { return fResourceProvider; }
GrResourceCache* getResourceCache() { return fResourceCache; }
@@ -418,64 +407,11 @@ private:
const uint32_t fUniqueID;
+ SkAutoTDelete<GrDrawingManager> fDrawingManager;
+
GrContext(); // init must be called after the constructor.
bool init(GrBackend, GrBackendContext, const GrContextOptions& options);
- // 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 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()
- : fContext(nullptr)
- , fAbandoned(false)
- , fNVPRTextContext(nullptr) {
- sk_bzero(fTextContexts, sizeof(fTextContexts));
- }
-
- ~DrawingMgr();
-
- void init(GrContext* context);
-
- void abandon();
- bool abandoned() const { return fAbandoned; }
-
- void reset();
- void flush();
-
- // Callers assume the creation ref of the drawContext!
- // NULL will be returned if the context has been abandoned.
- GrDrawContext* drawContext(GrRenderTarget* rt, const SkSurfaceProps* surfaceProps);
-
- GrTextContext* textContext(const SkSurfaceProps& props, GrRenderTarget* rt);
-
- GrDrawTarget* newDrawTarget(GrRenderTarget* rt);
-
- private:
- void cleanup();
-
- friend class GrContext; // for access to fDrawTarget for testing
-
- static const int kNumPixelGeometries = 5; // The different pixel geometries
- static const int kNumDFTOptions = 2; // DFT or no DFT
-
- GrContext* fContext;
-
- bool fAbandoned;
- SkTDArray<GrDrawTarget*> fDrawTargets;
-
- GrTextContext* fNVPRTextContext;
- GrTextContext* fTextContexts[kNumPixelGeometries][kNumDFTOptions];
- };
-
- DrawingMgr fDrawingMgr;
-
void initMockContext();
void initCommon();
« 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