| 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 26 matching lines...) Expand all Loading... |
| 37 return SkImage::NewFromEncoded(resourceData); | 37 return SkImage::NewFromEncoded(resourceData); |
| 38 } | 38 } |
| 39 | 39 |
| 40 SkStreamAsset* GetResourceAsStream(const char* resource) { | 40 SkStreamAsset* GetResourceAsStream(const char* resource) { |
| 41 SkString resourcePath = GetResourcePath(resource); | 41 SkString resourcePath = GetResourcePath(resource); |
| 42 SkAutoTDelete<SkFILEStream> stream(new SkFILEStream(resourcePath.c_str())); | 42 SkAutoTDelete<SkFILEStream> stream(new SkFILEStream(resourcePath.c_str())); |
| 43 if (stream->isValid()) { | 43 if (stream->isValid()) { |
| 44 return stream.detach(); | 44 return stream.detach(); |
| 45 } else { | 45 } else { |
| 46 SkDebugf("Resource %s not found.\n", resource); | 46 SkDebugf("Resource %s not found.\n", resource); |
| 47 return NULL; | 47 return nullptr; |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 | 50 |
| 51 SkTypeface* GetResourceAsTypeface(const char* resource) { | 51 SkTypeface* GetResourceAsTypeface(const char* resource) { |
| 52 SkAutoTDelete<SkStreamAsset> stream(GetResourceAsStream(resource)); | 52 SkAutoTDelete<SkStreamAsset> stream(GetResourceAsStream(resource)); |
| 53 if (!stream) { | 53 if (!stream) { |
| 54 return NULL; | 54 return nullptr; |
| 55 } | 55 } |
| 56 return SkTypeface::CreateFromStream(stream.detach()); | 56 return SkTypeface::CreateFromStream(stream.detach()); |
| 57 } | 57 } |
| OLD | NEW |