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

Unified Diff: src/core/SkDraw.cpp

Issue 1955633002: Take SkStrokeRec::InitStyle rather than SkPaint::Style in mask filter and DrawMask (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: src/core/SkDraw.cpp
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 0cdd3a19dc0038b3d08b71211baf80ffb96ff0ed..6184bd78bc48db5003c1f204344b84d292853815 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -993,7 +993,7 @@ void SkDraw::drawRRect(const SkRRect& rrect, const SkPaint& paint) const {
if (rrect.transform(*fMatrix, &devRRect)) {
SkAutoBlitterChoose blitter(fDst, *fMatrix, paint);
if (paint.getMaskFilter()->filterRRect(devRRect, *fMatrix, *fRC, blitter.get(),
- SkPaint::kFill_Style)) {
+ SkStrokeRec::kFill_InitStyle)) {
return; // filterRRect() called the blitter, so we're done
}
}
@@ -1117,8 +1117,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 +2025,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 +2043,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:
robertphillips 2016/05/05 19:52:06 !paint.getStrokeWidth() ?
bsalomon 2016/05/05 20:15:16 Done.
+ SkASSERT(paint.getStrokeWidth());
+ paint.setStyle(SkPaint::kStroke_Style);
+ break;
+ case SkStrokeRec::kFill_InitStyle:
robertphillips 2016/05/05 19:52:06 xtra space ?
bsalomon 2016/05/05 20:15:16 Done. (actually other line is shy one space.)
+ 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;

Powered by Google App Engine
This is Rietveld 408576698