Chromium Code Reviews| Index: samplecode/SampleTinyBitmap.cpp |
| diff --git a/samplecode/SampleTinyBitmap.cpp b/samplecode/SampleTinyBitmap.cpp |
| index 16cbce4adc7e038c23116f3ef3974734b00bd49e..42866d07adfe6b370e7be9f4430fbfbfb6631dbd 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 = ctable->lockColors(); |
| + SkPMColor c[N]; |
| for (int i = 0; i < N; i++) { |
| c[i] = SkPackARGB32(0x80, 0x80, 0, 0); |
| } |
| - ctable->unlockColors(true); |
| + SkColorTable* ctable = new SkColorTable(c, N); |
| + |
| + SkBitmap bm; |
| bm.setConfig(SkBitmap::kIndex8_Config, 1, 1); |
| bm.allocPixels(ctable); |
| ctable->unref(); |
| @@ -58,10 +58,13 @@ protected: |
| static void setBitmapOpaque(SkBitmap* bm, bool isOpaque) { |
| SkAutoLockPixels alp(*bm); // needed for ctable |
| bm->setIsOpaque(isOpaque); |
| +#if 0 |
|
djsollen
2013/10/09 15:42:18
same?
reed1
2013/10/09 15:51:25
same as other sample (not even gm) comment
|
| + // 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) { |