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

Side by Side Diff: tools/lua/lua_pictures.cpp

Issue 17113004: Replace SkPicture(SkStream) constructors with a factory. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Remove a change in behavior Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « tools/filtermain.cpp ('k') | tools/pinspect.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 2013 Google Inc. 2 * Copyright 2013 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 "SkLua.h" 8 #include "SkLua.h"
9 #include "SkLuaCanvas.h" 9 #include "SkLuaCanvas.h"
10 #include "SkPicture.h" 10 #include "SkPicture.h"
(...skipping 28 matching lines...) Expand all
39 "testIndex %% divisor == remainder."); 39 "testIndex %% divisor == remainder.");
40 DEFINE_string2(skpPath, r, "", "Read this .skp file or .skp files from this dir" ); 40 DEFINE_string2(skpPath, r, "", "Read this .skp file or .skp files from this dir" );
41 DEFINE_string2(luaFile, l, "", "File containing lua script to run"); 41 DEFINE_string2(luaFile, l, "", "File containing lua script to run");
42 DEFINE_string2(headCode, s, "", "Optional lua code to call at beginning"); 42 DEFINE_string2(headCode, s, "", "Optional lua code to call at beginning");
43 DEFINE_string2(tailFunc, s, "", "Optional lua function to call at end"); 43 DEFINE_string2(tailFunc, s, "", "Optional lua function to call at end");
44 44
45 static SkPicture* load_picture(const char path[]) { 45 static SkPicture* load_picture(const char path[]) {
46 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path)); 46 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path));
47 SkPicture* pic = NULL; 47 SkPicture* pic = NULL;
48 if (stream.get()) { 48 if (stream.get()) {
49 bool success; 49 pic = SkPicture::CreateFromStream(stream.get(), &lazy_decode_bitmap);
50 pic = SkNEW_ARGS(SkPicture, (stream.get(), &success,
51 &lazy_decode_bitmap));
52 if (!success) {
53 SkDELETE(pic);
54 pic = NULL;
55 }
56 } 50 }
57 return pic; 51 return pic;
58 } 52 }
59 53
60 static SkData* read_into_data(const char file[]) { 54 static SkData* read_into_data(const char file[]) {
61 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(file)); 55 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(file));
62 if (!stream.get()) { 56 if (!stream.get()) {
63 return SkData::NewEmpty(); 57 return SkData::NewEmpty();
64 } 58 }
65 size_t len = stream->getLength(); 59 size_t len = stream->getLength();
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 167 }
174 } 168 }
175 return 0; 169 return 0;
176 } 170 }
177 171
178 #if !defined SK_BUILD_FOR_IOS 172 #if !defined SK_BUILD_FOR_IOS
179 int main(int argc, char * const argv[]) { 173 int main(int argc, char * const argv[]) {
180 return tool_main(argc, (char**) argv); 174 return tool_main(argc, (char**) argv);
181 } 175 }
182 #endif 176 #endif
OLDNEW
« no previous file with comments | « tools/filtermain.cpp ('k') | tools/pinspect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698