aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/batches/GrDashLinePathRenderer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/batches/GrDashLinePathRenderer.cpp')
-rw-r--r--src/gpu/batches/GrDashLinePathRenderer.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/gpu/batches/GrDashLinePathRenderer.cpp b/src/gpu/batches/GrDashLinePathRenderer.cpp
new file mode 100644
index 0000000000..e26f5d7627
--- /dev/null
+++ b/src/gpu/batches/GrDashLinePathRenderer.cpp
@@ -0,0 +1,26 @@
+/*
+ * 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"
+
+bool GrDashLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
+ SkPoint pts[2];
+ if (args.fStroke->isDashed() && args.fPath->isLine(pts)) {
+ return GrDashingEffect::CanDrawDashLine(pts, *args.fStroke, *args.fViewMatrix);
+ }
+ return false;
+}
+
+bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
+ SkPoint pts[2];
+ SkAssertResult(args.fPath->isLine(pts));
+ return GrDashingEffect::DrawDashLine(args.fTarget, *args.fPipelineBuilder, args.fColor,
+ *args.fViewMatrix, pts, args.fAntiAlias, *args.fStroke);
+}