add new cubic test for overflow
git-svn-id: http://skia.googlecode.com/svn/trunk@379 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
8af9602f61
commit
d0d0e65a63
@ -11,6 +11,7 @@
|
||||
#include "SkXfermode.h"
|
||||
#include "SkColorPriv.h"
|
||||
#include "SkColorFilter.h"
|
||||
#include "SkParsePath.h"
|
||||
#include "SkTime.h"
|
||||
#include "SkTypeface.h"
|
||||
|
||||
@ -37,6 +38,36 @@ static void test_cubic() {
|
||||
#endif
|
||||
}
|
||||
|
||||
static void test_cubic2() {
|
||||
const char* str = "M2242 -590088L-377758 9.94099e+07L-377758 9.94099e+07L2242 -590088Z";
|
||||
SkPath path;
|
||||
SkParsePath::FromSVGString(str, &path);
|
||||
|
||||
{
|
||||
float x = strtof("9.94099e+07", NULL);
|
||||
int ix = (int)x;
|
||||
int fx = (int)(x * 65536);
|
||||
int ffx = SkScalarToFixed(x);
|
||||
printf("%g %x %x %x\n", x, ix, fx, ffx);
|
||||
|
||||
SkRect r = path.getBounds();
|
||||
SkIRect ir;
|
||||
r.round(&ir);
|
||||
printf("[%g %g %g %g] [%x %x %x %x]\n",
|
||||
r.fLeft, r.fTop, r.fRight, r.fBottom,
|
||||
ir.fLeft, ir.fTop, ir.fRight, ir.fBottom);
|
||||
}
|
||||
|
||||
SkBitmap bitmap;
|
||||
bitmap.setConfig(SkBitmap::kARGB_8888_Config, 300, 200);
|
||||
bitmap.allocPixels();
|
||||
|
||||
SkCanvas canvas(bitmap);
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
canvas.drawPath(path, paint);
|
||||
}
|
||||
|
||||
class PathView : public SkView {
|
||||
public:
|
||||
int fDStroke, fStroke, fMinStroke, fMaxStroke;
|
||||
@ -45,6 +76,7 @@ public:
|
||||
|
||||
PathView() {
|
||||
test_cubic();
|
||||
test_cubic2();
|
||||
|
||||
fShowHairline = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user