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

Side by Side Diff: samplecode/SampleAnimator.cpp

Issue 2343933002: Revert of SkFontData to use smart pointers. (Closed)
Patch Set: 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 | « include/utils/mac/SkCGUtils.h ('k') | src/animator/SkAnimateMaker.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 2011 Google Inc. 2 * Copyright 2011 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 #include "SampleCode.h" 7 #include "SampleCode.h"
8 #include "SkView.h" 8 #include "SkView.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 10
11 #include "SkAnimator.h" 11 #include "SkAnimator.h"
12 #include "SkStream.h" 12 #include "SkStream.h"
13 #include "SkDOM.h" 13 #include "SkDOM.h"
14 14
15 #include <memory>
16
17 /////////////////////////////////////////////////////////////////////////////// 15 ///////////////////////////////////////////////////////////////////////////////
18 16
19 class SkAnimatorView : public SkView { 17 class SkAnimatorView : public SkView {
20 public: 18 public:
21 SkAnimatorView(); 19 SkAnimatorView();
22 virtual ~SkAnimatorView(); 20 virtual ~SkAnimatorView();
23 21
24 void setURIBase(const char dir[]); 22 void setURIBase(const char dir[]);
25 23
26 SkAnimator* getAnimator() const { return fAnimator; } 24 SkAnimator* getAnimator() const { return fAnimator; }
(...skipping 18 matching lines...) Expand all
45 43
46 SkAnimatorView::~SkAnimatorView() { 44 SkAnimatorView::~SkAnimatorView() {
47 delete fAnimator; 45 delete fAnimator;
48 } 46 }
49 47
50 void SkAnimatorView::setURIBase(const char dir[]) { 48 void SkAnimatorView::setURIBase(const char dir[]) {
51 fBaseURI.set(dir); 49 fBaseURI.set(dir);
52 } 50 }
53 51
54 bool SkAnimatorView::decodeFile(const char path[]) { 52 bool SkAnimatorView::decodeFile(const char path[]) {
55 std::unique_ptr<SkStream> is = SkStream::MakeFromFile(path); 53 SkAutoTDelete<SkStream> is(SkStream::NewFromFile(path));
56 return is && this->decodeStream(is.get()); 54 return is.get() != nullptr && this->decodeStream(is);
57 } 55 }
58 56
59 bool SkAnimatorView::decodeMemory(const void* buffer, size_t size) { 57 bool SkAnimatorView::decodeMemory(const void* buffer, size_t size) {
60 SkMemoryStream is(buffer, size); 58 SkMemoryStream is(buffer, size);
61 return this->decodeStream(&is); 59 return this->decodeStream(&is);
62 } 60 }
63 61
64 static const SkDOMNode* find_nodeID(const SkDOM& dom, 62 static const SkDOMNode* find_nodeID(const SkDOM& dom,
65 const SkDOMNode* node, const char name[]) { 63 const SkDOMNode* node, const char name[]) {
66 if (nullptr == node) { 64 if (nullptr == node) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 av->setURIBase("/skia/trunk/animations/"); 162 av->setURIBase("/skia/trunk/animations/");
165 av->decodeFile("/skia/trunk/animations/checkbox.xml"); 163 av->decodeFile("/skia/trunk/animations/checkbox.xml");
166 #else 164 #else
167 av->setURIBase("/"); 165 av->setURIBase("/");
168 av->decodeFile("/testanim.txt"); 166 av->decodeFile("/testanim.txt");
169 #endif 167 #endif
170 return av; 168 return av;
171 } 169 }
172 170
173 static SkViewRegister reg(MyFactory); 171 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « include/utils/mac/SkCGUtils.h ('k') | src/animator/SkAnimateMaker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698