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