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

Side by Side Diff: src/gpu/batches/GrDrawAtlasBatch.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
« no previous file with comments | « src/gpu/batches/GrDiscardBatch.h ('k') | src/gpu/batches/GrDrawPathBatch.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "GrDrawAtlasBatch.h" 8 #include "GrDrawAtlasBatch.h"
9 #include "GrBatchFlushState.h" 9 #include "GrBatchFlushState.h"
10 #include "GrBatchTest.h" 10 #include "GrBatchTest.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 bounds.growToInclude(quad[2].fX, quad[2].fY); 152 bounds.growToInclude(quad[2].fX, quad[2].fY);
153 currVertex += vertexStride; 153 currVertex += vertexStride;
154 154
155 *(reinterpret_cast<SkPoint*>(currVertex)) = quad[3]; 155 *(reinterpret_cast<SkPoint*>(currVertex)) = quad[3];
156 *(reinterpret_cast<SkPoint*>(currVertex+texOffset)) = SkPoint::Make(curr Rect.fLeft, 156 *(reinterpret_cast<SkPoint*>(currVertex+texOffset)) = SkPoint::Make(curr Rect.fLeft,
157 curr Rect.fBottom); 157 curr Rect.fBottom);
158 bounds.growToInclude(quad[3].fX, quad[3].fY); 158 bounds.growToInclude(quad[3].fX, quad[3].fY);
159 currVertex += vertexStride; 159 currVertex += vertexStride;
160 } 160 }
161 161
162 viewMatrix.mapRect(&bounds); 162 this->setTransformedBounds(bounds, viewMatrix, HasAABloat::kNo, IsZeroArea:: kNo);
163 // Outset for a half pixel in each direction to account for snapping in non- AA case
164 bounds.outset(0.5f, 0.5f);
165 this->setBounds(bounds);
166 } 163 }
167 164
168 bool GrDrawAtlasBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) { 165 bool GrDrawAtlasBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) {
169 GrDrawAtlasBatch* that = t->cast<GrDrawAtlasBatch>(); 166 GrDrawAtlasBatch* that = t->cast<GrDrawAtlasBatch>();
170 167
171 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeli ne(), 168 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeli ne(),
172 that->bounds(), caps)) { 169 that->bounds(), caps)) {
173 return false; 170 return false;
174 } 171 }
175 172
176 // We currently use a uniform viewmatrix for this batch 173 // We currently use a uniform viewmatrix for this batch
177 if (!this->viewMatrix().cheapEqualTo(that->viewMatrix())) { 174 if (!this->viewMatrix().cheapEqualTo(that->viewMatrix())) {
178 return false; 175 return false;
179 } 176 }
180 177
181 if (this->hasColors() != that->hasColors()) { 178 if (this->hasColors() != that->hasColors()) {
182 return false; 179 return false;
183 } 180 }
184 181
185 if (!this->hasColors() && this->color() != that->color()) { 182 if (!this->hasColors() && this->color() != that->color()) {
186 return false; 183 return false;
187 } 184 }
188 185
189 if (this->color() != that->color()) { 186 if (this->color() != that->color()) {
190 fColor = GrColor_ILLEGAL; 187 fColor = GrColor_ILLEGAL;
191 } 188 }
192 fGeoData.push_back_n(that->fGeoData.count(), that->fGeoData.begin()); 189 fGeoData.push_back_n(that->fGeoData.count(), that->fGeoData.begin());
193 fQuadCount += that->quadCount(); 190 fQuadCount += that->quadCount();
194 191
195 this->joinBounds(that->bounds()); 192 this->joinBounds(*that);
196 return true; 193 return true;
197 } 194 }
198 195
199 #ifdef GR_TEST_UTILS 196 #ifdef GR_TEST_UTILS
200 197
201 static SkRSXform random_xform(SkRandom* random) { 198 static SkRSXform random_xform(SkRandom* random) {
202 static const SkScalar kMinExtent = -100.f; 199 static const SkScalar kMinExtent = -100.f;
203 static const SkScalar kMaxExtent = 100.f; 200 static const SkScalar kMaxExtent = 100.f;
204 static const SkScalar kMinScale = 0.1f; 201 static const SkScalar kMinScale = 0.1f;
205 static const SkScalar kMaxScale = 100.f; 202 static const SkScalar kMaxScale = 100.f;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 &colors, hasColors); 253 &colors, hasColors);
257 254
258 SkMatrix viewMatrix = GrTest::TestMatrix(random); 255 SkMatrix viewMatrix = GrTest::TestMatrix(random);
259 256
260 GrColor color = GrRandomColor(random); 257 GrColor color = GrRandomColor(random);
261 return new GrDrawAtlasBatch(color, viewMatrix, spriteCount, xforms.begin(), texRects.begin(), 258 return new GrDrawAtlasBatch(color, viewMatrix, spriteCount, xforms.begin(), texRects.begin(),
262 hasColors ? colors.begin() : nullptr); 259 hasColors ? colors.begin() : nullptr);
263 } 260 }
264 261
265 #endif 262 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrDiscardBatch.h ('k') | src/gpu/batches/GrDrawPathBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698