diff --git a/src/screenshooter.c b/src/screenshooter.c index da06ae3a..246796eb 100644 --- a/src/screenshooter.c +++ b/src/screenshooter.c @@ -240,6 +240,18 @@ output_run(uint32_t *p, uint32_t delta, int run) return p; } +static uint32_t +component_delta(uint32_t next, uint32_t prev) +{ + unsigned char dr, dg, db; + + dr = (next >> 16) - (prev >> 16); + dg = (next >> 8) - (prev >> 8); + db = (next >> 0) - (prev >> 0); + + return (dr << 16) | (dg << 8) | (db << 0); +} + static void weston_recorder_frame_notify(struct wl_listener *listener, void *data) { @@ -295,7 +307,7 @@ weston_recorder_frame_notify(struct wl_listener *listener, void *data) stride * (r[i].y2 - j - 1) + r[i].x1; for (k = 0; k < width; k++) { next = *s++; - delta = (next - *d) & 0x00ffffff; + delta = component_delta(next, *d); *d++ = next; if (run == 0 || delta == prev) { run++; diff --git a/wcap/wcap-decode.c b/wcap/wcap-decode.c index 3ce7a196..425ccff1 100644 --- a/wcap/wcap-decode.c +++ b/wcap/wcap-decode.c @@ -42,7 +42,8 @@ wcap_decoder_decode_rectangle(struct wcap_decoder *decoder, uint32_t v, *p = decoder->p, *d; int width = rect->x2 - rect->x1, height = rect->y2 - rect->y1; int x, i, j, k, l, count = width * height; - + unsigned char r, g, b, dr, dg, db; + d = decoder->frame + (rect->y2 - 1) * decoder->width; x = rect->x1; i = 0; @@ -55,8 +56,14 @@ wcap_decoder_decode_rectangle(struct wcap_decoder *decoder, j = 1 << (l - 0xe0 + 7); } + dr = (v >> 16); + dg = (v >> 8); + db = (v >> 0); for (k = 0; k < j; k++) { - d[x] = (d[x] + v) | 0xff000000; + r = (d[x] >> 16) + dr; + g = (d[x] >> 8) + dg; + b = (d[x] >> 0) + db; + d[x] = 0xff000000 | (r << 16) | (g << 8) | b; x++; if (x == rect->x2) { x = rect->x1;