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

Unified Diff: samplecode/SampleBlur.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 | « include/core/SkColorTable.h ('k') | samplecode/SampleDitherBitmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleBlur.cpp
diff --git a/samplecode/SampleBlur.cpp b/samplecode/SampleBlur.cpp
index e8e97722872f71186c1fe231868a5687c22db2dd..d951d8508b528961c9444405835294ac6d541123 100644
--- a/samplecode/SampleBlur.cpp
+++ b/samplecode/SampleBlur.cpp
@@ -15,14 +15,14 @@
#include "SkView.h"
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(255 - i, 0, 0, 0);
}
- ctable->unlockColors(true);
+
+ SkBitmap bm;
+ SkColorTable* ctable = new SkColorTable(c, 256);
+
bm.setConfig(SkBitmap::kIndex8_Config, 256, 256);
bm.allocPixels(ctable);
ctable->unref();
« no previous file with comments | « include/core/SkColorTable.h ('k') | samplecode/SampleDitherBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698