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

Unified Diff: src/gpu/GrDashLinePathRenderer.cpp

Issue 1100073003: Extract gpu line dashing to GrDashLinePathRenderer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address review comments Created 5 years, 8 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/GrDashLinePathRenderer.h ('k') | src/gpu/GrDefaultPathRenderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDashLinePathRenderer.cpp
diff --git a/src/gpu/GrDashLinePathRenderer.cpp b/src/gpu/GrDashLinePathRenderer.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..bd49a72156f27a90c9a1f32488a74f42805a06e2
--- /dev/null
+++ b/src/gpu/GrDashLinePathRenderer.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "GrDashLinePathRenderer.h"
+
+#include "GrGpu.h"
+#include "effects/GrDashingEffect.h"
+
+GrDashLinePathRenderer::GrDashLinePathRenderer(GrContext* context)
+ : fGpu(SkRef(context->getGpu())) {
+}
+
+GrDashLinePathRenderer::~GrDashLinePathRenderer() {
+}
+
+bool GrDashLinePathRenderer::canDrawPath(const GrDrawTarget* target,
+ const GrPipelineBuilder* pipelineBuilder,
+ const SkMatrix& viewMatrix,
+ const SkPath& path,
+ const GrStrokeInfo& stroke,
+ bool antiAlias) const {
+ SkPoint pts[2];
+ if (stroke.isDashed() && path.isLine(pts)) {
+ return GrDashingEffect::CanDrawDashLine(pts, stroke, viewMatrix);
+ }
+ return false;
+}
+
+bool GrDashLinePathRenderer::onDrawPath(GrDrawTarget* target,
+ GrPipelineBuilder* pipelineBuilder,
+ GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkPath& path,
+ const GrStrokeInfo& stroke,
+ bool useAA) {
+ SkPoint pts[2];
+ SkAssertResult(path.isLine(pts));
+ return GrDashingEffect::DrawDashLine(fGpu, target, pipelineBuilder, color,
+ viewMatrix, pts, useAA, stroke);
+}
« no previous file with comments | « src/gpu/GrDashLinePathRenderer.h ('k') | src/gpu/GrDefaultPathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698