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

Side by Side Diff: src/gpu/effects/GrDashingEffect.cpp

Issue 1835283002: Simplify GrDrawBatch uploads and token uage. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 8 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/GrVertexBatch.cpp ('k') | src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp » ('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 2014 Google Inc. 2 * Copyright 2014 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 "GrDashingEffect.h" 8 #include "GrDashingEffect.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 LocalCoords localCoords(this->usesLocalCoords() ? LocalCoords::kUseP osition_Type : 351 LocalCoords localCoords(this->usesLocalCoords() ? LocalCoords::kUseP osition_Type :
352 LocalCoords::kUnus ed_Type); 352 LocalCoords::kUnus ed_Type);
353 gp.reset(CreateForDeviceSpace(color, coverage, localCoords, this->vi ewMatrix())); 353 gp.reset(CreateForDeviceSpace(color, coverage, localCoords, this->vi ewMatrix()));
354 } 354 }
355 355
356 if (!gp) { 356 if (!gp) {
357 SkDebugf("Could not create GrGeometryProcessor\n"); 357 SkDebugf("Could not create GrGeometryProcessor\n");
358 return; 358 return;
359 } 359 }
360 360
361 target->initDraw(gp);
362
363 // useAA here means Edge AA or MSAA 361 // useAA here means Edge AA or MSAA
364 bool useAA = this->aaMode() != kBW_DashAAMode; 362 bool useAA = this->aaMode() != kBW_DashAAMode;
365 bool fullDash = this->fullDash(); 363 bool fullDash = this->fullDash();
366 364
367 // We do two passes over all of the dashes. First we setup the start, e nd, and bounds, 365 // We do two passes over all of the dashes. First we setup the start, e nd, and bounds,
368 // rectangles. We preserve all of this work in the rects / draws arrays below. Then we 366 // rectangles. We preserve all of this work in the rects / draws arrays below. Then we
369 // iterate again over these decomposed dashes to generate vertices 367 // iterate again over these decomposed dashes to generate vertices
370 static const int kNumStackDashes = 128; 368 static const int kNumStackDashes = 128;
371 SkSTArray<kNumStackDashes, SkRect, true> rects; 369 SkSTArray<kNumStackDashes, SkRect, true> rects;
372 SkSTArray<kNumStackDashes, DashDraw, true> draws; 370 SkSTArray<kNumStackDashes, DashDraw, true> draws;
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 } else { 618 } else {
621 SkPoint* verts = reinterpret_cast<SkPoint*>(vertices); 619 SkPoint* verts = reinterpret_cast<SkPoint*>(vertices);
622 SkASSERT(gp->getVertexStride() == sizeof(SkPoint)); 620 SkASSERT(gp->getVertexStride() == sizeof(SkPoint));
623 setup_dashed_rect_pos(rects[rectIndex], curVIdx, geom.fSrcRo tInv, verts); 621 setup_dashed_rect_pos(rects[rectIndex], curVIdx, geom.fSrcRo tInv, verts);
624 } 622 }
625 curVIdx += 4; 623 curVIdx += 4;
626 } 624 }
627 rectIndex++; 625 rectIndex++;
628 } 626 }
629 SkASSERT(0 == (curVIdx % 4) && (curVIdx / 4) == totalRectCount); 627 SkASSERT(0 == (curVIdx % 4) && (curVIdx / 4) == totalRectCount);
630 helper.recordDraw(target); 628 helper.recordDraw(target, gp);
631 } 629 }
632 630
633 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { 631 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
634 DashBatch* that = t->cast<DashBatch>(); 632 DashBatch* that = t->cast<DashBatch>();
635 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi peline(), 633 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi peline(),
636 that->bounds(), caps)) { 634 that->bounds(), caps)) {
637 return false; 635 return false;
638 } 636 }
639 637
640 if (this->aaMode() != that->aaMode()) { 638 if (this->aaMode() != that->aaMode()) {
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 info.fIntervals = intervals; 1296 info.fIntervals = intervals;
1299 info.fCount = 2; 1297 info.fCount = 2;
1300 info.fPhase = phase; 1298 info.fPhase = phase;
1301 SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info); 1299 SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info);
1302 SkASSERT(success); 1300 SkASSERT(success);
1303 1301
1304 return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT); 1302 return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT);
1305 } 1303 }
1306 1304
1307 #endif 1305 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrVertexBatch.cpp ('k') | src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698