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
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp
index 5ec64cf..f904859 100644
--- a/tests/BitmapCopyTest.cpp
+++ b/tests/BitmapCopyTest.cpp
@@ -11,7 +11,7 @@
 };
 
 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 @@
 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 @@
         { 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 @@
                            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());