diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-04-16 20:33:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-07-25 08:38:12 +0200 |
commit | 81994cb2b8b32453a92bcb011830fcb884f22ff3 (patch) | |
tree | ae1750e92421ad2e0ec3f50351c3be6581841598 /canvas/source/directx | |
parent | dabedcaf27b0af1e38a611b8d8e48444f848e01d (diff) |
Convert internal vcl bitmap formats transparency->alpha (II)
(Second attempt at landing this)
Image formats and graphics APIs use alpha, not transparency,
so change our internal formats and data structures to work directly
with alpha, so we don't need to modify data before we push it to
graphics APIs.
Add a couple of new Color constants to make the intention
of the vcl code clearer.
Notes
(*) On macOS, tweaking the logic in CreateWithSalBitmapAndMask
to more accurately reflect the requirements of the
CGImageCreateWithMask function seems to fix some
tests.
(*) The vcl code does not properly support gradients
with transparency. So the previous code was wrong, and this
change is going to result in slightly different wrongness.
Change-Id: I9e21c2e98d88ecfdc5f75db13bd1ffff7c38db98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114168
Tested-by: Jenkins
Reviewed-by: Patrick Luby <plubius@neooffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'canvas/source/directx')
-rw-r--r-- | canvas/source/directx/dx_canvasbitmap.cxx | 2 | ||||
-rw-r--r-- | canvas/source/directx/dx_vcltools.cxx | 18 |
2 files changed, 4 insertions, 16 deletions
diff --git a/canvas/source/directx/dx_canvasbitmap.cxx b/canvas/source/directx/dx_canvasbitmap.cxx index 33dc7859fadb..fb06288ada86 100644 --- a/canvas/source/directx/dx_canvasbitmap.cxx +++ b/canvas/source/directx/dx_canvasbitmap.cxx @@ -214,7 +214,7 @@ namespace dxcanvas sal_uInt8* pOutBits=pAlphaBits.get()+y*nScanWidth; for( sal_Int32 x=0; x<aSize.getWidth(); ++x ) { - *pOutBits++ = 255-*pInBits; + *pOutBits++ = *pInBits; pInBits += 4; } } diff --git a/canvas/source/directx/dx_vcltools.cxx b/canvas/source/directx/dx_vcltools.cxx index 456f22386dd1..fb5e5c5e93db 100644 --- a/canvas/source/directx/dx_vcltools.cxx +++ b/canvas/source/directx/dx_vcltools.cxx @@ -211,11 +211,7 @@ namespace dxcanvas::tools *pCurrOutput++ = aCol.GetBlue(); *pCurrOutput++ = aCol.GetGreen(); *pCurrOutput++ = aCol.GetRed(); - - // our notion of alpha is - // different from the rest - // of the world's - *pCurrOutput++ = 255 - static_cast<BYTE>(*pAScan++); + *pCurrOutput++ = static_cast<BYTE>(*pAScan++); } } break; @@ -231,11 +227,7 @@ namespace dxcanvas::tools *pCurrOutput++ = *pScan++; *pCurrOutput++ = *pScan++; *pCurrOutput++ = *pScan++; - - // our notion of alpha is - // different from the rest - // of the world's - *pCurrOutput++ = 255 - static_cast<BYTE>(*pAScan++); + *pCurrOutput++ = static_cast<BYTE>(*pAScan++); } } break; @@ -258,11 +250,7 @@ namespace dxcanvas::tools *pCurrOutput++ = aCol.GetBlue(); *pCurrOutput++ = aCol.GetGreen(); *pCurrOutput++ = aCol.GetRed(); - - // our notion of alpha is - // different from the rest - // of the world's - *pCurrOutput++ = 255 - static_cast<BYTE>(*pAScan++); + *pCurrOutput++ = static_cast<BYTE>(*pAScan++); } } break; |