Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: tools/Resources.cpp

Issue 1933393002: Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Restore deleted Android code. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/Resources.h ('k') | tools/debugger/SkDrawCommand.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 SkString resourcePath = GetResourcePath(resource); 42 SkString resourcePath = GetResourcePath(resource);
43 SkAutoTDelete<SkFILEStream> stream(new SkFILEStream(resourcePath.c_str())); 43 SkAutoTDelete<SkFILEStream> stream(new SkFILEStream(resourcePath.c_str()));
44 if (stream->isValid()) { 44 if (stream->isValid()) {
45 return stream.release(); 45 return stream.release();
46 } else { 46 } else {
47 SkDebugf("Resource %s not found.\n", resource); 47 SkDebugf("Resource %s not found.\n", resource);
48 return nullptr; 48 return nullptr;
49 } 49 }
50 } 50 }
51 51
52 SkTypeface* GetResourceAsTypeface(const char* resource) { 52 sk_sp<SkTypeface> MakeResourceAsTypeface(const char* resource) {
53 SkAutoTDelete<SkStreamAsset> stream(GetResourceAsStream(resource)); 53 SkAutoTDelete<SkStreamAsset> stream(GetResourceAsStream(resource));
54 if (!stream) { 54 if (!stream) {
55 return nullptr; 55 return nullptr;
56 } 56 }
57 return SkTypeface::CreateFromStream(stream.release()); 57 return SkTypeface::MakeFromStream(stream.release());
58 } 58 }
OLDNEW
« no previous file with comments | « tools/Resources.h ('k') | tools/debugger/SkDrawCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698