diff options
author | Thijs Vermeir <thijsvermeir@gmail.com> | 2007-10-31 14:44:55 +0000 |
---|---|---|
committer | Thijs Vermeir <thijsvermeir@gmail.com> | 2007-10-31 14:44:55 +0000 |
commit | 7412141912cc527a231697e38793871b17e6425b (patch) | |
tree | f883a01f61bad481bd6fb436516f0fb1d2b14a14 | |
parent | aac84ad1c721c8db84b729d2b265aa62c3f1b5c9 (diff) | |
download | gst-plugins-bad-7412141912cc527a231697e38793871b17e6425b.tar.gz gst-plugins-bad-7412141912cc527a231697e38793871b17e6425b.tar.bz2 gst-plugins-bad-7412141912cc527a231697e38793871b17e6425b.zip |
gst/librfb/rfbdecoder.c: Some refactoring in RAW encoding
Original commit message from CVS:
* gst/librfb/rfbdecoder.c:
Some refactoring in RAW encoding
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | gst/librfb/rfbdecoder.c | 27 |
2 files changed, 19 insertions, 13 deletions
@@ -1,3 +1,8 @@ +2007-10-31 Thijs Vermeir,,, <thijsvermeir@gmail.com> + + * gst/librfb/rfbdecoder.c: + Some refactoring in RAW encoding + 2007-10-31 Thijs Vermeir <thijsvermeir@gmail.com> * gst/librfb/d3des.h: diff --git a/gst/librfb/rfbdecoder.c b/gst/librfb/rfbdecoder.c index bd13569b..1cc43b09 100644 --- a/gst/librfb/rfbdecoder.c +++ b/gst/librfb/rfbdecoder.c @@ -639,24 +639,25 @@ static void rfb_decoder_raw_encoding (RfbDecoder * decoder, gint start_x, gint start_y, gint rect_w, gint rect_h) { - gint pos_y, size; - guint8 *frame, *buffer; - gint width; - guint32 src_offset; - guint32 dst_offset; + gint size; + guint8 *frame, *buffer, *p; + guint32 raw_line_size, line_size; - /* read the data */ size = rect_h * rect_w * decoder->bpp / 8; GST_DEBUG ("Reading %d bytes", size); buffer = rfb_decoder_read (decoder, size); - frame = decoder->frame; - width = decoder->rect_width; - - for (pos_y = start_y; pos_y < (start_y + rect_h); pos_y++) { - src_offset = (pos_y - start_y) * rect_w * decoder->bpp / 8; - dst_offset = ((pos_y * width) + start_x) * decoder->bpp / 8; - memcpy (frame + dst_offset, buffer + src_offset, rect_w * decoder->bpp / 8); + line_size = decoder->rect_width * decoder->bpp / 8; + raw_line_size = rect_w * decoder->bpp / 8; + frame = + decoder->frame + (((start_y * decoder->rect_width) + + start_x) * decoder->bpp / 8); + p = buffer; + + while (rect_h--) { + memcpy (frame, p, raw_line_size); + p += raw_line_size; + frame += line_size; } g_free (buffer); |