1 // Copyright 2012 Intel Corporation
3 // All rights reserved.
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
8 // - Redistributions of source code must retain the above copyright notice, this
9 // list of conditions and the following disclaimer.
11 // - Redistributions in binary form must reproduce the above copyright notice,
12 // this list of conditions and the following disclaimer in the documentation
13 // and/or other materials provided with the distribution.
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #include "wcore_error.h"
31 #include "linux_platform.h"
33 #include "wegl_config.h"
34 #include "wegl_context.h"
35 #include "wegl_util.h"
37 #include "droid_display.h"
38 #include "droid_platform.h"
39 #include "droid_window.h"
41 static const struct wcore_platform_vtbl droid_platform_vtbl
;
44 droid_platform_destroy(struct wcore_platform
*wc_self
)
46 struct droid_platform
*self
= droid_platform(wc_self
);
53 ok
&= linux_platform_destroy(self
->linux
);
55 ok
&= wcore_platform_teardown(wc_self
);
60 struct wcore_platform
*
61 droid_platform_create(void)
63 struct droid_platform
*self
;
66 self
= wcore_calloc(sizeof(*self
));
70 ok
= wcore_platform_init(&self
->wcore
);
74 self
->linux
= linux_platform_create();
78 self
->wcore
.vtbl
= &droid_platform_vtbl
;
82 droid_platform_destroy(&self
->wcore
);
88 struct wcore_platform
*wc_self
,
91 return linux_platform_dl_can_open(droid_platform(wc_self
)->linux
,
97 struct wcore_platform
*wc_self
,
101 return linux_platform_dl_sym(droid_platform(wc_self
)->linux
,
105 static const struct wcore_platform_vtbl droid_platform_vtbl
= {
106 .destroy
= droid_platform_destroy
,
108 .make_current
= wegl_make_current
,
109 .get_proc_address
= wegl_get_proc_address
,
110 .dl_can_open
= droid_dl_can_open
,
111 .dl_sym
= droid_dl_sym
,
114 .connect
= droid_display_connect
,
115 .destroy
= droid_display_disconnect
,
116 .supports_context_api
= wegl_display_supports_context_api
,
121 .choose
= wegl_config_choose
,
122 .destroy
= wegl_config_destroy
,
127 .create
= wegl_context_create
,
128 .destroy
= wegl_context_destroy
,
133 .create
= droid_window_create
,
134 .destroy
= droid_window_destroy
,
135 .show
= droid_window_show
,
136 .swap_buffers
= wegl_surface_swap_buffers
,
137 .resize
= droid_window_resize
,