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

Side by Side Diff: src/gpu/GrStyle.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.h ('k') | tests/GrShapeTest.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 * 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 "GrStyle.h" 8 #include "GrStyle.h"
9 9
10 int GrStyle::KeySize(const GrStyle &style, Apply apply, uint32_t flags) { 10 int GrStyle::KeySize(const GrStyle &style, Apply apply, uint32_t flags) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 return false; 130 return false;
131 } 131 }
132 *remainingStroke = strokeRec; 132 *remainingStroke = strokeRec;
133 return true; 133 return true;
134 } 134 }
135 135
136 bool GrStyle::applyToPath(SkPath* dst, SkStrokeRec::InitStyle* style, const SkPa th& src) const { 136 bool GrStyle::applyToPath(SkPath* dst, SkStrokeRec::InitStyle* style, const SkPa th& src) const {
137 SkASSERT(style); 137 SkASSERT(style);
138 SkASSERT(dst); 138 SkASSERT(dst);
139 SkStrokeRec strokeRec = fStrokeRec; 139 SkStrokeRec strokeRec = fStrokeRec;
140 if (!apply_path_effect(dst, &strokeRec, fPathEffect, src)) { 140 const SkPath* pathForStrokeRec = &src;
141 if (apply_path_effect(dst, &strokeRec, fPathEffect, src)) {
142 pathForStrokeRec = dst;
143 } else if (fPathEffect) {
141 return false; 144 return false;
142 } 145 }
143 if (strokeRec.needToApply()) { 146 if (strokeRec.needToApply()) {
144 if (!strokeRec.applyToPath(dst, *dst)) { 147 if (!strokeRec.applyToPath(dst, *pathForStrokeRec)) {
145 return false; 148 return false;
146 } 149 }
147 *style = SkStrokeRec::kFill_InitStyle; 150 *style = SkStrokeRec::kFill_InitStyle;
151 } else if (!fPathEffect) {
152 // Nothing to do for path effect or stroke, fail.
153 return false;
148 } else { 154 } else {
149 SkASSERT(SkStrokeRec::kFill_Style == strokeRec.getStyle() || 155 SkASSERT(SkStrokeRec::kFill_Style == strokeRec.getStyle() ||
150 SkStrokeRec::kHairline_Style == strokeRec.getStyle()); 156 SkStrokeRec::kHairline_Style == strokeRec.getStyle());
151 *style = strokeRec.getStyle() == SkStrokeRec::kFill_Style 157 *style = strokeRec.getStyle() == SkStrokeRec::kFill_Style
152 ? SkStrokeRec::kFill_InitStyle 158 ? SkStrokeRec::kFill_InitStyle
153 : SkStrokeRec::kHairline_InitStyle; 159 : SkStrokeRec::kHairline_InitStyle;
154 } 160 }
155 return true; 161 return true;
156 } 162 }
OLDNEW
« no previous file with comments | « src/gpu/GrStyle.h ('k') | tests/GrShapeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698