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

Unified Diff: samplecode/SampleDitherBitmap.cpp

Issue 169063002: use SkColorType instead of SkBitmap::Config in samplecode (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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/SampleDither.cpp ('k') | samplecode/SampleEncode.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 dc439002d0c8d853d419dafffb49f23ba35bad2f..d6d15e9887749e87c6b8a18dd4dee40f8ddcffa5 100644
--- a/samplecode/SampleDitherBitmap.cpp
+++ b/samplecode/SampleDitherBitmap.cpp
@@ -60,8 +60,9 @@ static SkBitmap make_bitmap() {
SkColorTable* ctable = new SkColorTable(c, 256, kOpaque_SkAlphaType);
SkBitmap bm;
- bm.setConfig(SkBitmap::kIndex8_Config, 256, 32);
- bm.allocPixels(ctable);
+ bm.allocPixels(SkImageInfo::Make(256, 32, kIndex_8_SkColorType,
+ kPremul_SkAlphaType),
+ NULL, ctable);
ctable->unref();
bm.lockPixels();
@@ -101,14 +102,6 @@ protected:
static void setBitmapOpaque(SkBitmap* bm, bool isOpaque) {
SkAutoLockPixels alp(*bm); // needed for ctable
bm->setAlphaType(isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
-#if 0
- SkColorTable* ctable = bm->getColorTable();
- if (ctable) {
- 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/SampleDither.cpp ('k') | samplecode/SampleEncode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698