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 "GrAAFillRectBatch.h" | 8 #include "GrAAFillRectBatch.h" |
9 | 9 |
10 #include "GrBatch.h" | 10 #include "GrBatch.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 gAAFillRectIndexBufferKey); | 168 gAAFillRectIndexBufferKey); |
169 } | 169 } |
170 | 170 |
171 GrColor color() const { return fBatch.fColor; } | 171 GrColor color() const { return fBatch.fColor; } |
172 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } | 172 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } |
173 bool canTweakAlphaForCoverage() const { return fBatch.fCanTweakAlphaForCover
age; } | 173 bool canTweakAlphaForCoverage() const { return fBatch.fCanTweakAlphaForCover
age; } |
174 bool colorIgnored() const { return fBatch.fColorIgnored; } | 174 bool colorIgnored() const { return fBatch.fColorIgnored; } |
175 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } | 175 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } |
176 bool coverageIgnored() const { return fBatch.fCoverageIgnored; } | 176 bool coverageIgnored() const { return fBatch.fCoverageIgnored; } |
177 | 177 |
178 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) { | 178 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
179 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipel
ine(), t->bounds(), | 179 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipel
ine(), t->bounds(), |
180 caps)) { | 180 caps)) { |
181 return false; | 181 return false; |
182 } | 182 } |
183 | 183 |
184 AAFillRectBatch* that = t->cast<AAFillRectBatch>(); | 184 AAFillRectBatch* that = t->cast<AAFillRectBatch>(); |
185 | 185 |
186 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); | 186 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); |
187 // We apply the viewmatrix to the rect points on the cpu. However, if t
he pipeline uses | 187 // We apply the viewmatrix to the rect points on the cpu. However, if t
he pipeline uses |
188 // local coords then we won't be able to batch. We could actually uploa
d the viewmatrix | 188 // local coords then we won't be able to batch. We could actually uploa
d the viewmatrix |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 | 330 |
331 BATCH_TEST_DEFINE(AAFillRectBatch) { | 331 BATCH_TEST_DEFINE(AAFillRectBatch) { |
332 GrColor color = GrRandomColor(random); | 332 GrColor color = GrRandomColor(random); |
333 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 333 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
334 SkRect rect = GrTest::TestRect(random); | 334 SkRect rect = GrTest::TestRect(random); |
335 SkRect devRect = GrTest::TestRect(random); | 335 SkRect devRect = GrTest::TestRect(random); |
336 return AAFillRectBatch::Create(color, viewMatrix, rect, devRect); | 336 return AAFillRectBatch::Create(color, viewMatrix, rect, devRect); |
337 } | 337 } |
338 | 338 |
339 #endif | 339 #endif |
OLD | NEW |