diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-05-29 12:03:46 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-05-29 12:03:46 +0000 |
commit | 8b06f1a7ff6d5a59387a90433064550de20787ee (patch) | |
tree | ffe3607c2832ddfcec2d5ecdfb72641e3b9fcba0 /src/core/SkPathEffect.cpp | |
parent | 398b1bcb7d30f9e55504b6de37d31ccc1a26c876 (diff) |
Detect when the caller was hairline AND strokeandfill, and resolve that into FILL
This fixes the unittests on WIN in the trybot for DEPS roll 4048
Review URL: https://codereview.appspot.com/6242057
git-svn-id: http://skia.googlecode.com/svn/trunk@4057 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkPathEffect.cpp')
-rw-r--r-- | src/core/SkPathEffect.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/core/SkPathEffect.cpp b/src/core/SkPathEffect.cpp index 48d165a52e..6b95d9b480 100644 --- a/src/core/SkPathEffect.cpp +++ b/src/core/SkPathEffect.cpp @@ -38,8 +38,14 @@ SkStrokeRec::SkStrokeRec(const SkPaint& paint) { fStrokeAndFill = false; break; case SkPaint::kStrokeAndFill_Style: - fWidth = paint.getStrokeWidth(); - fStrokeAndFill = true; + if (0 == paint.getStrokeWidth()) { + // hairline+fill == fill + fWidth = kStrokeRec_FillStyleWidth; + fStrokeAndFill = false; + } else { + fWidth = paint.getStrokeWidth(); + fStrokeAndFill = true; + } break; default: SkASSERT(!"unknown paint style"); @@ -67,6 +73,22 @@ SkStrokeRec::Style SkStrokeRec::getStyle() const { void SkStrokeRec::setFillStyle() { fWidth = kStrokeRec_FillStyleWidth; + fStrokeAndFill = false; +} + +void SkStrokeRec::setHairlineStyle() { + fWidth = 0; + fStrokeAndFill = false; +} + +void SkStrokeRec::setStrokeStyle(SkScalar width, bool strokeAndFill) { + if (strokeAndFill && (0 == width)) { + // hairline+fill == fill + this->setFillStyle(); + } else { + fWidth = width; + fStrokeAndFill = strokeAndFill; + } } #include "SkStroke.h" |