diff options
author | caryclark <caryclark@google.com> | 2016-02-05 13:59:31 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-05 13:59:31 -0800 |
commit | 52b64619d99325bac2f9b53c9fb0a4b7c69e442f (patch) | |
tree | 34d5712194ab3520880988dd16c160f82f847424 | |
parent | 2fba80912027999b560a97a832948c37ab36acfe (diff) |
increase subdivision for very large cubics
Allow 512 subdivisions for hairline cubics instead of 64
to allow very large cubics to be properly approximated with
lines.
R=reed@google.com
BUG=339297
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1674813002
Review URL: https://codereview.chromium.org/1674813002
-rw-r--r-- | gm/strokefill.cpp | 26 | ||||
-rw-r--r-- | src/core/SkScan_Hairline.cpp | 2 |
2 files changed, 27 insertions, 1 deletions
diff --git a/gm/strokefill.cpp b/gm/strokefill.cpp index 4f6e6d2927..fc1a281f00 100644 --- a/gm/strokefill.cpp +++ b/gm/strokefill.cpp @@ -331,3 +331,29 @@ DEF_SIMPLE_GM_BG_NAME(strokefill, canvas, 640, 480, SK_ColorWHITE, path4.moveTo(0, 0); // test for crbug.com/247770 canvas->drawPath(path4, paint); } + +DEF_SIMPLE_GM(bug339297, canvas, 640, 480) { + SkPath path; + path.moveTo(-469515, -10354890); + path.cubicTo(771919.62f, -10411179, 2013360.1f, -10243774, 3195542.8f, -9860664); + path.lineTo(3195550, -9860655); + path.lineTo(3195539, -9860652); + path.lineTo(3195539, -9860652); + path.lineTo(3195539, -9860652); + path.cubicTo(2013358.1f, -10243761, 771919.25f, -10411166, -469513.84f, -10354877); + path.lineTo(-469515, -10354890); + path.close(); + + canvas->translate(258, 10365663); + + SkPaint paint; + paint.setAntiAlias(true); + paint.setColor(SK_ColorBLACK); + paint.setStyle(SkPaint::kFill_Style); + canvas->drawPath(path, paint); + + paint.setColor(SK_ColorRED); + paint.setStyle(SkPaint::kStroke_Style); + paint.setStrokeWidth(1); + canvas->drawPath(path, paint); +} diff --git a/src/core/SkScan_Hairline.cpp b/src/core/SkScan_Hairline.cpp index a63220efef..2b2194b0d3 100644 --- a/src/core/SkScan_Hairline.cpp +++ b/src/core/SkScan_Hairline.cpp @@ -192,7 +192,7 @@ void SkScan::HairRect(const SkRect& rect, const SkRasterClip& clip, #include "SkGeometry.h" #include "SkNx.h" -#define kMaxCubicSubdivideLevel 6 +#define kMaxCubicSubdivideLevel 9 #define kMaxQuadSubdivideLevel 5 static int compute_int_quad_dist(const SkPoint pts[3]) { |