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

Side by Side Diff: src/gpu/GrStyle.h

Issue 1970003003: Add bounds to GrShape (Closed) Base URL: https://chromium.googlesource.com/skia.git@grshapeisempty
Patch Set: put back const& 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/GrShape.cpp ('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 #ifndef GrStyle_DEFINED 8 #ifndef GrStyle_DEFINED
9 #define GrStyle_DEFINED 9 #define GrStyle_DEFINED
10 10
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 * been overwritten. Scale controls geometric approximations made by the pat h effect and 160 * been overwritten. Scale controls geometric approximations made by the pat h effect and
161 * stroker. It is typically computed from the view matrix. 161 * stroker. It is typically computed from the view matrix.
162 */ 162 */
163 bool SK_WARN_UNUSED_RESULT applyToPath(SkPath* dst, SkStrokeRec::InitStyle* fillOrHairline, 163 bool SK_WARN_UNUSED_RESULT applyToPath(SkPath* dst, SkStrokeRec::InitStyle* fillOrHairline,
164 const SkPath& src, SkScalar scale) co nst; 164 const SkPath& src, SkScalar scale) co nst;
165 165
166 /** Given bounds of a path compute the bounds of path with the style applied . */ 166 /** Given bounds of a path compute the bounds of path with the style applied . */
167 void adjustBounds(SkRect* dst, const SkRect& src) const { 167 void adjustBounds(SkRect* dst, const SkRect& src) const {
168 if (this->pathEffect()) { 168 if (this->pathEffect()) {
169 this->pathEffect()->computeFastBounds(dst, src); 169 this->pathEffect()->computeFastBounds(dst, src);
170 // This may not be the correct SkStrokeRec to use. skbug.com/5299
171 // It happens to work for dashing.
172 SkScalar radius = fStrokeRec.getInflationRadius();
173 dst->outset(radius, radius);
170 } else { 174 } else {
171 SkScalar radius = fStrokeRec.getInflationRadius(); 175 SkScalar radius = fStrokeRec.getInflationRadius();
172 *dst = src.makeOutset(radius, radius); 176 *dst = src.makeOutset(radius, radius);
173 } 177 }
174 } 178 }
175 179
176 private: 180 private:
177 void initPathEffect(SkPathEffect* pe); 181 void initPathEffect(SkPathEffect* pe);
178 182
179 struct DashInfo { 183 struct DashInfo {
(...skipping 14 matching lines...) Expand all
194 SkScalar fPhase; 198 SkScalar fPhase;
195 SkAutoSTArray<4, SkScalar> fIntervals; 199 SkAutoSTArray<4, SkScalar> fIntervals;
196 }; 200 };
197 201
198 SkStrokeRec fStrokeRec; 202 SkStrokeRec fStrokeRec;
199 sk_sp<SkPathEffect> fPathEffect; 203 sk_sp<SkPathEffect> fPathEffect;
200 DashInfo fDashInfo; 204 DashInfo fDashInfo;
201 }; 205 };
202 206
203 #endif 207 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrShape.cpp ('k') | tests/GrShapeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698