| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
| 10 #include "SkShader.h" | 10 #include "SkShader.h" |
| 11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
| 12 #include "SkUtils.h" | 12 #include "SkUtils.h" |
| 13 | 13 |
| 14 namespace skiagm { | 14 namespace skiagm { |
| 15 | 15 |
| 16 static SkBitmap make_bitmap() { | 16 static SkBitmap make_bitmap() { |
| 17 const SkPMColor c[] = { SkPackARGB32(0x80, 0x80, 0, 0) }; | 17 SkBitmap bm; |
| 18 SkColorTable* ctable = new SkColorTable(c, SK_ARRAY_COUNT(c)); | |
| 19 | 18 |
| 20 SkBitmap bm; | 19 SkColorTable* ctable = new SkColorTable(1); |
| 20 SkPMColor* c = ctable->lockColors(); |
| 21 c[0] = SkPackARGB32(0x80, 0x80, 0, 0); |
| 22 ctable->unlockColors(true); |
| 23 |
| 21 bm.setConfig(SkBitmap::kIndex8_Config, 1, 1); | 24 bm.setConfig(SkBitmap::kIndex8_Config, 1, 1); |
| 22 bm.allocPixels(ctable); | 25 bm.allocPixels(ctable); |
| 23 ctable->unref(); | 26 ctable->unref(); |
| 24 | 27 |
| 25 bm.lockPixels(); | 28 bm.lockPixels(); |
| 26 *bm.getAddr8(0, 0) = 0; | 29 *bm.getAddr8(0, 0) = 0; |
| 27 bm.unlockPixels(); | 30 bm.unlockPixels(); |
| 28 return bm; | 31 return bm; |
| 29 } | 32 } |
| 30 | 33 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 55 private: | 58 private: |
| 56 typedef GM INHERITED; | 59 typedef GM INHERITED; |
| 57 }; | 60 }; |
| 58 | 61 |
| 59 ////////////////////////////////////////////////////////////////////////////// | 62 ////////////////////////////////////////////////////////////////////////////// |
| 60 | 63 |
| 61 static GM* MyFactory(void*) { return new TinyBitmapGM; } | 64 static GM* MyFactory(void*) { return new TinyBitmapGM; } |
| 62 static GMRegistry reg(MyFactory); | 65 static GMRegistry reg(MyFactory); |
| 63 | 66 |
| 64 } | 67 } |
| OLD | NEW |