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/gm/all_bitmap_configs.cpp b/gm/all_bitmap_configs.cpp
index ea7b734..60aec88 100644
--- a/gm/all_bitmap_configs.cpp
+++ b/gm/all_bitmap_configs.cpp
@@ -124,10 +124,9 @@
         pmColors[i] = premultiply_color(colors[i]);
     }
     SkBitmap bm;
-    sk_sp<SkColorTable> ctable(new SkColorTable(pmColors, SK_ARRAY_COUNT(pmColors)));
     SkImageInfo info = SkImageInfo::Make(SCALE, SCALE, kIndex_8_SkColorType,
                                          kPremul_SkAlphaType);
-    bm.allocPixels(info, nullptr, ctable.get());
+    bm.allocPixels(info, SkColorTable::Make(pmColors, SK_ARRAY_COUNT(pmColors)));
     SkAutoLockPixels autoLockPixels1(n32bitmap);
     SkAutoLockPixels autoLockPixels2(bm);
     for (int y = 0; y < SCALE; ++y) {
diff --git a/gm/bitmapfilters.cpp b/gm/bitmapfilters.cpp
index 2cded98..22e5d09 100644
--- a/gm/bitmapfilters.cpp
+++ b/gm/bitmapfilters.cpp
@@ -17,12 +17,9 @@
     for (size_t i = 0; i < SK_ARRAY_COUNT(colors); ++i) {
         colorsPM[i] = SkPreMultiplyColor(colors[i]);
     }
-    SkColorTable* ctable = new SkColorTable(colorsPM, 4);
-
     bm->allocPixels(SkImageInfo::Make(2, 2, kIndex_8_SkColorType,
                                       kPremul_SkAlphaType),
-                    nullptr, ctable);
-    ctable->unref();
+                    SkColorTable::Make(colorsPM, 4));
 
     *bm->getAddr8(0, 0) = 0;
     *bm->getAddr8(1, 0) = 1;
diff --git a/gm/encode-srgb.cpp b/gm/encode-srgb.cpp
index f62d48a..894b0ef 100644
--- a/gm/encode-srgb.cpp
+++ b/gm/encode-srgb.cpp
@@ -67,10 +67,9 @@
         pmColors[i] = toPMColor(colors[i]);
     }
 
-    sk_sp<SkColorTable> colorTable(new SkColorTable(pmColors, SK_ARRAY_COUNT(pmColors)));
     SkImageInfo info = SkImageInfo::Make(imageWidth, imageHeight, kIndex_8_SkColorType,
                                          alphaType, colorSpace);
-    bitmap->allocPixels(info, nullptr, colorTable.get());
+    bitmap->allocPixels(info, SkColorTable::Make(pmColors, SK_ARRAY_COUNT(pmColors)));
     for (int y = 0; y < imageHeight; y++) {
         for (int x = 0; x < imageWidth; x++) {
             *bitmap->getAddr8(x, y) = (x / div_round_up(imageWidth, 2)) +
diff --git a/gm/image_pict.cpp b/gm/image_pict.cpp
index 792173c..f23b89e 100644
--- a/gm/image_pict.cpp
+++ b/gm/image_pict.cpp
@@ -199,8 +199,7 @@
     SkImageInfo info = SkImageInfo::Make(100, 100, kIndex_8_SkColorType, kPremul_SkAlphaType);
 
     SkBitmap bm2;
-    sk_sp<SkColorTable> ct(new SkColorTable(colors, count));
-    bm2.allocPixels(info, nullptr, ct.get());
+    bm2.allocPixels(info, SkColorTable::Make(colors, count));
     for (int y = 0; y < info.height(); ++y) {
         for (int x = 0; x < info.width(); ++x) {
             *bm2.getAddr8(x, y) = find_closest(*bm.getAddr32(x, y), colors, count);
diff --git a/gm/tinybitmap.cpp b/gm/tinybitmap.cpp
index 0f0f137..1640cb2 100644
--- a/gm/tinybitmap.cpp
+++ b/gm/tinybitmap.cpp
@@ -15,13 +15,11 @@
 
 static SkBitmap make_bitmap() {
     const SkPMColor c[] = { SkPackARGB32(0x80, 0x80, 0, 0) };
-    SkColorTable* ctable = new SkColorTable(c, SK_ARRAY_COUNT(c));
 
     SkBitmap bm;
     bm.allocPixels(SkImageInfo::Make(1, 1, kIndex_8_SkColorType,
                                      kPremul_SkAlphaType),
-                   nullptr, ctable);
-    ctable->unref();
+                   SkColorTable::Make(c, SK_ARRAY_COUNT(c)));
 
     bm.lockPixels();
     *bm.getAddr8(0, 0) = 0;