CxImage is used for image conversion for clipboard support. CxImage have currently some issue: - library is old and unsupported; - required an old libpng library. Currently the MingW binary we distribute due to some issue have PNG disabled (so no clipboard image support). Note that currently we support (before and after this patch) only BMP and PNG. PNG is required as the default agent format. However Windows programs wants to have BMP (specifically DIB) in the clipboard. This patch remove CxImage and use directly libpng (BMP is supported directly by Windows APIs). Tested with various formats and the compiled agent with a Linux client. The main concern is actually the possible problem to support some weird/old BMP file formats however I don't think any actual program will handle BMP2 (BMP3 was introduced with Windows 3 probably 30 years ago). The test patch add a test helper executable and a script to test PNG encoding. Changes since v12: - change code style. Changes since v11: - change code to compute palette colors. Changes since v10: - use 2 buffer classes to make implementation easier; - better format a long statement; - remove RFC from spec check patch. Changes since v9: - add some more tests for different image bits (2,4,8) and gray; - fix 2 bit gray images; - make some comments more clear. Changes since v8: - test intermediate image too. This test single PNG -> BMP conversions. Changes since v7: - use png_set_bgr to avoid manually swap pixel components; - use "unsigned int" instead of unsigned; - use png_error instead of a manual longjmp; - moved some code hunks in early patches; - minor style changes. Changes since v6: - minor style changes; - merge small change to imagetest from Uri (usage error). Changes since v5: - remove jpeg dependencies, were used just to satisfy CxImage but not used in the code. Changes since v4: - remove tiff dependency, was just for CxImage. Changes since v3: - reuse code to compute DIB stride; - update documentation comments; - update copyright lines. Changes since v2: - updated copyright lines; - update some function documentation; - fixed 2 bit PNGs; - removed RFC from tests; - improved test adding different images; - merged Uri fix for memory. Frediano Ziglio (6): Move image handling to a separate file Initial rewrite of image conversion code Write code to decode PNG format Support encoding PNG images Add test for PNG files spec: run tests during RPM build if possible Makefile.am | 28 +++- configure.ac | 5 +- mingw-spice-vdagent.spec.in | 37 ++++- test-png | 58 +++++++ vdagent/image.cpp | 174 +++++++++++++++++++++ vdagent/image.h | 69 +++++++++ vdagent/imagepng.cpp | 357 ++++++++++++++++++++++++++++++++++++++++++++ vdagent/imagepng.h | 25 ++++ vdagent/imagetest.cpp | 82 ++++++++++ vdagent/vdagent.cpp | 57 +------ 10 files changed, 831 insertions(+), 61 deletions(-) create mode 100755 test-png create mode 100644 vdagent/image.cpp create mode 100644 vdagent/image.h create mode 100644 vdagent/imagepng.cpp create mode 100644 vdagent/imagepng.h create mode 100644 vdagent/imagetest.cpp -- 2.13.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel