diff options
author | 2016-05-06 07:22:58 -0700 | |
---|---|---|
committer | 2016-05-06 07:22:58 -0700 | |
commit | 055e192adc0072ae2548ef5431ceee652945f9c2 (patch) | |
tree | eaced153f10fe492e99302404c5b1b96d6b796e4 /src/core/SkDraw.cpp | |
parent | ad3a5c634d6d96874a8b5f13e96d05d62fd0d35d (diff) |
Take SkStrokeRec::InitStyle rather than SkPaint::Style in mask filter and DrawMask
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1955633002
Review-Url: https://codereview.chromium.org/1955633002
Diffstat (limited to 'src/core/SkDraw.cpp')
-rw-r--r-- | src/core/SkDraw.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index 0cdd3a19dc..d2c6bb131e 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -992,8 +992,7 @@ void SkDraw::drawRRect(const SkRRect& rrect, const SkPaint& paint) const { SkRRect devRRect; if (rrect.transform(*fMatrix, &devRRect)) { SkAutoBlitterChoose blitter(fDst, *fMatrix, paint); - if (paint.getMaskFilter()->filterRRect(devRRect, *fMatrix, *fRC, blitter.get(), - SkPaint::kFill_Style)) { + if (paint.getMaskFilter()->filterRRect(devRRect, *fMatrix, *fRC, blitter.get())) { return; // filterRRect() called the blitter, so we're done } } @@ -1117,8 +1116,8 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint, } if (paint->getMaskFilter()) { - SkPaint::Style style = doFill ? SkPaint::kFill_Style : - SkPaint::kStroke_Style; + SkStrokeRec::InitStyle style = doFill ? SkStrokeRec::kFill_InitStyle + : SkStrokeRec::kHairline_InitStyle; if (paint->getMaskFilter()->filterPath(*devPathPtr, *fMatrix, *fRC, blitter, style)) { return; // filterPath() called the blitter, so we're done } @@ -2025,7 +2024,8 @@ static bool compute_bounds(const SkPath& devPath, const SkIRect* clipBounds, return true; } -static void draw_into_mask(const SkMask& mask, const SkPath& devPath, SkPaint::Style style) { +static void draw_into_mask(const SkMask& mask, const SkPath& devPath, + SkStrokeRec::InitStyle style) { SkDraw draw; if (!draw.fDst.reset(mask)) { return; @@ -2042,14 +2042,23 @@ static void draw_into_mask(const SkMask& mask, const SkPath& devPath, SkPaint::S draw.fRC = &clip; draw.fMatrix = &matrix; paint.setAntiAlias(true); - paint.setStyle(style); + switch (style) { + case SkStrokeRec::kHairline_InitStyle: + SkASSERT(!paint.getStrokeWidth()); + paint.setStyle(SkPaint::kStroke_Style); + break; + case SkStrokeRec::kFill_InitStyle: + SkASSERT(paint.getStyle() == SkPaint::kFill_Style); + break; + + } draw.drawPath(devPath, paint); } bool SkDraw::DrawToMask(const SkPath& devPath, const SkIRect* clipBounds, const SkMaskFilter* filter, const SkMatrix* filterMatrix, SkMask* mask, SkMask::CreateMode mode, - SkPaint::Style style) { + SkStrokeRec::InitStyle style) { if (SkMask::kJustRenderImage_CreateMode != mode) { if (!compute_bounds(devPath, clipBounds, filter, filterMatrix, &mask->fBounds)) return false; |