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

Unified Diff: src/gpu/GrDrawingManager.cpp

Issue 1407883004: Remove GrPipelineBuilder from getPathRenderer call (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Hide GrContext::drawingManager entry point 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/GrDrawingManager.h ('k') | src/gpu/GrPathRenderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawingManager.cpp
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 0dbd476c791df31aa83d1e8bca44ead9f7de7af1..0a487daf4146fadb7f7869f8144454d702188ec5 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -10,6 +10,7 @@
#include "GrDrawingManager.h"
#include "GrDrawTarget.h"
#include "GrResourceProvider.h"
+#include "GrSoftwarePathRenderer.h"
#include "GrStencilAndCoverTextContext.h"
#include "SkTTopoSort.h"
@@ -29,6 +30,9 @@ void GrDrawingManager::cleanup() {
delete fTextContexts[i][1];
fTextContexts[i][1] = nullptr;
}
+
+ SkSafeSetNull(fPathRendererChain);
+ SkSafeSetNull(fSoftwarePathRenderer);
}
GrDrawingManager::~GrDrawingManager() {
@@ -40,6 +44,12 @@ void GrDrawingManager::abandon() {
this->cleanup();
}
+void GrDrawingManager::freeGpuResources() {
+ // a path renderer may be holding onto resources
+ SkSafeSetNull(fPathRendererChain);
+ SkSafeSetNull(fSoftwarePathRenderer);
+}
+
void GrDrawingManager::reset() {
for (int i = 0; i < fDrawTargets.count(); ++i) {
fDrawTargets[i]->reset();
@@ -114,7 +124,33 @@ GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) {
return SkRef(dt);
}
-GrDrawContext* GrDrawingManager::drawContext(GrRenderTarget* rt,
+/*
+ * This method finds a path renderer that can draw the specified path on
+ * the provided target.
+ * Due to its expense, the software path renderer has split out so it can
+ * can be individually allowed/disallowed via the "allowSW" boolean.
+ */
+GrPathRenderer* GrDrawingManager::getPathRenderer(const GrPathRenderer::CanDrawPathArgs& args,
+ bool allowSW,
+ GrPathRendererChain::DrawType drawType,
+ GrPathRenderer::StencilSupport* stencilSupport) {
+
+ if (!fPathRendererChain) {
+ fPathRendererChain = new GrPathRendererChain(fContext);
+ }
+
+ GrPathRenderer* pr = fPathRendererChain->getPathRenderer(args, drawType, stencilSupport);
+ if (!pr && allowSW) {
+ if (!fSoftwarePathRenderer) {
+ fSoftwarePathRenderer = new GrSoftwarePathRenderer(fContext);
+ }
+ pr = fSoftwarePathRenderer;
+ }
+
+ return pr;
+}
+
+GrDrawContext* GrDrawingManager::drawContext(GrRenderTarget* rt,
const SkSurfaceProps* surfaceProps) {
if (this->abandoned()) {
return nullptr;
« no previous file with comments | « src/gpu/GrDrawingManager.h ('k') | src/gpu/GrPathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698