| 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 #include "GrDefaultPathRenderer.h" | 8 #include "GrDefaultPathRenderer.h" |
| 9 | 9 |
| 10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
| 11 #include "GrBatchTest.h" | 11 #include "GrBatchTest.h" |
| 12 #include "GrContext.h" | 12 #include "GrContext.h" |
| 13 #include "GrDefaultGeoProcFactory.h" | 13 #include "GrDefaultGeoProcFactory.h" |
| 14 #include "GrPathUtils.h" | 14 #include "GrPathUtils.h" |
| 15 #include "GrPipelineBuilder.h" | 15 #include "GrPipelineBuilder.h" |
| 16 #include "GrVertices.h" | 16 #include "GrVertices.h" |
| 17 #include "SkGeometry.h" | 17 #include "SkGeometry.h" |
| 18 #include "SkString.h" | 18 #include "SkString.h" |
| 19 #include "SkStrokeRec.h" | 19 #include "SkStrokeRec.h" |
| 20 #include "SkTLazy.h" | 20 #include "SkTLazy.h" |
| 21 #include "SkTraceEvent.h" | 21 #include "SkTraceEvent.h" |
| 22 | 22 |
| 23 #include "batches/GrRectBatchFactory.h" |
| 23 #include "batches/GrVertexBatch.h" | 24 #include "batches/GrVertexBatch.h" |
| 24 | 25 |
| 25 GrDefaultPathRenderer::GrDefaultPathRenderer(bool separateStencilSupport, | 26 GrDefaultPathRenderer::GrDefaultPathRenderer(bool separateStencilSupport, |
| 26 bool stencilWrapOpsSupport) | 27 bool stencilWrapOpsSupport) |
| 27 : fSeparateStencil(separateStencilSupport) | 28 : fSeparateStencil(separateStencilSupport) |
| 28 , fStencilWrapOps(stencilWrapOpsSupport) { | 29 , fStencilWrapOps(stencilWrapOpsSupport) { |
| 29 } | 30 } |
| 30 | 31 |
| 31 | 32 |
| 32 //////////////////////////////////////////////////////////////////////////////// | 33 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 } else { | 691 } else { |
| 691 if (!viewMatrix.invert(&localMatrix)) { | 692 if (!viewMatrix.invert(&localMatrix)) { |
| 692 return false; | 693 return false; |
| 693 } | 694 } |
| 694 } | 695 } |
| 695 } else { | 696 } else { |
| 696 bounds = path.getBounds(); | 697 bounds = path.getBounds(); |
| 697 } | 698 } |
| 698 const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? S
kMatrix::I() : | 699 const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? S
kMatrix::I() : |
| 699 v
iewMatrix; | 700 v
iewMatrix; |
| 700 target->drawNonAARect(*pipelineBuilder, color, viewM, bounds, localM
atrix); | 701 SkAutoTUnref<GrDrawBatch> batch( |
| 702 GrRectBatchFactory::CreateNonAAFill(color, viewM, bounds, nu
llptr, |
| 703 &localMatrix)); |
| 704 target->drawBatch(*pipelineBuilder, batch); |
| 701 } else { | 705 } else { |
| 702 if (passCount > 1) { | 706 if (passCount > 1) { |
| 703 pipelineBuilder->setDisableColorXPFactory(); | 707 pipelineBuilder->setDisableColorXPFactory(); |
| 704 } | 708 } |
| 705 | 709 |
| 706 DefaultPathBatch::Geometry geometry; | 710 DefaultPathBatch::Geometry geometry; |
| 707 geometry.fColor = color; | 711 geometry.fColor = color; |
| 708 geometry.fPath = path; | 712 geometry.fPath = path; |
| 709 geometry.fTolerance = srcSpaceTol; | 713 geometry.fTolerance = srcSpaceTol; |
| 710 | 714 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 geometry.fColor = color; | 768 geometry.fColor = color; |
| 765 geometry.fPath = path; | 769 geometry.fPath = path; |
| 766 geometry.fTolerance = srcSpaceTol; | 770 geometry.fTolerance = srcSpaceTol; |
| 767 | 771 |
| 768 viewMatrix.mapRect(&bounds); | 772 viewMatrix.mapRect(&bounds); |
| 769 uint8_t coverage = GrRandomCoverage(random); | 773 uint8_t coverage = GrRandomCoverage(random); |
| 770 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); | 774 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); |
| 771 } | 775 } |
| 772 | 776 |
| 773 #endif | 777 #endif |
| OLD | NEW |