Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: src/gpu/batches/GrAAFillRectBatch.cpp

Issue 2127673002: Consolidate handling of infinitely thin primitives and aa bloat handing WRT batch bounds (Closed) Base URL: https://skia.googlesource.com/skia.git@AAStrokeRect
Patch Set: update for instanced rendering Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 const SkRect& rect, 166 const SkRect& rect,
167 const SkRect& devRect, 167 const SkRect& devRect,
168 const SkMatrix* localMatrix) : INHERITED(ClassID()) { 168 const SkMatrix* localMatrix) : INHERITED(ClassID()) {
169 if (localMatrix) { 169 if (localMatrix) {
170 void* mem = fRectData.push_back_n(sizeof(RectWithLocalMatrixInfo)); 170 void* mem = fRectData.push_back_n(sizeof(RectWithLocalMatrixInfo));
171 new (mem) RectWithLocalMatrixInfo(color, viewMatrix, rect, devRect, *localMatrix); 171 new (mem) RectWithLocalMatrixInfo(color, viewMatrix, rect, devRect, *localMatrix);
172 } else { 172 } else {
173 void* mem = fRectData.push_back_n(sizeof(RectInfo)); 173 void* mem = fRectData.push_back_n(sizeof(RectInfo));
174 new (mem) RectInfo(color, viewMatrix, rect, devRect); 174 new (mem) RectInfo(color, viewMatrix, rect, devRect);
175 } 175 }
176 fBounds = devRect; 176 IsZeroArea zeroArea = (!rect.width() || !rect.height()) ? IsZeroArea::kY es
177 : IsZeroArea::kN o;
178 this->setBounds(devRect, HasAABloat::kYes, zeroArea);
177 fRectCnt = 1; 179 fRectCnt = 1;
178 } 180 }
179 181
180 const char* name() const override { return "AAFillRectBatch"; } 182 const char* name() const override { return "AAFillRectBatch"; }
181 183
182 SkString dumpInfo() const override { 184 SkString dumpInfo() const override {
183 SkString str; 185 SkString str;
184 str.appendf("# batched: %d\n", fRectCnt); 186 str.appendf("# batched: %d\n", fRectCnt);
185 const RectInfo* info = this->first(); 187 const RectInfo* info = this->first();
186 for (int i = 0; i < fRectCnt; ++i) { 188 for (int i = 0; i < fRectCnt; ++i) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 } 273 }
272 274
273 // In the event of two batches, one who can tweak, one who cannot, we ju st fall back to 275 // In the event of two batches, one who can tweak, one who cannot, we ju st fall back to
274 // not tweaking 276 // not tweaking
275 if (fOverrides.canTweakAlphaForCoverage() && !that->fOverrides.canTweakA lphaForCoverage()) { 277 if (fOverrides.canTweakAlphaForCoverage() && !that->fOverrides.canTweakA lphaForCoverage()) {
276 fOverrides = that->fOverrides; 278 fOverrides = that->fOverrides;
277 } 279 }
278 280
279 fRectData.push_back_n(that->fRectData.count(), that->fRectData.begin()); 281 fRectData.push_back_n(that->fRectData.count(), that->fRectData.begin());
280 fRectCnt += that->fRectCnt; 282 fRectCnt += that->fRectCnt;
281 this->joinBounds(that->bounds()); 283 this->joinBounds(*that);
282 return true; 284 return true;
283 } 285 }
284 286
285 struct RectInfo { 287 struct RectInfo {
286 public: 288 public:
287 RectInfo(GrColor color, const SkMatrix& viewMatrix, const SkRect& rect, 289 RectInfo(GrColor color, const SkMatrix& viewMatrix, const SkRect& rect,
288 const SkRect& devRect) 290 const SkRect& devRect)
289 : RectInfo(color, viewMatrix, rect, devRect, HasLocalMatrix::kNo) {} 291 : RectInfo(color, viewMatrix, rect, devRect, HasLocalMatrix::kNo) {}
290 bool hasLocalMatrix() const { return HasLocalMatrix::kYes == fHasLocalMa trix; } 292 bool hasLocalMatrix() const { return HasLocalMatrix::kYes == fHasLocalMa trix; }
291 GrColor color() const { return fColor; } 293 GrColor color() const { return fColor; }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 DRAW_BATCH_TEST_DEFINE(AAFillRectBatchLocalMatrix) { 399 DRAW_BATCH_TEST_DEFINE(AAFillRectBatchLocalMatrix) {
398 GrColor color = GrRandomColor(random); 400 GrColor color = GrRandomColor(random);
399 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); 401 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random);
400 SkMatrix localMatrix = GrTest::TestMatrix(random); 402 SkMatrix localMatrix = GrTest::TestMatrix(random);
401 SkRect rect = GrTest::TestRect(random); 403 SkRect rect = GrTest::TestRect(random);
402 SkRect devRect = GrTest::TestRect(random); 404 SkRect devRect = GrTest::TestRect(random);
403 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRe ct); 405 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRe ct);
404 } 406 }
405 407
406 #endif 408 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrAADistanceFieldPathRenderer.cpp ('k') | src/gpu/batches/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698