need to clamp all of the cubic points after a chop, in case our finite precision
meant we didn't compute values below the chop-point. crbug:234190 R=caryclark@google.com Review URL: https://codereview.chromium.org/14607012 git-svn-id: http://skia.googlecode.com/svn/trunk@9071 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
6843bdb706
commit
3eff3592ac
@ -283,11 +283,12 @@ static void chop_cubic_in_Y(SkPoint pts[4], const SkRect& clip) {
|
||||
SkPoint tmp[7];
|
||||
SkChopCubicAt(pts, tmp, t);
|
||||
|
||||
// tmp[3, 4].fY should all be to the below clip.fTop, and
|
||||
// tmp[3, 4, 5].fY should all be to the below clip.fTop, and
|
||||
// still be monotonic in Y. Since we can't trust the numerics of
|
||||
// the chopper, we force those conditions now
|
||||
tmp[3].fY = clip.fTop;
|
||||
clamp_ge(tmp[4].fY, clip.fTop);
|
||||
clamp_ge(tmp[5].fY, tmp[4].fY);
|
||||
|
||||
pts[0] = tmp[3];
|
||||
pts[1] = tmp[4];
|
||||
|
@ -31,6 +31,20 @@ static SkSurface* new_surface(int w, int h) {
|
||||
return SkSurface::NewRaster(info);
|
||||
}
|
||||
|
||||
// This used to assert in the debug build, as the edges did not all line-up.
|
||||
static void test_bad_cubic_crbug234190() {
|
||||
SkPath path;
|
||||
path.moveTo(13.8509f, 3.16858f);
|
||||
path.cubicTo(-2.35893e+08f, -4.21044e+08f,
|
||||
-2.38991e+08f, -4.26573e+08f,
|
||||
-2.41016e+08f, -4.30188e+08f);
|
||||
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
SkAutoTUnref<SkSurface> surface(new_surface(84, 88));
|
||||
surface->getCanvas()->drawPath(path, paint);
|
||||
}
|
||||
|
||||
static void test_bad_cubic_crbug229478() {
|
||||
const SkPoint pts[] = {
|
||||
{ 4595.91064f, -11596.9873f },
|
||||
@ -2377,6 +2391,7 @@ static void TestPath(skiatest::Reporter* reporter) {
|
||||
test_clipped_cubic();
|
||||
test_crbug_170666();
|
||||
test_bad_cubic_crbug229478();
|
||||
test_bad_cubic_crbug234190();
|
||||
}
|
||||
|
||||
#include "TestClassDef.h"
|
||||
|
Loading…
Reference in New Issue
Block a user