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

Side by Side Diff: src/gpu/GrDrawContext.cpp

Issue 1264283004: Revert of Use new API everywhere for GrDefaultGeoProcFactory (Closed) Base URL: https://skia.googlesource.com/skia.git@lccleanup2
Patch Set: Created 5 years, 4 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/GrDefaultPathRenderer.cpp ('k') | src/gpu/GrRectBatch.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 /* 2 /*
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrAARectRenderer.h" 9 #include "GrAARectRenderer.h"
10 #include "GrAtlasTextContext.h" 10 #include "GrAtlasTextContext.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 init.getOverrideColorIfSet(&fGeoData[0].fColor); 281 init.getOverrideColorIfSet(&fGeoData[0].fColor);
282 282
283 // setup batch properties 283 // setup batch properties
284 fBatch.fColorIgnored = !init.readsColor(); 284 fBatch.fColorIgnored = !init.readsColor();
285 fBatch.fColor = fGeoData[0].fColor; 285 fBatch.fColor = fGeoData[0].fColor;
286 fBatch.fUsesLocalCoords = init.readsLocalCoords(); 286 fBatch.fUsesLocalCoords = init.readsLocalCoords();
287 fBatch.fCoverageIgnored = !init.readsCoverage(); 287 fBatch.fCoverageIgnored = !init.readsCoverage();
288 } 288 }
289 289
290 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override { 290 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override {
291 SkAutoTUnref<const GrGeometryProcessor> gp; 291 SkAutoTUnref<const GrGeometryProcessor> gp(
292 { 292 GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPositi on_GPType,
293 using namespace GrDefaultGeoProcFactory; 293 this->color(),
294 Color color(this->color()); 294 this->usesLocalCoords(),
295 Coverage coverage(this->coverageIgnored() ? Coverage::kSolid_Type : 295 this->coverageIgnored(),
296 Coverage::kNone_Type); 296 this->viewMatrix(),
297 LocalCoords localCoords(this->usesLocalCoords() ? LocalCoords::kUseP osition_Type : 297 SkMatrix::I()));
298 LocalCoords::kUnus ed_Type);
299 gp.reset(GrDefaultGeoProcFactory::Create(color, coverage, localCoord s,
300 this->viewMatrix()));
301 }
302 298
303 batchTarget->initDraw(gp, pipeline); 299 batchTarget->initDraw(gp, pipeline);
304 300
305 size_t vertexStride = gp->getVertexStride(); 301 size_t vertexStride = gp->getVertexStride();
306 302
307 SkASSERT(vertexStride == sizeof(GrDefaultGeoProcFactory::PositionAttr)); 303 SkASSERT(vertexStride == sizeof(GrDefaultGeoProcFactory::PositionAttr));
308 304
309 Geometry& args = fGeoData[0]; 305 Geometry& args = fGeoData[0];
310 306
311 int vertexCount = kVertsPerHairlineRect; 307 int vertexCount = kVertsPerHairlineRect;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 localMatrix); 553 localMatrix);
558 } 554 }
559 555
560 static const GrGeometryProcessor* set_vertex_attributes(bool hasLocalCoords, 556 static const GrGeometryProcessor* set_vertex_attributes(bool hasLocalCoords,
561 bool hasColors, 557 bool hasColors,
562 int* colorOffset, 558 int* colorOffset,
563 int* texOffset, 559 int* texOffset,
564 GrColor color, 560 GrColor color,
565 const SkMatrix& viewMatr ix, 561 const SkMatrix& viewMatr ix,
566 bool coverageIgnored) { 562 bool coverageIgnored) {
567 using namespace GrDefaultGeoProcFactory;
568 *texOffset = -1; 563 *texOffset = -1;
569 *colorOffset = -1; 564 *colorOffset = -1;
570 Color gpColor(color); 565 uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType;
571 if (hasColors) {
572 gpColor.fType = Color::kAttribute_Type;
573 }
574
575 Coverage coverage(coverageIgnored ? Coverage::kNone_Type : Coverage::kSolid_ Type);
576 LocalCoords localCoords(hasLocalCoords ? LocalCoords::kHasExplicit_Type :
577 LocalCoords::kUsePosition_Type);
578 if (hasLocalCoords && hasColors) { 566 if (hasLocalCoords && hasColors) {
579 *colorOffset = sizeof(SkPoint); 567 *colorOffset = sizeof(SkPoint);
580 *texOffset = sizeof(SkPoint) + sizeof(GrColor); 568 *texOffset = sizeof(SkPoint) + sizeof(GrColor);
569 flags |= GrDefaultGeoProcFactory::kColor_GPType |
570 GrDefaultGeoProcFactory::kLocalCoord_GPType;
581 } else if (hasLocalCoords) { 571 } else if (hasLocalCoords) {
582 *texOffset = sizeof(SkPoint); 572 *texOffset = sizeof(SkPoint);
573 flags |= GrDefaultGeoProcFactory::kLocalCoord_GPType;
583 } else if (hasColors) { 574 } else if (hasColors) {
584 *colorOffset = sizeof(SkPoint); 575 *colorOffset = sizeof(SkPoint);
576 flags |= GrDefaultGeoProcFactory::kColor_GPType;
585 } 577 }
586 return GrDefaultGeoProcFactory::Create(gpColor, coverage, localCoords, viewM atrix); 578 return GrDefaultGeoProcFactory::Create(flags, color, hasLocalCoords, coverag eIgnored,
579 viewMatrix, SkMatrix::I());
587 } 580 }
588 581
589 class DrawVerticesBatch : public GrBatch { 582 class DrawVerticesBatch : public GrBatch {
590 public: 583 public:
591 struct Geometry { 584 struct Geometry {
592 GrColor fColor; 585 GrColor fColor;
593 SkTDArray<SkPoint> fPositions; 586 SkTDArray<SkPoint> fPositions;
594 SkTDArray<uint16_t> fIndices; 587 SkTDArray<uint16_t> fIndices;
595 SkTDArray<GrColor> fColors; 588 SkTDArray<GrColor> fColors;
596 SkTDArray<SkPoint> fLocalCoords; 589 SkTDArray<SkPoint> fLocalCoords;
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 return DrawVerticesBatch::Create(geometry, type, viewMatrix, 1327 return DrawVerticesBatch::Create(geometry, type, viewMatrix,
1335 positions.begin(), vertexCount, 1328 positions.begin(), vertexCount,
1336 indices.begin(), hasIndices ? vertexCount : 0, 1329 indices.begin(), hasIndices ? vertexCount : 0,
1337 colors.begin(), 1330 colors.begin(),
1338 texCoords.begin(), 1331 texCoords.begin(),
1339 bounds); 1332 bounds);
1340 } 1333 }
1341 1334
1342 #endif 1335 #endif
1343 1336
OLDNEW
« no previous file with comments | « src/gpu/GrDefaultPathRenderer.cpp ('k') | src/gpu/GrRectBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698