diff options
author | Mike Reed <reed@google.com> | 2017-04-01 12:14:57 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-01 16:46:11 +0000 |
commit | 9920b10f5292838f00600f676c4578cd11705e60 (patch) | |
tree | 9217d23bf701b4ccfd15d818bfea44b766ad4fc3 /gm | |
parent | ec61785bbb989a1901b063923da30c04ed41332f (diff) |
Revert[2] "clean up (partially) colortable api""
This reverts commit 1d1165ca6575e082b892c5460492c411618783ad.
Bug: skia:
Change-Id: Idbc0634ae3cec2e79f592d252de8751b077e6408
Reviewed-on: https://skia-review.googlesource.com/11024
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'gm')
-rw-r--r-- | gm/all_bitmap_configs.cpp | 3 | ||||
-rw-r--r-- | gm/bitmapfilters.cpp | 5 | ||||
-rw-r--r-- | gm/encode-srgb.cpp | 3 | ||||
-rw-r--r-- | gm/image_pict.cpp | 3 | ||||
-rw-r--r-- | gm/tinybitmap.cpp | 4 |
5 files changed, 5 insertions, 13 deletions
diff --git a/gm/all_bitmap_configs.cpp b/gm/all_bitmap_configs.cpp index ea7b73483b..60aec88ddf 100644 --- a/gm/all_bitmap_configs.cpp +++ b/gm/all_bitmap_configs.cpp @@ -124,10 +124,9 @@ static SkBitmap indexed_bitmap() { 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 2cded98236..22e5d0943f 100644 --- a/gm/bitmapfilters.cpp +++ b/gm/bitmapfilters.cpp @@ -17,12 +17,9 @@ static void make_bm(SkBitmap* bm) { 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 f62d48ae2c..894b0ef8d5 100644 --- a/gm/encode-srgb.cpp +++ b/gm/encode-srgb.cpp @@ -67,10 +67,9 @@ static void make_index8(SkBitmap* bitmap, SkAlphaType alphaType, sk_sp<SkColorSp 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 792173ce66..f23b89e728 100644 --- a/gm/image_pict.cpp +++ b/gm/image_pict.cpp @@ -199,8 +199,7 @@ static std::unique_ptr<SkImageGenerator> make_ctable_generator(GrContext*, sk_sp 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 0f0f1374ea..1640cb23d1 100644 --- a/gm/tinybitmap.cpp +++ b/gm/tinybitmap.cpp @@ -15,13 +15,11 @@ namespace skiagm { 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; |