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