Revert "change SkColorTable to be immutable"
This reverts commit 1c0ff422868b3badf5ffe0790a5d051d1896e2f7.
BUG=
Review URL: https://codereview.chromium.org/26709002
git-svn-id: http://skia.googlecode.com/svn/trunk@11677 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/samplecode/SampleTinyBitmap.cpp b/samplecode/SampleTinyBitmap.cpp
index 42866d0..16cbce4 100644
--- a/samplecode/SampleTinyBitmap.cpp
+++ b/samplecode/SampleTinyBitmap.cpp
@@ -13,15 +13,15 @@
#include "SkUtils.h"
static SkBitmap make_bitmap() {
+ SkBitmap bm;
const int N = 1;
+ SkColorTable* ctable = new SkColorTable(N);
- SkPMColor c[N];
+ SkPMColor* c = ctable->lockColors();
for (int i = 0; i < N; i++) {
c[i] = SkPackARGB32(0x80, 0x80, 0, 0);
}
- SkColorTable* ctable = new SkColorTable(c, N);
-
- SkBitmap bm;
+ ctable->unlockColors(true);
bm.setConfig(SkBitmap::kIndex8_Config, 1, 1);
bm.allocPixels(ctable);
ctable->unref();
@@ -58,13 +58,10 @@
static void setBitmapOpaque(SkBitmap* bm, bool isOpaque) {
SkAutoLockPixels alp(*bm); // needed for ctable
bm->setIsOpaque(isOpaque);
-#if 0
- // TODO - I think we just want to not allow this anymore
SkColorTable* ctable = bm->getColorTable();
if (ctable) {
ctable->setIsOpaque(isOpaque);
}
-#endif
}
virtual void onDrawContent(SkCanvas* canvas) {