OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 protected: | 29 protected: |
30 void onOnceBeforeDraw() override { | 30 void onOnceBeforeDraw() override { |
31 // Copyright-free file from http://openclipart.org/detail/29213/paper-pl
ane-by-ddoo | 31 // Copyright-free file from http://openclipart.org/detail/29213/paper-pl
ane-by-ddoo |
32 SkString pngFilename = GetResourcePath("plane.png"); | 32 SkString pngFilename = GetResourcePath("plane.png"); |
33 SkAutoDataUnref data(SkData::NewFromFileName(pngFilename.c_str())); | 33 SkAutoDataUnref data(SkData::NewFromFileName(pngFilename.c_str())); |
34 if (data.get()) { | 34 if (data.get()) { |
35 // Create a cache which will boot the pixels out anytime the | 35 // Create a cache which will boot the pixels out anytime the |
36 // bitmap is unlocked. | 36 // bitmap is unlocked. |
37 SkAutoTUnref<SkDiscardableMemoryPool> pool( | 37 SkAutoTUnref<SkDiscardableMemoryPool> pool( |
38 SkDiscardableMemoryPool::Create(1)); | 38 SkDiscardableMemoryPool::Create(1)); |
39 SkAssertResult(SkInstallDiscardablePixelRef(SkImageGenerator::NewFro
mEncoded(data), | 39 SkAssertResult(SkDEPRECATED_InstallDiscardablePixelRef( |
| 40 SkImageGenerator::NewFro
mEncoded(data), |
40 nullptr, &fBitmap, pool)
); | 41 nullptr, &fBitmap, pool)
); |
41 } | 42 } |
42 } | 43 } |
43 | 44 |
44 SkString onShortName() override { | 45 SkString onShortName() override { |
45 return SkString("factory"); | 46 return SkString("factory"); |
46 } | 47 } |
47 | 48 |
48 SkISize onISize() override { | 49 SkISize onISize() override { |
49 return SkISize::Make(640, 480); | 50 return SkISize::Make(640, 480); |
50 } | 51 } |
51 | 52 |
52 void onDraw(SkCanvas* canvas) override { | 53 void onDraw(SkCanvas* canvas) override { |
53 canvas->drawBitmap(fBitmap, 0, 0); | 54 canvas->drawBitmap(fBitmap, 0, 0); |
54 } | 55 } |
55 | 56 |
56 private: | 57 private: |
57 SkBitmap fBitmap; | 58 SkBitmap fBitmap; |
58 | 59 |
59 typedef GM INHERITED; | 60 typedef GM INHERITED; |
60 }; | 61 }; |
61 | 62 |
62 ////////////////////////////////////////////////////////////////////////////// | 63 ////////////////////////////////////////////////////////////////////////////// |
63 | 64 |
64 static GM* MyFactory(void*) { return new FactoryGM; } | 65 static GM* MyFactory(void*) { return new FactoryGM; } |
65 static GMRegistry reg(MyFactory); | 66 static GMRegistry reg(MyFactory); |
66 | 67 |
67 } // namespace skiagm | 68 } // namespace skiagm |
OLD | NEW |