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 "GrNonAAFillRectBatch.h" | 8 #include "GrNonAAFillRectBatch.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
11 #include "GrColor.h" | 11 #include "GrColor.h" |
12 #include "GrDefaultGeoProcFactory.h" | 12 #include "GrDefaultGeoProcFactory.h" |
13 #include "GrPrimitiveProcessor.h" | 13 #include "GrPrimitiveProcessor.h" |
14 #include "GrResourceProvider.h" | 14 #include "GrResourceProvider.h" |
15 #include "GrTInstanceBatch.h" | 15 #include "GrTInstanceBatch.h" |
16 #include "GrQuad.h" | 16 #include "GrQuad.h" |
17 #include "GrVertexBatch.h" | 17 #include "GrVertexBatch.h" |
18 | 18 |
19 // Common functions | 19 // Common functions |
20 class NonAAFillRectBatchBase { | 20 class NonAAFillRectBatchBase { |
21 public: | 21 public: |
22 static const int kVertsPerInstance = 4; | 22 static const int kVertsPerInstance = 4; |
23 static const int kIndicesPerInstance = 6; | 23 static const int kIndicesPerInstance = 6; |
24 | 24 |
25 static void InitInvariantOutputCoverage(GrInitInvariantOutput* out) { | 25 static void InitInvariantOutputCoverage(GrInitInvariantOutput* out) { |
26 out->setKnownSingleComponent(0xff); | 26 out->setKnownSingleComponent(0xff); |
27 } | 27 } |
28 | 28 |
29 static const GrIndexBuffer* GetIndexBuffer(GrResourceProvider* rp) { | 29 static const GrBuffer* GetIndexBuffer(GrResourceProvider* rp) { |
30 return rp->refQuadIndexBuffer(); | 30 return rp->refQuadIndexBuffer(); |
31 } | 31 } |
32 | 32 |
33 template <typename Geometry> | 33 template <typename Geometry> |
34 static void SetBounds(const Geometry& geo, SkRect* outBounds) { | 34 static void SetBounds(const Geometry& geo, SkRect* outBounds) { |
35 geo.fViewMatrix.mapRect(outBounds, geo.fRect); | 35 geo.fViewMatrix.mapRect(outBounds, geo.fRect); |
36 } | 36 } |
37 | 37 |
38 template <typename Geometry> | 38 template <typename Geometry> |
39 static void UpdateBoundsAfterAppend(const Geometry& geo, SkRect* outBounds)
{ | 39 static void UpdateBoundsAfterAppend(const Geometry& geo, SkRect* outBounds)
{ |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 SkMatrix localMatrix = GrTest::TestMatrix(random); | 329 SkMatrix localMatrix = GrTest::TestMatrix(random); |
330 | 330 |
331 bool hasLocalRect = random->nextBool(); | 331 bool hasLocalRect = random->nextBool(); |
332 bool hasLocalMatrix = random->nextBool(); | 332 bool hasLocalMatrix = random->nextBool(); |
333 return GrNonAAFillRectBatch::Create(color, viewMatrix, rect, | 333 return GrNonAAFillRectBatch::Create(color, viewMatrix, rect, |
334 hasLocalRect ? &localRect : nullptr, | 334 hasLocalRect ? &localRect : nullptr, |
335 hasLocalMatrix ? &localMatrix : nullptr)
; | 335 hasLocalMatrix ? &localMatrix : nullptr)
; |
336 } | 336 } |
337 | 337 |
338 #endif | 338 #endif |
OLD | NEW |