Description: On systems that use Cairo as the VCL backend, the following occurs: VirtualDevice aRenderContext; aRenderContext.DrawPixel(Point(8, 1), COL_GREEN); aRenderContext.GetPixel(Point(8, 1))); Last line returns 000000ff! This is wrong https://github.com/chrissherlock/libreoffice-experimental/blob/pixelbug/vcl/qa/cppunit/outdev/PixelTest.cxx Steps to Reproduce: 1. Cherry pick my commit on github: https://github.com/chrissherlock/libreoffice-experimental/commit/515c1b3e3ddf1a06028982b5741350dfeedc010f 2. Run make CppunitTest_PixelTest Actual Results: /home/chris/repos/libreoffice-latest/vcl/qa/cppunit/outdev/PixelTest.cxx:35:PixelTest::testPixel equality assertion failed - Expected: c[00800000] - Actual : c[000000ff] PixelTest::testPixel finished in: 21ms PixelTest.cxx:35:Assertion Test name: PixelTest::testPixel equality assertion failed - Expected: c[00800000] - Actual : c[000000ff] Failures !!! Run: 1 Failure total: 1 Failures: 1 Errors: 0 Error: a unit test failed, please do one of: make CppunitTest_PixelTest CPPUNITTRACE="gdb --args" # for interactive debugging on Linux make CppunitTest_PixelTest VALGRIND=memcheck # for memory checking make CppunitTest_PixelTest DEBUGCPPUNIT=TRUE # for exception catching Expected Results: Should be returning 00800000 (COL_GREEN). Reproducible: Always User Profile Reset: No Additional Info:
Please note, I did step through this, I think the issue may occur in
Luckily we don't use GetPixel practically anywhere except for tests. This looks like an issue of not taking account of per-multiplied alpha and misinterpretation of RGBA / ARGB or something like that.. Anyway the GetPixel should already be tested in BackendTest.cxx once we can enable that (needs fixing issues with the backends first and enable backend by backend).
I debugged this, and it isn't an issue with premultiplied alpha as far as I can see. In SvpSalGraphics::getPixel, the value of data is 0x0000 unsigned char *data = cairo_image_surface_get_data(target); data[SVP_CAIRO_ALPHA] is 0 data[SVP_CAIRO_BLUE] is 0 data[SVP_CAIRO_GREEN] is 0 data[SVP_CAIRO_RED] is 0
Amazing Post, Thank you for sharing this post really this is awesome and very useful. http://corporate-office-headquarters-au.com/coles/
... VirtualDevice aRenderContext; aRenderContext.DrawPixel(Point(8, 1), COL_GREEN); ... aRenderContext is 0x0 so you are drawing outside the bounds of the device. Change it to ... VirtualDevice aRenderContext; aRenderContext.SetOutputSizePixel(Size(10,10)); aRenderContext.DrawPixel(Point(8, 1), COL_GREEN); and it will work
Thanks!