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 virtual void onOnceBeforeDraw() SK_OVERRIDE { | 28 virtual void onOnceBeforeDraw() SK_OVERRIDE { |
29 // Copyright-free file from http://openclipart.org/detail/29213/paper-pl
ane-by-ddoo | 29 // Copyright-free file from http://openclipart.org/detail/29213/paper-pl
ane-by-ddoo |
30 SkString filename = SkOSPath::SkPathJoin(INHERITED::gResourcePath.c_str(
), | 30 SkString filename = SkOSPath::SkPathJoin(INHERITED::gResourcePath.c_str(
), |
31 "plane.png"); | 31 "plane.png"); |
32 SkAutoDataUnref data(SkData::NewFromFileName(filename.c_str())); | 32 SkAutoDataUnref data(SkData::NewFromFileName(filename.c_str())); |
33 if (NULL != data.get()) { | 33 if (NULL != data.get()) { |
34 // Create a cache which will boot the pixels out anytime the | 34 // Create a cache which will boot the pixels out anytime the |
35 // bitmap is unlocked. | 35 // bitmap is unlocked. |
36 SkAutoTUnref<SkDiscardableMemoryPool> pool( | 36 SkAutoTUnref<SkDiscardableMemoryPool> pool( |
37 SkNEW_ARGS(SkDiscardableMemoryPool, (1))); | 37 SkNEW_ARGS(SkDiscardableMemoryPool, (1))); |
38 SkAssertResult(SkDecodingImageGenerator::Install(data, | 38 SkAssertResult( |
39 &fBitmap, pool)); | 39 SkDecodingImageGenerator::Install(data, &fBitmap, NULL, pool)); |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 virtual SkString onShortName() { | 43 virtual SkString onShortName() { |
44 return SkString("factory"); | 44 return SkString("factory"); |
45 } | 45 } |
46 | 46 |
47 virtual SkISize onISize() { | 47 virtual SkISize onISize() { |
48 return make_isize(640, 480); | 48 return make_isize(640, 480); |
49 } | 49 } |
(...skipping 12 matching lines...) Expand all Loading... |
62 | 62 |
63 typedef GM INHERITED; | 63 typedef GM INHERITED; |
64 }; | 64 }; |
65 | 65 |
66 ////////////////////////////////////////////////////////////////////////////// | 66 ////////////////////////////////////////////////////////////////////////////// |
67 | 67 |
68 static GM* MyFactory(void*) { return new FactoryGM; } | 68 static GM* MyFactory(void*) { return new FactoryGM; } |
69 static GMRegistry reg(MyFactory); | 69 static GMRegistry reg(MyFactory); |
70 | 70 |
71 } | 71 } |
OLD | NEW |