| 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 "SampleCode.h" | 8 #include "SampleCode.h" |
| 9 #include "SkView.h" | 9 #include "SkView.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "sk_tool_utils.h" | 23 #include "sk_tool_utils.h" |
| 24 | 24 |
| 25 static void make_bm(SkBitmap* bm) { | 25 static void make_bm(SkBitmap* bm) { |
| 26 const SkPMColor colors[] = { | 26 const SkPMColor colors[] = { |
| 27 SkPreMultiplyColor(SK_ColorRED), SkPreMultiplyColor(SK_ColorGREEN), | 27 SkPreMultiplyColor(SK_ColorRED), SkPreMultiplyColor(SK_ColorGREEN), |
| 28 SkPreMultiplyColor(SK_ColorBLUE), SkPreMultiplyColor(SK_ColorWHITE) | 28 SkPreMultiplyColor(SK_ColorBLUE), SkPreMultiplyColor(SK_ColorWHITE) |
| 29 }; | 29 }; |
| 30 SkColorTable* ctable = new SkColorTable(colors, 4); | 30 SkColorTable* ctable = new SkColorTable(colors, 4); |
| 31 bm->allocPixels(SkImageInfo::Make(2, 2, kIndex_8_SkColorType, | 31 bm->allocPixels(SkImageInfo::Make(2, 2, kIndex_8_SkColorType, |
| 32 kOpaque_SkAlphaType), | 32 kOpaque_SkAlphaType), |
| 33 NULL, ctable); | 33 nullptr, ctable); |
| 34 ctable->unref(); | 34 ctable->unref(); |
| 35 | 35 |
| 36 *bm->getAddr8(0, 0) = 0; | 36 *bm->getAddr8(0, 0) = 0; |
| 37 *bm->getAddr8(1, 0) = 1; | 37 *bm->getAddr8(1, 0) = 1; |
| 38 *bm->getAddr8(0, 1) = 2; | 38 *bm->getAddr8(0, 1) = 2; |
| 39 *bm->getAddr8(1, 1) = 3; | 39 *bm->getAddr8(1, 1) = 3; |
| 40 } | 40 } |
| 41 | 41 |
| 42 static SkScalar draw_bm(SkCanvas* canvas, const SkBitmap& bm, | 42 static SkScalar draw_bm(SkCanvas* canvas, const SkBitmap& bm, |
| 43 SkScalar x, SkScalar y, SkPaint* paint) { | 43 SkScalar x, SkScalar y, SkPaint* paint) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 113 } |
| 114 | 114 |
| 115 private: | 115 private: |
| 116 typedef SampleView INHERITED; | 116 typedef SampleView INHERITED; |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 ////////////////////////////////////////////////////////////////////////////// | 119 ////////////////////////////////////////////////////////////////////////////// |
| 120 | 120 |
| 121 static SkView* MyFactory() { return new FilterView; } | 121 static SkView* MyFactory() { return new FilterView; } |
| 122 static SkViewRegister reg(MyFactory); | 122 static SkViewRegister reg(MyFactory); |
| OLD | NEW |