window: simplify window_create_surface
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
committed by
Kristian Høgsberg
parent
9943686be3
commit
b362736bb2
+23
-18
@@ -494,6 +494,9 @@ egl_window_surface_create(struct display *display,
|
|||||||
{
|
{
|
||||||
struct egl_window_surface *surface;
|
struct egl_window_surface *surface;
|
||||||
|
|
||||||
|
if (display->dpy == EGL_NO_DISPLAY)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
surface = calloc(1, sizeof *surface);
|
surface = calloc(1, sizeof *surface);
|
||||||
if (!surface)
|
if (!surface)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -525,6 +528,17 @@ egl_window_surface_create(struct display *display,
|
|||||||
return &surface->base;
|
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
|
#endif
|
||||||
|
|
||||||
struct shm_surface_data {
|
struct shm_surface_data {
|
||||||
@@ -1130,28 +1144,19 @@ window_create_surface(struct window *window)
|
|||||||
if (!window->transparent)
|
if (!window->transparent)
|
||||||
flags = SURFACE_OPAQUE;
|
flags = SURFACE_OPAQUE;
|
||||||
|
|
||||||
switch (window->buffer_type) {
|
if (!window->toysurface &&
|
||||||
#ifdef HAVE_CAIRO_EGL
|
window->buffer_type == WINDOW_BUFFER_TYPE_EGL_WINDOW &&
|
||||||
case WINDOW_BUFFER_TYPE_EGL_WINDOW:
|
window->display->dpy) {
|
||||||
if (!window->toysurface && window->display->dpy)
|
window->toysurface =
|
||||||
window->toysurface =
|
egl_window_surface_create(window->display,
|
||||||
egl_window_surface_create(window->display,
|
window->surface, flags,
|
||||||
window->surface,
|
&window->allocation);
|
||||||
flags,
|
}
|
||||||
&window->allocation);
|
|
||||||
|
|
||||||
if (window->toysurface)
|
if (!window->toysurface)
|
||||||
break;
|
|
||||||
/* fall through */
|
|
||||||
#endif
|
|
||||||
case WINDOW_BUFFER_TYPE_SHM:
|
|
||||||
window->toysurface = shm_surface_create(window->display,
|
window->toysurface = shm_surface_create(window->display,
|
||||||
window->surface, flags,
|
window->surface, flags,
|
||||||
&window->allocation);
|
&window->allocation);
|
||||||
break;
|
|
||||||
default:
|
|
||||||
assert(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
window_get_resize_dx_dy(window, &dx, &dy);
|
window_get_resize_dx_dy(window, &dx, &dy);
|
||||||
window->cairo_surface =
|
window->cairo_surface =
|
||||||
|
|||||||
Reference in New Issue
Block a user