[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]
More about upside down images...
- To: rdesktop@xxxxxxxx
- Subject: More about upside down images...
- From: Sebastian Andersson <sa@xxxxxxxxx>
- Date: Thu, 19 Oct 2000 17:07:29 +0200
- Delivered-To: mailing list rdesktop@cifs.org
- Mailing-List: contact rdesktop-help@cifs.org; run by ezmlm
I've found the error why some parts of some pictures were upside down:
process_raw_bmpcache gets a picture that is upside down from the stream
and puts it in the cache. Reversing the image there leads to a nicer
result.
Just a quick hack that fixes it:
static void process_raw_bmpcache(STREAM s)
{
HBITMAP bitmap;
uint16 cache_idx, bufsize;
uint8 cache_id, width, height, bpp;
uint8 *data, *d2;
int y;
in_uint8(s, cache_id);
in_uint8s(s, 1); /* pad */
in_uint8(s, width);
in_uint8(s, height);
in_uint8(s, bpp);
in_uint16_le(s, bufsize);
in_uint16_le(s, cache_idx);
in_uint8p(s, data, bufsize);
DEBUG("RAW_BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d)\n",
width, height, cache_id, cache_idx);
d2 = xmalloc(width*height);
for(y=0; y < height; y++) {
memcpy(&d2[(height-y-1)*width], &data[y*width], width);
}
bitmap = ui_create_bitmap(width, height, d2);
xfree(d2);
cache_put_bitmap(cache_id, cache_idx, bitmap);
}
A better solution would probably be to turn the image as it is read from
the stream.
Mvh,
/Sebastian