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 "SkAnimTimer.h" | 10 #include "SkAnimTimer.h" |
10 #include "SkView.h" | 11 #include "SkView.h" |
11 #include "SkCanvas.h" | 12 #include "SkCanvas.h" |
12 #include "SkGradientShader.h" | 13 #include "SkGradientShader.h" |
13 #include "SkGraphics.h" | 14 #include "SkGraphics.h" |
14 #include "SkImageDecoder.h" | |
15 #include "SkPath.h" | 15 #include "SkPath.h" |
16 #include "SkRandom.h" | 16 #include "SkRandom.h" |
17 #include "SkRegion.h" | 17 #include "SkRegion.h" |
18 #include "SkShader.h" | 18 #include "SkShader.h" |
19 #include "SkUtils.h" | 19 #include "SkUtils.h" |
20 #include "SkXfermode.h" | 20 #include "SkXfermode.h" |
21 #include "SkColorPriv.h" | 21 #include "SkColorPriv.h" |
22 #include "SkColorFilter.h" | 22 #include "SkColorFilter.h" |
23 #include "SkTime.h" | 23 #include "SkTime.h" |
24 #include "SkTypeface.h" | 24 #include "SkTypeface.h" |
25 | 25 |
26 #include "SkOSFile.h" | 26 #include "SkOSFile.h" |
27 #include "SkStream.h" | 27 #include "SkStream.h" |
28 | 28 |
29 #include "SkGeometry.h" // private include :( | 29 #include "SkGeometry.h" // private include :( |
30 | 30 |
31 static sk_sp<SkShader> make_shader0(SkIPoint* size) { | 31 static sk_sp<SkShader> make_shader0(SkIPoint* size) { |
32 SkBitmap bm; | 32 SkBitmap bm; |
33 | 33 |
34 // SkImageDecoder::DecodeFile("/skimages/progressivejpg.jpg", &bm); | 34 // decode_file("/skimages/progressivejpg.jpg", &bm); |
35 SkImageDecoder::DecodeFile("/skimages/logo.png", &bm); | 35 decode_file("/skimages/logo.png", &bm); |
36 size->set(bm.width(), bm.height()); | 36 size->set(bm.width(), bm.height()); |
37 return SkShader::MakeBitmapShader(bm, SkShader::kClamp_TileMode, | 37 return SkShader::MakeBitmapShader(bm, SkShader::kClamp_TileMode, |
38 SkShader::kClamp_TileMode); | 38 SkShader::kClamp_TileMode); |
39 } | 39 } |
40 | 40 |
41 static sk_sp<SkShader> make_shader1(const SkIPoint& size) { | 41 static sk_sp<SkShader> make_shader1(const SkIPoint& size) { |
42 SkPoint pts[] = { { 0, 0, }, | 42 SkPoint pts[] = { { 0, 0, }, |
43 { SkIntToScalar(size.fX), SkIntToScalar(size.fY) } }; | 43 { SkIntToScalar(size.fX), SkIntToScalar(size.fY) } }; |
44 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorRED }
; | 44 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorRED }
; |
45 return SkGradientShader::MakeLinear(pts, colors, nullptr, | 45 return SkGradientShader::MakeLinear(pts, colors, nullptr, |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 } | 333 } |
334 | 334 |
335 private: | 335 private: |
336 typedef SampleView INHERITED; | 336 typedef SampleView INHERITED; |
337 }; | 337 }; |
338 | 338 |
339 ////////////////////////////////////////////////////////////////////////////// | 339 ////////////////////////////////////////////////////////////////////////////// |
340 | 340 |
341 static SkView* MyFactory() { return new PatchView; } | 341 static SkView* MyFactory() { return new PatchView; } |
342 static SkViewRegister reg(MyFactory); | 342 static SkViewRegister reg(MyFactory); |
OLD | NEW |