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

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

Issue 1355353002: Create GrDraw and start fast pathing src over rects (Closed) Base URL: https://skia.googlesource.com/skia.git@strokerect2
Patch Set: tweaks Created 5 years, 2 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/GrNonAAFillRectBatch.h ('k') | src/gpu/batches/GrNonAAStrokeRectBatch.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 "GrNonAAFillRectBatch.h" 8 #include "GrNonAAFillRectBatch.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 262
263 bool Append(GrBatch* origBatch, 263 bool Append(GrBatch* origBatch,
264 GrColor color, 264 GrColor color,
265 const SkMatrix& viewMatrix, 265 const SkMatrix& viewMatrix,
266 const SkRect& rect, 266 const SkRect& rect,
267 const SkRect* localRect, 267 const SkRect* localRect,
268 const SkMatrix* localMatrix) { 268 const SkMatrix* localMatrix) {
269 bool usePerspective = viewMatrix.hasPerspective() || 269 bool usePerspective = viewMatrix.hasPerspective() ||
270 (localMatrix && localMatrix->hasPerspective()); 270 (localMatrix && localMatrix->hasPerspective());
271 271
272 if (usePerspective && origBatch->classID() != NonAAFillRectBatchPerspective: :ClassID()) { 272 if (!usePerspective) {
273 return false; 273 if (origBatch->classID() != NonAAFillRectBatchSimple::ClassID()) {
274 } 274 return false;
275 }
275 276
276 if (!usePerspective) {
277 NonAAFillRectBatchSimple* batch = origBatch->cast<NonAAFillRectBatchSimp le>(); 277 NonAAFillRectBatchSimple* batch = origBatch->cast<NonAAFillRectBatchSimp le>();
278 append_to_batch(batch, color, viewMatrix, rect, localRect, localMatrix); 278 append_to_batch(batch, color, viewMatrix, rect, localRect, localMatrix);
279 batch->updateBoundsAfterAppend(); 279 batch->updateBoundsAfterAppend();
280 } else { 280 } else {
281 if (origBatch->classID() != NonAAFillRectBatchPerspective::ClassID()) {
282 return false;
283 }
284
281 NonAAFillRectBatchPerspective* batch = origBatch->cast<NonAAFillRectBatc hPerspective>(); 285 NonAAFillRectBatchPerspective* batch = origBatch->cast<NonAAFillRectBatc hPerspective>();
282 const NonAAFillRectBatchPerspective::Geometry& geo = batch->geoData()->b ack(); 286 const NonAAFillRectBatchPerspective::Geometry& geo = batch->geoData()->b ack();
283 287
284 if (!geo.fViewMatrix.cheapEqualTo(viewMatrix) || 288 if (!geo.fViewMatrix.cheapEqualTo(viewMatrix) ||
285 geo.fHasLocalRect != SkToBool(localRect) || 289 geo.fHasLocalRect != SkToBool(localRect) ||
286 geo.fHasLocalMatrix != SkToBool(localMatrix) || 290 geo.fHasLocalMatrix != SkToBool(localMatrix) ||
287 (geo.fHasLocalMatrix && !geo.fLocalMatrix.cheapEqualTo(*localMatrix) )) { 291 (geo.fHasLocalMatrix && !geo.fLocalMatrix.cheapEqualTo(*localMatrix) )) {
288 return false; 292 return false;
289 } 293 }
290 294
(...skipping 20 matching lines...) Expand all
311 SkMatrix localMatrix = GrTest::TestMatrix(random); 315 SkMatrix localMatrix = GrTest::TestMatrix(random);
312 316
313 bool hasLocalRect = random->nextBool(); 317 bool hasLocalRect = random->nextBool();
314 bool hasLocalMatrix = random->nextBool(); 318 bool hasLocalMatrix = random->nextBool();
315 return GrNonAAFillRectBatch::Create(color, viewMatrix, rect, 319 return GrNonAAFillRectBatch::Create(color, viewMatrix, rect,
316 hasLocalRect ? &localRect : nullptr, 320 hasLocalRect ? &localRect : nullptr,
317 hasLocalMatrix ? &localMatrix : nullptr) ; 321 hasLocalMatrix ? &localMatrix : nullptr) ;
318 } 322 }
319 323
320 #endif 324 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrNonAAFillRectBatch.h ('k') | src/gpu/batches/GrNonAAStrokeRectBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698