зеркало из https://github.com/mozilla/moz-skia.git
fix warings. add SkTAbs()
git-svn-id: http://skia.googlecode.com/svn/trunk@7075 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
b5715a1c80
Коммит
2b57dc6bb2
|
@ -283,6 +283,13 @@ static inline int32_t SkAbs32(int32_t value) {
|
|||
#endif
|
||||
}
|
||||
|
||||
template <typename T> inline T SkTAbs(T value) {
|
||||
if (value < 0) {
|
||||
value = -value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
static inline int32_t SkMax32(int32_t a, int32_t b) {
|
||||
if (a < b)
|
||||
a = b;
|
||||
|
|
|
@ -400,7 +400,7 @@ static void TestDeferredCanvasBitmapShaderNoLeak(skiatest::Reporter* reporter) {
|
|||
}
|
||||
}
|
||||
// All cached resources should be evictable since last canvas call was flush()
|
||||
canvas.freeMemoryIfPossible(~0);
|
||||
canvas.freeMemoryIfPossible(~0U);
|
||||
REPORTER_ASSERT(reporter, 0 == canvas.storageAllocatedForRecording());
|
||||
}
|
||||
|
||||
|
|
|
@ -15,22 +15,24 @@ static float make_zero() {
|
|||
}
|
||||
#endif
|
||||
|
||||
struct RectCenter {
|
||||
SkIRect fRect;
|
||||
SkIPoint fCenter;
|
||||
};
|
||||
|
||||
static void test_center(skiatest::Reporter* reporter) {
|
||||
static const struct {
|
||||
SkIRect fRect;
|
||||
SkIPoint fCenter;
|
||||
} data[] = {
|
||||
static const RectCenter gData[] = {
|
||||
{ { 0, 0, 0, 0 }, { 0, 0 } },
|
||||
{ { 0, 0, 1, 1 }, { 0, 0 } },
|
||||
{ { -1, -1, 0, 0 }, { -1, -1 } },
|
||||
{ { 0, 0, 10, 7 }, { 5, 3 } },
|
||||
{ { 0, 0, 11, 6 }, { 5, 3 } },
|
||||
};
|
||||
for (size_t index = 0; index < SK_ARRAY_COUNT(data); ++index) {
|
||||
for (size_t index = 0; index < SK_ARRAY_COUNT(gData); ++index) {
|
||||
REPORTER_ASSERT(reporter,
|
||||
data[index].fRect.centerX() == data[index].fCenter.x());
|
||||
gData[index].fRect.centerX() == gData[index].fCenter.x());
|
||||
REPORTER_ASSERT(reporter,
|
||||
data[index].fRect.centerY() == data[index].fCenter.y());
|
||||
gData[index].fRect.centerY() == gData[index].fCenter.y());
|
||||
}
|
||||
|
||||
SkRandom rand;
|
||||
|
|
|
@ -25,7 +25,7 @@ static bool nearly_equal_scalar(SkMScalar a, SkMScalar b) {
|
|||
const SkScalar tolerance = SK_Scalar1 / 1024;
|
||||
#endif
|
||||
|
||||
return SkScalarAbs(a - b) <= tolerance;
|
||||
return SkTAbs<SkMScalar>(a - b) <= tolerance;
|
||||
}
|
||||
|
||||
template <typename T> void assert16(skiatest::Reporter* reporter, const T data[],
|
||||
|
|
|
@ -35,7 +35,7 @@ static void test_inset(skiatest::Reporter* reporter) {
|
|||
// Test out the basic API entry points
|
||||
static void test_round_rect_basic(skiatest::Reporter* reporter) {
|
||||
// Test out initialization methods
|
||||
SkPoint zeroPt = { 0.0, 0.0 };
|
||||
SkPoint zeroPt = { 0, 0 };
|
||||
SkRRect empty;
|
||||
|
||||
empty.setEmpty();
|
||||
|
|
Загрузка…
Ссылка в новой задаче