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 "GrRectBatch.h" | 8 #include "GrRectBatch.h" |
9 | 9 |
10 #include "GrBatch.h" | 10 #include "GrBatch.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 The vertex attrib order is always pos, color, [local coords]. | 25 The vertex attrib order is always pos, color, [local coords]. |
26 */ | 26 */ |
27 static const GrGeometryProcessor* create_rect_gp(bool hasExplicitLocalCoords, | 27 static const GrGeometryProcessor* create_rect_gp(bool hasExplicitLocalCoords, |
28 GrColor color, | 28 GrColor color, |
29 const SkMatrix* localMatrix) { | 29 const SkMatrix* localMatrix) { |
30 uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType | | 30 uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType | |
31 GrDefaultGeoProcFactory::kColor_GPType; | 31 GrDefaultGeoProcFactory::kColor_GPType; |
32 flags |= hasExplicitLocalCoords ? GrDefaultGeoProcFactory::kLocalCoord_GPTyp
e : 0; | 32 flags |= hasExplicitLocalCoords ? GrDefaultGeoProcFactory::kLocalCoord_GPTyp
e : 0; |
33 if (localMatrix) { | 33 if (localMatrix) { |
34 return GrDefaultGeoProcFactory::Create(flags, color, SkMatrix::I(), *loc
alMatrix, | 34 return GrDefaultGeoProcFactory::Create(flags, color, SkMatrix::I(), *loc
alMatrix); |
35 GrColorIsOpaque(color)); | |
36 } else { | 35 } else { |
37 return GrDefaultGeoProcFactory::Create(flags, color, SkMatrix::I(), SkMa
trix::I(), | 36 return GrDefaultGeoProcFactory::Create(flags, color, SkMatrix::I(), SkMa
trix::I()); |
38 GrColorIsOpaque(color)); | |
39 } | 37 } |
40 } | 38 } |
41 | 39 |
42 class RectBatch : public GrBatch { | 40 class RectBatch : public GrBatch { |
43 public: | 41 public: |
44 struct Geometry { | 42 struct Geometry { |
45 SkMatrix fViewMatrix; | 43 SkMatrix fViewMatrix; |
46 SkRect fRect; | 44 SkRect fRect; |
47 SkRect fLocalRect; | 45 SkRect fLocalRect; |
48 SkMatrix fLocalMatrix; | 46 SkMatrix fLocalMatrix; |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 if (hasLocalMatrix) { | 273 if (hasLocalMatrix) { |
276 localMatrix = GrTest::TestMatrix(random); | 274 localMatrix = GrTest::TestMatrix(random); |
277 } | 275 } |
278 | 276 |
279 return GrRectBatch::Create(color, viewMatrix, rect, | 277 return GrRectBatch::Create(color, viewMatrix, rect, |
280 hasLocalRect ? &localRect : NULL, | 278 hasLocalRect ? &localRect : NULL, |
281 hasLocalMatrix ? &localMatrix : NULL); | 279 hasLocalMatrix ? &localMatrix : NULL); |
282 } | 280 } |
283 | 281 |
284 #endif | 282 #endif |
OLD | NEW |