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

Side by Side Diff: tools/viewer/SKPSlide.cpp

Issue 2339273002: SkFontData to use smart pointers. (Closed)
Patch Set: Add trivial bodies to the trivial implementations. Created 4 years, 3 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/lua/lua_pictures.cpp ('k') | no next file » | 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 2016 Google Inc. 2 * Copyright 2016 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 "SKPSlide.h" 8 #include "SKPSlide.h"
9 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 17 matching lines...) Expand all
28 28
29 canvas->drawPicture(fPic.get()); 29 canvas->drawPicture(fPic.get());
30 30
31 if (isOffset) { 31 if (isOffset) {
32 canvas->restore(); 32 canvas->restore();
33 } 33 }
34 } 34 }
35 } 35 }
36 36
37 static sk_sp<SkPicture> read_picture(const char path[]) { 37 static sk_sp<SkPicture> read_picture(const char path[]) {
38 SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(path)); 38 std::unique_ptr<SkStream> stream = SkStream::MakeFromFile(path);
39 if (stream.get() == nullptr) { 39 if (!stream) {
40 SkDebugf("Could not read %s.\n", path); 40 SkDebugf("Could not read %s.\n", path);
41 return nullptr; 41 return nullptr;
42 } 42 }
43 43
44 auto pic = SkPicture::MakeFromStream(stream.get()); 44 auto pic = SkPicture::MakeFromStream(stream.get());
45 if (!pic) { 45 if (!pic) {
46 SkDebugf("Could not read %s as an SkPicture.\n", path); 46 SkDebugf("Could not read %s as an SkPicture.\n", path);
47 } 47 }
48 return pic; 48 return pic;
49 } 49 }
50 50
51 void SKPSlide::load(SkScalar, SkScalar) { 51 void SKPSlide::load(SkScalar, SkScalar) {
52 fPic = read_picture(fPath.c_str()); 52 fPic = read_picture(fPath.c_str());
53 fCullRect = fPic->cullRect().roundOut(); 53 fCullRect = fPic->cullRect().roundOut();
54 } 54 }
55 55
56 void SKPSlide::unload() { 56 void SKPSlide::unload() {
57 fPic.reset(nullptr); 57 fPic.reset(nullptr);
58 } 58 }
OLDNEW
« no previous file with comments | « tools/lua/lua_pictures.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698