| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "ppapi/cpp/completion_callback.h" | 9 #include "ppapi/cpp/completion_callback.h" |
| 10 #include "ppapi/cpp/graphics_2d.h" | 10 #include "ppapi/cpp/graphics_2d.h" |
| 11 #include "ppapi/cpp/image_data.h" | 11 #include "ppapi/cpp/image_data.h" |
| 12 #include "ppapi/cpp/instance.h" | 12 #include "ppapi/cpp/instance.h" |
| 13 #include "ppapi/cpp/module.h" | 13 #include "ppapi/cpp/module.h" |
| 14 #include "ppapi/cpp/var.h" | 14 #include "ppapi/cpp/var.h" |
| 15 | 15 |
| 16 #include "SkCanvas.h" | 16 #include "SkCanvas.h" |
| 17 #include "SkBitmap.h" | 17 #include "SkBitmap.h" |
| 18 #include "SkString.h" | 18 #include "SkString.h" |
| 19 #include "SkThreadUtils.h" | 19 #include "SkThreadUtils.h" |
| 20 | 20 |
| 21 class SkiaInstance; | 21 class SkiaInstance; |
| 22 | 22 |
| 23 // Used by SkDebugf | 23 // Used by SkDebugf |
| 24 SkiaInstance* gPluginInstance; | 24 SkiaInstance* gPluginInstance; |
| 25 | 25 |
| 26 // Main entry point for the app we're linked into | 26 // Main entry point for the app we're linked into |
| 27 extern int test_main(int, char**); | 27 extern int test_main(); |
| 28 | 28 |
| 29 // Tokenize a command line and store it in argc and argv. | 29 // Tokenize a command line and store it in argc and argv. |
| 30 void SkStringToProgramArgs(const SkString commandLine, int* argc, char*** argv)
{ | 30 void SkStringToProgramArgs(const SkString commandLine, int* argc, char*** argv)
{ |
| 31 int numBreaks = 0; | 31 int numBreaks = 0; |
| 32 const char* commandChars = commandLine.c_str(); | 32 const char* commandChars = commandLine.c_str(); |
| 33 for (size_t i = 0; i < strlen(commandChars); i++) { | 33 for (size_t i = 0; i < strlen(commandChars); i++) { |
| 34 if (isspace(commandChars[i])) { | 34 if (isspace(commandChars[i])) { |
| 35 numBreaks++; | 35 numBreaks++; |
| 36 } | 36 } |
| 37 } | 37 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 61 length++; | 61 length++; |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 // Run the program with the given command line. | 66 // Run the program with the given command line. |
| 67 void RunProgram(const SkString& commandLine) { | 67 void RunProgram(const SkString& commandLine) { |
| 68 int argc; | 68 int argc; |
| 69 char** argv; | 69 char** argv; |
| 70 SkStringToProgramArgs(commandLine, &argc, &argv); | 70 SkStringToProgramArgs(commandLine, &argc, &argv); |
| 71 test_main(argc, argv); | 71 test_main(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 | 74 |
| 75 // Skia's subclass of pp::Instance, our interface with the browser. | 75 // Skia's subclass of pp::Instance, our interface with the browser. |
| 76 class SkiaInstance : public pp::Instance { | 76 class SkiaInstance : public pp::Instance { |
| 77 public: | 77 public: |
| 78 explicit SkiaInstance(PP_Instance instance) : pp::Instance(instance) { | 78 explicit SkiaInstance(PP_Instance instance) : pp::Instance(instance) { |
| 79 gPluginInstance = this; | 79 gPluginInstance = this; |
| 80 } | 80 } |
| 81 | 81 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 102 virtual pp::Instance* CreateInstance(PP_Instance instance) { | 102 virtual pp::Instance* CreateInstance(PP_Instance instance) { |
| 103 return new SkiaInstance(instance); | 103 return new SkiaInstance(instance); |
| 104 } | 104 } |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 namespace pp { | 107 namespace pp { |
| 108 Module* CreateModule() { | 108 Module* CreateModule() { |
| 109 return new SkiaModule(); | 109 return new SkiaModule(); |
| 110 } | 110 } |
| 111 } // namespace pp | 111 } // namespace pp |
| OLD | NEW |