OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 "GrAAHairLinePathRenderer.h" | 9 #include "GrAAHairLinePathRenderer.h" |
10 | 10 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 * Generates the lines and quads to be rendered. Lines are always recorded in | 244 * Generates the lines and quads to be rendered. Lines are always recorded in |
245 * device space. We will do a device space bloat to account for the 1pixel | 245 * device space. We will do a device space bloat to account for the 1pixel |
246 * thickness. | 246 * thickness. |
247 * Quads are recorded in device space unless m contains | 247 * Quads are recorded in device space unless m contains |
248 * perspective, then in they are in src space. We do this because we will | 248 * perspective, then in they are in src space. We do this because we will |
249 * subdivide large quads to reduce over-fill. This subdivision has to be | 249 * subdivide large quads to reduce over-fill. This subdivision has to be |
250 * performed before applying the perspective matrix. | 250 * performed before applying the perspective matrix. |
251 */ | 251 */ |
252 int generate_lines_and_quads(const SkPath& path, | 252 int generate_lines_and_quads(const SkPath& path, |
253 const SkMatrix& m, | 253 const SkMatrix& m, |
254 const GrIRect& devClipBounds, | 254 const SkIRect& devClipBounds, |
255 PtArray* lines, | 255 PtArray* lines, |
256 PtArray* quads, | 256 PtArray* quads, |
257 PtArray* conics, | 257 PtArray* conics, |
258 IntArray* quadSubdivCnts, | 258 IntArray* quadSubdivCnts, |
259 FloatArray* conicWeights) { | 259 FloatArray* conicWeights) { |
260 SkPath::Iter iter(path, false); | 260 SkPath::Iter iter(path, false); |
261 | 261 |
262 int totalQuadCount = 0; | 262 int totalQuadCount = 0; |
263 GrRect bounds; | 263 SkRect bounds; |
264 GrIRect ibounds; | 264 SkIRect ibounds; |
265 | 265 |
266 bool persp = m.hasPerspective(); | 266 bool persp = m.hasPerspective(); |
267 | 267 |
268 for (;;) { | 268 for (;;) { |
269 GrPoint pathPts[4]; | 269 GrPoint pathPts[4]; |
270 GrPoint devPts[4]; | 270 GrPoint devPts[4]; |
271 SkPath::Verb verb = iter.next(pathPts); | 271 SkPath::Verb verb = iter.next(pathPts); |
272 switch (verb) { | 272 switch (verb) { |
273 case SkPath::kConic_Verb: { | 273 case SkPath::kConic_Verb: { |
274 SkConic dst[2]; | 274 SkConic dst[2]; |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 const SkPath& path, | 979 const SkPath& path, |
980 GrDrawTarget* target, | 980 GrDrawTarget* target, |
981 int* lineCnt, | 981 int* lineCnt, |
982 int* quadCnt, | 982 int* quadCnt, |
983 int* conicCnt, | 983 int* conicCnt, |
984 GrDrawTarget::AutoReleaseGeometry* arg, | 984 GrDrawTarget::AutoReleaseGeometry* arg, |
985 SkRect* devBounds) { | 985 SkRect* devBounds) { |
986 GrDrawState* drawState = target->drawState(); | 986 GrDrawState* drawState = target->drawState(); |
987 int rtHeight = drawState->getRenderTarget()->height(); | 987 int rtHeight = drawState->getRenderTarget()->height(); |
988 | 988 |
989 GrIRect devClipBounds; | 989 SkIRect devClipBounds; |
990 target->getClip()->getConservativeBounds(drawState->getRenderTarget(), &devC
lipBounds); | 990 target->getClip()->getConservativeBounds(drawState->getRenderTarget(), &devC
lipBounds); |
991 | 991 |
992 SkMatrix viewM = drawState->getViewMatrix(); | 992 SkMatrix viewM = drawState->getViewMatrix(); |
993 | 993 |
994 // All the vertices that we compute are within 1 of path control points with
the exception of | 994 // All the vertices that we compute are within 1 of path control points with
the exception of |
995 // one of the bounding vertices for each quad. The add_quads() function will
update the bounds | 995 // one of the bounding vertices for each quad. The add_quads() function will
update the bounds |
996 // for each quad added. | 996 // for each quad added. |
997 *devBounds = path.getBounds(); | 997 *devBounds = path.getBounds(); |
998 viewM.mapRect(devBounds); | 998 viewM.mapRect(devBounds); |
999 devBounds->outset(SK_Scalar1, SK_Scalar1); | 999 devBounds->outset(SK_Scalar1, SK_Scalar1); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 kVertsPerQuad*n, // vCount | 1181 kVertsPerQuad*n, // vCount |
1182 kIdxsPerQuad*n, // iCount | 1182 kIdxsPerQuad*n, // iCount |
1183 &devBounds); | 1183 &devBounds); |
1184 conics += n; | 1184 conics += n; |
1185 } | 1185 } |
1186 } | 1186 } |
1187 target->resetIndexSource(); | 1187 target->resetIndexSource(); |
1188 | 1188 |
1189 return true; | 1189 return true; |
1190 } | 1190 } |
OLD | NEW |