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

Side by Side Diff: experimental/AndroidPathRenderer/GrAndroidPathRenderer.cpp

Issue 1096513002: Pass dashing information to path rasterizers. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix 100-col issue 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 unified diff | Download patch
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrAndroidPathRenderer.h" 9 #include "GrAndroidPathRenderer.h"
10 #include "AndroidPathRenderer.h" 10 #include "AndroidPathRenderer.h"
11 #include "Vertex.h" 11 #include "Vertex.h"
12 12
13 GrAndroidPathRenderer::GrAndroidPathRenderer() { 13 GrAndroidPathRenderer::GrAndroidPathRenderer() {
14 } 14 }
15 15
16 bool GrAndroidPathRenderer::canDrawPath(const SkPath& path, 16 bool GrAndroidPathRenderer::canDrawPath(const SkPath& path,
17 const SkStrokeRec& stroke, 17 const GrStrokeInfo& stroke,
18 const GrDrawTarget* target, 18 const GrDrawTarget* target,
19 bool antiAlias) const { 19 bool antiAlias) const {
20 return ((stroke.isFillStyle() || stroke.getStyle() == SkStrokeRec::kStroke_S tyle) 20 return ((stroke.isFillStyle() || stroke.getStrokeRec().getStyle() == SkStrok eRec::kStroke_Style)
21 && !path.isInverseFillType() && path.isConvex()); 21 && !path.isInverseFillType() && path.isConvex());
22 } 22 }
23 23
24 struct ColorVertex { 24 struct ColorVertex {
25 SkPoint pos; 25 SkPoint pos;
26 GrColor color; 26 GrColor color;
27 }; 27 };
28 28
29 bool GrAndroidPathRenderer::onDrawPath(const SkPath& origPath, 29 bool GrAndroidPathRenderer::onDrawPath(const SkPath& origPath,
30 const SkStrokeRec& stroke, 30 const GrStrokeInfo& stroke,
31 GrDrawTarget* target, 31 GrDrawTarget* target,
32 bool antiAlias) { 32 bool antiAlias) {
33 33
34 // generate verts using Android algorithm 34 // generate verts using Android algorithm
35 android::uirenderer::VertexBuffer vertices; 35 android::uirenderer::VertexBuffer vertices;
36 android::uirenderer::PathRenderer::ConvexPathVertices(origPath, stroke, anti Alias, NULL, 36 android::uirenderer::PathRenderer::ConvexPathVertices(origPath, stroke.getSt rokeRec(),
37 &vertices); 37 antiAlias, NULL, &vert ices);
38 38
39 // set vertex attributes depending on anti-alias 39 // set vertex attributes depending on anti-alias
40 GrDrawState* drawState = target->drawState(); 40 GrDrawState* drawState = target->drawState();
41 if (antiAlias) { 41 if (antiAlias) {
42 // position + coverage 42 // position + coverage
43 GrVertexAttrib attribs[] = { 43 GrVertexAttrib attribs[] = {
44 GrVertexAttrib(kVec2f_GrVertexAttribType, 0), 44 GrVertexAttrib(kVec2f_GrVertexAttribType, 0),
45 GrVertexAttrib(kVec4ub_GrVertexAttribType, sizeof(GrPoint)) 45 GrVertexAttrib(kVec4ub_GrVertexAttribType, sizeof(GrPoint))
46 }; 46 };
47 drawState->setVertexAttribs(attribs, SK_ARRAY_COUNT(attribs)); 47 drawState->setVertexAttribs(attribs, SK_ARRAY_COUNT(attribs));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 size_t vsize = drawState->getVertexSize(); 80 size_t vsize = drawState->getVertexSize();
81 size_t copySize = vsize*vertCount; 81 size_t copySize = vsize*vertCount;
82 memcpy(geo.vertices(), vertices.getBuffer(), copySize); 82 memcpy(geo.vertices(), vertices.getBuffer(), copySize);
83 } 83 }
84 84
85 // render it 85 // render it
86 target->drawNonIndexed(kTriangleStrip_GrPrimitiveType, 0, vertCount); 86 target->drawNonIndexed(kTriangleStrip_GrPrimitiveType, 0, vertCount);
87 87
88 return true; 88 return true;
89 } 89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698