| 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 "SkLua.h" | 8 #include "SkLua.h" |
| 9 #include "SkLuaCanvas.h" | 9 #include "SkLuaCanvas.h" |
| 10 #include "SkPicture.h" | 10 #include "SkPicture.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // for i in {0..5}; do lua_pictures --skpPath SKP_PATH -l YOUR_SCRIPT --modulo $
i 6 &; done | 32 // for i in {0..5}; do lua_pictures --skpPath SKP_PATH -l YOUR_SCRIPT --modulo $
i 6 &; done |
| 33 DEFINE_string(modulo, "", "[--modulo <remainder> <divisor>]: only run tests for
which " | 33 DEFINE_string(modulo, "", "[--modulo <remainder> <divisor>]: only run tests for
which " |
| 34 "testIndex %% divisor == remainder."); | 34 "testIndex %% divisor == remainder."); |
| 35 DEFINE_string2(skpPath, r, "", "Read this .skp file or .skp files from this dir"
); | 35 DEFINE_string2(skpPath, r, "", "Read this .skp file or .skp files from this dir"
); |
| 36 DEFINE_string2(luaFile, l, "", "File containing lua script to run"); | 36 DEFINE_string2(luaFile, l, "", "File containing lua script to run"); |
| 37 DEFINE_string2(headCode, s, "", "Optional lua code to call at beginning"); | 37 DEFINE_string2(headCode, s, "", "Optional lua code to call at beginning"); |
| 38 DEFINE_string2(tailFunc, s, "", "Optional lua function to call at end"); | 38 DEFINE_string2(tailFunc, s, "", "Optional lua function to call at end"); |
| 39 DEFINE_bool2(quiet, q, false, "Silence all non-error related output"); | 39 DEFINE_bool2(quiet, q, false, "Silence all non-error related output"); |
| 40 | 40 |
| 41 static sk_sp<SkPicture> load_picture(const char path[]) { | 41 static sk_sp<SkPicture> load_picture(const char path[]) { |
| 42 SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(path)); | 42 std::unique_ptr<SkStream> stream = SkStream::MakeFromFile(path); |
| 43 if (stream.get()) { | 43 if (stream) { |
| 44 return SkPicture::MakeFromStream(stream.get()); | 44 return SkPicture::MakeFromStream(stream.get()); |
| 45 } | 45 } |
| 46 return nullptr; | 46 return nullptr; |
| 47 } | 47 } |
| 48 | 48 |
| 49 static void call_canvas(lua_State* L, SkLuaCanvas* canvas, | 49 static void call_canvas(lua_State* L, SkLuaCanvas* canvas, |
| 50 const char pictureFile[], const char funcName[]) { | 50 const char pictureFile[], const char funcName[]) { |
| 51 lua_getglobal(L, funcName); | 51 lua_getglobal(L, funcName); |
| 52 if (!lua_isfunction(L, -1)) { | 52 if (!lua_isfunction(L, -1)) { |
| 53 int t = lua_type(L, -1); | 53 int t = lua_type(L, -1); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 return 0; | 161 return 0; |
| 162 } | 162 } |
| 163 | 163 |
| 164 #if !defined SK_BUILD_FOR_IOS | 164 #if !defined SK_BUILD_FOR_IOS |
| 165 int main(int argc, char * const argv[]) { | 165 int main(int argc, char * const argv[]) { |
| 166 return tool_main(argc, (char**) argv); | 166 return tool_main(argc, (char**) argv); |
| 167 } | 167 } |
| 168 #endif | 168 #endif |
| OLD | NEW |