diff options
author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2012-11-13 19:10:22 +0100 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-11-13 17:01:02 -0500 |
commit | f9e710b57c9b21638431fbfec6cf45a40bdf1b57 (patch) | |
tree | c17a1a2ac3cf4c278ba188f19d477e856513a494 /src/screenshooter.c | |
parent | a95b2d6d41fb9cf0687f25cae57868eda9b7b04c (diff) | |
download | weston-f9e710b57c9b21638431fbfec6cf45a40bdf1b57.tar.gz |
screenshooter: Use the renderer function for reading out pixels
This also changes the compositor's read_format to a pixman format.
Diffstat (limited to 'src/screenshooter.c')
-rw-r--r-- | src/screenshooter.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/screenshooter.c b/src/screenshooter.c index ffcc9706..23181a23 100644 --- a/src/screenshooter.c +++ b/src/screenshooter.c @@ -112,10 +112,10 @@ screenshooter_frame_notify(struct wl_listener *listener, void *data) return; } - glPixelStorei(GL_PACK_ALIGNMENT, 1); - glReadPixels(0, 0, output->current->width, output->current->height, - output->compositor->read_format, - GL_UNSIGNED_BYTE, pixels); + output->compositor->renderer->read_pixels(output, + output->compositor->read_format, pixels, + 0, 0, output->current->width, + output->current->height); stride = wl_shm_buffer_get_stride(l->buffer); @@ -123,10 +123,10 @@ screenshooter_frame_notify(struct wl_listener *listener, void *data) s = pixels + stride * (l->buffer->height - 1); switch (output->compositor->read_format) { - case GL_BGRA_EXT: + case PIXMAN_a8r8g8b8: copy_bgra_yflip(d, s, output->current->height, stride); break; - case GL_RGBA: + case PIXMAN_a8b8g8r8: copy_rgba_yflip(d, s, output->current->height, stride); break; default: @@ -299,10 +299,10 @@ weston_recorder_frame_notify(struct wl_listener *listener, void *data) for (i = 0; i < n; i++) { width = r[i].x2 - r[i].x1; height = r[i].y2 - r[i].y1; - glReadPixels(r[i].x1, output->current->height - r[i].y2, - width, height, - output->compositor->read_format, - GL_UNSIGNED_BYTE, recorder->rect); + output->compositor->renderer->read_pixels(output, + output->compositor->read_format, recorder->rect, + r[i].x1, output->current->height - r[i].y2, + width, height); s = recorder->rect; p = recorder->rect; @@ -367,12 +367,15 @@ weston_recorder_create(struct weston_output *output, const char *filename) header.magic = WCAP_HEADER_MAGIC; switch (output->compositor->read_format) { - case GL_BGRA_EXT: + case PIXMAN_a8r8g8b8: header.format = WCAP_FORMAT_XRGB8888; break; - case GL_RGBA: + case PIXMAN_a8b8g8r8: header.format = WCAP_FORMAT_XBGR8888; break; + default: + weston_log("unknown recorder format\n"); + break; } header.width = output->current->width; |