mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-14 17:48:08 +02:00
window: simplify window_create_surface
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
parent
9943686be3
commit
b362736bb2
1 changed files with 23 additions and 18 deletions
|
|
@ -494,6 +494,9 @@ egl_window_surface_create(struct display *display,
|
|||
{
|
||||
struct egl_window_surface *surface;
|
||||
|
||||
if (display->dpy == EGL_NO_DISPLAY)
|
||||
return NULL;
|
||||
|
||||
surface = calloc(1, sizeof *surface);
|
||||
if (!surface)
|
||||
return NULL;
|
||||
|
|
@ -525,6 +528,17 @@ egl_window_surface_create(struct display *display,
|
|||
return &surface->base;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static struct toysurface *
|
||||
egl_window_surface_create(struct display *display,
|
||||
struct wl_surface *wl_surface,
|
||||
uint32_t flags,
|
||||
struct rectangle *rectangle)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
struct shm_surface_data {
|
||||
|
|
@ -1130,28 +1144,19 @@ window_create_surface(struct window *window)
|
|||
if (!window->transparent)
|
||||
flags = SURFACE_OPAQUE;
|
||||
|
||||
switch (window->buffer_type) {
|
||||
#ifdef HAVE_CAIRO_EGL
|
||||
case WINDOW_BUFFER_TYPE_EGL_WINDOW:
|
||||
if (!window->toysurface && window->display->dpy)
|
||||
window->toysurface =
|
||||
egl_window_surface_create(window->display,
|
||||
window->surface,
|
||||
flags,
|
||||
&window->allocation);
|
||||
if (!window->toysurface &&
|
||||
window->buffer_type == WINDOW_BUFFER_TYPE_EGL_WINDOW &&
|
||||
window->display->dpy) {
|
||||
window->toysurface =
|
||||
egl_window_surface_create(window->display,
|
||||
window->surface, flags,
|
||||
&window->allocation);
|
||||
}
|
||||
|
||||
if (window->toysurface)
|
||||
break;
|
||||
/* fall through */
|
||||
#endif
|
||||
case WINDOW_BUFFER_TYPE_SHM:
|
||||
if (!window->toysurface)
|
||||
window->toysurface = shm_surface_create(window->display,
|
||||
window->surface, flags,
|
||||
&window->allocation);
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
window_get_resize_dx_dy(window, &dx, &dy);
|
||||
window->cairo_surface =
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue