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 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkData.h" | 10 #include "SkData.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 protected: | 28 protected: |
29 virtual void onOnceBeforeDraw() SK_OVERRIDE { | 29 virtual void onOnceBeforeDraw() SK_OVERRIDE { |
30 // Copyright-free file from http://openclipart.org/detail/29213/paper-pl
ane-by-ddoo | 30 // Copyright-free file from http://openclipart.org/detail/29213/paper-pl
ane-by-ddoo |
31 SkString filename = SkOSPath::SkPathJoin(INHERITED::gResourcePath.c_str(
), | 31 SkString filename = SkOSPath::SkPathJoin(INHERITED::gResourcePath.c_str(
), |
32 "plane.png"); | 32 "plane.png"); |
33 SkAutoDataUnref data(SkData::NewFromFileName(filename.c_str())); | 33 SkAutoDataUnref data(SkData::NewFromFileName(filename.c_str())); |
34 if (NULL != data.get()) { | 34 if (NULL != 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 SkNEW_ARGS(SkDiscardableMemoryPool, (1))); | 38 SkDiscardableMemoryPool::Create(1)); |
39 SkAssertResult(SkInstallDiscardablePixelRef( | 39 SkAssertResult(SkInstallDiscardablePixelRef( |
40 SkDecodingImageGenerator::Create( | 40 SkDecodingImageGenerator::Create( |
41 data, SkDecodingImageGenerator::Options()), | 41 data, SkDecodingImageGenerator::Options()), |
42 &fBitmap, pool)); | 42 &fBitmap, pool)); |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 virtual SkString onShortName() { | 46 virtual SkString onShortName() { |
47 return SkString("factory"); | 47 return SkString("factory"); |
48 } | 48 } |
(...skipping 16 matching lines...) Expand all Loading... |
65 | 65 |
66 typedef GM INHERITED; | 66 typedef GM INHERITED; |
67 }; | 67 }; |
68 | 68 |
69 ////////////////////////////////////////////////////////////////////////////// | 69 ////////////////////////////////////////////////////////////////////////////// |
70 | 70 |
71 static GM* MyFactory(void*) { return new FactoryGM; } | 71 static GM* MyFactory(void*) { return new FactoryGM; } |
72 static GMRegistry reg(MyFactory); | 72 static GMRegistry reg(MyFactory); |
73 | 73 |
74 } // namespace skiagm | 74 } // namespace skiagm |
OLD | NEW |