| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 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 MOJO_PUBLIC_PLATFORM_NATIVE_MGL_ONSCREEN_THUNKS_H_ | |
| 6 #define MOJO_PUBLIC_PLATFORM_NATIVE_MGL_ONSCREEN_THUNKS_H_ | |
| 7 | |
| 8 #include <MGL/mgl_onscreen.h> | |
| 9 #include <stddef.h> | |
| 10 | |
| 11 // Structure used to bind the interface which manipulates MGL contexts to a | |
| 12 // DSO to theose of the embedder. | |
| 13 // | |
| 14 // This is the ABI between the embedder and the DSO. It can only have new | |
| 15 // functions added to the end. No other changes are supported. | |
| 16 #pragma pack(push, 8) | |
| 17 struct MGLOnscreenThunks { | |
| 18 size_t size; // Should be set to sizeof(MojoMGLOnscreenThunks). | |
| 19 | |
| 20 void (*MGLResizeSurface)(uint32_t width, uint32_t height); | |
| 21 void (*MGLSwapBuffers)(void); | |
| 22 }; | |
| 23 #pragma pack(pop) | |
| 24 | |
| 25 // Intended to be called from the embedder. Returns an object initialized to | |
| 26 // contain pointers to each of the embedder's MGLOnscreenThunks functions. | |
| 27 inline struct MGLOnscreenThunks MojoMakeMGLOnscreenThunks() { | |
| 28 struct MGLOnscreenThunks mgl_onscreen_thunks = { | |
| 29 sizeof(struct MGLOnscreenThunks), MGLResizeSurface, MGLSwapBuffers, | |
| 30 }; | |
| 31 | |
| 32 return mgl_onscreen_thunks; | |
| 33 } | |
| 34 | |
| 35 // Use this type for the function found by dynamically discovering it in | |
| 36 // a DSO linked with mojo_system. For example: | |
| 37 // MojoSetMGLOnscreenThunksFn mojo_set_gles2_thunks_fn = | |
| 38 // reinterpret_cast<MojoSetMGLOnscreenThunksFn>( | |
| 39 // app_library.GetFunctionPointer("MojoSetMGLOnscreenThunks")); | |
| 40 // The expected size of |mgl_thunks| is returned. | |
| 41 // The contents of |mgl_thunks| are copied. | |
| 42 typedef size_t (*MojoSetMGLOnscreenThunksFn)( | |
| 43 const struct MGLOnscreenThunks* mgl_thunks); | |
| 44 | |
| 45 #endif // MOJO_PUBLIC_PLATFORM_NATIVE_MGL_ONSCREEN_THUNKS_H_ | |
| OLD | NEW |