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 "gm.h" |
| 9 |
| 10 #include "Resources.h" |
8 #include "SampleCode.h" | 11 #include "SampleCode.h" |
| 12 #include "SkCanvas.h" |
| 13 #include "SkColorFilter.h" |
| 14 #include "SkColorPriv.h" |
9 #include "SkData.h" | 15 #include "SkData.h" |
10 #include "SkDecodingImageGenerator.h" | 16 #include "SkDecodingImageGenerator.h" |
11 #include "SkDumpCanvas.h" | 17 #include "SkDumpCanvas.h" |
12 #include "SkView.h" | |
13 #include "SkCanvas.h" | |
14 #include "SkGradientShader.h" | 18 #include "SkGradientShader.h" |
15 #include "SkGraphics.h" | 19 #include "SkGraphics.h" |
16 #include "SkImageDecoder.h" | 20 #include "SkImageDecoder.h" |
17 #include "SkOSFile.h" | 21 #include "SkOSFile.h" |
18 #include "SkPath.h" | 22 #include "SkPath.h" |
19 #include "SkPicture.h" | 23 #include "SkPicture.h" |
20 #include "SkPictureRecorder.h" | 24 #include "SkPictureRecorder.h" |
21 #include "SkRandom.h" | 25 #include "SkRandom.h" |
22 #include "SkRegion.h" | 26 #include "SkRegion.h" |
23 #include "SkShader.h" | 27 #include "SkShader.h" |
24 #include "SkUtils.h" | 28 #include "SkStream.h" |
25 #include "SkColorPriv.h" | |
26 #include "SkColorFilter.h" | |
27 #include "SkTime.h" | 29 #include "SkTime.h" |
28 #include "SkTypeface.h" | 30 #include "SkTypeface.h" |
| 31 #include "SkUtils.h" |
| 32 #include "SkView.h" |
| 33 #include "SkXMLParser.h" |
29 #include "SkXfermode.h" | 34 #include "SkXfermode.h" |
30 #include "SkStream.h" | |
31 #include "SkXMLParser.h" | |
32 | |
33 #include "gm.h" | |
34 | 35 |
35 /////////////////////////////////////////////////////////////////////////////// | 36 /////////////////////////////////////////////////////////////////////////////// |
36 | 37 |
37 static SkBitmap load_bitmap() { | 38 static SkBitmap load_bitmap() { |
38 SkBitmap bm; | 39 SkBitmap bm; |
39 SkString directory = skiagm::GM::GetResourcePath(); | 40 SkString resourcePath = GetResourcePath(); |
40 SkString path = SkOSPath::SkPathJoin(directory.c_str(), "mandrill_512.png"); | 41 SkString path = SkOSPath::SkPathJoin(resourcePath.c_str(), "mandrill_512.png
"); |
41 SkAutoDataUnref data(SkData::NewFromFileName(path.c_str())); | 42 SkAutoDataUnref data(SkData::NewFromFileName(path.c_str())); |
42 if (data.get() != NULL) { | 43 if (data.get() != NULL) { |
43 SkInstallDiscardablePixelRef(SkDecodingImageGenerator::Create( | 44 SkInstallDiscardablePixelRef(SkDecodingImageGenerator::Create( |
44 data, SkDecodingImageGenerator::Options()), &bm); | 45 data, SkDecodingImageGenerator::Options()), &bm); |
45 } | 46 } |
46 return bm; | 47 return bm; |
47 } | 48 } |
48 | 49 |
49 static void drawCircle(SkCanvas* canvas, int r, SkColor color) { | 50 static void drawCircle(SkCanvas* canvas, int r, SkColor color) { |
50 SkPaint paint; | 51 SkPaint paint; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 SkPicture* fPicture; | 193 SkPicture* fPicture; |
193 SkPicture* fSubPicture; | 194 SkPicture* fSubPicture; |
194 | 195 |
195 typedef SampleView INHERITED; | 196 typedef SampleView INHERITED; |
196 }; | 197 }; |
197 | 198 |
198 ////////////////////////////////////////////////////////////////////////////// | 199 ////////////////////////////////////////////////////////////////////////////// |
199 | 200 |
200 static SkView* MyFactory() { return new PictureView; } | 201 static SkView* MyFactory() { return new PictureView; } |
201 static SkViewRegister reg(MyFactory); | 202 static SkViewRegister reg(MyFactory); |
OLD | NEW |