зеркало из https://github.com/mozilla/moz-skia.git
warning fixes
Review URL http://codereview.appspot.com/5328050/ git-svn-id: http://skia.googlecode.com/svn/trunk@2548 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
c5507bfe2d
Коммит
72e49b8982
|
@ -32,8 +32,8 @@ protected:
|
|||
// Compute these independently and store in variables, rather
|
||||
// than in the parameter-passing expression, to get consistent
|
||||
// evaluation order across compilers.
|
||||
float y = rand->nextUScalar1() * 480;
|
||||
float x = rand->nextUScalar1() * 640;
|
||||
SkScalar y = rand->nextUScalar1() * 480;
|
||||
SkScalar x = rand->nextUScalar1() * 640;
|
||||
pts[i].set(x, y);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ protected:
|
|||
paint->setColor(SK_ColorRED);
|
||||
paint->setStyle(SkPaint::kFill_Style);
|
||||
SkScalar x = D/2;
|
||||
float y = D/2 - (fm.fAscent + fm.fDescent)/2;
|
||||
SkScalar y = D/2 - (fm.fAscent + fm.fDescent)/2;
|
||||
SkString str;
|
||||
str.appendS32(count);
|
||||
canvas->drawText(str.c_str(), str.size(), x, y, *paint);
|
||||
|
|
|
@ -46,6 +46,20 @@
|
|||
static const SkMScalar SK_MScalarPI = 3.14159265f;
|
||||
#endif
|
||||
|
||||
#ifdef SK_SCALAR_IS_FLOAT
|
||||
#define SkMScalarToScalar SkMScalarToFloat
|
||||
#define SkScalarToMScalar SkFloatToMScalar
|
||||
#else
|
||||
#if SK_MSCALAR_IS_DOUBLE
|
||||
// we don't have fixed <-> double macros, use double<->scalar macros
|
||||
#define SkMScalarToScalar SkDoubleToScalar
|
||||
#define SkScalarToMScalar SkScalarToDouble
|
||||
#else
|
||||
#define SkMScalarToScalar SkFloatToFixed
|
||||
#define SkScalarToMScalar SkFixedToFloat
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static const SkMScalar SK_MScalar1 = 1;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -75,10 +75,10 @@ struct GrDrawState {
|
|||
Edge(float x, float y, float z) : fX(x), fY(y), fZ(z) {}
|
||||
GrPoint intersect(const Edge& other) {
|
||||
return GrPoint::Make(
|
||||
(fY * other.fZ - other.fY * fZ) /
|
||||
(fX * other.fY - other.fX * fY),
|
||||
(fX * other.fZ - other.fX * fZ) /
|
||||
(other.fX * fY - fX * other.fY));
|
||||
SkFloatToScalar((fY * other.fZ - other.fY * fZ) /
|
||||
(fX * other.fY - other.fX * fY)),
|
||||
SkFloatToScalar((fX * other.fZ - other.fX * fZ) /
|
||||
(other.fX * fY - fX * other.fY)));
|
||||
}
|
||||
float fX, fY, fZ;
|
||||
};
|
||||
|
|
|
@ -326,7 +326,7 @@ void SkMatrix44::map(const SkScalar src[4], SkScalar dst[4]) const {
|
|||
for (int j = 0; j < 4; j++) {
|
||||
value += fMat[j][i] * src[j];
|
||||
}
|
||||
result[i] = value;
|
||||
result[i] = SkMScalarToScalar(value);
|
||||
}
|
||||
memcpy(dst, result, sizeof(result));
|
||||
}
|
||||
|
@ -355,12 +355,12 @@ void SkMatrix44::dump() const {
|
|||
|
||||
static void initFromMatrix(SkMScalar dst[4][4], const SkMatrix& src) {
|
||||
sk_bzero(dst, 16 * sizeof(SkMScalar));
|
||||
dst[0][0] = src[SkMatrix::kMScaleX];
|
||||
dst[1][0] = src[SkMatrix::kMSkewX];
|
||||
dst[3][0] = src[SkMatrix::kMTransX];
|
||||
dst[0][1] = src[SkMatrix::kMSkewY];
|
||||
dst[1][1] = src[SkMatrix::kMScaleY];
|
||||
dst[3][1] = src[SkMatrix::kMTransY];
|
||||
dst[0][0] = SkScalarToMScalar(src[SkMatrix::kMScaleX]);
|
||||
dst[1][0] = SkScalarToMScalar(src[SkMatrix::kMSkewX]);
|
||||
dst[3][0] = SkScalarToMScalar(src[SkMatrix::kMTransX]);
|
||||
dst[0][1] = SkScalarToMScalar(src[SkMatrix::kMSkewY]);
|
||||
dst[1][1] = SkScalarToMScalar(src[SkMatrix::kMScaleY]);
|
||||
dst[3][1] = SkScalarToMScalar(src[SkMatrix::kMTransY]);
|
||||
dst[2][2] = dst[3][3] = 1;
|
||||
}
|
||||
|
||||
|
@ -377,13 +377,13 @@ SkMatrix44::operator SkMatrix() const {
|
|||
SkMatrix dst;
|
||||
dst.reset(); // setup our perspective correctly for identity
|
||||
|
||||
dst[SkMatrix::kMScaleX] = SkMScalarToFloat(fMat[0][0]);
|
||||
dst[SkMatrix::kMSkewX] = SkMScalarToFloat(fMat[1][0]);
|
||||
dst[SkMatrix::kMTransX] = SkMScalarToFloat(fMat[3][0]);
|
||||
dst[SkMatrix::kMScaleX] = SkMScalarToScalar(fMat[0][0]);
|
||||
dst[SkMatrix::kMSkewX] = SkMScalarToScalar(fMat[1][0]);
|
||||
dst[SkMatrix::kMTransX] = SkMScalarToScalar(fMat[3][0]);
|
||||
|
||||
dst[SkMatrix::kMSkewY] = SkMScalarToFloat(fMat[0][1]);
|
||||
dst[SkMatrix::kMScaleY] = SkMScalarToFloat(fMat[1][1]);
|
||||
dst[SkMatrix::kMTransY] = SkMScalarToFloat(fMat[3][1]);
|
||||
dst[SkMatrix::kMSkewY] = SkMScalarToScalar(fMat[0][1]);
|
||||
dst[SkMatrix::kMScaleY] = SkMScalarToScalar(fMat[1][1]);
|
||||
dst[SkMatrix::kMTransY] = SkMScalarToScalar(fMat[3][1]);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче