diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-04-15 12:11:56 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-04-15 21:05:34 +0200 |
commit | cb09533c4a007e7cfde69046bcaeb47117d30a86 (patch) | |
tree | 2977ff2a7d5efc5408b9e30e32a6684b7e561a3b /canvas | |
parent | d0c7afcce3016759a1371be361ce8b39dfc7fc17 (diff) |
tdf#141269 Incorrect transparency after roundtrip
Revert "convert internal bitmap formats transparency->alpha"
This reverts commit c181e510c5f5e74f1f6824b64637849aace9ae63.
and later fix up of
Revert "tdf#141504 qt5: ugly images"
This reverts commit e7424ff25a724ea5bb54b2282d5c3cbf74c92053.
a lot of places are still working int transparency values
and not opacity
Change-Id: I31342cdb76629acbaebfcdfa385407d3291fe06f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114150
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
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, 17 insertions, 5 deletions
diff --git a/canvas/source/directx/dx_canvasbitmap.cxx b/canvas/source/directx/dx_canvasbitmap.cxx index dba32d220434..adc4b741a4c3 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++ = *pInBits; + *pOutBits++ = 255-*pInBits; pInBits += 4; } } diff --git a/canvas/source/directx/dx_vcltools.cxx b/canvas/source/directx/dx_vcltools.cxx index d29043070ef3..5ed07159aba8 100644 --- a/canvas/source/directx/dx_vcltools.cxx +++ b/canvas/source/directx/dx_vcltools.cxx @@ -214,7 +214,11 @@ namespace dxcanvas::tools *pCurrOutput++ = aCol.GetBlue(); *pCurrOutput++ = aCol.GetGreen(); *pCurrOutput++ = aCol.GetRed(); - *pCurrOutput++ = static_cast<BYTE>(*pAScan++); + + // our notion of alpha is + // different from the rest + // of the world's + *pCurrOutput++ = 255 - static_cast<BYTE>(*pAScan++); } } break; @@ -230,7 +234,11 @@ namespace dxcanvas::tools *pCurrOutput++ = *pScan++; *pCurrOutput++ = *pScan++; *pCurrOutput++ = *pScan++; - *pCurrOutput++ = static_cast<BYTE>(*pAScan++); + + // our notion of alpha is + // different from the rest + // of the world's + *pCurrOutput++ = 255 - static_cast<BYTE>(*pAScan++); } } break; @@ -253,7 +261,11 @@ namespace dxcanvas::tools *pCurrOutput++ = aCol.GetBlue(); *pCurrOutput++ = aCol.GetGreen(); *pCurrOutput++ = aCol.GetRed(); - *pCurrOutput++ = static_cast<BYTE>(*pAScan++); + + // our notion of alpha is + // different from the rest + // of the world's + *pCurrOutput++ = 255 - static_cast<BYTE>(*pAScan++); } } break; diff --git a/canvas/source/vcl/canvasbitmaphelper.cxx b/canvas/source/vcl/canvasbitmaphelper.cxx index 2da1fe0ab0ad..dd1898486e8a 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 ] = aColor.GetAlpha(); + pRes[ 3 ] = 255 - aColor.GetAlpha(); return aRes; } |