aboutsummaryrefslogtreecommitdiff
path: root/samplecode/SampleDitherBitmap.cpp
diff options
context:
space:
mode:
authorreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-10 14:44:56 +0000
committerreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-10 14:44:56 +0000
commit0a6151d66cc32d91eca037c91e557158cf8a2be2 (patch)
tree7fe96285f9fee5c8804bbbc60dd0395b983511a0 /samplecode/SampleDitherBitmap.cpp
parentb006fe7e2f6178ce076a5e2c76b4540d3d27ca98 (diff)
Revert "Revert "change SkColorTable to be immutable""
This reverts commit b8162cb840f4cb6002ef68d5ac775c6a122c52a9. Fixed was call-sites in benches that used the (now gone) setIsOpaque api. R=scroggo@google.com Review URL: https://codereview.chromium.org/26572006 git-svn-id: http://skia.googlecode.com/svn/trunk@11695 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode/SampleDitherBitmap.cpp')
-rw-r--r--samplecode/SampleDitherBitmap.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/samplecode/SampleDitherBitmap.cpp b/samplecode/SampleDitherBitmap.cpp
index df727c4203..7f29305a51 100644
--- a/samplecode/SampleDitherBitmap.cpp
+++ b/samplecode/SampleDitherBitmap.cpp
@@ -54,14 +54,13 @@ static void test_pathregion() {
}
static SkBitmap make_bitmap() {
- SkBitmap bm;
- SkColorTable* ctable = new SkColorTable(256);
-
- SkPMColor* c = ctable->lockColors();
+ SkPMColor c[256];
for (int i = 0; i < 256; i++) {
c[i] = SkPackARGB32(0xFF, i, 0, 0);
}
- ctable->unlockColors(true);
+ SkColorTable* ctable = new SkColorTable(c, 256, kOpaque_SkAlphaType);
+
+ SkBitmap bm;
bm.setConfig(SkBitmap::kIndex8_Config, 256, 32);
bm.allocPixels(ctable);
ctable->unref();
@@ -102,10 +101,14 @@ protected:
static void setBitmapOpaque(SkBitmap* bm, bool isOpaque) {
SkAutoLockPixels alp(*bm); // needed for ctable
bm->setIsOpaque(isOpaque);
+#if 0
SkColorTable* ctable = bm->getColorTable();
if (ctable) {
- ctable->setIsOpaque(isOpaque);
+ if (ctable->isOpaque() != isOpaque) {
+ // how do we change a colortable? don't want to
+ }
}
+#endif
}
static void draw2(SkCanvas* canvas, const SkBitmap& bm) {