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

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

Issue 1353043002: Revert of add a ClassID function to GrBatch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/batches/GrAAStrokeRectBatch.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 /* 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 "GrAALinearizingConvexPathRenderer.h" 9 #include "GrAALinearizingConvexPathRenderer.h"
10 10
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 coverageType = Coverage::kAttribute_Type; 112 coverageType = Coverage::kAttribute_Type;
113 } 113 }
114 Coverage coverage(coverageType); 114 Coverage coverage(coverageType);
115 LocalCoords localCoords(usesLocalCoords ? LocalCoords::kUsePosition_Type : 115 LocalCoords localCoords(usesLocalCoords ? LocalCoords::kUsePosition_Type :
116 LocalCoords::kUnused_Type); 116 LocalCoords::kUnused_Type);
117 return CreateForDeviceSpace(color, coverage, localCoords, viewMatrix); 117 return CreateForDeviceSpace(color, coverage, localCoords, viewMatrix);
118 } 118 }
119 119
120 class AAFlatteningConvexPathBatch : public GrVertexBatch { 120 class AAFlatteningConvexPathBatch : public GrVertexBatch {
121 public: 121 public:
122 DEFINE_BATCH_CLASS_ID
123
124 struct Geometry { 122 struct Geometry {
125 GrColor fColor; 123 GrColor fColor;
126 SkMatrix fViewMatrix; 124 SkMatrix fViewMatrix;
127 SkPath fPath; 125 SkPath fPath;
128 SkScalar fStrokeWidth; 126 SkScalar fStrokeWidth;
129 SkPaint::Join fJoin; 127 SkPaint::Join fJoin;
130 SkScalar fMiterLimit; 128 SkScalar fMiterLimit;
131 }; 129 };
132 130
133 static GrDrawBatch* Create(const Geometry& geometry) { 131 static GrDrawBatch* Create(const Geometry& geometry) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 indexCount += currentIndices; 251 indexCount += currentIndices;
254 } 252 }
255 draw(target, this->pipeline(), vertexCount, vertexStride, vertices, inde xCount, 253 draw(target, this->pipeline(), vertexCount, vertexStride, vertices, inde xCount,
256 indices); 254 indices);
257 sk_free(vertices); 255 sk_free(vertices);
258 sk_free(indices); 256 sk_free(indices);
259 } 257 }
260 258
261 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } 259 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
262 260
263 AAFlatteningConvexPathBatch(const Geometry& geometry) : INHERITED(ClassID()) { 261 AAFlatteningConvexPathBatch(const Geometry& geometry) {
262 this->initClassID<AAFlatteningConvexPathBatch>();
264 fGeoData.push_back(geometry); 263 fGeoData.push_back(geometry);
265 264
266 // compute bounds 265 // compute bounds
267 fBounds = geometry.fPath.getBounds(); 266 fBounds = geometry.fPath.getBounds();
268 geometry.fViewMatrix.mapRect(&fBounds); 267 geometry.fViewMatrix.mapRect(&fBounds);
269 } 268 }
270 269
271 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { 270 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
272 AAFlatteningConvexPathBatch* that = t->cast<AAFlatteningConvexPathBatch> (); 271 AAFlatteningConvexPathBatch* that = t->cast<AAFlatteningConvexPathBatch> ();
273 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi peline(), 272 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi peline(),
(...skipping 28 matching lines...) Expand all
302 GrColor fColor; 301 GrColor fColor;
303 bool fUsesLocalCoords; 302 bool fUsesLocalCoords;
304 bool fColorIgnored; 303 bool fColorIgnored;
305 bool fCoverageIgnored; 304 bool fCoverageIgnored;
306 bool fLinesOnly; 305 bool fLinesOnly;
307 bool fCanTweakAlphaForCoverage; 306 bool fCanTweakAlphaForCoverage;
308 }; 307 };
309 308
310 BatchTracker fBatch; 309 BatchTracker fBatch;
311 SkSTArray<1, Geometry, true> fGeoData; 310 SkSTArray<1, Geometry, true> fGeoData;
312
313 typedef GrVertexBatch INHERITED;
314 }; 311 };
315 312
316 bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) { 313 bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
317 if (args.fPath->isEmpty()) { 314 if (args.fPath->isEmpty()) {
318 return true; 315 return true;
319 } 316 }
320 AAFlatteningConvexPathBatch::Geometry geometry; 317 AAFlatteningConvexPathBatch::Geometry geometry;
321 geometry.fColor = args.fColor; 318 geometry.fColor = args.fColor;
322 geometry.fViewMatrix = *args.fViewMatrix; 319 geometry.fViewMatrix = *args.fViewMatrix;
323 geometry.fPath = *args.fPath; 320 geometry.fPath = *args.fPath;
(...skipping 15 matching lines...) Expand all
339 DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { 336 DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) {
340 AAFlatteningConvexPathBatch::Geometry geometry; 337 AAFlatteningConvexPathBatch::Geometry geometry;
341 geometry.fColor = GrRandomColor(random); 338 geometry.fColor = GrRandomColor(random);
342 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); 339 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random);
343 geometry.fPath = GrTest::TestPathConvex(random); 340 geometry.fPath = GrTest::TestPathConvex(random);
344 341
345 return AAFlatteningConvexPathBatch::Create(geometry); 342 return AAFlatteningConvexPathBatch::Create(geometry);
346 } 343 }
347 344
348 #endif 345 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/batches/GrAAStrokeRectBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698