| 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" |
| 11 #include "SkShader.h" | 11 #include "SkShader.h" |
| 12 #include "SkKey.h" | 12 #include "SkKey.h" |
| 13 | 13 |
| 14 static void make_bitmap(SkBitmap* bm) { | 14 static void make_bitmap(SkBitmap* bm) { |
| 15 const int W = 100; | 15 const int W = 100; |
| 16 const int H = 100; | 16 const int H = 100; |
| 17 bm->setConfig(SkBitmap::kARGB_8888_Config, W, H); | 17 bm->allocN32Pixels(W, H); |
| 18 bm->allocPixels(); | |
| 19 | 18 |
| 20 SkPaint paint; | 19 SkPaint paint; |
| 21 SkCanvas canvas(*bm); | 20 SkCanvas canvas(*bm); |
| 22 canvas.drawColor(SK_ColorWHITE); | 21 canvas.drawColor(SK_ColorWHITE); |
| 23 | 22 |
| 24 const SkColor colors[] = { | 23 const SkColor colors[] = { |
| 25 SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE | 24 SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE |
| 26 }; | 25 }; |
| 27 | 26 |
| 28 for (int ix = 0; ix < W; ix += 1) { | 27 for (int ix = 0; ix < W; ix += 1) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 82 } |
| 84 | 83 |
| 85 private: | 84 private: |
| 86 typedef SampleView INHERITED; | 85 typedef SampleView INHERITED; |
| 87 }; | 86 }; |
| 88 | 87 |
| 89 ////////////////////////////////////////////////////////////////////////////// | 88 ////////////////////////////////////////////////////////////////////////////// |
| 90 | 89 |
| 91 static SkView* MyFactory() { return new RepeatTileView; } | 90 static SkView* MyFactory() { return new RepeatTileView; } |
| 92 static SkViewRegister reg(MyFactory); | 91 static SkViewRegister reg(MyFactory); |
| OLD | NEW |