aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar weita@google.com <weita@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-05-03 18:23:30 +0000
committerGravatar weita@google.com <weita@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-05-03 18:23:30 +0000
commitf9ab99aaade8c451c0e9309b4c61a448373019e3 (patch)
tree0d9bc4974227cff2f3fa8f5ecd79a57382b01595 /tests
parent4226396806f99fea03fcc4f95f6367402bd5fa3d (diff)
Allow copying an Index8 bitmap when srcConfig and dstConfig are both
Index8. Also, change the logic of SkBitmap.copyTo() to do memcpy() if srcConfig and dstConfig are the same. git-svn-id: http://skia.googlecode.com/svn/trunk@164 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests')
-rw-r--r--tests/BitmapCopyTest.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp
index 5ec64cfc03..f904859156 100644
--- a/tests/BitmapCopyTest.cpp
+++ b/tests/BitmapCopyTest.cpp
@@ -11,7 +11,7 @@ static const char* gConfigName[] = {
};
static void init_src(const SkBitmap& bitmap) {
- SkAutoLockPixels lock(bitmap);
+ SkAutoLockPixels lock(bitmap);
if (bitmap.getPixels()) {
memset(bitmap.getPixels(), 4, bitmap.getSize());
}
@@ -32,7 +32,7 @@ struct Pair {
static void TestBitmapCopy(skiatest::Reporter* reporter) {
static const Pair gPairs[] = {
{ SkBitmap::kNo_Config, "00000000" },
- { SkBitmap::kA1_Config, "01101110" },
+ { SkBitmap::kA1_Config, "01000000" },
{ SkBitmap::kA8_Config, "00101110" },
{ SkBitmap::kIndex8_Config, "00111110" },
{ SkBitmap::kRGB_565_Config, "00101110" },
@@ -40,15 +40,15 @@ static void TestBitmapCopy(skiatest::Reporter* reporter) {
{ SkBitmap::kARGB_8888_Config, "00101110" },
{ SkBitmap::kRLE_Index8_Config, "00000000" }
};
-
+
const int W = 20;
const int H = 33;
-
+
for (size_t i = 0; i < SK_ARRAY_COUNT(gPairs); i++) {
for (size_t j = 0; j < SK_ARRAY_COUNT(gPairs); j++) {
SkBitmap src, dst;
SkColorTable* ct = NULL;
-
+
src.setConfig(gPairs[i].fConfig, W, H);
if (SkBitmap::kIndex8_Config == src.config()) {
ct = init_ctable();
@@ -66,12 +66,13 @@ static void TestBitmapCopy(skiatest::Reporter* reporter) {
boolStr(success));
reporter->reportFailed(str);
}
-
+
if (success) {
REPORTER_ASSERT(reporter, src.width() == dst.width());
REPORTER_ASSERT(reporter, src.height() == dst.height());
+ REPORTER_ASSERT(reporter, dst.config() == gPairs[j].fConfig);
if (src.config() == dst.config()) {
- SkAutoLockPixels srcLock(src);
+ SkAutoLockPixels srcLock(src);
SkAutoLockPixels dstLock(dst);
REPORTER_ASSERT(reporter, src.readyToDraw());
REPORTER_ASSERT(reporter, dst.readyToDraw());