Implement buffer.damage in shm, use it in window.c

This commit is contained in:
Benjamin Franzke
2011-03-07 15:08:09 +01:00
committed by Kristian Høgsberg
parent e997c5fb09
commit bde55ec8e4
5 changed files with 65 additions and 24 deletions
+2
View File
@@ -199,6 +199,8 @@ frame_callback(struct wl_surface *surface, void *data, uint32_t time)
render(smoke);
display_surface_damage(smoke->display, smoke->surface,
0, 0, smoke->width, smoke->height);
window_damage(smoke->window, 0, 0, smoke->width, smoke->height);
wl_display_frame_callback(display_get_display(smoke->display),
window_get_wl_surface(smoke->window),
+26 -2
View File
@@ -734,8 +734,21 @@ window_attach_surface(struct window *window)
void
window_flush(struct window *window)
{
if (window->cairo_surface)
window_attach_surface(window);
if (window->cairo_surface) {
switch (window->buffer_type) {
case WINDOW_BUFFER_TYPE_EGL_IMAGE:
case WINDOW_BUFFER_TYPE_SHM:
display_surface_damage(window->display,
window->cairo_surface,
0, 0,
window->allocation.width,
window->allocation.height);
break;
default:
break;
}
window_attach_surface(window);
}
}
void
@@ -1420,6 +1433,17 @@ window_get_title(struct window *window)
return window->title;
}
void
display_surface_damage(struct display *display, cairo_surface_t *cairo_surface,
int32_t x, int32_t y, int32_t width, int32_t height)
{
struct wl_buffer *buffer;
buffer = display_get_buffer_for_surface(display, cairo_surface);
wl_buffer_damage(buffer, x, y, width, height);
}
void
window_damage(struct window *window, int32_t x, int32_t y,
int32_t width, int32_t height)
+4
View File
@@ -193,6 +193,10 @@ enum window_buffer_type {
WINDOW_BUFFER_TYPE_SHM,
};
void
display_surface_damage(struct display *display, cairo_surface_t *cairo_surface,
int32_t x, int32_t y, int32_t width, int32_t height);
void
window_set_buffer_type(struct window *window, enum window_buffer_type type);