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

Unified Diff: src/gpu/GrDrawingManager.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 | « src/gpu/GrDrawContext.cpp ('k') | src/gpu/GrTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawingManager.h
diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..d799493c8fc8888d2d740af20235cd28eef2f02a
--- /dev/null
+++ b/src/gpu/GrDrawingManager.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrDrawingManager_DEFINED
+#define GrDrawingManager_DEFINED
+
+#include "SkTDArray.h"
+
+class GrContext;
+class GrDrawContext;
+class GrTextContext;
+
+// Currently the DrawingManager 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 GrDrawingManager {
+public:
+ ~GrDrawingManager();
+
+ bool abandoned() const { return fAbandoned; }
+
+ GrDrawContext* drawContext(GrRenderTarget* rt, const SkSurfaceProps* surfaceProps);
+
+ GrTextContext* textContext(const SkSurfaceProps& props, GrRenderTarget* rt);
+
+ // The caller automatically gets a ref on the returned drawTarget. It must
+ // be balanced by an unref call.
+ GrDrawTarget* newDrawTarget(GrRenderTarget* rt);
+
+ GrContext* getContext() { return fContext; }
+
+private:
+ GrDrawingManager(GrContext* context)
+ : fContext(context)
+ , fAbandoned(false)
+ , fNVPRTextContext(nullptr) {
+ sk_bzero(fTextContexts, sizeof(fTextContexts));
+ }
+
+ void abandon();
+ void cleanup();
+ void reset();
+ void flush();
+
+ friend class GrContext; // for access to: ctor, abandon, reset & flush
+
+ 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];
+};
+
+#endif
« no previous file with comments | « src/gpu/GrDrawContext.cpp ('k') | src/gpu/GrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698