OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #include "GrTessellatingPathRenderer.h" | 8 #include "GrTessellatingPathRenderer.h" |
9 | 9 |
10 #include "GrAuditTrail.h" | 10 #include "GrAuditTrail.h" |
11 #include "GrBatchFlushState.h" | 11 #include "GrBatchFlushState.h" |
12 #include "GrBatchTest.h" | 12 #include "GrBatchTest.h" |
13 #include "GrClip.h" | 13 #include "GrClip.h" |
14 #include "GrDefaultGeoProcFactory.h" | 14 #include "GrDefaultGeoProcFactory.h" |
15 #include "GrMesh.h" | 15 #include "GrMesh.h" |
16 #include "GrPathUtils.h" | 16 #include "GrPathUtils.h" |
| 17 #include "GrPipelineBuilder.h" |
17 #include "GrResourceCache.h" | 18 #include "GrResourceCache.h" |
18 #include "GrResourceProvider.h" | 19 #include "GrResourceProvider.h" |
19 #include "GrTessellator.h" | 20 #include "GrTessellator.h" |
20 #include "SkGeometry.h" | 21 #include "SkGeometry.h" |
21 | 22 |
22 #include "batches/GrVertexBatch.h" | 23 #include "batches/GrVertexBatch.h" |
23 | 24 |
24 #include <stdio.h> | 25 #include <stdio.h> |
25 | 26 |
26 /* | 27 /* |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 if (!args.fViewMatrix->invert(&vmi)) { | 265 if (!args.fViewMatrix->invert(&vmi)) { |
265 return false; | 266 return false; |
266 } | 267 } |
267 vmi.mapRect(&clipBounds); | 268 vmi.mapRect(&clipBounds); |
268 SkPath path; | 269 SkPath path; |
269 args.fShape->asPath(&path); | 270 args.fShape->asPath(&path); |
270 SkAutoTUnref<GrDrawBatch> batch(TessellatingPathBatch::Create(args.fPaint->g
etColor(), | 271 SkAutoTUnref<GrDrawBatch> batch(TessellatingPathBatch::Create(args.fPaint->g
etColor(), |
271 *args.fShape, | 272 *args.fShape, |
272 *args.fViewMat
rix, clipBounds)); | 273 *args.fViewMat
rix, clipBounds)); |
273 | 274 |
274 args.fDrawContext->drawBatch(*args.fPaint, *args.fClip, *args.fUserStencilSe
ttings, batch); | 275 GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->mustUseHW
AA(*args.fPaint)); |
| 276 pipelineBuilder.setUserStencil(args.fUserStencilSettings); |
| 277 |
| 278 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); |
275 | 279 |
276 return true; | 280 return true; |
277 } | 281 } |
278 | 282 |
279 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 283 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
280 | 284 |
281 #ifdef GR_TEST_UTILS | 285 #ifdef GR_TEST_UTILS |
282 | 286 |
283 DRAW_BATCH_TEST_DEFINE(TesselatingPathBatch) { | 287 DRAW_BATCH_TEST_DEFINE(TesselatingPathBatch) { |
284 GrColor color = GrRandomColor(random); | 288 GrColor color = GrRandomColor(random); |
285 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); | 289 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); |
286 SkPath path = GrTest::TestPath(random); | 290 SkPath path = GrTest::TestPath(random); |
287 SkRect clipBounds = GrTest::TestRect(random); | 291 SkRect clipBounds = GrTest::TestRect(random); |
288 SkMatrix vmi; | 292 SkMatrix vmi; |
289 bool result = viewMatrix.invert(&vmi); | 293 bool result = viewMatrix.invert(&vmi); |
290 if (!result) { | 294 if (!result) { |
291 SkFAIL("Cannot invert matrix\n"); | 295 SkFAIL("Cannot invert matrix\n"); |
292 } | 296 } |
293 vmi.mapRect(&clipBounds); | 297 vmi.mapRect(&clipBounds); |
294 GrStyle style; | 298 GrStyle style; |
295 do { | 299 do { |
296 GrTest::TestStyle(random, &style); | 300 GrTest::TestStyle(random, &style); |
297 } while (style.strokeRec().isHairlineStyle()); | 301 } while (style.strokeRec().isHairlineStyle()); |
298 GrShape shape(path, style); | 302 GrShape shape(path, style); |
299 return TessellatingPathBatch::Create(color, shape, viewMatrix, clipBounds); | 303 return TessellatingPathBatch::Create(color, shape, viewMatrix, clipBounds); |
300 } | 304 } |
301 | 305 |
302 #endif | 306 #endif |
OLD | NEW |