aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-31 16:31:11 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-31 16:31:11 +0000
commit6fcbfcead5dc1b61fa5b4c139a1a3714e8c58091 (patch)
treec7bfb4b07deb28223c78af4de69e2440f34c3427 /tests
parent081560e3abe25c4821b79ca1465f4dbd371c4b5c (diff)
Revert "add SK_ATTR_DEPRECATED -- will need to disable for chrome, since it triggers a warning"
This reverts commit 1d22c4aaf9d8f053f25194a1ed74b137bfb19497. git-svn-id: http://skia.googlecode.com/svn/trunk@12056 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests')
-rw-r--r--tests/BitmapCopyTest.cpp13
-rw-r--r--tests/GpuBitmapCopyTest.cpp2
-rw-r--r--tests/Matrix44Test.cpp78
-rw-r--r--tests/PathTest.cpp2
-rw-r--r--tests/ShaderImageFilterTest.cpp3
-rw-r--r--tests/Writer32Test.cpp10
-rw-r--r--tests/XfermodeTest.cpp4
7 files changed, 51 insertions, 61 deletions
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp
index 5cef1eb986..bf0d2f7813 100644
--- a/tests/BitmapCopyTest.cpp
+++ b/tests/BitmapCopyTest.cpp
@@ -96,7 +96,7 @@ static uint32_t getPixel(int x, int y, const SkBitmap& bm) {
SkAutoLockPixels lock(bm);
const void* rawAddr = bm.getAddr(x,y);
- switch (bm.config()) {
+ switch (bm.getConfig()) {
case SkBitmap::kARGB_8888_Config:
memcpy(&val, rawAddr, sizeof(uint32_t));
break;
@@ -130,7 +130,7 @@ static void setPixel(int x, int y, uint32_t val, SkBitmap& bm) {
SkAutoLockPixels lock(bm);
void* rawAddr = bm.getAddr(x,y);
- switch (bm.config()) {
+ switch (bm.getConfig()) {
case SkBitmap::kARGB_8888_Config:
memcpy(rawAddr, &val, sizeof(uint32_t));
break;
@@ -162,7 +162,7 @@ static void setPixel(int x, int y, uint32_t val, SkBitmap& bm) {
// Utility to return string containing name of each format, to
// simplify diagnostic output.
static const char* getSkConfigName(const SkBitmap& bm) {
- switch (bm.config()) {
+ switch (bm.getConfig()) {
case SkBitmap::kNo_Config: return "SkBitmap::kNo_Config";
case SkBitmap::kA1_Config: return "SkBitmap::kA1_Config";
case SkBitmap::kA8_Config: return "SkBitmap::kA8_Config";
@@ -458,7 +458,7 @@ static void TestBitmapCopy(skiatest::Reporter* reporter) {
srcReady = src.extractSubset(&subset, r);
} else {
- srcReady = src.copyTo(&subset, src.config());
+ srcReady = src.copyTo(&subset, src.getConfig());
}
// Not all configurations will generate a valid 'subset'.
@@ -469,7 +469,7 @@ static void TestBitmapCopy(skiatest::Reporter* reporter) {
// buf to a SkBitmap, but copies are done using the
// raw buffer pointer.
const size_t bufSize = subH *
- SkBitmap::ComputeRowBytes(src.config(), subW) * 2;
+ SkBitmap::ComputeRowBytes(src.getConfig(), subW) * 2;
SkAutoMalloc autoBuf (bufSize);
uint8_t* buf = static_cast<uint8_t*>(autoBuf.get());
@@ -496,7 +496,8 @@ static void TestBitmapCopy(skiatest::Reporter* reporter) {
memset(buf, 0xFF, bufSize);
// Config with stride greater than src but that fits in buf.
bufBm.setConfig(gPairs[i].fConfig, subW, subH,
- SkBitmap::ComputeRowBytes(subset.config(), subW) * 2);
+ SkBitmap::ComputeRowBytes(subset.getConfig(), subW)
+ * 2);
bufBm.setPixels(buf);
successExpected = false;
// Then attempt to copy with a stride that is too large
diff --git a/tests/GpuBitmapCopyTest.cpp b/tests/GpuBitmapCopyTest.cpp
index 6e1d74dd97..0d9cf2ba85 100644
--- a/tests/GpuBitmapCopyTest.cpp
+++ b/tests/GpuBitmapCopyTest.cpp
@@ -139,7 +139,7 @@ static void TestGpuBitmapCopy(skiatest::Reporter* reporter, GrContextFactory* fa
SkCanvas drawingCanvas(device);
SkPaint paint;
paint.setColor(SK_ColorRED);
- drawingCanvas.drawRect(SkRect::Make(subsetRect), paint);
+ drawingCanvas.drawRect(SkRect::MakeFromIRect(subsetRect), paint);
// Extract a subset. If this succeeds we will test copying the subset.
SkBitmap subset;
diff --git a/tests/Matrix44Test.cpp b/tests/Matrix44Test.cpp
index 51a6e7f950..772d7b2cf3 100644
--- a/tests/Matrix44Test.cpp
+++ b/tests/Matrix44Test.cpp
@@ -73,7 +73,8 @@ static bool nearly_equal(const SkMatrix44& a, const SkMatrix44& b) {
}
static bool is_identity(const SkMatrix44& m) {
- SkMatrix44 identity(SkMatrix44::kIdentity_Constructor);
+ SkMatrix44 identity;
+ identity.reset();
return nearly_equal(m, identity);
}
@@ -84,7 +85,7 @@ static bool bits_isonly(int value, int mask) {
static void test_constructor(skiatest::Reporter* reporter) {
// Allocate a matrix on the heap
- SkMatrix44* placeholderMatrix = new SkMatrix44(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44* placeholderMatrix = new SkMatrix44();
SkAutoTDelete<SkMatrix44> deleteMe(placeholderMatrix);
for (int row = 0; row < 4; ++row) {
@@ -114,8 +115,7 @@ static void test_constructor(skiatest::Reporter* reporter) {
}
static void test_translate(skiatest::Reporter* reporter) {
- SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 inverse(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 mat, inverse;
mat.setTranslate(0, 0, 0);
REPORTER_ASSERT(reporter, bits_isonly(mat.getType(), SkMatrix44::kIdentity_Mask));
@@ -124,9 +124,7 @@ static void test_translate(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, mat.invert(&inverse));
REPORTER_ASSERT(reporter, bits_isonly(inverse.getType(), SkMatrix44::kTranslate_Mask));
- SkMatrix44 a(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 b(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 c(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 a, b, c;
a.set3x3(1, 2, 3, 4, 5, 6, 7, 8, 9);
b.setTranslate(10, 11, 12);
@@ -142,8 +140,7 @@ static void test_translate(skiatest::Reporter* reporter) {
}
static void test_scale(skiatest::Reporter* reporter) {
- SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 inverse(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 mat, inverse;
mat.setScale(1, 1, 1);
REPORTER_ASSERT(reporter, bits_isonly(mat.getType(), SkMatrix44::kIdentity_Mask));
@@ -152,9 +149,7 @@ static void test_scale(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, mat.invert(&inverse));
REPORTER_ASSERT(reporter, bits_isonly(inverse.getType(), SkMatrix44::kScale_Mask));
- SkMatrix44 a(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 b(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 c(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 a, b, c;
a.set3x3(1, 2, 3, 4, 5, 6, 7, 8, 9);
b.setScale(10, 11, 12);
@@ -212,7 +207,7 @@ static void test_map2(skiatest::Reporter* reporter, const SkMatrix44& mat) {
}
static void test_map2(skiatest::Reporter* reporter) {
- SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 mat;
for (size_t i = 0; i < SK_ARRAY_COUNT(gMakeProcs); ++i) {
gMakeProcs[i](&mat);
@@ -221,7 +216,7 @@ static void test_map2(skiatest::Reporter* reporter) {
}
static void test_gettype(skiatest::Reporter* reporter) {
- SkMatrix44 matrix(SkMatrix44::kIdentity_Constructor);
+ SkMatrix44 matrix;
REPORTER_ASSERT(reporter, matrix.isIdentity());
REPORTER_ASSERT(reporter, SkMatrix44::kIdentity_Mask == matrix.getType());
@@ -256,7 +251,7 @@ static void test_gettype(skiatest::Reporter* reporter) {
}
static void test_common_angles(skiatest::Reporter* reporter) {
- SkMatrix44 rot(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 rot;
// Test precision of rotation in common cases
int common_angles[] = { 0, 90, -90, 180, -180, 270, -270, 360, -360 };
for (int i = 0; i < 9; ++i) {
@@ -269,10 +264,7 @@ static void test_common_angles(skiatest::Reporter* reporter) {
static void test_concat(skiatest::Reporter* reporter) {
int i;
- SkMatrix44 a(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 b(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 c(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 d(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 a, b, c, d;
a.setTranslate(10, 10, 10);
b.setScale(2, 2, 2);
@@ -309,11 +301,11 @@ static void test_concat(skiatest::Reporter* reporter) {
}
static void test_determinant(skiatest::Reporter* reporter) {
- SkMatrix44 a(SkMatrix44::kIdentity_Constructor);
+ SkMatrix44 a;
REPORTER_ASSERT(reporter, nearly_equal_double(1, a.determinant()));
a.set(1, 1, 2);
REPORTER_ASSERT(reporter, nearly_equal_double(2, a.determinant()));
- SkMatrix44 b(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 b;
REPORTER_ASSERT(reporter, a.invert(&b));
REPORTER_ASSERT(reporter, nearly_equal_double(0.5, b.determinant()));
SkMatrix44 c = b = a;
@@ -334,10 +326,11 @@ static void test_determinant(skiatest::Reporter* reporter) {
}
static void test_invert(skiatest::Reporter* reporter) {
- SkMatrix44 inverse(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 inverse;
double inverseData[16];
- SkMatrix44 identity(SkMatrix44::kIdentity_Constructor);
+ SkMatrix44 identity;
+ identity.setIdentity();
identity.invert(&inverse);
inverse.asRowMajord(inverseData);
assert16<double>(reporter, inverseData,
@@ -346,7 +339,7 @@ static void test_invert(skiatest::Reporter* reporter) {
0, 0, 1, 0,
0, 0, 0, 1);
- SkMatrix44 translation(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 translation;
translation.setTranslate(2, 3, 4);
translation.invert(&inverse);
inverse.asRowMajord(inverseData);
@@ -356,7 +349,7 @@ static void test_invert(skiatest::Reporter* reporter) {
0, 0, 1, -4,
0, 0, 0, 1);
- SkMatrix44 scale(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 scale;
scale.setScale(2, 4, 8);
scale.invert(&inverse);
inverse.asRowMajord(inverseData);
@@ -366,7 +359,7 @@ static void test_invert(skiatest::Reporter* reporter) {
0, 0, 0.125, 0,
0, 0, 0, 1);
- SkMatrix44 scaleTranslation(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 scaleTranslation;
scaleTranslation.setScale(10, 100, 1000);
scaleTranslation.preTranslate(2, 3, 4);
scaleTranslation.invert(&inverse);
@@ -377,10 +370,10 @@ static void test_invert(skiatest::Reporter* reporter) {
0, 0, 0.001, -4,
0, 0, 0, 1);
- SkMatrix44 rotation(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 rotation;
rotation.setRotateDegreesAbout(0, 0, 1, 90);
rotation.invert(&inverse);
- SkMatrix44 expected(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 expected;
double expectedInverseRotation[16] =
{0, 1, 0, 0,
-1, 0, 0, 0,
@@ -389,7 +382,7 @@ static void test_invert(skiatest::Reporter* reporter) {
expected.setRowMajord(expectedInverseRotation);
REPORTER_ASSERT(reporter, nearly_equal(expected, inverse));
- SkMatrix44 affine(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 affine;
affine.setRotateDegreesAbout(0, 0, 1, 90);
affine.preScale(10, 20, 100);
affine.preTranslate(2, 3, 4);
@@ -402,7 +395,8 @@ static void test_invert(skiatest::Reporter* reporter) {
expected.setRowMajord(expectedInverseAffine);
REPORTER_ASSERT(reporter, nearly_equal(expected, inverse));
- SkMatrix44 perspective(SkMatrix44::kIdentity_Constructor);
+ SkMatrix44 perspective;
+ perspective.setIdentity();
perspective.setDouble(3, 2, 1.0);
perspective.invert(&inverse);
double expectedInversePerspective[16] =
@@ -413,7 +407,8 @@ static void test_invert(skiatest::Reporter* reporter) {
expected.setRowMajord(expectedInversePerspective);
REPORTER_ASSERT(reporter, nearly_equal(expected, inverse));
- SkMatrix44 affineAndPerspective(SkMatrix44::kIdentity_Constructor);
+ SkMatrix44 affineAndPerspective;
+ affineAndPerspective.setIdentity();
affineAndPerspective.setDouble(3, 2, 1.0);
affineAndPerspective.preScale(10, 20, 100);
affineAndPerspective.preTranslate(2, 3, 4);
@@ -428,8 +423,8 @@ static void test_invert(skiatest::Reporter* reporter) {
}
static void test_transpose(skiatest::Reporter* reporter) {
- SkMatrix44 a(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 b(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 a;
+ SkMatrix44 b;
int i = 0;
for (int row = 0; row < 4; ++row) {
@@ -444,7 +439,7 @@ static void test_transpose(skiatest::Reporter* reporter) {
}
static void test_get_set_double(skiatest::Reporter* reporter) {
- SkMatrix44 a(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 a;
for (int row = 0; row < 4; ++row) {
for (int col = 0; col < 4; ++col) {
a.setDouble(row, col, 3.141592653589793);
@@ -459,9 +454,7 @@ static void test_get_set_double(skiatest::Reporter* reporter) {
}
static void test_set_row_col_major(skiatest::Reporter* reporter) {
- SkMatrix44 a(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 b(SkMatrix44::kUninitialized_Constructor);
-
+ SkMatrix44 a, b, c, d;
for (int row = 0; row < 4; ++row) {
for (int col = 0; col < 4; ++col) {
a.setDouble(row, col, row * 4 + col);
@@ -496,7 +489,7 @@ static void test_3x3_conversion(skiatest::Reporter* reporter) {
5, 6, 0, 8,
0, 0, 1, 0,
13, 14, 0, 16 };
- SkMatrix44 a44(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 a44;
a44.setRowMajor(values4x4);
SkMatrix a33 = a44;
@@ -505,7 +498,7 @@ static void test_3x3_conversion(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, expected33 == a33);
SkMatrix44 a44flattened = a33;
- SkMatrix44 expected44flattened(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 expected44flattened;
expected44flattened.setRowMajor(values4x4flattened);
REPORTER_ASSERT(reporter, nearly_equal(a44flattened, expected44flattened));
@@ -529,12 +522,9 @@ static void test_3x3_conversion(skiatest::Reporter* reporter) {
}
static void TestMatrix44(skiatest::Reporter* reporter) {
- SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 inverse(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 iden1(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 iden2(SkMatrix44::kUninitialized_Constructor);
- SkMatrix44 rot(SkMatrix44::kUninitialized_Constructor);
+ SkMatrix44 mat, inverse, iden1, iden2, rot;
+ mat.reset();
mat.setTranslate(1, 1, 1);
mat.invert(&inverse);
iden1.setConcat(mat, inverse);
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index d879ea6e33..6544c0b8d7 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -1768,7 +1768,7 @@ static void write_and_read_back(skiatest::Reporter* reporter,
const SkPath& p) {
SkWriter32 writer(100);
writer.writePath(p);
- size_t size = writer.bytesWritten();
+ size_t size = writer.size();
SkAutoMalloc storage(size);
writer.flatten(storage.get());
SkReader32 reader(storage.get(), size);
diff --git a/tests/ShaderImageFilterTest.cpp b/tests/ShaderImageFilterTest.cpp
index 49fc6e040b..78aa796caa 100644
--- a/tests/ShaderImageFilterTest.cpp
+++ b/tests/ShaderImageFilterTest.cpp
@@ -37,8 +37,7 @@ static void test_asShaderMode(skiatest::Reporter* reporter) {
SkShader* s = SkGradientShader::CreateRadial(
center, radius, colors, pos, SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode);
SkPaint paint;
- SkImageFilter::CropRect cr(r);
- paint.setImageFilter(SkRectShaderImageFilter::Create(s, &cr))->unref();
+ paint.setImageFilter(SkRectShaderImageFilter::Create(s, r))->unref();
canvasFilter.drawRect(r, paint);
s->unref();
}
diff --git a/tests/Writer32Test.cpp b/tests/Writer32Test.cpp
index 15218378ec..8b4aba5ec3 100644
--- a/tests/Writer32Test.cpp
+++ b/tests/Writer32Test.cpp
@@ -86,7 +86,7 @@ static void test_ptr(skiatest::Reporter* reporter) {
writer.writePtr(p1);
writer.write8(0x66);
- size_t size = writer.bytesWritten();
+ size_t size = writer.size();
REPORTER_ASSERT(reporter, 2 * sizeof(void*) + 2 * sizeof(int32_t));
char buffer[32];
@@ -103,14 +103,14 @@ static void test_ptr(skiatest::Reporter* reporter) {
static void test1(skiatest::Reporter* reporter, SkWriter32* writer) {
const uint32_t data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
for (size_t i = 0; i < SK_ARRAY_COUNT(data); ++i) {
- REPORTER_ASSERT(reporter, i*4 == writer->bytesWritten());
+ REPORTER_ASSERT(reporter, i*4 == writer->size());
writer->write32(data[i]);
uint32_t* addr = writer->peek32(i * 4);
REPORTER_ASSERT(reporter, data[i] == *addr);
}
char buffer[sizeof(data)];
- REPORTER_ASSERT(reporter, sizeof(buffer) == writer->bytesWritten());
+ REPORTER_ASSERT(reporter, sizeof(buffer) == writer->size());
writer->flatten(buffer);
REPORTER_ASSERT(reporter, !memcmp(data, buffer, sizeof(buffer)));
}
@@ -124,7 +124,7 @@ static void test2(skiatest::Reporter* reporter, SkWriter32* writer) {
len += SkWriter32::WriteStringSize(gStr, i);
writer->writeString(gStr, i);
}
- REPORTER_ASSERT(reporter, writer->bytesWritten() == len);
+ REPORTER_ASSERT(reporter, writer->size() == len);
SkAutoMalloc storage(len);
writer->flatten(storage.get());
@@ -167,7 +167,7 @@ static void testWritePad(skiatest::Reporter* reporter, SkWriter32* writer) {
}
}
- uint32_t totalBytes = writer->bytesWritten();
+ uint32_t totalBytes = writer->size();
SkAutoMalloc readStorage(totalBytes);
writer->flatten(readStorage.get());
diff --git a/tests/XfermodeTest.cpp b/tests/XfermodeTest.cpp
index 7d23b8530a..620fbf4c93 100644
--- a/tests/XfermodeTest.cpp
+++ b/tests/XfermodeTest.cpp
@@ -23,7 +23,7 @@ static void test_asMode(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, reportedMode != mode);
// test IsMode
- REPORTER_ASSERT(reporter, SkXfermode::AsMode(xfer, &reportedMode));
+ REPORTER_ASSERT(reporter, SkXfermode::IsMode(xfer, &reportedMode));
REPORTER_ASSERT(reporter, reportedMode == mode);
// repeat that test, but with asMode instead
@@ -41,7 +41,7 @@ static void test_asMode(skiatest::Reporter* reporter) {
SkXfermode::Mode reportedMode = ILLEGAL_MODE;
REPORTER_ASSERT(reporter, !bogusXfer->asMode(&reportedMode));
REPORTER_ASSERT(reporter, reportedMode == ILLEGAL_MODE);
- REPORTER_ASSERT(reporter, !SkXfermode::AsMode(bogusXfer, &reportedMode));
+ REPORTER_ASSERT(reporter, !SkXfermode::IsMode(bogusXfer, &reportedMode));
REPORTER_ASSERT(reporter, reportedMode == ILLEGAL_MODE);
bogusXfer->unref();
}