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