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

Side by Side Diff: include/core/SkStrokeRec.h

Issue 1928133002: Unify implementations of stroking radius calculations (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: use makeOutset 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 | « no previous file | src/core/SkPaint.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 2012 Google Inc. 2 * Copyright 2012 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 SkStrokeRec_DEFINED 8 #ifndef SkStrokeRec_DEFINED
9 #define SkStrokeRec_DEFINED 9 #define SkStrokeRec_DEFINED
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 * src and dst may be the same path. 92 * src and dst may be the same path.
93 */ 93 */
94 bool applyToPath(SkPath* dst, const SkPath& src) const; 94 bool applyToPath(SkPath* dst, const SkPath& src) const;
95 95
96 /** 96 /**
97 * Apply these stroke parameters to a paint. 97 * Apply these stroke parameters to a paint.
98 */ 98 */
99 void applyToPaint(SkPaint* paint) const; 99 void applyToPaint(SkPaint* paint) const;
100 100
101 /** 101 /**
102 * Gives a conservative value for the outset that should applied to a
103 * geometries bounds to account for any inflation due to applying this
104 * strokeRec to the geometry.
105 */
106 SkScalar getInflationRadius() const;
107
108 /**
109 * Equivalent to:
110 * SkStrokeRec rec(paint, style);
111 * rec.getInflationRadius();
112 * This does not account for other effects on the paint (i.e. path
113 * effect).
114 */
115 static SkScalar GetInflationRadius(const SkPaint&, SkPaint::Style);
116
117 /**
102 * Compare if two SkStrokeRecs have an equal effect on a path. 118 * Compare if two SkStrokeRecs have an equal effect on a path.
103 * Equal SkStrokeRecs produce equal paths. Equality of produced 119 * Equal SkStrokeRecs produce equal paths. Equality of produced
104 * paths does not take the ResScale parameter into account. 120 * paths does not take the ResScale parameter into account.
105 */ 121 */
106 bool hasEqualEffect(const SkStrokeRec& other) const { 122 bool hasEqualEffect(const SkStrokeRec& other) const {
107 if (!this->needToApply()) { 123 if (!this->needToApply()) {
108 return this->getStyle() == other.getStyle(); 124 return this->getStyle() == other.getStyle();
109 } 125 }
110 return fWidth == other.fWidth && 126 return fWidth == other.fWidth &&
111 fMiterLimit == other.fMiterLimit && 127 fMiterLimit == other.fMiterLimit &&
(...skipping 14 matching lines...) Expand all
126 // 142 //
127 // fCap and fJoin are larger than needed to avoid having to initialize 143 // fCap and fJoin are larger than needed to avoid having to initialize
128 // any pad values 144 // any pad values
129 uint32_t fCap : 16; // SkPaint::Cap 145 uint32_t fCap : 16; // SkPaint::Cap
130 uint32_t fJoin : 15; // SkPaint::Join 146 uint32_t fJoin : 15; // SkPaint::Join
131 uint32_t fStrokeAndFill : 1; // bool 147 uint32_t fStrokeAndFill : 1; // bool
132 }; 148 };
133 SK_END_REQUIRE_DENSE 149 SK_END_REQUIRE_DENSE
134 150
135 #endif 151 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698