| 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 "LazyDecodeBitmap.h" |
| 9 #include "SkLua.h" | 9 #include "SkLua.h" |
| 10 #include "SkLuaCanvas.h" | 10 #include "SkLuaCanvas.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 DEFINE_string(modulo, "", "[--modulo <remainder> <divisor>]: only run tests for
which " | 35 DEFINE_string(modulo, "", "[--modulo <remainder> <divisor>]: only run tests for
which " |
| 36 "testIndex %% divisor == remainder."); | 36 "testIndex %% divisor == remainder."); |
| 37 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"
); |
| 38 DEFINE_string2(luaFile, l, "", "File containing lua script to run"); | 38 DEFINE_string2(luaFile, l, "", "File containing lua script to run"); |
| 39 DEFINE_string2(headCode, s, "", "Optional lua code to call at beginning"); | 39 DEFINE_string2(headCode, s, "", "Optional lua code to call at beginning"); |
| 40 DEFINE_string2(tailFunc, s, "", "Optional lua function to call at end"); | 40 DEFINE_string2(tailFunc, s, "", "Optional lua function to call at end"); |
| 41 DEFINE_bool2(quiet, q, false, "Silence all non-error related output"); | 41 DEFINE_bool2(quiet, q, false, "Silence all non-error related output"); |
| 42 | 42 |
| 43 static SkPicture* load_picture(const char path[]) { | 43 static SkPicture* load_picture(const char path[]) { |
| 44 SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(path)); | 44 SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(path)); |
| 45 SkPicture* pic = NULL; | 45 SkPicture* pic = nullptr; |
| 46 if (stream.get()) { | 46 if (stream.get()) { |
| 47 pic = SkPicture::CreateFromStream(stream.get(), &sk_tools::LazyDecodeBit
map); | 47 pic = SkPicture::CreateFromStream(stream.get(), &sk_tools::LazyDecodeBit
map); |
| 48 } | 48 } |
| 49 return pic; | 49 return pic; |
| 50 } | 50 } |
| 51 | 51 |
| 52 static void call_canvas(lua_State* L, SkLuaCanvas* canvas, | 52 static void call_canvas(lua_State* L, SkLuaCanvas* canvas, |
| 53 const char pictureFile[], const char funcName[]) { | 53 const char pictureFile[], const char funcName[]) { |
| 54 lua_getglobal(L, funcName); | 54 lua_getglobal(L, funcName); |
| 55 if (!lua_isfunction(L, -1)) { | 55 if (!lua_isfunction(L, -1)) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 82 const char* summary = gSummarizeFunc; | 82 const char* summary = gSummarizeFunc; |
| 83 if (!FLAGS_tailFunc.isEmpty()) { | 83 if (!FLAGS_tailFunc.isEmpty()) { |
| 84 summary = FLAGS_tailFunc[0]; | 84 summary = FLAGS_tailFunc[0]; |
| 85 } | 85 } |
| 86 | 86 |
| 87 SkAutoGraphics ag; | 87 SkAutoGraphics ag; |
| 88 SkLua L(summary); | 88 SkLua L(summary); |
| 89 | 89 |
| 90 for (int i = 0; i < FLAGS_luaFile.count(); ++i) { | 90 for (int i = 0; i < FLAGS_luaFile.count(); ++i) { |
| 91 SkAutoDataUnref data(SkData::NewFromFileName(FLAGS_luaFile[i])); | 91 SkAutoDataUnref data(SkData::NewFromFileName(FLAGS_luaFile[i])); |
| 92 if (NULL == data.get()) { | 92 if (nullptr == data.get()) { |
| 93 data.reset(SkData::NewEmpty()); | 93 data.reset(SkData::NewEmpty()); |
| 94 } | 94 } |
| 95 if (!FLAGS_quiet) { | 95 if (!FLAGS_quiet) { |
| 96 SkDebugf("loading %s...\n", FLAGS_luaFile[i]); | 96 SkDebugf("loading %s...\n", FLAGS_luaFile[i]); |
| 97 } | 97 } |
| 98 if (!L.runCode(data->data(), data->size())) { | 98 if (!L.runCode(data->data(), data->size())) { |
| 99 SkDebugf("failed to load luaFile %s\n", FLAGS_luaFile[i]); | 99 SkDebugf("failed to load luaFile %s\n", FLAGS_luaFile[i]); |
| 100 exit(-1); | 100 exit(-1); |
| 101 } | 101 } |
| 102 } | 102 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 return 0; | 164 return 0; |
| 165 } | 165 } |
| 166 | 166 |
| 167 #if !defined SK_BUILD_FOR_IOS | 167 #if !defined SK_BUILD_FOR_IOS |
| 168 int main(int argc, char * const argv[]) { | 168 int main(int argc, char * const argv[]) { |
| 169 return tool_main(argc, (char**) argv); | 169 return tool_main(argc, (char**) argv); |
| 170 } | 170 } |
| 171 #endif | 171 #endif |
| OLD | NEW |