| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef PPAPI_MAIN_PPAPI_MAIN_H_ | |
| 6 #define PPAPI_MAIN_PPAPI_MAIN_H_ | |
| 7 | |
| 8 #include "ppapi/c/pp_instance.h" | |
| 9 #include "ppapi/c/pp_module.h" | |
| 10 #include "ppapi_main/ppapi_event.h" | |
| 11 | |
| 12 #include "utils/macros.h" | |
| 13 | |
| 14 EXTERN_C_BEGIN | |
| 15 | |
| 16 // Prototype for 'main' which will get called on startup | |
| 17 int ppapi_main(int argc, const char *argv[]); | |
| 18 | |
| 19 // Provided by "main" module, use one of the macros below | |
| 20 void* UserCreateInstance(PP_Instance inst); | |
| 21 | |
| 22 // Helpers to access PPAPI interfaces | |
| 23 void* PPAPI_GetInstanceObject(); | |
| 24 PP_Instance PPAPI_GetInstanceId(); | |
| 25 const void* PPAPI_GetInterface(const char *name); | |
| 26 | |
| 27 // Provided by library for basic instance types | |
| 28 void* PPAPI_CreateInstance(PP_Instance inst, const char *args[]); | |
| 29 void* PPAPI_CreateInstance2D(PP_Instance inst, const char *args[]); | |
| 30 void* PPAPI_CreateInstance3D(PP_Instance inst, const char *args[]); | |
| 31 | |
| 32 // Event APIs | |
| 33 PPAPIEvent* PPAPI_AcquireEvent(); | |
| 34 void PPAPI_ReleaseEvent(PPAPIEvent* event); | |
| 35 | |
| 36 // Functions for Graphic Instances | |
| 37 int32_t *PPAPIGet3DAttribs(uint32_t width, uint32_t height); | |
| 38 void PPAPIBuildContext(uint32_t width, uint32_t height); | |
| 39 void PPAPIRender(PP_Resource ctx, uint32_t width, uint32_t height); | |
| 40 | |
| 41 | |
| 42 EXTERN_C_END | |
| 43 | |
| 44 #define PPAPI_MAIN_DEFAULT_ARGS NULL, NULL | |
| 45 | |
| 46 #define PPAPI_MAIN_USE(factory, ...) \ | |
| 47 void* UserCreateInstance(PP_Instance inst) { \ | |
| 48 static const char *params[] = { __VA_ARGS__ }; \ | |
| 49 return factory(inst, params); \ | |
| 50 } | |
| 51 | |
| 52 #define PPAPI_MAIN_WITH_DEFAULT_ARGS \ | |
| 53 PPAPI_MAIN_USE(PPAPI_CreateInstance, PPAPI_MAIN_DEFAULT_ARGS) | |
| 54 | |
| 55 #define PPAPI_MAIN_3D_WITH_DEFAULT_ARGS \ | |
| 56 PPAPI_MAIN_USE(PPAPI_CreateInstance3D, PPAPI_MAIN_DEFAULT_ARGS) | |
| 57 | |
| 58 #define PPAPI_MAIN_WITH_ARGS(...) \ | |
| 59 PPAPI_MAIN_USE(PPAPI_CreateInstance, __VA_ARGS__) | |
| 60 | |
| 61 | |
| 62 #endif // PPAPI_MAIN_PPAPI_MAIN_H_ | |
| OLD | NEW |