OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "Resources.h" | 8 #include "Resources.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCommandLineFlags.h" | 10 #include "SkCommandLineFlags.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 SkDebugf("Resource %s not found.\n", resource); | 39 SkDebugf("Resource %s not found.\n", resource); |
40 return NULL; | 40 return NULL; |
41 } | 41 } |
42 } | 42 } |
43 | 43 |
44 SkTypeface* GetResourceAsTypeface(const char* resource) { | 44 SkTypeface* GetResourceAsTypeface(const char* resource) { |
45 SkAutoTDelete<SkStreamAsset> stream(GetResourceAsStream(resource)); | 45 SkAutoTDelete<SkStreamAsset> stream(GetResourceAsStream(resource)); |
46 if (!stream) { | 46 if (!stream) { |
47 return NULL; | 47 return NULL; |
48 } | 48 } |
49 SkAutoTUnref<SkTypeface> typeface(SkTypeface::CreateFromStream(stream.detach
())); | 49 return SkTypeface::CreateFromStream(stream.detach()); |
50 if (!typeface) { | |
51 SkDebugf("Resource %s not a valid font.\n", resource); | |
52 } | |
53 return typeface.detach(); | |
54 } | 50 } |
OLD | NEW |