OLD | NEW |
1 | |
2 /* | 1 /* |
3 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
4 * | 3 * |
5 * 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 |
6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
7 */ | 6 */ |
| 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 "SkGradientShader.h" | 11 #include "SkGradientShader.h" |
12 #include "SkGraphics.h" | 12 #include "SkGraphics.h" |
13 #include "SkImageDecoder.h" | 13 #include "SkImageDecoder.h" |
14 #include "SkPath.h" | 14 #include "SkPath.h" |
15 #include "SkRegion.h" | 15 #include "SkRegion.h" |
16 #include "SkShader.h" | 16 #include "SkShader.h" |
17 #include "SkUtils.h" | 17 #include "SkUtils.h" |
(...skipping 10 matching lines...) Expand all Loading... |
28 public: | 28 public: |
29 SkBitmap* fBitmaps; | 29 SkBitmap* fBitmaps; |
30 int fBitmapCount; | 30 int fBitmapCount; |
31 int fCurrIndex; | 31 int fCurrIndex; |
32 | 32 |
33 Filter2View() { | 33 Filter2View() { |
34 fBitmapCount = SK_ARRAY_COUNT(gNames)*2; | 34 fBitmapCount = SK_ARRAY_COUNT(gNames)*2; |
35 fBitmaps = new SkBitmap[fBitmapCount]; | 35 fBitmaps = new SkBitmap[fBitmapCount]; |
36 | 36 |
37 for (int i = 0; i < fBitmapCount/2; i++) { | 37 for (int i = 0; i < fBitmapCount/2; i++) { |
38 SkImageDecoder::DecodeFile(gNames[i], &fBitmaps[i], | 38 SkImageDecoder::DecodeFile(gNames[i], &fBitmaps[i], kN32_SkColorType
, |
39 SkBitmap::kARGB_8888_Config, | 39 SkImageDecoder::kDecodePixels_Mode, NULL)
; |
40 SkImageDecoder::kDecodePixels_Mode, NULL); | |
41 } | 40 } |
42 for (int i = fBitmapCount/2; i < fBitmapCount; i++) { | 41 for (int i = fBitmapCount/2; i < fBitmapCount; i++) { |
43 SkImageDecoder::DecodeFile(gNames[i-fBitmapCount/2], &fBitmaps[i], | 42 SkImageDecoder::DecodeFile(gNames[i-fBitmapCount/2], &fBitmaps[i], k
RGB_565_SkColorType, |
44 SkBitmap::kRGB_565_Config, | 43 SkImageDecoder::kDecodePixels_Mode, NULL)
; |
45 SkImageDecoder::kDecodePixels_Mode, NULL); | |
46 } | 44 } |
47 fCurrIndex = 0; | 45 fCurrIndex = 0; |
48 | 46 |
49 this->setBGColor(SK_ColorGRAY); | 47 this->setBGColor(SK_ColorGRAY); |
50 } | 48 } |
51 | 49 |
52 virtual ~Filter2View() { | 50 virtual ~Filter2View() { |
53 delete[] fBitmaps; | 51 delete[] fBitmaps; |
54 } | 52 } |
55 | 53 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 111 } |
114 | 112 |
115 private: | 113 private: |
116 typedef SampleView INHERITED; | 114 typedef SampleView INHERITED; |
117 }; | 115 }; |
118 | 116 |
119 ////////////////////////////////////////////////////////////////////////////// | 117 ////////////////////////////////////////////////////////////////////////////// |
120 | 118 |
121 static SkView* MyFactory() { return new Filter2View; } | 119 static SkView* MyFactory() { return new Filter2View; } |
122 static SkViewRegister reg(MyFactory); | 120 static SkViewRegister reg(MyFactory); |
OLD | NEW |