OLD | NEW |
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 "LazyDecodeBitmap.h" | |
9 #include "SkLua.h" | 8 #include "SkLua.h" |
10 #include "SkLuaCanvas.h" | 9 #include "SkLuaCanvas.h" |
11 #include "SkPicture.h" | 10 #include "SkPicture.h" |
12 #include "SkCommandLineFlags.h" | 11 #include "SkCommandLineFlags.h" |
13 #include "SkGraphics.h" | 12 #include "SkGraphics.h" |
14 #include "SkStream.h" | 13 #include "SkStream.h" |
15 #include "SkData.h" | 14 #include "SkData.h" |
16 #include "picture_utils.h" | 15 #include "picture_utils.h" |
17 #include "SkOSFile.h" | 16 #include "SkOSFile.h" |
18 #include "SkImageDecoder.h" | 17 #include "SkImageDecoder.h" |
(...skipping 18 matching lines...) Expand all Loading... |
37 DEFINE_string2(skpPath, r, "", "Read this .skp file or .skp files from this dir"
); | 36 DEFINE_string2(skpPath, r, "", "Read this .skp file or .skp files from this dir"
); |
38 DEFINE_string2(luaFile, l, "", "File containing lua script to run"); | 37 DEFINE_string2(luaFile, l, "", "File containing lua script to run"); |
39 DEFINE_string2(headCode, s, "", "Optional lua code to call at beginning"); | 38 DEFINE_string2(headCode, s, "", "Optional lua code to call at beginning"); |
40 DEFINE_string2(tailFunc, s, "", "Optional lua function to call at end"); | 39 DEFINE_string2(tailFunc, s, "", "Optional lua function to call at end"); |
41 DEFINE_bool2(quiet, q, false, "Silence all non-error related output"); | 40 DEFINE_bool2(quiet, q, false, "Silence all non-error related output"); |
42 | 41 |
43 static SkPicture* load_picture(const char path[]) { | 42 static SkPicture* load_picture(const char path[]) { |
44 SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(path)); | 43 SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(path)); |
45 SkPicture* pic = nullptr; | 44 SkPicture* pic = nullptr; |
46 if (stream.get()) { | 45 if (stream.get()) { |
47 pic = SkPicture::CreateFromStream(stream.get(), &sk_tools::LazyDecodeBit
map); | 46 pic = SkPicture::CreateFromStream(stream.get()); |
48 } | 47 } |
49 return pic; | 48 return pic; |
50 } | 49 } |
51 | 50 |
52 static void call_canvas(lua_State* L, SkLuaCanvas* canvas, | 51 static void call_canvas(lua_State* L, SkLuaCanvas* canvas, |
53 const char pictureFile[], const char funcName[]) { | 52 const char pictureFile[], const char funcName[]) { |
54 lua_getglobal(L, funcName); | 53 lua_getglobal(L, funcName); |
55 if (!lua_isfunction(L, -1)) { | 54 if (!lua_isfunction(L, -1)) { |
56 int t = lua_type(L, -1); | 55 int t = lua_type(L, -1); |
57 SkDebugf("--- expected %s function %d, ignoring.\n", funcName, t); | 56 SkDebugf("--- expected %s function %d, ignoring.\n", funcName, t); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 161 } |
163 } | 162 } |
164 return 0; | 163 return 0; |
165 } | 164 } |
166 | 165 |
167 #if !defined SK_BUILD_FOR_IOS | 166 #if !defined SK_BUILD_FOR_IOS |
168 int main(int argc, char * const argv[]) { | 167 int main(int argc, char * const argv[]) { |
169 return tool_main(argc, (char**) argv); | 168 return tool_main(argc, (char**) argv); |
170 } | 169 } |
171 #endif | 170 #endif |
OLD | NEW |