| 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 "GrPLSPathRenderer.h" | 8 #include "GrPLSPathRenderer.h" |
| 9 | 9 |
| 10 #include "SkChunkAlloc.h" | 10 #include "SkChunkAlloc.h" |
| 11 #include "SkGeometry.h" | 11 #include "SkGeometry.h" |
| 12 #include "SkPathPriv.h" | 12 #include "SkPathPriv.h" |
| 13 #include "SkString.h" | 13 #include "SkString.h" |
| 14 #include "SkTSort.h" | 14 #include "SkTSort.h" |
| 15 #include "SkTraceEvent.h" | 15 #include "SkTraceEvent.h" |
| 16 #include "GrBatchFlushState.h" | 16 #include "GrBatchFlushState.h" |
| 17 #include "GrBatchTest.h" | 17 #include "GrBatchTest.h" |
| 18 #include "GrCaps.h" | 18 #include "GrCaps.h" |
| 19 #include "GrContext.h" | 19 #include "GrContext.h" |
| 20 #include "GrDefaultGeoProcFactory.h" | 20 #include "GrDefaultGeoProcFactory.h" |
| 21 #include "GrPLSGeometryProcessor.h" | 21 #include "GrPLSGeometryProcessor.h" |
| 22 #include "GrInvariantOutput.h" | 22 #include "GrInvariantOutput.h" |
| 23 #include "GrPathUtils.h" | 23 #include "GrPathUtils.h" |
| 24 #include "GrProcessor.h" | 24 #include "GrProcessor.h" |
| 25 #include "GrPipelineBuilder.h" |
| 25 #include "GrStyle.h" | 26 #include "GrStyle.h" |
| 26 #include "GrTessellator.h" | 27 #include "GrTessellator.h" |
| 27 #include "batches/GrVertexBatch.h" | 28 #include "batches/GrVertexBatch.h" |
| 28 #include "glsl/GrGLSLGeometryProcessor.h" | 29 #include "glsl/GrGLSLGeometryProcessor.h" |
| 29 #include "gl/builders/GrGLProgramBuilder.h" | 30 #include "gl/builders/GrGLProgramBuilder.h" |
| 30 #include "glsl/GrGLSLPLSPathRendering.h" | 31 #include "glsl/GrGLSLPLSPathRendering.h" |
| 31 | 32 |
| 32 GrPLSPathRenderer::GrPLSPathRenderer() { | 33 GrPLSPathRenderer::GrPLSPathRenderer() { |
| 33 } | 34 } |
| 34 | 35 |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 bool GrPLSPathRenderer::onDrawPath(const DrawPathArgs& args) { | 944 bool GrPLSPathRenderer::onDrawPath(const DrawPathArgs& args) { |
| 944 SkASSERT(!args.fShape->isEmpty()) | 945 SkASSERT(!args.fShape->isEmpty()) |
| 945 SkASSERT(!inPLSDraw); | 946 SkASSERT(!inPLSDraw); |
| 946 SkDEBUGCODE(inPLSDraw = true;) | 947 SkDEBUGCODE(inPLSDraw = true;) |
| 947 SkPath path; | 948 SkPath path; |
| 948 args.fShape->asPath(&path); | 949 args.fShape->asPath(&path); |
| 949 | 950 |
| 950 SkAutoTUnref<GrDrawBatch> batch(new PLSPathBatch(args.fPaint->getColor(), | 951 SkAutoTUnref<GrDrawBatch> batch(new PLSPathBatch(args.fPaint->getColor(), |
| 951 path, *args.fViewMatrix)); | 952 path, *args.fViewMatrix)); |
| 952 | 953 |
| 953 args.fDrawContext->drawBatch(*args.fPaint, *args.fClip, *args.fUserStencilSe
ttings, batch); | 954 GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->mustUseHW
AA(*args.fPaint)); |
| 955 pipelineBuilder.setUserStencil(args.fUserStencilSettings); |
| 956 |
| 957 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); |
| 954 | 958 |
| 955 SkDEBUGCODE(inPLSDraw = false;) | 959 SkDEBUGCODE(inPLSDraw = false;) |
| 956 return true; | 960 return true; |
| 957 | 961 |
| 958 } | 962 } |
| 959 | 963 |
| 960 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 964 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 961 | 965 |
| 962 #ifdef GR_TEST_UTILS | 966 #ifdef GR_TEST_UTILS |
| 963 | 967 |
| 964 DRAW_BATCH_TEST_DEFINE(PLSPathBatch) { | 968 DRAW_BATCH_TEST_DEFINE(PLSPathBatch) { |
| 965 GrColor color = GrRandomColor(random); | 969 GrColor color = GrRandomColor(random); |
| 966 SkMatrix vm = GrTest::TestMatrixInvertible(random); | 970 SkMatrix vm = GrTest::TestMatrixInvertible(random); |
| 967 SkPath path = GrTest::TestPathConvex(random); | 971 SkPath path = GrTest::TestPathConvex(random); |
| 968 | 972 |
| 969 return new PLSPathBatch(color, path, vm); | 973 return new PLSPathBatch(color, path, vm); |
| 970 } | 974 } |
| 971 | 975 |
| 972 #endif | 976 #endif |
| OLD | NEW |