Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(545)

Side by Side Diff: samplecode/SampleFilter2.cpp

Issue 1812323003: Remove uses of SkImageDecoder from samplecode (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « samplecode/SampleEmboss.cpp ('k') | samplecode/SampleHairline.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "DecodeFile.h"
8 #include "SampleCode.h" 9 #include "SampleCode.h"
9 #include "SkView.h" 10 #include "SkView.h"
10 #include "SkCanvas.h" 11 #include "SkCanvas.h"
11 #include "SkGradientShader.h" 12 #include "SkGradientShader.h"
12 #include "SkGraphics.h" 13 #include "SkGraphics.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"
18 #include "SkXfermode.h" 18 #include "SkXfermode.h"
19 #include "SkColorPriv.h" 19 #include "SkColorPriv.h"
20 #include "SkColorFilter.h" 20 #include "SkColorFilter.h"
21 #include "SkTime.h" 21 #include "SkTime.h"
22 22
23 static const char* gNames[] = { 23 static const char* gNames[] = {
24 "/skimages/background_01.png" 24 "/skimages/background_01.png"
25 }; 25 };
26 26
27 class Filter2View : public SampleView { 27 class Filter2View : public SampleView {
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], kN32_SkColorType , 38 decode_file(gNames[i], &fBitmaps[i]);
39 SkImageDecoder::kDecodePixels_Mode, nullp tr);
40 } 39 }
41 for (int i = fBitmapCount/2; i < fBitmapCount; i++) { 40 for (int i = fBitmapCount/2; i < fBitmapCount; i++) {
42 SkImageDecoder::DecodeFile(gNames[i-fBitmapCount/2], &fBitmaps[i], k RGB_565_SkColorType, 41 decode_file(gNames[i-fBitmapCount/2], &fBitmaps[i], kRGB_565_SkColor Type);
43 SkImageDecoder::kDecodePixels_Mode, nullp tr);
44 } 42 }
45 fCurrIndex = 0; 43 fCurrIndex = 0;
46 44
47 this->setBGColor(SK_ColorGRAY); 45 this->setBGColor(SK_ColorGRAY);
48 } 46 }
49 47
50 virtual ~Filter2View() { 48 virtual ~Filter2View() {
51 delete[] fBitmaps; 49 delete[] fBitmaps;
52 } 50 }
53 51
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 109 }
112 110
113 private: 111 private:
114 typedef SampleView INHERITED; 112 typedef SampleView INHERITED;
115 }; 113 };
116 114
117 ////////////////////////////////////////////////////////////////////////////// 115 //////////////////////////////////////////////////////////////////////////////
118 116
119 static SkView* MyFactory() { return new Filter2View; } 117 static SkView* MyFactory() { return new Filter2View; }
120 static SkViewRegister reg(MyFactory); 118 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleEmboss.cpp ('k') | samplecode/SampleHairline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698