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