Suppress some warnings on linux.
R=reed@google.com Review URL: https://codereview.appspot.com/6572046 git-svn-id: http://skia.googlecode.com/svn/trunk@5687 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
5c83dcc371
commit
373ebc6345
@ -110,9 +110,9 @@ private:
|
||||
|
||||
static inline float SkFastInvSqrt(float x) {
|
||||
float xhalf = 0.5f*x;
|
||||
int i = *(int*)&x;
|
||||
int i = *SkTCast<int*>(&x);
|
||||
i = 0x5f3759df - (i>>1);
|
||||
x = *(float*)&i;
|
||||
x = *SkTCast<float*>(&i);
|
||||
x = x*(1.5f-xhalf*x*x);
|
||||
// x = x*(1.5f-xhalf*x*x); // this line takes err from 10^-3 to 10^-6
|
||||
return x;
|
||||
|
@ -272,13 +272,15 @@ protected:
|
||||
path->lineTo(fPoints[(fCurrPoint++) & (kNumPoints - 1)]);
|
||||
break;
|
||||
case SkPath::kQuad_Verb:
|
||||
path->quadTo(fPoints[(fCurrPoint++) & (kNumPoints - 1)],
|
||||
fPoints[(fCurrPoint++) & (kNumPoints - 1)]);
|
||||
path->quadTo(fPoints[(fCurrPoint + 0) & (kNumPoints - 1)],
|
||||
fPoints[(fCurrPoint + 1) & (kNumPoints - 1)]);
|
||||
fCurrPoint += 2;
|
||||
break;
|
||||
case SkPath::kCubic_Verb:
|
||||
path->cubicTo(fPoints[(fCurrPoint++) & (kNumPoints - 1)],
|
||||
fPoints[(fCurrPoint++) & (kNumPoints - 1)],
|
||||
fPoints[(fCurrPoint++) & (kNumPoints - 1)]);
|
||||
path->cubicTo(fPoints[(fCurrPoint + 0) & (kNumPoints - 1)],
|
||||
fPoints[(fCurrPoint + 1) & (kNumPoints - 1)],
|
||||
fPoints[(fCurrPoint + 2) & (kNumPoints - 1)]);
|
||||
fCurrPoint += 3;
|
||||
break;
|
||||
case SkPath::kClose_Verb:
|
||||
path->close();
|
||||
|
@ -40,7 +40,7 @@
|
||||
#define SK_ScalarHalf (0.5f)
|
||||
/** SK_ScalarInfinity is defined to be infinity as an SkScalar
|
||||
*/
|
||||
#define SK_ScalarInfinity (*(const float*)&gIEEEInfinity)
|
||||
#define SK_ScalarInfinity (*SkTCast<const float*>(&gIEEEInfinity))
|
||||
/** SK_ScalarMax is defined to be the largest value representable as an SkScalar
|
||||
*/
|
||||
#define SK_ScalarMax (3.402823466e+38f)
|
||||
@ -49,7 +49,7 @@
|
||||
#define SK_ScalarMin (-SK_ScalarMax)
|
||||
/** SK_ScalarNaN is defined to be 'Not a Number' as an SkScalar
|
||||
*/
|
||||
#define SK_ScalarNaN (*(const float*)(const void*)&gIEEENotANumber)
|
||||
#define SK_ScalarNaN (*SkTCast<const float*>(&gIEEENotANumber))
|
||||
/** SkScalarIsNaN(n) returns true if argument is not a number
|
||||
*/
|
||||
static inline bool SkScalarIsNaN(float x) { return x != x; }
|
||||
|
@ -269,13 +269,13 @@ void SkCamera3D::doUpdate() const {
|
||||
fAxis.normalize(&axis);
|
||||
|
||||
{
|
||||
SkScalar dot = SkUnit3D::Dot(*(const SkUnit3D*)(const void*)&fZenith, axis);
|
||||
SkScalar dot = SkUnit3D::Dot(*SkTCast<const SkUnit3D*>(&fZenith), axis);
|
||||
|
||||
zenith.fX = fZenith.fX - SkUnitScalarMul(dot, axis.fX);
|
||||
zenith.fY = fZenith.fY - SkUnitScalarMul(dot, axis.fY);
|
||||
zenith.fZ = fZenith.fZ - SkUnitScalarMul(dot, axis.fZ);
|
||||
|
||||
(void)((SkPoint3D*)(void*)&zenith)->normalize(&zenith);
|
||||
SkTCast<SkPoint3D*>(&zenith)->normalize(&zenith);
|
||||
}
|
||||
|
||||
SkUnit3D::Cross(axis, zenith, &cross);
|
||||
@ -313,8 +313,8 @@ void SkCamera3D::patchToMatrix(const SkPatch3D& quilt, SkMatrix* matrix) const {
|
||||
diff.fY = quilt.fOrigin.fY - fLocation.fY;
|
||||
diff.fZ = quilt.fOrigin.fZ - fLocation.fZ;
|
||||
|
||||
dot = SkUnit3D::Dot(*(const SkUnit3D*)(const void*)&diff,
|
||||
*(const SkUnit3D*)(((const SkScalar*)(const void*)&fOrientation) + 6));
|
||||
dot = SkUnit3D::Dot(*SkTCast<const SkUnit3D*>(&diff),
|
||||
*SkTCast<const SkUnit3D*>(SkTCast<const SkScalar*>(&fOrientation) + 6));
|
||||
|
||||
patchPtr = (const SkScalar*)&quilt;
|
||||
matrix->set(SkMatrix::kMScaleX, SkScalarDotDiv(3, patchPtr, 1, mapPtr, 1, dot));
|
||||
|
@ -154,25 +154,29 @@ if (false) { // avoid bit rot, suppress warning
|
||||
this->INHERITED::onInflate(dom, node);
|
||||
|
||||
int index;
|
||||
if ((index = dom.findList(node, "mode", "fixed,auto-width,auto-height")) >= 0)
|
||||
if ((index = dom.findList(node, "mode", "fixed,auto-width,auto-height")) >= 0) {
|
||||
this->setMode((Mode)index);
|
||||
else
|
||||
} else {
|
||||
assert_no_attr(dom, node, "mode");
|
||||
}
|
||||
|
||||
if ((index = dom.findList(node, "spacing-align", "start,center,end")) >= 0)
|
||||
if ((index = dom.findList(node, "spacing-align", "start,center,end")) >= 0) {
|
||||
this->setSpacingAlign((SkTextBox::SpacingAlign)index);
|
||||
else
|
||||
} else {
|
||||
assert_no_attr(dom, node, "spacing-align");
|
||||
}
|
||||
|
||||
SkScalar s[2];
|
||||
if (dom.findScalars(node, "margin", s, 2))
|
||||
if (dom.findScalars(node, "margin", s, 2)) {
|
||||
this->setMargin(s[0], s[1]);
|
||||
else
|
||||
} else {
|
||||
assert_no_attr(dom, node, "margin");
|
||||
}
|
||||
|
||||
const char* text = dom.findAttr(node, "text");
|
||||
if (text)
|
||||
if (text) {
|
||||
this->setText(text);
|
||||
}
|
||||
|
||||
if ((node = dom.getFirstChild(node, "paint")) != NULL &&
|
||||
(node = dom.getFirstChild(node, "screenplay")) != NULL)
|
||||
|
@ -184,14 +184,14 @@ static float nextFloat(SkRandom& rand) {
|
||||
*/
|
||||
static bool equal_float_native_skia(float x, uint32_t ni, uint32_t si) {
|
||||
if (!(x == x)) { // NAN
|
||||
return si == SK_MaxS32 || si == SK_MinS32;
|
||||
return ((int32_t)si) == SK_MaxS32 || ((int32_t)si) == SK_MinS32;
|
||||
}
|
||||
// for out of range, C is undefined, but skia always should return NaN32
|
||||
if (x > SK_MaxS32) {
|
||||
return si == SK_MaxS32;
|
||||
return ((int32_t)si) == SK_MaxS32;
|
||||
}
|
||||
if (x < -SK_MaxS32) {
|
||||
return si == SK_MinS32;
|
||||
return ((int32_t)si) == SK_MinS32;
|
||||
}
|
||||
return si == ni;
|
||||
}
|
||||
|
@ -44,8 +44,8 @@ static bool are_equal(skiatest::Reporter* reporter,
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
float aVal = a.get(i);
|
||||
float bVal = b.get(i);
|
||||
int aValI = *reinterpret_cast<int*>(&aVal);
|
||||
int bValI = *reinterpret_cast<int*>(&bVal);
|
||||
int aValI = *SkTCast<int*>(&aVal);
|
||||
int bValI = *SkTCast<int*>(&bVal);
|
||||
if (0 == aVal && 0 == bVal && aValI != bValI) {
|
||||
foundZeroSignDiff = true;
|
||||
} else {
|
||||
@ -58,8 +58,8 @@ static bool are_equal(skiatest::Reporter* reporter,
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
float aVal = a.get(i);
|
||||
float bVal = b.get(i);
|
||||
int aValI = *reinterpret_cast<int*>(&aVal);
|
||||
int bValI = *reinterpret_cast<int*>(&bVal);
|
||||
int aValI = *SkTCast<int*>(&aVal);
|
||||
int bValI = *SkTCast<int*>(&bVal);
|
||||
if (sk_float_isnan(aVal) && aValI == bValI) {
|
||||
foundNaN = true;
|
||||
} else {
|
||||
|
@ -14,7 +14,7 @@
|
||||
static const size_t MIN_CHILDREN = 6;
|
||||
static const size_t MAX_CHILDREN = 11;
|
||||
|
||||
static const size_t NUM_RECTS = 200;
|
||||
static const int NUM_RECTS = 200;
|
||||
static const size_t NUM_ITERATIONS = 100;
|
||||
static const size_t NUM_QUERIES = 50;
|
||||
|
||||
@ -46,7 +46,7 @@ static bool verify_query(SkIRect query, DataRect rects[],
|
||||
SkTDArray<void*>& found) {
|
||||
SkTDArray<void*> expected;
|
||||
// manually intersect with every rectangle
|
||||
for (size_t i = 0; i < NUM_RECTS; ++i) {
|
||||
for (int i = 0; i < NUM_RECTS; ++i) {
|
||||
if (SkIRect::IntersectsNoEmptyCheck(query, rects[i].rect)) {
|
||||
expected.push(rects[i].data);
|
||||
}
|
||||
@ -106,7 +106,7 @@ static void TestRTree(skiatest::Reporter* reporter) {
|
||||
random_data_rects(rand, rects, NUM_RECTS);
|
||||
|
||||
// First try bulk-loaded inserts
|
||||
for (size_t i = 0; i < NUM_RECTS; ++i) {
|
||||
for (int i = 0; i < NUM_RECTS; ++i) {
|
||||
rtree->insert(rects[i].data, rects[i].rect, true);
|
||||
}
|
||||
rtree->flushDeferredInserts();
|
||||
@ -118,7 +118,7 @@ static void TestRTree(skiatest::Reporter* reporter) {
|
||||
REPORTER_ASSERT(reporter, 0 == rtree->getCount());
|
||||
|
||||
// Then try immediate inserts
|
||||
for (size_t i = 0; i < NUM_RECTS; ++i) {
|
||||
for (int i = 0; i < NUM_RECTS; ++i) {
|
||||
rtree->insert(rects[i].data, rects[i].rect);
|
||||
}
|
||||
runQueries(reporter, rand, rects, *rtree);
|
||||
|
Loading…
Reference in New Issue
Block a user