Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(808)

Unified Diff: samplecode/SampleDitherBitmap.cpp

Issue 25353002: change SkColorTable to be immutable (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samplecode/SampleBlur.cpp ('k') | samplecode/SampleTinyBitmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleDitherBitmap.cpp
diff --git a/samplecode/SampleDitherBitmap.cpp b/samplecode/SampleDitherBitmap.cpp
index df727c42033867ddbda6039dc27a0c4a1eb0ee32..7f29305a51a58fced0242cb0fdb8fda3c23f731f 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) {
« no previous file with comments | « samplecode/SampleBlur.cpp ('k') | samplecode/SampleTinyBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698