diff options
author | Yonit Halperin <yhalperi@redhat.com> | 2011-05-18 17:28:20 +0300 |
---|---|---|
committer | Yonit Halperin <yhalperi@redhat.com> | 2011-05-19 12:57:41 +0300 |
commit | d63fd4c5b0ac3e60e4e1652f30375ac61dcf492d (patch) | |
tree | be765bcd6ae1e57dcf624d96d51f045569a8c557 /client/display_channel.cpp | |
parent | 483d13ce611686c37d766e0a38fdf9aae1d39fe5 (diff) | |
download | spice-d63fd4c5b0ac3e60e4e1652f30375ac61dcf492d.tar.gz spice-d63fd4c5b0ac3e60e4e1652f30375ac61dcf492d.tar.xz spice-d63fd4c5b0ac3e60e4e1652f30375ac61dcf492d.zip |
client: fix flipped video in Linux guest on windows client, RHBZ #667689
Video streams from Linux guests are oriented top-down, where gdi_canvas_put_image always
received display context for down-top oriented bitmap. I fixed create_bitmap
to consider the stream orientation.
Diffstat (limited to 'client/display_channel.cpp')
-rw-r--r-- | client/display_channel.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/client/display_channel.cpp b/client/display_channel.cpp index dbe7d0b8..3b8b91a4 100644 --- a/client/display_channel.cpp +++ b/client/display_channel.cpp @@ -217,7 +217,7 @@ public: #ifdef WIN32 static int create_bitmap(HDC *dc, HBITMAP *prev_bitmap, uint8_t **data, int *nstride, - int width, int height) + int width, int height, bool top_down) { HBITMAP bitmap; struct { @@ -228,7 +228,7 @@ static int create_bitmap(HDC *dc, HBITMAP *prev_bitmap, memset(&bitmap_info, 0, sizeof(bitmap_info)); bitmap_info.inf.bmiHeader.biSize = sizeof(bitmap_info.inf.bmiHeader); bitmap_info.inf.bmiHeader.biWidth = width; - bitmap_info.inf.bmiHeader.biHeight = height; + bitmap_info.inf.bmiHeader.biHeight = top_down ? -height : height; bitmap_info.inf.bmiHeader.biPlanes = 1; bitmap_info.inf.bmiHeader.biBitCount = 32; @@ -284,7 +284,7 @@ VideoStream::VideoStream(RedClient& client, Canvas& canvas, DisplayChannel& chan try { #ifdef WIN32 if (!create_bitmap(&_dc, &_prev_bitmap, &_uncompressed_data, &_stride, - stream_width, stream_height)) { + stream_width, stream_height, _top_down)) { THROW("create_bitmap failed"); } #else @@ -299,6 +299,8 @@ VideoStream::VideoStream(RedClient& client, Canvas& canvas, DisplayChannel& chan SetViewportOrgEx(_dc, 0, stream_height - src_height, NULL); #endif + // this doesn't have effect when using gdi_canvas. The sign of BITMAPINFO's biHeight + // determines the orientation (see create_bitmap). if (_top_down) { _pixmap.data = _uncompressed_data; _pixmap.stride = _stride; |