Revert[4] "clean up (partially) colortable api""""

Fixes:
- create temp api for android to pass nullptr
- don't release and access sk_sp<SkData> at the same time in parameters

This reverts commit b14131c1851eea6acbd34cc42a8f860daed36b21.

Bug: skia:
Change-Id: Ic0e4f62520ba9f35455499ed30d306ad19d998a8
Reviewed-on: https://skia-review.googlesource.com/11129
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp
index 70958ca..4578bbb 100644
--- a/tests/BitmapCopyTest.cpp
+++ b/tests/BitmapCopyTest.cpp
@@ -62,11 +62,11 @@
     }
 }
 
-static SkColorTable* init_ctable() {
+static sk_sp<SkColorTable> init_ctable() {
     static const SkColor colors[] = {
         SK_ColorBLACK, SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE
     };
-    return new SkColorTable(colors, SK_ARRAY_COUNT(colors));
+    return SkColorTable::Make(colors, SK_ARRAY_COUNT(colors));
 }
 
 struct Pair {
@@ -194,16 +194,13 @@
 
 static void setup_src_bitmaps(SkBitmap* srcOpaque, SkBitmap* srcPremul,
                               SkColorType ct) {
-    SkColorTable* ctable = nullptr;
+    sk_sp<SkColorTable> ctable;
     if (kIndex_8_SkColorType == ct) {
         ctable = init_ctable();
     }
 
-    srcOpaque->allocPixels(SkImageInfo::Make(W, H, ct, kOpaque_SkAlphaType),
-                           nullptr, ctable);
-    srcPremul->allocPixels(SkImageInfo::Make(W, H, ct, kPremul_SkAlphaType),
-                           nullptr, ctable);
-    SkSafeUnref(ctable);
+    srcOpaque->allocPixels(SkImageInfo::Make(W, H, ct, kOpaque_SkAlphaType), ctable);
+    srcPremul->allocPixels(SkImageInfo::Make(W, H, ct, kPremul_SkAlphaType), ctable);
     init_src(*srcOpaque);
     init_src(*srcPremul);
 }
@@ -378,7 +375,7 @@
 
             // Create bitmap to act as source for copies and subsets.
             SkBitmap src, subset;
-            SkColorTable* ct = nullptr;
+            sk_sp<SkColorTable> ct;
             if (kIndex_8_SkColorType == src.colorType()) {
                 ct = init_ctable();
             }
@@ -394,7 +391,6 @@
                                                      kPremul_SkAlphaType))) {
                 // failure is fine, as we will notice later on
             }
-            SkSafeUnref(ct);
 
             // Either copy src or extract into 'subset', which is used
             // for subsequent calls to copyPixelsTo/From.