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

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

Issue 1139743002: GLProgramsTest 3.0 (Closed) Base URL: https://skia.googlesource.com/skia.git@randbatch11
Patch Set: feedback Created 5 years, 7 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/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrAtlasTextContext.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 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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 void reset() { 623 void reset() {
624 PathDataList::Iter iter; 624 PathDataList::Iter iter;
625 iter.init(fPathList, PathDataList::Iter::kHead_IterStart); 625 iter.init(fPathList, PathDataList::Iter::kHead_IterStart);
626 PathData* pathData; 626 PathData* pathData;
627 while ((pathData = iter.get())) { 627 while ((pathData = iter.get())) {
628 iter.next(); 628 iter.next();
629 fPathList.remove(pathData); 629 fPathList.remove(pathData);
630 SkDELETE(pathData); 630 SkDELETE(pathData);
631 } 631 }
632 SkDELETE(fAtlas); 632 SkDELETE(fAtlas);
633 fPathCache.reset();
633 } 634 }
634 635
635 static void HandleEviction(GrBatchAtlas::AtlasID id, void* pr) { 636 static void HandleEviction(GrBatchAtlas::AtlasID id, void* pr) {
636 PathTestStruct* dfpr = (PathTestStruct*)pr; 637 PathTestStruct* dfpr = (PathTestStruct*)pr;
637 // remove any paths that use this plot 638 // remove any paths that use this plot
638 PathDataList::Iter iter; 639 PathDataList::Iter iter;
639 iter.init(dfpr->fPathList, PathDataList::Iter::kHead_IterStart); 640 iter.init(dfpr->fPathList, PathDataList::Iter::kHead_IterStart);
640 PathData* pathData; 641 PathData* pathData;
641 while ((pathData = iter.get())) { 642 while ((pathData = iter.get())) {
642 iter.next(); 643 iter.next();
643 if (id == pathData->fID) { 644 if (id == pathData->fID) {
644 dfpr->fPathCache.remove(pathData->fKey); 645 dfpr->fPathCache.remove(pathData->fKey);
645 dfpr->fPathList.remove(pathData); 646 dfpr->fPathList.remove(pathData);
646 SkDELETE(pathData); 647 SkDELETE(pathData);
647 } 648 }
648 } 649 }
649 } 650 }
650 651
651 uint32_t fContextID; 652 uint32_t fContextID;
652 GrBatchAtlas* fAtlas; 653 GrBatchAtlas* fAtlas;
653 PathCache fPathCache; 654 PathCache fPathCache;
654 PathDataList fPathList; 655 PathDataList fPathList;
655 }; 656 };
656 657
657 BATCH_TEST_DEFINE(AADistanceFieldPathRenderer) { 658 BATCH_TEST_DEFINE(AADistanceFieldPathBatch) {
658 static PathTestStruct gTestStruct; 659 static PathTestStruct gTestStruct;
659 660
660 if (context->uniqueID() != gTestStruct.fContextID) { 661 if (context->uniqueID() != gTestStruct.fContextID) {
661 gTestStruct.fContextID = context->uniqueID(); 662 gTestStruct.fContextID = context->uniqueID();
662 gTestStruct.reset(); 663 gTestStruct.reset();
663 gTestStruct.fAtlas = create_atlas(context, &PathTestStruct::HandleEvicti on, 664 gTestStruct.fAtlas = create_atlas(context, &PathTestStruct::HandleEvicti on,
664 (void*)&gTestStruct); 665 (void*)&gTestStruct);
665 } 666 }
666 667
667 SkMatrix viewMatrix = GrTest::TestMatrix(random); 668 SkMatrix viewMatrix = GrTest::TestMatrix(random);
668 GrColor color = GrRandomColor(random); 669 GrColor color = GrRandomColor(random);
669 670
670 AADistanceFieldPathBatch::Geometry geometry(GrTest::TestStrokeRec(random)); 671 AADistanceFieldPathBatch::Geometry geometry(GrTest::TestStrokeRec(random));
671 geometry.fPath = GrTest::TestPath(random); 672 geometry.fPath = GrTest::TestPath(random);
672 geometry.fAntiAlias = random->nextBool(); 673 geometry.fAntiAlias = random->nextBool();
673 674
674 return AADistanceFieldPathBatch::Create(geometry, color, viewMatrix, 675 return AADistanceFieldPathBatch::Create(geometry, color, viewMatrix,
675 gTestStruct.fAtlas, 676 gTestStruct.fAtlas,
676 &gTestStruct.fPathCache, 677 &gTestStruct.fPathCache,
677 &gTestStruct.fPathList); 678 &gTestStruct.fPathList);
678 } 679 }
679 680
680 #endif 681 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrAtlasTextContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698