Hi,

Great work on debugging this! ACK.

Regards,

Hans


On 03/12/2013 01:00 PM, Arnon Gilboa wrote:
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
---
  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;
          }

_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to