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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 info.fColor = color; | 104 info.fColor = color; |
105 info.fRect = rect; | 105 info.fRect = rect; |
106 fHasLocalRect = SkToBool(localRect); | 106 fHasLocalRect = SkToBool(localRect); |
107 fHasLocalMatrix = SkToBool(localMatrix); | 107 fHasLocalMatrix = SkToBool(localMatrix); |
108 if (fHasLocalMatrix) { | 108 if (fHasLocalMatrix) { |
109 fLocalMatrix = *localMatrix; | 109 fLocalMatrix = *localMatrix; |
110 } | 110 } |
111 if (fHasLocalRect) { | 111 if (fHasLocalRect) { |
112 info.fLocalRect = *localRect; | 112 info.fLocalRect = *localRect; |
113 } | 113 } |
114 viewMatrix.mapRect(&fBounds, rect); | 114 this->setTransformedBounds(rect, viewMatrix, HasAABloat::kNo, IsZeroArea
::kNo); |
115 } | 115 } |
116 | 116 |
117 const char* name() const override { return "NonAAFillRectPerspectiveBatch";
} | 117 const char* name() const override { return "NonAAFillRectPerspectiveBatch";
} |
118 | 118 |
119 SkString dumpInfo() const override { | 119 SkString dumpInfo() const override { |
120 SkString str; | 120 SkString str; |
121 str.appendf("# batched: %d\n", fRects.count()); | 121 str.appendf("# batched: %d\n", fRects.count()); |
122 for (int i = 0; i < fRects.count(); ++i) { | 122 for (int i = 0; i < fRects.count(); ++i) { |
123 const RectInfo& geo = fRects[0]; | 123 const RectInfo& geo = fRects[0]; |
124 str.appendf("%d: Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B:
%.2f]\n", | 124 str.appendf("%d: Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B:
%.2f]\n", |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 return false; | 204 return false; |
205 } | 205 } |
206 | 206 |
207 // In the event of two batches, one who can tweak, one who cannot, we ju
st fall back to | 207 // In the event of two batches, one who can tweak, one who cannot, we ju
st fall back to |
208 // not tweaking | 208 // not tweaking |
209 if (fOverrides.canTweakAlphaForCoverage() && !that->fOverrides.canTweakA
lphaForCoverage()) { | 209 if (fOverrides.canTweakAlphaForCoverage() && !that->fOverrides.canTweakA
lphaForCoverage()) { |
210 fOverrides = that->fOverrides; | 210 fOverrides = that->fOverrides; |
211 } | 211 } |
212 | 212 |
213 fRects.push_back_n(that->fRects.count(), that->fRects.begin()); | 213 fRects.push_back_n(that->fRects.count(), that->fRects.begin()); |
214 this->joinBounds(that->bounds()); | 214 this->joinBounds(*that); |
215 return true; | 215 return true; |
216 } | 216 } |
217 | 217 |
218 struct RectInfo { | 218 struct RectInfo { |
219 SkRect fRect; | 219 SkRect fRect; |
220 GrColor fColor; | 220 GrColor fColor; |
221 SkRect fLocalRect; | 221 SkRect fLocalRect; |
222 }; | 222 }; |
223 | 223 |
224 GrXPOverridesForBatch fOverrides; | 224 GrXPOverridesForBatch fOverrides; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 hasLocalMatrix = true; | 261 hasLocalMatrix = true; |
262 } | 262 } |
263 | 263 |
264 bool hasLocalRect = random->nextBool(); | 264 bool hasLocalRect = random->nextBool(); |
265 return GrNonAAFillRectBatch::CreateWithPerspective(color, viewMatrix, rect, | 265 return GrNonAAFillRectBatch::CreateWithPerspective(color, viewMatrix, rect, |
266 hasLocalRect ? &localRect
: nullptr, | 266 hasLocalRect ? &localRect
: nullptr, |
267 hasLocalMatrix ? &localMa
trix : nullptr); | 267 hasLocalMatrix ? &localMa
trix : nullptr); |
268 } | 268 } |
269 | 269 |
270 #endif | 270 #endif |
OLD | NEW |