#include "SkPaint.h"
#include "SkDashPathEffect.h"
-static void drawline(SkCanvas* canvas, int on, int off, const SkPaint& paint) {
+static void drawline(SkCanvas* canvas, int on, int off, const SkPaint& paint,
+ SkScalar finalX = SkIntToScalar(600)) {
SkPaint p(paint);
const SkScalar intervals[] = {
};
p.setPathEffect(new SkDashPathEffect(intervals, 2, 0))->unref();
- canvas->drawLine(0, 0, SkIntToScalar(600), 0, p);
+ canvas->drawLine(0, 0, finalX, 0, p);
+}
+
+// earlier bug stopped us from drawing very long single-segment dashes, because
+// SkPathMeasure was skipping very small delta-T values (nearlyzero). This is
+// now fixes, so this giant dash should appear.
+static void show_giant_dash(SkCanvas* canvas) {
+ SkPaint paint;
+
+ drawline(canvas, 1, 1, paint, SkIntToScalar(20 * 1000));
}
class DashingGM : public skiagm::GM {
}
}
}
+
+ show_giant_dash(canvas);
}
};
distance = this->compute_quad_segs(&tmp[2], distance, halft, maxt, ptIndex);
} else {
SkScalar d = SkPoint::Distance(pts[0], pts[2]);
- SkASSERT(d >= 0);
- if (SkScalarNearlyZero(d)) {
- d = 0;
- }
SkScalar prevD = distance;
distance += d;
if (distance > prevD) {
distance = this->compute_cubic_segs(&tmp[3], distance, halft, maxt, ptIndex);
} else {
SkScalar d = SkPoint::Distance(pts[0], pts[3]);
- SkASSERT(d >= 0);
- if (SkScalarNearlyZero(d)) {
- d = 0;
- }
SkScalar prevD = distance;
distance += d;
if (distance > prevD) {
SkASSERT(stopT >= 0 && stopT <= SK_Scalar1);
SkASSERT(startT <= stopT);
- if (SkScalarNearlyZero(stopT - startT)) {
- return;
+ if (startT == stopT) {
+ return; // should we report this, to undo a moveTo?
}
SkPoint tmp0[7], tmp1[7];