OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrPathUtils_DEFINED | 8 #ifndef GrPathUtils_DEFINED |
9 #define GrPathUtils_DEFINED | 9 #define GrPathUtils_DEFINED |
10 | 10 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 * and reorder to avoid stalling for loads. The assumption is that a | 67 * and reorder to avoid stalling for loads. The assumption is that a |
68 * path renderer will have a small fixed number of vertices that it | 68 * path renderer will have a small fixed number of vertices that it |
69 * uploads for each quad. | 69 * uploads for each quad. |
70 * | 70 * |
71 * N is the number of vertices. | 71 * N is the number of vertices. |
72 * STRIDE is the size of each vertex. | 72 * STRIDE is the size of each vertex. |
73 * UV_OFFSET is the offset of the UV values within each vertex. | 73 * UV_OFFSET is the offset of the UV values within each vertex. |
74 * vertices is a pointer to the first vertex. | 74 * vertices is a pointer to the first vertex. |
75 */ | 75 */ |
76 template <int N, size_t STRIDE, size_t UV_OFFSET> | 76 template <int N, size_t STRIDE, size_t UV_OFFSET> |
77 void apply(const void* vertices) { | 77 void apply(const void* vertices) const { |
78 intptr_t xyPtr = reinterpret_cast<intptr_t>(vertices); | 78 intptr_t xyPtr = reinterpret_cast<intptr_t>(vertices); |
79 intptr_t uvPtr = reinterpret_cast<intptr_t>(vertices) + UV_OFFSET; | 79 intptr_t uvPtr = reinterpret_cast<intptr_t>(vertices) + UV_OFFSET; |
80 float sx = fM[0]; | 80 float sx = fM[0]; |
81 float kx = fM[1]; | 81 float kx = fM[1]; |
82 float tx = fM[2]; | 82 float tx = fM[2]; |
83 float ky = fM[3]; | 83 float ky = fM[3]; |
84 float sy = fM[4]; | 84 float sy = fM[4]; |
85 float ty = fM[5]; | 85 float ty = fM[5]; |
86 for (int i = 0; i < N; ++i) { | 86 for (int i = 0; i < N; ++i) { |
87 const SkPoint* xy = reinterpret_cast<const SkPoint*>(xyPtr); | 87 const SkPoint* xy = reinterpret_cast<const SkPoint*>(xyPtr); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 void getCubicKLM(const SkPoint p[4], SkScalar klm[9]); | 170 void getCubicKLM(const SkPoint p[4], SkScalar klm[9]); |
171 | 171 |
172 // When tessellating curved paths into linear segments, this defines the max
imum distance | 172 // When tessellating curved paths into linear segments, this defines the max
imum distance |
173 // in screen space which a segment may deviate from the mathmatically correc
t value. | 173 // in screen space which a segment may deviate from the mathmatically correc
t value. |
174 // Above this value, the segment will be subdivided. | 174 // Above this value, the segment will be subdivided. |
175 // This value was chosen to approximate the supersampling accuracy of the ra
ster path (16 | 175 // This value was chosen to approximate the supersampling accuracy of the ra
ster path (16 |
176 // samples, or one quarter pixel). | 176 // samples, or one quarter pixel). |
177 static const SkScalar kDefaultTolerance = SkDoubleToScalar(0.25); | 177 static const SkScalar kDefaultTolerance = SkDoubleToScalar(0.25); |
178 }; | 178 }; |
179 #endif | 179 #endif |
OLD | NEW |