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

Side by Side Diff: tests/GrShapeTest.cpp

Issue 1954123002: Fix issue where GrStyle::applyToPath exited before applying stroke (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix comments Created 4 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/GrStyle.cpp ('k') | no next file » | 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 * Copyright 2016 Google Inc. 2 * Copyright 2016 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 <initializer_list> 8 #include <initializer_list>
9 #include <functional> 9 #include <functional>
10 #include "Test.h" 10 #include "Test.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 fAppliedPEThenStroke.asPath(&a); 81 fAppliedPEThenStroke.asPath(&a);
82 fAppliedFull.asPath(&b); 82 fAppliedFull.asPath(&b);
83 REPORTER_ASSERT(r, a == b); 83 REPORTER_ASSERT(r, a == b);
84 84
85 // Check that the same path is produced when style is applied by GrShape and GrStyle. 85 // Check that the same path is produced when style is applied by GrShape and GrStyle.
86 SkPath preStyle; 86 SkPath preStyle;
87 SkPath postPathEffect; 87 SkPath postPathEffect;
88 SkPath postAllStyle; 88 SkPath postAllStyle;
89 89
90 fBase.asPath(&preStyle); 90 fBase.asPath(&preStyle);
91 SkStrokeRec postPathEffectStrokeRec(SkStrokeRec::kFill_InitStyle); 91 SkStrokeRec postPEStrokeRec(SkStrokeRec::kFill_InitStyle);
92 if (fBase.style().applyPathEffectToPath(&postPathEffect, &postPathEffect StrokeRec, 92 if (fBase.style().applyPathEffectToPath(&postPathEffect, &postPEStrokeRe c, preStyle)) {
93 preStyle)) { 93 // run postPathEffect through GrShape to get any geometry reductions that would have
94 // occurred to fAppliedPE.
95 GrShape(postPathEffect, GrStyle(postPEStrokeRec, nullptr)).asPath(&p ostPathEffect);
96
94 SkPath testPath; 97 SkPath testPath;
95 fAppliedPE.asPath(&testPath); 98 fAppliedPE.asPath(&testPath);
96 REPORTER_ASSERT(r, testPath == postPathEffect); 99 REPORTER_ASSERT(r, testPath == postPathEffect);
97 REPORTER_ASSERT(r, 100 REPORTER_ASSERT(r, postPEStrokeRec.hasEqualEffect(fAppliedPE.style() .strokeRec()));
98 postPathEffectStrokeRec.hasEqualEffect(fAppliedPE.st yle().strokeRec()));
99 } 101 }
100 SkStrokeRec::InitStyle fillOrHairline; 102 SkStrokeRec::InitStyle fillOrHairline;
101 if (fBase.style().applyToPath(&postAllStyle, &fillOrHairline, preStyle)) { 103 if (fBase.style().applyToPath(&postAllStyle, &fillOrHairline, preStyle)) {
104 // run postPathEffect through GrShape to get any reductions that wou ld have occurred
105 // to fAppliedFull.
106 GrShape(postAllStyle, GrStyle(fillOrHairline)).asPath(&postAllStyle) ;
107
102 SkPath testPath; 108 SkPath testPath;
103 fAppliedFull.asPath(&testPath); 109 fAppliedFull.asPath(&testPath);
104 REPORTER_ASSERT(r, testPath == postAllStyle); 110 REPORTER_ASSERT(r, testPath == postAllStyle);
105 if (fillOrHairline == SkStrokeRec::kFill_InitStyle) { 111 if (fillOrHairline == SkStrokeRec::kFill_InitStyle) {
106 REPORTER_ASSERT(r, fAppliedFull.style().isSimpleFill()); 112 REPORTER_ASSERT(r, fAppliedFull.style().isSimpleFill());
107 } else { 113 } else {
108 REPORTER_ASSERT(r, fAppliedFull.style().isSimpleHairline()); 114 REPORTER_ASSERT(r, fAppliedFull.style().isSimpleHairline());
109 } 115 }
110 } 116 }
111 } 117 }
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 } 852 }
847 } 853 }
848 854
849 // Test a volatile empty path. 855 // Test a volatile empty path.
850 test_volatile_path(reporter, SkPath(), true); 856 test_volatile_path(reporter, SkPath(), true);
851 857
852 test_empty_shape(reporter); 858 test_empty_shape(reporter);
853 } 859 }
854 860
855 #endif 861 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrStyle.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698