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 "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 Loading... |
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 Loading... |
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); |
OLD | NEW |