aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-03-31 09:20:50 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-31 15:39:31 +0000
commit2e491a6a113c5e16a3b7bede5fa6f588deeb928d (patch)
treee8540e14d4ca1dd12ca3b2df5d9ef0b6f48b3a7f /samplecode
parentf3333c89bf05fc602d9bf8e1e24547668c660383 (diff)
clean up (partially) colortable api
Needs this to land: https://codereview.chromium.org/2789853002/ Bug: skia: Change-Id: I38d916a546b7fa64d000d973e695ddda24a589e7 Reviewed-on: https://skia-review.googlesource.com/10600 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
Diffstat (limited to 'samplecode')
-rw-r--r--samplecode/SampleBlur.cpp6
-rw-r--r--samplecode/SampleDitherBitmap.cpp5
-rw-r--r--samplecode/SampleFilter.cpp4
-rw-r--r--samplecode/SampleTinyBitmap.cpp4
4 files changed, 5 insertions, 14 deletions
diff --git a/samplecode/SampleBlur.cpp b/samplecode/SampleBlur.cpp
index 7e6a32562d..c43dc9bd43 100644
--- a/samplecode/SampleBlur.cpp
+++ b/samplecode/SampleBlur.cpp
@@ -4,6 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+
#include "SampleCode.h"
#include "SkBlurMask.h"
#include "SkBlurMaskFilter.h"
@@ -20,12 +21,9 @@ static SkBitmap make_bitmap() {
}
SkBitmap bm;
- SkColorTable* ctable = new SkColorTable(c, 256);
-
bm.allocPixels(SkImageInfo::Make(256, 256, kIndex_8_SkColorType,
kPremul_SkAlphaType),
- nullptr, ctable);
- ctable->unref();
+ SkColorTable::Make(c, 256));
bm.lockPixels();
const float cx = bm.width() * 0.5f;
diff --git a/samplecode/SampleDitherBitmap.cpp b/samplecode/SampleDitherBitmap.cpp
index 676d4c3530..bdd3071c0b 100644
--- a/samplecode/SampleDitherBitmap.cpp
+++ b/samplecode/SampleDitherBitmap.cpp
@@ -56,12 +56,9 @@ static SkBitmap make_bitmap() {
for (int i = 0; i < 256; i++) {
c[i] = SkPackARGB32(0xFF, i, 0, 0);
}
- SkColorTable* ctable = new SkColorTable(c, 256);
-
SkBitmap bm;
bm.allocPixels(SkImageInfo::Make(256, 32, kIndex_8_SkColorType, kPremul_SkAlphaType),
- nullptr, ctable);
- ctable->unref();
+ SkColorTable::Make(c, 256));
bm.lockPixels();
for (int y = 0; y < bm.height(); y++) {
diff --git a/samplecode/SampleFilter.cpp b/samplecode/SampleFilter.cpp
index 66de8f317f..d12f804d19 100644
--- a/samplecode/SampleFilter.cpp
+++ b/samplecode/SampleFilter.cpp
@@ -26,11 +26,9 @@ static void make_bm(SkBitmap* bm) {
SkPreMultiplyColor(SK_ColorRED), SkPreMultiplyColor(SK_ColorGREEN),
SkPreMultiplyColor(SK_ColorBLUE), SkPreMultiplyColor(SK_ColorWHITE)
};
- SkColorTable* ctable = new SkColorTable(colors, 4);
bm->allocPixels(SkImageInfo::Make(2, 2, kIndex_8_SkColorType,
kOpaque_SkAlphaType),
- nullptr, ctable);
- ctable->unref();
+ SkColorTable::Make(colors, 4));
*bm->getAddr8(0, 0) = 0;
*bm->getAddr8(1, 0) = 1;
diff --git a/samplecode/SampleTinyBitmap.cpp b/samplecode/SampleTinyBitmap.cpp
index 4fb508b898..6b01d11d5a 100644
--- a/samplecode/SampleTinyBitmap.cpp
+++ b/samplecode/SampleTinyBitmap.cpp
@@ -19,13 +19,11 @@ static SkBitmap make_bitmap() {
for (int i = 0; i < N; i++) {
c[i] = SkPackARGB32(0x80, 0x80, 0, 0);
}
- SkColorTable* ctable = new SkColorTable(c, N);
SkBitmap bm;
bm.allocPixels(SkImageInfo::Make(1, 1, kIndex_8_SkColorType,
kPremul_SkAlphaType),
- nullptr, ctable);
- ctable->unref();
+ SkColorTable::Make(c, N));
bm.lockPixels();
for (int y = 0; y < bm.height(); y++) {