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

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

Issue 1345393003: 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 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 "GrAADistanceFieldPathRenderer.h" 9 #include "GrAADistanceFieldPathRenderer.h"
10 10
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 return maxDim < 64.f && maxDim * maxScale < 256.f; 104 return maxDim < 64.f && maxDim * maxScale < 256.f;
105 } 105 }
106 106
107 //////////////////////////////////////////////////////////////////////////////// 107 ////////////////////////////////////////////////////////////////////////////////
108 108
109 // padding around path bounds to allow for antialiased pixels 109 // padding around path bounds to allow for antialiased pixels
110 static const SkScalar kAntiAliasPad = 1.0f; 110 static const SkScalar kAntiAliasPad = 1.0f;
111 111
112 class AADistanceFieldPathBatch : public GrVertexBatch { 112 class AADistanceFieldPathBatch : public GrVertexBatch {
113 public: 113 public:
114 DEFINE_BATCH_CLASS_ID
115
116 typedef GrAADistanceFieldPathRenderer::PathData PathData; 114 typedef GrAADistanceFieldPathRenderer::PathData PathData;
117 typedef SkTDynamicHash<PathData, PathData::Key> PathCache; 115 typedef SkTDynamicHash<PathData, PathData::Key> PathCache;
118 typedef GrAADistanceFieldPathRenderer::PathDataList PathDataList; 116 typedef GrAADistanceFieldPathRenderer::PathDataList PathDataList;
119 117
120 struct Geometry { 118 struct Geometry {
121 Geometry(const SkStrokeRec& stroke) : fStroke(stroke) {} 119 Geometry(const SkStrokeRec& stroke) : fStroke(stroke) {}
122 SkPath fPath; 120 SkPath fPath;
123 SkStrokeRec fStroke; 121 SkStrokeRec fStroke;
124 bool fAntiAlias; 122 bool fAntiAlias;
125 PathData* fPathData; 123 PathData* fPathData;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 flushInfo.fInstancesToFlush++; 269 flushInfo.fInstancesToFlush++;
272 } 270 }
273 271
274 this->flush(target, &flushInfo); 272 this->flush(target, &flushInfo);
275 } 273 }
276 274
277 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } 275 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
278 276
279 AADistanceFieldPathBatch(const Geometry& geometry, GrColor color, const SkMa trix& viewMatrix, 277 AADistanceFieldPathBatch(const Geometry& geometry, GrColor color, const SkMa trix& viewMatrix,
280 GrBatchAtlas* atlas, 278 GrBatchAtlas* atlas,
281 PathCache* pathCache, PathDataList* pathList) 279 PathCache* pathCache, PathDataList* pathList) {
282 : INHERITED(ClassID()) { 280 this->initClassID<AADistanceFieldPathBatch>();
283 fBatch.fColor = color; 281 fBatch.fColor = color;
284 fBatch.fViewMatrix = viewMatrix; 282 fBatch.fViewMatrix = viewMatrix;
285 fGeoData.push_back(geometry); 283 fGeoData.push_back(geometry);
286 fGeoData.back().fPathData = nullptr; 284 fGeoData.back().fPathData = nullptr;
287 285
288 fAtlas = atlas; 286 fAtlas = atlas;
289 fPathCache = pathCache; 287 fPathCache = pathCache;
290 fPathList = pathList; 288 fPathList = pathList;
291 289
292 // Compute bounds 290 // Compute bounds
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 bool fUsesLocalCoords; 512 bool fUsesLocalCoords;
515 bool fColorIgnored; 513 bool fColorIgnored;
516 bool fCoverageIgnored; 514 bool fCoverageIgnored;
517 }; 515 };
518 516
519 BatchTracker fBatch; 517 BatchTracker fBatch;
520 SkSTArray<1, Geometry, true> fGeoData; 518 SkSTArray<1, Geometry, true> fGeoData;
521 GrBatchAtlas* fAtlas; 519 GrBatchAtlas* fAtlas;
522 PathCache* fPathCache; 520 PathCache* fPathCache;
523 PathDataList* fPathList; 521 PathDataList* fPathList;
524
525 typedef GrVertexBatch INHERITED;
526 }; 522 };
527 523
528 bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) { 524 bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
529 // we've already bailed on inverse filled paths, so this is safe 525 // we've already bailed on inverse filled paths, so this is safe
530 if (args.fPath->isEmpty()) { 526 if (args.fPath->isEmpty()) {
531 return true; 527 return true;
532 } 528 }
533 529
534 if (!fAtlas) { 530 if (!fAtlas) {
535 fAtlas = args.fResourceProvider->createAtlas(kAlpha_8_GrPixelConfig, 531 fAtlas = args.fResourceProvider->createAtlas(kAlpha_8_GrPixelConfig,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 geometry.fPath = GrTest::TestPath(random); 617 geometry.fPath = GrTest::TestPath(random);
622 geometry.fAntiAlias = random->nextBool(); 618 geometry.fAntiAlias = random->nextBool();
623 619
624 return AADistanceFieldPathBatch::Create(geometry, color, viewMatrix, 620 return AADistanceFieldPathBatch::Create(geometry, color, viewMatrix,
625 gTestStruct.fAtlas, 621 gTestStruct.fAtlas,
626 &gTestStruct.fPathCache, 622 &gTestStruct.fPathCache,
627 &gTestStruct.fPathList); 623 &gTestStruct.fPathList);
628 } 624 }
629 625
630 #endif 626 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrAAConvexPathRenderer.cpp ('k') | src/gpu/batches/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698