fix warnings
git-svn-id: http://skia.googlecode.com/svn/trunk@1129 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
9ccdb95319
commit
261b8e2ca1
@ -437,7 +437,7 @@ protected:
|
||||
SkRect rect = {0, 0, SkIntToScalar(40), SkIntToScalar(40) };
|
||||
SkRect rect2 = {0, 0, SkIntToScalar(65), SkIntToScalar(20) };
|
||||
SkScalar left = 0, top = 0, x = 0, y = 0;
|
||||
int index;
|
||||
size_t index;
|
||||
|
||||
char ascii[] = "ascii...";
|
||||
size_t asciiLength = sizeof(ascii) - 1;
|
||||
|
@ -579,8 +579,8 @@ void SampleWindow::draw(SkCanvas* canvas) {
|
||||
int count = canvas->save();
|
||||
canvas->resetMatrix();
|
||||
// Ensure the mouse position is on screen.
|
||||
int width = this->width();
|
||||
int height = this->height();
|
||||
int width = SkScalarRound(this->width());
|
||||
int height = SkScalarRound(this->height());
|
||||
if (fMouseX >= width) fMouseX = width - 1;
|
||||
else if (fMouseX < 0) fMouseX = 0;
|
||||
if (fMouseY >= height) fMouseY = height - 1;
|
||||
|
@ -94,8 +94,8 @@ protected:
|
||||
} else {
|
||||
paint.setMaskFilter(NULL);
|
||||
}
|
||||
canvas->drawCircle(200 + gRecs[i].fCx*100,
|
||||
200 + gRecs[i].fCy*100, 50, paint);
|
||||
canvas->drawCircle(200 + gRecs[i].fCx*100.f,
|
||||
200 + gRecs[i].fCy*100.f, 50, paint);
|
||||
}
|
||||
// draw text
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
SkShader::kClamp_TileMode,
|
||||
SkShader::kClamp_TileMode);
|
||||
|
||||
SkRect src = { 0, 0, bm.width(), bm.height() };
|
||||
SkRect src = { 0, 0, SkIntToScalar(bm.width()), SkIntToScalar(bm.height()) };
|
||||
SkRect dst = { -150, -150, 150, 150 };
|
||||
SkMatrix matrix;
|
||||
matrix.setRectToRect(src, dst, SkMatrix::kFill_ScaleToFit);
|
||||
|
@ -10,7 +10,7 @@
|
||||
// see bug# 1504910
|
||||
static void test_circlebounds(SkCanvas* canvas) {
|
||||
#ifdef SK_SCALAR_IS_FLOAT
|
||||
SkRect r = { 1.39999998, 1, 21.3999996, 21 };
|
||||
SkRect r = { 1.39999998f, 1, 21.3999996f, 21 };
|
||||
SkPath p;
|
||||
p.addOval(r);
|
||||
SkASSERT(r == p.getBounds());
|
||||
|
@ -106,8 +106,8 @@ public:
|
||||
SkRandom rand;
|
||||
|
||||
for (int i = 0; i < 50; i++) {
|
||||
int x = nextScalarRange(rand, -fClip.width()*1, fClip.width()*2);
|
||||
int y = nextScalarRange(rand, -fClip.height()*1, fClip.height()*2);
|
||||
SkScalar x = nextScalarRange(rand, -fClip.width()*1, fClip.width()*2);
|
||||
SkScalar y = nextScalarRange(rand, -fClip.height()*1, fClip.height()*2);
|
||||
if (i == 0)
|
||||
fPath.moveTo(x, y);
|
||||
else
|
||||
|
@ -77,15 +77,14 @@ static void make_bm(SkBitmap* bm)
|
||||
draw_sweep(&c, bm->width(), bm->height(), 0);
|
||||
}
|
||||
|
||||
static void pre_dither(const SkBitmap& bm)
|
||||
{
|
||||
static void pre_dither(const SkBitmap& bm) {
|
||||
SkAutoLockPixels alp(bm);
|
||||
|
||||
for (unsigned y = 0; y < bm.height(); y++) {
|
||||
for (int y = 0; y < bm.height(); y++) {
|
||||
DITHER_4444_SCAN(y);
|
||||
|
||||
SkPMColor* p = bm.getAddr32(0, y);
|
||||
for (unsigned x = 0; x < bm.width(); x++) {
|
||||
for (int x = 0; x < bm.width(); x++) {
|
||||
SkPMColor c = *p;
|
||||
|
||||
unsigned a = SkGetPackedA32(c);
|
||||
|
@ -27,27 +27,27 @@ static void test_strokerect(SkCanvas* canvas) {
|
||||
SkRect r;
|
||||
|
||||
r.set(10, 10, 14, 14);
|
||||
r.offset(0.25, 0.3333);
|
||||
r.offset(0.25f, 0.3333f);
|
||||
test_strokerect(canvas, r);
|
||||
canvas->translate(0, 20);
|
||||
|
||||
r.set(10, 10, 14.5f, 14.5f);
|
||||
r.offset(0.25, 0.3333);
|
||||
r.offset(0.25f, 0.3333f);
|
||||
test_strokerect(canvas, r);
|
||||
canvas->translate(0, 20);
|
||||
|
||||
r.set(10, 10, 14.5f, 20);
|
||||
r.offset(0.25, 0.3333);
|
||||
r.offset(0.25f, 0.3333f);
|
||||
test_strokerect(canvas, r);
|
||||
canvas->translate(0, 20);
|
||||
|
||||
r.set(10, 10, 20, 14.5f);
|
||||
r.offset(0.25, 0.3333);
|
||||
r.offset(0.25f, 0.3333f);
|
||||
test_strokerect(canvas, r);
|
||||
canvas->translate(0, 20);
|
||||
|
||||
r.set(10, 10, 20, 20);
|
||||
r.offset(0.25, 0.3333);
|
||||
r.offset(0.25f, 0.3333f);
|
||||
test_strokerect(canvas, r);
|
||||
canvas->translate(0, 20);
|
||||
|
||||
|
@ -12,10 +12,10 @@
|
||||
|
||||
static void test_edgeclipper() {
|
||||
SkPoint pts[] = {
|
||||
{ -8.38822452e+21, -7.69721471e+19 },
|
||||
{ 1.57645875e+23, 1.44634003e+21 },
|
||||
{ 1.61519691e+23, 1.48208059e+21 },
|
||||
{ 3.13963584e+23, 2.88057438e+21 }
|
||||
{ -8.38822452e+21f, -7.69721471e+19f },
|
||||
{ 1.57645875e+23f, 1.44634003e+21f },
|
||||
{ 1.61519691e+23f, 1.48208059e+21f },
|
||||
{ 3.13963584e+23f, 2.88057438e+21f }
|
||||
};
|
||||
SkRect clip = { 0, 0, 300, 200 };
|
||||
|
||||
@ -39,7 +39,7 @@ static void paint_proc1(SkPaint* paint) {
|
||||
static void paint_proc2(SkPaint* paint) {
|
||||
SkScalar dir[3] = { 1, 1, 1};
|
||||
paint->setMaskFilter(
|
||||
SkBlurMaskFilter::CreateEmboss(dir, 0.1, 0.05, 1))->unref();
|
||||
SkBlurMaskFilter::CreateEmboss(dir, 0.1f, 0.05f, 1))->unref();
|
||||
}
|
||||
|
||||
static void paint_proc3(SkPaint* paint) {
|
||||
|
@ -68,10 +68,10 @@ protected:
|
||||
// test handling of obscene cubic values (currently broken)
|
||||
if (false) {
|
||||
SkPoint pts[4];
|
||||
pts[0].set(1.61061274e+09, 6291456);
|
||||
pts[1].set(-7.18397061e+15, -1.53091184e+13);
|
||||
pts[2].set(-1.30077315e+16, -2.77196141e+13);
|
||||
pts[3].set(-1.30077315e+16, -2.77196162e+13);
|
||||
pts[0].set(1.61061274e+09f, 6291456);
|
||||
pts[1].set(-7.18397061e+15f, -1.53091184e+13f);
|
||||
pts[2].set(-1.30077315e+16f, -2.77196141e+13f);
|
||||
pts[3].set(-1.30077315e+16f, -2.77196162e+13f);
|
||||
|
||||
SkPath path;
|
||||
path.moveTo(pts[0]);
|
||||
@ -83,6 +83,7 @@ protected:
|
||||
canvas->rotate(30);
|
||||
|
||||
paint.setAntiAlias(true);
|
||||
paint.setLCDRenderText(true);
|
||||
SkSafeUnref(paint.setTypeface(SkTypeface::CreateFromName("Times Roman", SkTypeface::kNormal)));
|
||||
|
||||
// const char* text = "abcdefghijklmnopqrstuvwxyz";
|
||||
|
@ -31,6 +31,12 @@ static int R(float x) {
|
||||
return (int)floor(SkScalarToFloat(gRand.nextUScalar1()) * x);
|
||||
}
|
||||
|
||||
static float huge() {
|
||||
double d = 1e100;
|
||||
float f = (float)d;
|
||||
return f;
|
||||
}
|
||||
|
||||
static float make_number() {
|
||||
float v;
|
||||
int sel;
|
||||
@ -38,15 +44,15 @@ static float make_number() {
|
||||
if (return_large == true && R(3) == 1) sel = R(6); else sel = R(4);
|
||||
if (return_undef == false && sel == 0) sel = 1;
|
||||
|
||||
if (R(2) == 1) v = R(100); else
|
||||
if (R(2) == 1) v = (float)R(100); else
|
||||
|
||||
switch (sel) {
|
||||
case 0: break;
|
||||
case 1: v = 0; break;
|
||||
case 2: v = 0.000001; break;
|
||||
case 2: v = 0.000001f; break;
|
||||
case 3: v = 10000; break;
|
||||
case 4: v = 2000000000; break;
|
||||
case 5: v = 1e100; break;
|
||||
case 5: v = huge(); break;
|
||||
}
|
||||
|
||||
if (R(4) == 1) v = -v;
|
||||
@ -303,8 +309,8 @@ static void do_fuzz(SkCanvas* canvas) {
|
||||
case 0: canvas->scale(-1000000000,1);
|
||||
canvas->scale(-1000000000,1);
|
||||
scval = 1; break;
|
||||
case 1: canvas->scale(-.000000001,1); scval = 2; break;
|
||||
case 2: canvas->scale(-.000000001,1); scval = 0; break;
|
||||
case 1: canvas->scale(-.000000001f,1); scval = 2; break;
|
||||
case 2: canvas->scale(-.000000001f,1); scval = 0; break;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ protected:
|
||||
|
||||
canvas->translate(SkIntToScalar(10), SkIntToScalar(10));
|
||||
|
||||
canvas->scale(1.00000001, 0.9999999);
|
||||
canvas->scale(1.00000001f, 0.9999999f);
|
||||
|
||||
drawN2(canvas, fBitmap);
|
||||
|
||||
|
@ -21,10 +21,10 @@
|
||||
// http://code.google.com/p/skia/issues/detail?id=32
|
||||
static void test_cubic() {
|
||||
SkPoint src[4] = {
|
||||
{ 556.25000, 523.03003 },
|
||||
{ 556.23999, 522.96002 },
|
||||
{ 556.21997, 522.89001 },
|
||||
{ 556.21997, 522.82001 }
|
||||
{ 556.25000f, 523.03003f },
|
||||
{ 556.23999f, 522.96002f },
|
||||
{ 556.21997f, 522.89001f },
|
||||
{ 556.21997f, 522.82001f }
|
||||
};
|
||||
SkPoint dst[11];
|
||||
dst[10].set(42, -42); // one past the end, that we don't clobber these
|
||||
|
@ -10,7 +10,7 @@ static void makebm(SkBitmap* bm, SkBitmap::Config config, int w, int h) {
|
||||
bm->eraseColor(0);
|
||||
|
||||
SkCanvas canvas(*bm);
|
||||
SkScalar s = w < h ? w : h;
|
||||
SkScalar s = SkIntToScalar(w < h ? w : h);
|
||||
SkPoint pts[] = { 0, 0, s, s };
|
||||
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE };
|
||||
SkScalar pos[] = { 0, SK_Scalar1/2, SK_Scalar1 };
|
||||
@ -122,7 +122,7 @@ protected:
|
||||
|
||||
const char text[] = "Shaded Text";
|
||||
const int textLen = SK_ARRAY_COUNT(text) - 1;
|
||||
static int pointSize = SkIntToScalar(48);
|
||||
static int pointSize = 48;
|
||||
|
||||
int w = pointSize * textLen;
|
||||
int h = pointSize;
|
||||
|
@ -171,7 +171,7 @@ protected:
|
||||
mf = SkBlurMaskFilter::Create(radius, gStyle[x - 1]);
|
||||
paint.setMaskFilter(mf)->unref();
|
||||
}
|
||||
canvas->drawText("Title Bar", 9, x*100, y*30, paint);
|
||||
canvas->drawText("Title Bar", 9, x*SkIntToScalar(100), y*SkIntToScalar(30), paint);
|
||||
radius *= 0.75f;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ static void lettersToBitmap(SkBitmap* dst, const char chars[],
|
||||
SkScalar x = 0;
|
||||
SkScalar width;
|
||||
SkPath p;
|
||||
for (int i = 0; i < strlen(chars); i++) {
|
||||
for (size_t i = 0; i < strlen(chars); i++) {
|
||||
original.getTextPath(&chars[i], 1, x, 0, &p);
|
||||
path.addPath(p);
|
||||
original.getTextWidths(&chars[i], 1, &width);
|
||||
@ -69,7 +69,7 @@ static void lettersToBitmap2(SkBitmap* dst, const char chars[],
|
||||
SkScalar x = 0;
|
||||
SkScalar width;
|
||||
SkPath p;
|
||||
for (int i = 0; i < strlen(chars); i++) {
|
||||
for (size_t i = 0; i < strlen(chars); i++) {
|
||||
original.getTextPath(&chars[i], 1, x, 0, &p);
|
||||
path.addPath(p);
|
||||
original.getTextWidths(&chars[i], 1, &width);
|
||||
|
@ -134,12 +134,12 @@ static void test_breakText()
|
||||
SkASSERT(m > mm);
|
||||
}
|
||||
}
|
||||
nn = n;
|
||||
nn = SkIntToScalar(n);
|
||||
mm = m;
|
||||
}
|
||||
|
||||
nn = paint.breakText(text, length, width, &mm);
|
||||
SkASSERT(nn == length);
|
||||
int length2 = paint.breakText(text, length, width, &mm);
|
||||
SkASSERT(length2 == length);
|
||||
SkASSERT(mm == width);
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,7 @@ protected:
|
||||
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
paint.setLCDRenderText(true);
|
||||
tbox.setText(gText, strlen(gText), paint);
|
||||
|
||||
for (int i = 9; i < 24; i += 2) {
|
||||
|
@ -17,7 +17,7 @@ static inline SkPMColor rgb2gray(SkPMColor c)
|
||||
unsigned g = SkGetPackedG32(c);
|
||||
unsigned b = SkGetPackedB32(c);
|
||||
|
||||
unsigned x = r * 5 + g * 7 + b * 4 >> 4;
|
||||
unsigned x = (r * 5 + g * 7 + b * 4) >> 4;
|
||||
|
||||
return SkPackARGB32(0, x, x, x) | (c & (SK_A32_MASK << SK_A32_SHIFT));
|
||||
}
|
||||
|
@ -135,7 +135,9 @@ bool SkWindow::handleInval(const SkRect* localR)
|
||||
}
|
||||
|
||||
void SkWindow::forceInvalAll() {
|
||||
fDirtyRgn.setRect(0, 0, this->width(), this->height());
|
||||
fDirtyRgn.setRect(0, 0,
|
||||
SkScalarCeil(this->width()),
|
||||
SkScalarCeil(this->height()));
|
||||
}
|
||||
|
||||
#if defined(SK_BUILD_FOR_WINCE) && defined(USE_GX_SCREEN)
|
||||
|
Loading…
Reference in New Issue
Block a user