Revert "Revert "long rect dash fix with guards""
This reverts commit fa6b6c2d1b613faf72071b99f4b404fa4ee5e076.
Reason for revert: Looks like this was actually caused by another change but happen to fail a test that looked very related to this
Original change's description:
> Revert "long rect dash fix with guards"
>
> This reverts commit 93ceab1b59f06c828cf62aa6a700e7f81620f23d.
>
> Reason for revert: breaking layout test
>
> Original change's description:
> > long rect dash fix with guards
> >
> > long rect dash with guards
> >
> > check dash fix back in with
> > guards against changing
> > chrome layout test results
> >
> > original change clipped against wrong rectangle
> > some of the time, causing tiled drawing to fail.
> > Always clip against outset rectangle.
> >
> > original CL: skia-review.googlesource.com/c/skia/+/84862
> >
> > efficiently dash very large rectangles and very long lines
> > Speed up dashing when lines and rects are absurdly large.
> >
> > Prior to this CL, only horizontal lines were detected.
> >
> > Also folded in a change to handle dashing of zero length lines.
> >
> > TBR=egdaniel@google.com
> > Bug: skia:7311
> > Change-Id: Ic3c68ec8ea35d0597c892c3b26ba7bb077045990
> > Reviewed-on: https://skia-review.googlesource.com/87768
> > Reviewed-by: Cary Clark <caryclark@skia.org>
> > Commit-Queue: Cary Clark <caryclark@skia.org>
>
> TBR=egdaniel@google.com,caryclark@skia.org
>
> Change-Id: I56ef771ccb281887d7381c2bd8a2553acbd30621
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:7311
> Reviewed-on: https://skia-review.googlesource.com/88421
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,caryclark@skia.org
Change-Id: Iecdd072544e6623bc4de8d5aab1402378112512d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:7311
Reviewed-on: https://skia-review.googlesource.com/88424
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/gm/strokes.cpp b/gm/strokes.cpp
index ed13d09..50b940a 100644
--- a/gm/strokes.cpp
+++ b/gm/strokes.cpp
@@ -533,3 +533,33 @@
canvas->drawLine(100, 100, 100, 100, paint);
}
+
+#ifdef PDF_IS_FIXED_SO_THIS_DOESNT_BREAK_IT
+DEF_SIMPLE_GM(longrect_dash, canvas, 250, 250) {
+ canvas->clear(SK_ColorWHITE);
+
+ SkPaint paint;
+ paint.setColor(SkColorSetARGB(255, 0, 0, 0));
+ paint.setStrokeWidth(5);
+ paint.setStrokeCap(SkPaint::kRound_Cap);
+ paint.setStrokeJoin(SkPaint::kBevel_Join);
+ paint.setStyle(SkPaint::kStroke_Style);
+ SkScalar dash_pattern[] = {1, 5};
+ paint.setPathEffect(SkDashPathEffect::Make(dash_pattern, 2, 0));
+ // try all combinations of stretching bounds
+ for (auto left : { 20.f, -100001.f } ) {
+ for (auto top : { 20.f, -100001.f } ) {
+ for (auto right : { 40.f, 100001.f } ) {
+ for (auto bottom : { 40.f, 100001.f } ) {
+ canvas->save();
+ canvas->clipRect({10, 10, 50, 50});
+ canvas->drawRect({left, top, right, bottom}, paint);
+ canvas->restore();
+ canvas->translate(60, 0);
+ }
+ }
+ canvas->translate(-60 * 4, 60);
+ }
+ }
+}
+#endif