aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-06-10 13:21:07 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-10 13:21:07 -0700
commit8151103535bab8639dab2cb308b1b9c04651b632 (patch)
tree715fe0f5b7f1e9289adc213801a3ec584bc142ee
parent7df9e4a87d84415391c167ea54cd389d4b423c2d (diff)
fix non-square stroke rects (non-aa)
-rw-r--r--gm/strokerect.cpp15
-rw-r--r--src/core/SkScan_Hairline.cpp2
2 files changed, 15 insertions, 2 deletions
diff --git a/gm/strokerect.cpp b/gm/strokerect.cpp
index f7e36057df..a1c8bb8d9a 100644
--- a/gm/strokerect.cpp
+++ b/gm/strokerect.cpp
@@ -110,7 +110,20 @@ protected:
private:
typedef GM INHERITED;
};
+DEF_GM(return new StrokeRectGM;)
///////////////////////////////////////////////////////////////////////////////////////////////////
-DEF_GM(return new StrokeRectGM;)
+/*
+ * Exercise rect-stroking (which is specialized from paths) when the resulting stroke-width is
+ * non-square. See https://bugs.chromium.org/p/skia/issues/detail?id=5408
+ */
+DEF_SIMPLE_GM(strokerect_anisotropic_5408, canvas, 200, 50) {
+ SkPaint p;
+ p.setStyle(SkPaint::kStroke_Style);
+ p.setStrokeWidth(6);
+
+ canvas->scale(10, 1);
+ SkRect r = SkRect::MakeXYWH(5, 20, 10, 10);
+ canvas->drawRect(r, p);
+}
diff --git a/src/core/SkScan_Hairline.cpp b/src/core/SkScan_Hairline.cpp
index fc9e82818d..083dc0df5f 100644
--- a/src/core/SkScan_Hairline.cpp
+++ b/src/core/SkScan_Hairline.cpp
@@ -641,7 +641,7 @@ void SkScan::FrameRect(const SkRect& r, const SkPoint& strokeSize,
outer.set(r.fLeft - rx, r.fTop - ry,
r.fRight + rx, r.fBottom + ry);
- if (r.width() <= dx || r.height() <= dx) {
+ if (r.width() <= dx || r.height() <= dy) {
SkScan::FillRect(outer, clip, blitter);
return;
}