OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "GrOvalRenderer.h" | 8 #include "GrOvalRenderer.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
11 #include "GrBatchTest.h" | 11 #include "GrBatchTest.h" |
12 #include "GrDrawTarget.h" | 12 #include "GrDrawTarget.h" |
13 #include "GrGeometryProcessor.h" | 13 #include "GrGeometryProcessor.h" |
14 #include "GrInvariantOutput.h" | 14 #include "GrInvariantOutput.h" |
15 #include "GrPipelineBuilder.h" | 15 #include "GrPipelineBuilder.h" |
16 #include "GrProcessor.h" | 16 #include "GrProcessor.h" |
17 #include "GrResourceProvider.h" | 17 #include "GrResourceProvider.h" |
18 #include "GrVertexBuffer.h" | 18 #include "GrVertexBuffer.h" |
19 #include "SkRRect.h" | 19 #include "SkRRect.h" |
20 #include "SkStrokeRec.h" | 20 #include "SkStrokeRec.h" |
21 #include "SkTLazy.h" | 21 #include "SkTLazy.h" |
| 22 #include "batches/GrRectBatchFactory.h" |
22 #include "batches/GrVertexBatch.h" | 23 #include "batches/GrVertexBatch.h" |
23 #include "effects/GrRRectEffect.h" | 24 #include "effects/GrRRectEffect.h" |
24 #include "glsl/GrGLSLFragmentShaderBuilder.h" | 25 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
25 #include "glsl/GrGLSLGeometryProcessor.h" | 26 #include "glsl/GrGLSLGeometryProcessor.h" |
26 #include "glsl/GrGLSLProgramDataManager.h" | 27 #include "glsl/GrGLSLProgramDataManager.h" |
27 #include "glsl/GrGLSLVarying.h" | 28 #include "glsl/GrGLSLVarying.h" |
28 #include "glsl/GrGLSLVertexShaderBuilder.h" | 29 #include "glsl/GrGLSLVertexShaderBuilder.h" |
29 #include "glsl/GrGLSLUniformHandler.h" | 30 #include "glsl/GrGLSLUniformHandler.h" |
30 #include "glsl/GrGLSLUtil.h" | 31 #include "glsl/GrGLSLUtil.h" |
31 | 32 |
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1486 SkMatrix invert; | 1487 SkMatrix invert; |
1487 if (!viewMatrix.invert(&invert)) { | 1488 if (!viewMatrix.invert(&invert)) { |
1488 return false; | 1489 return false; |
1489 } | 1490 } |
1490 | 1491 |
1491 arfps.addCoverageFragmentProcessor(effect)->unref(); | 1492 arfps.addCoverageFragmentProcessor(effect)->unref(); |
1492 SkRect bounds = outer->getBounds(); | 1493 SkRect bounds = outer->getBounds(); |
1493 if (applyAA) { | 1494 if (applyAA) { |
1494 bounds.outset(SK_ScalarHalf, SK_ScalarHalf); | 1495 bounds.outset(SK_ScalarHalf, SK_ScalarHalf); |
1495 } | 1496 } |
1496 target->drawNonAARect(pipelineBuilder, color, SkMatrix::I(), bounds, invert)
; | 1497 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, S
kMatrix::I(), |
| 1498 bounds,
nullptr, &invert)); |
| 1499 target->drawBatch(pipelineBuilder, batch); |
1497 return true; | 1500 return true; |
1498 } | 1501 } |
1499 | 1502 |
1500 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 1503 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
1501 | 1504 |
1502 class RRectCircleRendererBatch : public GrVertexBatch { | 1505 class RRectCircleRendererBatch : public GrVertexBatch { |
1503 public: | 1506 public: |
1504 DEFINE_BATCH_CLASS_ID | 1507 DEFINE_BATCH_CLASS_ID |
1505 | 1508 |
1506 struct Geometry { | 1509 struct Geometry { |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2080 } | 2083 } |
2081 | 2084 |
2082 DRAW_BATCH_TEST_DEFINE(RRectBatch) { | 2085 DRAW_BATCH_TEST_DEFINE(RRectBatch) { |
2083 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 2086 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
2084 GrColor color = GrRandomColor(random); | 2087 GrColor color = GrRandomColor(random); |
2085 const SkRRect& rrect = GrTest::TestRRectSimple(random); | 2088 const SkRRect& rrect = GrTest::TestRRectSimple(random); |
2086 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); | 2089 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); |
2087 } | 2090 } |
2088 | 2091 |
2089 #endif | 2092 #endif |
OLD | NEW |