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 "SkView.h" | 9 #include "SkView.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 18 matching lines...) Expand all Loading... |
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], kN32_SkColorType
, | 38 SkImageDecoder::DecodeFile(gNames[i], &fBitmaps[i], kN32_SkColorType
, |
39 SkImageDecoder::kDecodePixels_Mode, NULL)
; | 39 SkImageDecoder::kDecodePixels_Mode, nullp
tr); |
40 } | 40 } |
41 for (int i = fBitmapCount/2; i < fBitmapCount; i++) { | 41 for (int i = fBitmapCount/2; i < fBitmapCount; i++) { |
42 SkImageDecoder::DecodeFile(gNames[i-fBitmapCount/2], &fBitmaps[i], k
RGB_565_SkColorType, | 42 SkImageDecoder::DecodeFile(gNames[i-fBitmapCount/2], &fBitmaps[i], k
RGB_565_SkColorType, |
43 SkImageDecoder::kDecodePixels_Mode, NULL)
; | 43 SkImageDecoder::kDecodePixels_Mode, nullp
tr); |
44 } | 44 } |
45 fCurrIndex = 0; | 45 fCurrIndex = 0; |
46 | 46 |
47 this->setBGColor(SK_ColorGRAY); | 47 this->setBGColor(SK_ColorGRAY); |
48 } | 48 } |
49 | 49 |
50 virtual ~Filter2View() { | 50 virtual ~Filter2View() { |
51 delete[] fBitmaps; | 51 delete[] fBitmaps; |
52 } | 52 } |
53 | 53 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 | 112 |
113 private: | 113 private: |
114 typedef SampleView INHERITED; | 114 typedef SampleView INHERITED; |
115 }; | 115 }; |
116 | 116 |
117 ////////////////////////////////////////////////////////////////////////////// | 117 ////////////////////////////////////////////////////////////////////////////// |
118 | 118 |
119 static SkView* MyFactory() { return new Filter2View; } | 119 static SkView* MyFactory() { return new Filter2View; } |
120 static SkViewRegister reg(MyFactory); | 120 static SkViewRegister reg(MyFactory); |
OLD | NEW |