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

Unified Diff: src/core/SkPaint.cpp

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, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkStrokeRec.h ('k') | src/core/SkStrokeRec.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPaint.cpp
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index d28168a58e9ea3c8fdbc248eeaa350e875031355..51bfd54a682adde766c3d6068ce663e5dfd0b3e2 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -2025,22 +2025,8 @@ const SkRect& SkPaint::doComputeFastBounds(const SkRect& origSrc,
src = &tmpSrc;
}
- if (kFill_Style != style) {
- // since we're stroked, outset the rect by the radius (and join type)
- SkScalar radius = SkScalarHalf(this->getStrokeWidth());
- if (0 == radius) { // hairline
- radius = SK_Scalar1;
- } else if (this->getStrokeJoin() == SkPaint::kMiter_Join) {
- SkScalar scale = this->getStrokeMiter();
- if (scale > SK_Scalar1) {
- radius = SkScalarMul(radius, scale);
- }
- }
- storage->set(src->fLeft - radius, src->fTop - radius,
- src->fRight + radius, src->fBottom + radius);
- } else {
- *storage = *src;
- }
+ SkScalar radius = SkStrokeRec::GetInflationRadius(*this, style);
+ *storage = src->makeOutset(radius, radius);
if (this->getMaskFilter()) {
this->getMaskFilter()->computeFastBounds(*storage, storage);
« no previous file with comments | « include/core/SkStrokeRec.h ('k') | src/core/SkStrokeRec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698