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

Side by Side Diff: samplecode/SampleShaders.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/SampleRegion.cpp ('k') | samplecode/SampleSlides.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 #include "SkTypeface.h" 22 #include "SkTypeface.h"
23 23
(...skipping 14 matching lines...) Expand all
38 38
39 return SkShader::MakeComposeShader(std::move(shaderB), std::move(shaderA), m ode); 39 return SkShader::MakeComposeShader(std::move(shaderB), std::move(shaderA), m ode);
40 } 40 }
41 41
42 class ShaderView : public SampleView { 42 class ShaderView : public SampleView {
43 public: 43 public:
44 sk_sp<SkShader> fShader; 44 sk_sp<SkShader> fShader;
45 SkBitmap fBitmap; 45 SkBitmap fBitmap;
46 46
47 ShaderView() { 47 ShaderView() {
48 SkImageDecoder::DecodeFile("/skimages/logo.gif", &fBitmap); 48 decode_file("/skimages/logo.gif", &fBitmap);
49 49
50 SkPoint pts[2]; 50 SkPoint pts[2];
51 SkColor colors[2]; 51 SkColor colors[2];
52 52
53 pts[0].set(0, 0); 53 pts[0].set(0, 0);
54 pts[1].set(SkIntToScalar(100), 0); 54 pts[1].set(SkIntToScalar(100), 0);
55 colors[0] = SK_ColorRED; 55 colors[0] = SK_ColorRED;
56 colors[1] = SK_ColorBLUE; 56 colors[1] = SK_ColorBLUE;
57 auto shaderA = SkGradientShader::MakeLinear(pts, colors, nullptr, 2, SkS hader::kClamp_TileMode); 57 auto shaderA = SkGradientShader::MakeLinear(pts, colors, nullptr, 2, SkS hader::kClamp_TileMode);
58 58
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
115 115
116 private: 116 private:
117 typedef SampleView INHERITED; 117 typedef SampleView INHERITED;
118 }; 118 };
119 119
120 ////////////////////////////////////////////////////////////////////////////// 120 //////////////////////////////////////////////////////////////////////////////
121 121
122 static SkView* MyFactory() { return new ShaderView; } 122 static SkView* MyFactory() { return new ShaderView; }
123 static SkViewRegister reg(MyFactory); 123 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleRegion.cpp ('k') | samplecode/SampleSlides.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698