OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
12 #include "SkSurface.h" | 12 #include "SkSurface.h" |
13 | 13 |
14 static SkBitmap make_bitmap() { | 14 static SkBitmap make_bitmap() { |
15 SkBitmap bm; | 15 SkBitmap bm; |
16 bm.setConfig(SkBitmap::kARGB_8888_Config , 5, 5); | 16 bm.allocN32Pixels(5, 5); |
17 bm.allocPixels(); | |
18 | 17 |
19 for (int y = 0; y < bm.height(); y++) { | 18 for (int y = 0; y < bm.height(); y++) { |
20 uint32_t* p = bm.getAddr32(0, y); | 19 uint32_t* p = bm.getAddr32(0, y); |
21 for (int x = 0; x < bm.width(); x++) { | 20 for (int x = 0; x < bm.width(); x++) { |
22 p[x] = ((x + y) & 1) ? SK_ColorWHITE : SK_ColorBLACK; | 21 p[x] = ((x + y) & 1) ? SK_ColorWHITE : SK_ColorBLACK; |
23 } | 22 } |
24 } | 23 } |
25 bm.unlockPixels(); | 24 bm.unlockPixels(); |
26 return bm; | 25 return bm; |
27 } | 26 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 canvas->drawBitmapRectToRect(fBM, NULL, dstRect, &paint); | 101 canvas->drawBitmapRectToRect(fBM, NULL, dstRect, &paint); |
103 } | 102 } |
104 private: | 103 private: |
105 typedef SkView INHERITED; | 104 typedef SkView INHERITED; |
106 }; | 105 }; |
107 | 106 |
108 ////////////////////////////////////////////////////////////////////////////// | 107 ////////////////////////////////////////////////////////////////////////////// |
109 | 108 |
110 static SkView* MyFactory() { return new TextureDomainView; } | 109 static SkView* MyFactory() { return new TextureDomainView; } |
111 static SkViewRegister reg(MyFactory); | 110 static SkViewRegister reg(MyFactory); |
OLD | NEW |