wcap: Transform damage rectangles according to output tranform

https://bugs.freedesktop.org/show_bug.cgi?id=56697
Kristian Høgsberg 12 years ago
parent f3dfe716f3
commit f0377dd3a7
  1. 52
      src/screenshooter.c

@ -253,6 +253,55 @@ component_delta(uint32_t next, uint32_t prev)
return (dr << 16) | (dg << 8) | (db << 0);
}
static void
transform_rect(struct weston_output *output, pixman_box32_t *r)
{
pixman_box32_t s = *r;
switch(output->transform) {
case WL_OUTPUT_TRANSFORM_FLIPPED:
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
s.x1 = output->width - r->x2;
s.x2 = output->width - r->x1;
break;
default:
break;
}
switch(output->transform) {
case WL_OUTPUT_TRANSFORM_NORMAL:
case WL_OUTPUT_TRANSFORM_FLIPPED:
r->x1 = s.x1;
r->x2 = s.x2;
break;
case WL_OUTPUT_TRANSFORM_90:
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
r->x1 = output->current->width - s.y2;
r->y1 = s.x1;
r->x2 = output->current->width - s.y1;
r->y2 = s.x2;
break;
case WL_OUTPUT_TRANSFORM_180:
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
r->x1 = output->current->width - s.x2;
r->y1 = output->current->height - s.y2;
r->x2 = output->current->width - s.x1;
r->y2 = output->current->height - s.y1;
break;
case WL_OUTPUT_TRANSFORM_270:
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
r->x1 = s.y1;
r->y1 = output->current->height - s.x2;
r->x2 = s.y2;
r->y2 = output->current->height - s.x1;
break;
default:
break;
}
}
static void
weston_recorder_frame_notify(struct wl_listener *listener, void *data)
{
@ -287,6 +336,9 @@ weston_recorder_frame_notify(struct wl_listener *listener, void *data)
if (n == 0)
return;
for (i = 0; i < n; i++)
transform_rect(output, &r[i]);
header.msecs = msecs;
header.nrects = n;
v[0].iov_base = &header;

Loading…
Cancel
Save