diff options
author | Arnon Gilboa <agilboa@redhat.com> | 2013-03-12 13:01:03 +0200 |
---|---|---|
committer | Arnon Gilboa <agilboa@redhat.com> | 2013-03-12 13:09:50 +0200 |
commit | da07ced71c864992a5806524f010fd8c2fb8c835 (patch) | |
tree | 9fd9924d846b9d443ddf80d2b5a85baa38368e88 /vdagent | |
parent | c1807e804046f98a14cfc3e4f7ef8e08cf31ee61 (diff) |
vdagent: use HBITMAP instead of DIB for image encoding
CxImage DIB to PNG encoding seems to ignore pallete in some scenarios.
This issue happens when copying a png from FireFox, but with IE it's ok.
rhbz #919150
Diffstat (limited to 'vdagent')
-rw-r--r-- | vdagent/vdagent.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp index 722815c..6f2a49c 100644 --- a/vdagent/vdagent.cpp +++ b/vdagent/vdagent.cpp @@ -42,7 +42,7 @@ typedef struct VDClipboardFormat { VDClipboardFormat clipboard_formats[] = { {CF_UNICODETEXT, {VD_AGENT_CLIPBOARD_UTF8_TEXT, 0}}, //FIXME: support more image types - {CF_DIB, {VD_AGENT_CLIPBOARD_IMAGE_PNG, VD_AGENT_CLIPBOARD_IMAGE_BMP, 0}}, + {CF_BITMAP, {VD_AGENT_CLIPBOARD_IMAGE_PNG, VD_AGENT_CLIPBOARD_IMAGE_BMP, 0}}, }; #define clipboard_formats_count (sizeof(clipboard_formats) / sizeof(clipboard_formats[0])) @@ -1025,8 +1025,13 @@ bool VDAgent::handle_clipboard_request(VDAgentClipboardRequest* clipboard_reques case VD_AGENT_CLIPBOARD_IMAGE_PNG: case VD_AGENT_CLIPBOARD_IMAGE_BMP: { DWORD cximage_format = get_cximage_format(clipboard_request->type); - ASSERT(cximage_format); - if (!image.CreateFromHANDLE(clip_data)) {
+ HPALETTE pal = 0; + + ASSERT(cximage_format);
+ if (IsClipboardFormatAvailable(CF_PALETTE)) {
+ pal = (HPALETTE)GetClipboardData(CF_PALETTE); + } + if (!image.CreateFromHBITMAP((HBITMAP)clip_data, pal)) {
vd_printf("Image create from handle failed");
break;
}
|