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" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 info.fRect = rect; | 84 info.fRect = rect; |
85 if (localRect && localMatrix) { | 85 if (localRect && localMatrix) { |
86 info.fLocalQuad.setFromMappedRect(*localRect, *localMatrix); | 86 info.fLocalQuad.setFromMappedRect(*localRect, *localMatrix); |
87 } else if (localRect) { | 87 } else if (localRect) { |
88 info.fLocalQuad.set(*localRect); | 88 info.fLocalQuad.set(*localRect); |
89 } else if (localMatrix) { | 89 } else if (localMatrix) { |
90 info.fLocalQuad.setFromMappedRect(rect, *localMatrix); | 90 info.fLocalQuad.setFromMappedRect(rect, *localMatrix); |
91 } else { | 91 } else { |
92 info.fLocalQuad.set(rect); | 92 info.fLocalQuad.set(rect); |
93 } | 93 } |
94 viewMatrix.mapRect(&fBounds, fRects[0].fRect); | 94 this->setTransformedBounds(fRects[0].fRect, viewMatrix, HasAABloat::kNo,
IsZeroArea::kNo); |
95 } | 95 } |
96 | 96 |
97 const char* name() const override { return "NonAAFillRectBatch"; } | 97 const char* name() const override { return "NonAAFillRectBatch"; } |
98 | 98 |
99 SkString dumpInfo() const override { | 99 SkString dumpInfo() const override { |
100 SkString str; | 100 SkString str; |
101 str.appendf("# batched: %d\n", fRects.count()); | 101 str.appendf("# batched: %d\n", fRects.count()); |
102 for (int i = 0; i < fRects.count(); ++i) { | 102 for (int i = 0; i < fRects.count(); ++i) { |
103 const RectInfo& info = fRects[i]; | 103 const RectInfo& info = fRects[i]; |
104 str.appendf("%d: Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B:
%.2f]\n", | 104 str.appendf("%d: Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B:
%.2f]\n", |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 return false; | 163 return false; |
164 } | 164 } |
165 | 165 |
166 // In the event of two batches, one who can tweak, one who cannot, we ju
st fall back to | 166 // In the event of two batches, one who can tweak, one who cannot, we ju
st fall back to |
167 // not tweaking | 167 // not tweaking |
168 if (fOverrides.canTweakAlphaForCoverage() && !that->fOverrides.canTweakA
lphaForCoverage()) { | 168 if (fOverrides.canTweakAlphaForCoverage() && !that->fOverrides.canTweakA
lphaForCoverage()) { |
169 fOverrides = that->fOverrides; | 169 fOverrides = that->fOverrides; |
170 } | 170 } |
171 | 171 |
172 fRects.push_back_n(that->fRects.count(), that->fRects.begin()); | 172 fRects.push_back_n(that->fRects.count(), that->fRects.begin()); |
173 this->joinBounds(that->bounds()); | 173 this->joinBounds(*that); |
174 return true; | 174 return true; |
175 } | 175 } |
176 | 176 |
177 struct RectInfo { | 177 struct RectInfo { |
178 GrColor fColor; | 178 GrColor fColor; |
179 SkMatrix fViewMatrix; | 179 SkMatrix fViewMatrix; |
180 SkRect fRect; | 180 SkRect fRect; |
181 GrQuad fLocalQuad; | 181 GrQuad fLocalQuad; |
182 }; | 182 }; |
183 | 183 |
(...skipping 29 matching lines...) Expand all Loading... |
213 SkMatrix localMatrix = GrTest::TestMatrix(random); | 213 SkMatrix localMatrix = GrTest::TestMatrix(random); |
214 | 214 |
215 bool hasLocalRect = random->nextBool(); | 215 bool hasLocalRect = random->nextBool(); |
216 bool hasLocalMatrix = random->nextBool(); | 216 bool hasLocalMatrix = random->nextBool(); |
217 return GrNonAAFillRectBatch::Create(color, viewMatrix, rect, | 217 return GrNonAAFillRectBatch::Create(color, viewMatrix, rect, |
218 hasLocalRect ? &localRect : nullptr, | 218 hasLocalRect ? &localRect : nullptr, |
219 hasLocalMatrix ? &localMatrix : nullptr)
; | 219 hasLocalMatrix ? &localMatrix : nullptr)
; |
220 } | 220 } |
221 | 221 |
222 #endif | 222 #endif |
OLD | NEW |