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

Side by Side Diff: src/gpu/batches/GrAAStrokeRectBatch.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
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 "GrAAStrokeRectBatch.h" 8 #include "GrAAStrokeRectBatch.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 SkAutoTUnref<const GrGeometryProcessor> gp(create_stroke_rect_gp(canTweakAlp haForCoverage, 186 SkAutoTUnref<const GrGeometryProcessor> gp(create_stroke_rect_gp(canTweakAlp haForCoverage,
187 this->viewM atrix(), 187 this->viewM atrix(),
188 this->usesL ocalCoords(), 188 this->usesL ocalCoords(),
189 this->cover ageIgnored())); 189 this->cover ageIgnored()));
190 if (!gp) { 190 if (!gp) {
191 SkDebugf("Couldn't create GrGeometryProcessor\n"); 191 SkDebugf("Couldn't create GrGeometryProcessor\n");
192 return; 192 return;
193 } 193 }
194 194
195 target->initDraw(gp);
196
197 size_t vertexStride = gp->getVertexStride(); 195 size_t vertexStride = gp->getVertexStride();
198 196
199 SkASSERT(canTweakAlphaForCoverage ? 197 SkASSERT(canTweakAlphaForCoverage ?
200 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorAttr) : 198 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorAttr) :
201 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorCovera geAttr)); 199 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorCovera geAttr));
202 int innerVertexNum = 4; 200 int innerVertexNum = 4;
203 int outerVertexNum = this->miterStroke() ? 4 : 8; 201 int outerVertexNum = this->miterStroke() ? 4 : 8;
204 int verticesPerInstance = (outerVertexNum + innerVertexNum) * 2; 202 int verticesPerInstance = (outerVertexNum + innerVertexNum) * 2;
205 int indicesPerInstance = this->miterStroke() ? kMiterIndexCnt : kBevelIndexC nt; 203 int indicesPerInstance = this->miterStroke() ? kMiterIndexCnt : kBevelIndexC nt;
206 int instanceCount = fGeoData.count(); 204 int instanceCount = fGeoData.count();
(...skipping 17 matching lines...) Expand all
224 outerVertexNum, 222 outerVertexNum,
225 innerVertexNum, 223 innerVertexNum,
226 args.fColor, 224 args.fColor,
227 args.fDevOutside, 225 args.fDevOutside,
228 args.fDevOutsideAssist, 226 args.fDevOutsideAssist,
229 args.fDevInside, 227 args.fDevInside,
230 fMiterStroke, 228 fMiterStroke,
231 args.fDegenerate, 229 args.fDegenerate,
232 canTweakAlphaForCoverage); 230 canTweakAlphaForCoverage);
233 } 231 }
234 helper.recordDraw(target); 232 helper.recordDraw(target, gp);
235 } 233 }
236 234
237 const GrBuffer* AAStrokeRectBatch::GetIndexBuffer(GrResourceProvider* resourcePr ovider, 235 const GrBuffer* AAStrokeRectBatch::GetIndexBuffer(GrResourceProvider* resourcePr ovider,
238 bool miterStroke) { 236 bool miterStroke) {
239 237
240 if (miterStroke) { 238 if (miterStroke) {
241 static const uint16_t gMiterIndices[] = { 239 static const uint16_t gMiterIndices[] = {
242 0 + 0, 1 + 0, 5 + 0, 5 + 0, 4 + 0, 0 + 0, 240 0 + 0, 1 + 0, 5 + 0, 5 + 0, 4 + 0, 0 + 0,
243 1 + 0, 2 + 0, 6 + 0, 6 + 0, 5 + 0, 1 + 0, 241 1 + 0, 2 + 0, 6 + 0, 6 + 0, 5 + 0, 1 + 0,
244 2 + 0, 3 + 0, 7 + 0, 7 + 0, 6 + 0, 2 + 0, 242 2 + 0, 3 + 0, 7 + 0, 7 + 0, 6 + 0, 2 + 0,
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 SkRect inside = outside; 652 SkRect inside = outside;
655 inside.inset(strokeWidth, strokeWidth); 653 inside.inset(strokeWidth, strokeWidth);
656 654
657 GrColor color = GrRandomColor(random); 655 GrColor color = GrRandomColor(random);
658 656
659 return GrAAStrokeRectBatch::Create(color, GrTest::TestMatrix(random), outsid e, outsideAssist, 657 return GrAAStrokeRectBatch::Create(color, GrTest::TestMatrix(random), outsid e, outsideAssist,
660 inside, miterStroke, inside.isFinite() && inside.isEmpty()); 658 inside, miterStroke, inside.isFinite() && inside.isEmpty());
661 } 659 }
662 660
663 #endif 661 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp ('k') | src/gpu/batches/GrAtlasTextBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698