diff options
author | Noel Grandin <noel@peralex.com> | 2021-01-07 09:46:07 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-02-23 11:20:35 +0100 |
commit | c181e510c5f5e74f1f6824b64637849aace9ae63 (patch) | |
tree | 31a658cbe4d8e1de92a1dcd39cd649a93f74685b /canvas | |
parent | d042b39c2f30246b51cba65400552c25a6dd5105 (diff) |
convert internal bitmap formats transparency->alpha
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.
Change-Id: I537f77f79e83876be11d787901df42710d190842
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108919
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'canvas')
-rw-r--r-- | canvas/source/directx/dx_canvasbitmap.cxx | 2 | ||||
-rw-r--r-- | canvas/source/directx/dx_vcltools.cxx | 18 | ||||
-rw-r--r-- | canvas/source/vcl/canvasbitmaphelper.cxx | 2 |
3 files changed, 5 insertions, 17 deletions
diff --git a/canvas/source/directx/dx_canvasbitmap.cxx b/canvas/source/directx/dx_canvasbitmap.cxx index adc4b741a4c3..dba32d220434 100644 --- a/canvas/source/directx/dx_canvasbitmap.cxx +++ b/canvas/source/directx/dx_canvasbitmap.cxx @@ -218,7 +218,7 @@ namespace dxcanvas sal_uInt8* pOutBits=pAlphaBits.get()+y*nScanWidth; for( sal_Int32 x=0; x<aSize.getX(); ++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 968b15b1dca3..323022b9caa2 100644 --- a/canvas/source/directx/dx_vcltools.cxx +++ b/canvas/source/directx/dx_vcltools.cxx @@ -215,11 +215,7 @@ namespace dxcanvas::tools *pCurrOutput++ = aCol.GetBlue(); *pCurrOutput++ = aCol.GetGreen(); *pCurrOutput++ = aCol.GetRed(); - - // out notion of alpha is - // different from the rest - // of the world's - *pCurrOutput++ = 255 - static_cast<BYTE>(*pAScan++); + *pCurrOutput++ = static_cast<BYTE>(*pAScan++); } } break; @@ -235,11 +231,7 @@ namespace dxcanvas::tools *pCurrOutput++ = *pScan++; *pCurrOutput++ = *pScan++; *pCurrOutput++ = *pScan++; - - // out notion of alpha is - // different from the rest - // of the world's - *pCurrOutput++ = 255 - static_cast<BYTE>(*pAScan++); + *pCurrOutput++ = static_cast<BYTE>(*pAScan++); } } break; @@ -263,11 +255,7 @@ namespace dxcanvas::tools *pCurrOutput++ = aCol.GetBlue(); *pCurrOutput++ = aCol.GetGreen(); *pCurrOutput++ = aCol.GetRed(); - - // out notion of alpha is - // different from the rest - // of the world's - *pCurrOutput++ = 255 - static_cast<BYTE>(*pAScan++); + *pCurrOutput++ = static_cast<BYTE>(*pAScan++); } } break; diff --git a/canvas/source/vcl/canvasbitmaphelper.cxx b/canvas/source/vcl/canvasbitmaphelper.cxx index dd1898486e8a..2da1fe0ab0ad 100644 --- a/canvas/source/vcl/canvasbitmaphelper.cxx +++ b/canvas/source/vcl/canvasbitmaphelper.cxx @@ -148,7 +148,7 @@ namespace vclcanvas pRes[ 0 ] = aColor.GetRed(); pRes[ 1 ] = aColor.GetGreen(); pRes[ 2 ] = aColor.GetBlue(); - pRes[ 3 ] = 255 - aColor.GetAlpha(); + pRes[ 3 ] = aColor.GetAlpha(); return aRes; } |