diff options
author | Armin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de> | 2024-09-19 20:25:18 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2024-09-20 11:00:00 +0200 |
commit | 92067587039473db38b139ecb56a3c64544e975b (patch) | |
tree | 4a9c73fb4c659276db1a81187836a28242e81366 /vcl/source/bitmap | |
parent | 5725374d6286653fbcdd50ec4999606e4932824d (diff) |
Correct usage of premultiply for ENABLE_WASM_STRIP_PREMULTIPLY
The order of parameters for vcl::bitmap::premultiply and
vcl::bitmap::unpremultiply was wrong because when doing
that I just used the same order that the indexing that was
to be replaced used it. Corrected that.
Change-Id: I59473acca8afdc58105b3381d1fdcedd6c0fd83b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173683
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'vcl/source/bitmap')
-rw-r--r-- | vcl/source/bitmap/BitmapTools.cxx | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx index 3fa06d54019a..75462f0a8999 100644 --- a/vcl/source/bitmap/BitmapTools.cxx +++ b/vcl/source/bitmap/BitmapTools.cxx @@ -375,9 +375,9 @@ BitmapEx* CreateFromCairoSurface(Size aSize, cairo_surface_t * pSurface) { // Cairo uses pre-multiplied alpha - we do not => re-multiply #if ENABLE_WASM_STRIP_PREMULTIPLY - nR = vcl::bitmap::unpremultiply(nAlpha, nR); - nG = vcl::bitmap::unpremultiply(nAlpha, nG); - nB = vcl::bitmap::unpremultiply(nAlpha, nB); + nR = vcl::bitmap::unpremultiply(nR, nAlpha); + nG = vcl::bitmap::unpremultiply(nG, nAlpha); + nB = vcl::bitmap::unpremultiply(nB, nAlpha); #else nR = unpremultiply_table[nAlpha][nR]; nG = unpremultiply_table[nAlpha][nG]; @@ -781,9 +781,9 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un #ifdef OSL_BIGENDIAN #if ENABLE_WASM_STRIP_PREMULTIPLY - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, aColor.GetRed()); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, aColor.GetGreen()); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, aColor.GetBlue()); + data[ nOff++ ] = vcl::bitmap::premultiply(aColor.GetRed(), nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(aColor.GetGreen(), nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(aColor.GetBlue(), nAlpha); #else data[ nOff++ ] = premultiply_table[nAlpha][aColor.GetRed()]; data[ nOff++ ] = premultiply_table[nAlpha][aColor.GetGreen()]; @@ -791,9 +791,9 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un #endif #else #if ENABLE_WASM_STRIP_PREMULTIPLY - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, aColor.GetBlue()); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, aColor.GetGreen()); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, aColor.GetRed()); + data[ nOff++ ] = vcl::bitmap::premultiply(aColor.GetBlue(), nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(aColor.GetGreen(), nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(aColor.GetRed(), nAlpha); #else data[ nOff++ ] = premultiply_table[nAlpha][aColor.GetBlue()]; data[ nOff++ ] = premultiply_table[nAlpha][aColor.GetGreen()]; @@ -817,9 +817,9 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un else nAlpha = data[ nOff ] = 255; #if ENABLE_WASM_STRIP_PREMULTIPLY - data[ nOff + 3 ] = vcl::bitmap::premultiply(nAlpha, *pReadScan++); - data[ nOff + 2 ] = vcl::bitmap::premultiply(nAlpha, *pReadScan++); - data[ nOff + 1 ] = vcl::bitmap::premultiply(nAlpha, *pReadScan++); + data[ nOff + 3 ] = vcl::bitmap::premultiply(*pReadScan++, nAlpha); + data[ nOff + 2 ] = vcl::bitmap::premultiply(*pReadScan++, nAlpha); + data[ nOff + 1 ] = vcl::bitmap::premultiply(*pReadScan++, nAlpha); #else data[ nOff + 3 ] = premultiply_table[nAlpha][*pReadScan++]; data[ nOff + 2 ] = premultiply_table[nAlpha][*pReadScan++]; @@ -832,9 +832,9 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un else nAlpha = data[ nOff + 3 ] = 255; #if ENABLE_WASM_STRIP_PREMULTIPLY - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, *pReadScan++); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, *pReadScan++); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, *pReadScan++); + data[ nOff++ ] = vcl::bitmap::premultiply(*pReadScan++, nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(*pReadScan++, nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(*pReadScan++, nAlpha); #else data[ nOff++ ] = premultiply_table[nAlpha][*pReadScan++]; data[ nOff++ ] = premultiply_table[nAlpha][*pReadScan++]; @@ -858,9 +858,9 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un else nAlpha = data[ nOff++ ] = 255; #if ENABLE_WASM_STRIP_PREMULTIPLY - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, *pReadScan++); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, *pReadScan++); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, *pReadScan++); + data[ nOff++ ] = vcl::bitmap::premultiply(*pReadScan++, nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(*pReadScan++, nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(*pReadScan++, nAlpha); #else data[ nOff++ ] = premultiply_table[nAlpha][*pReadScan++]; data[ nOff++ ] = premultiply_table[nAlpha][*pReadScan++]; @@ -872,9 +872,9 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un else nAlpha = data[ nOff + 3 ] = 255; #if ENABLE_WASM_STRIP_PREMULTIPLY - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, pReadScan[ 2 ]); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, pReadScan[ 1 ]); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, pReadScan[ 0 ]); + data[ nOff++ ] = vcl::bitmap::premultiply(pReadScan[ 2 ], nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(pReadScan[ 1 ], nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(pReadScan[ 0 ], nAlpha); #else data[ nOff++ ] = premultiply_table[nAlpha][pReadScan[ 2 ]]; data[ nOff++ ] = premultiply_table[nAlpha][pReadScan[ 1 ]]; @@ -899,9 +899,9 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un else nAlpha = data[ nOff++ ] = 255; #if ENABLE_WASM_STRIP_PREMULTIPLY - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, pReadScan[ 2 ]); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, pReadScan[ 1 ]); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, pReadScan[ 0 ]); + data[ nOff++ ] = vcl::bitmap::premultiply(pReadScan[ 2 ], nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(pReadScan[ 1 ], nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(pReadScan[ 0 ], nAlpha); #else data[ nOff++ ] = premultiply_table[nAlpha][pReadScan[ 2 ]]; data[ nOff++ ] = premultiply_table[nAlpha][pReadScan[ 1 ]]; @@ -914,9 +914,9 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un else nAlpha = data[ nOff + 3 ] = 255; #if ENABLE_WASM_STRIP_PREMULTIPLY - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, *pReadScan++); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, *pReadScan++); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, *pReadScan++); + data[ nOff++ ] = vcl::bitmap::premultiply(*pReadScan++, nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(*pReadScan++, nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(*pReadScan++, nAlpha); #else data[ nOff++ ] = premultiply_table[nAlpha][*pReadScan++]; data[ nOff++ ] = premultiply_table[nAlpha][*pReadScan++]; @@ -941,9 +941,9 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un else nAlpha = data[ nOff ++ ] = 255; #if ENABLE_WASM_STRIP_PREMULTIPLY - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, *pReadScan++); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, *pReadScan++); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, *pReadScan++); + data[ nOff++ ] = vcl::bitmap::premultiply(*pReadScan++, nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(*pReadScan++, nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(*pReadScan++, nAlpha); #else data[ nOff++ ] = premultiply_table[nAlpha][*pReadScan++]; data[ nOff++ ] = premultiply_table[nAlpha][*pReadScan++]; @@ -956,9 +956,9 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un else nAlpha = data[ nOff + 3 ] = 255; #if ENABLE_WASM_STRIP_PREMULTIPLY - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, pReadScan[ 2 ]); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, pReadScan[ 1 ]); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, pReadScan[ 0 ]); + data[ nOff++ ] = vcl::bitmap::premultiply(pReadScan[ 2 ], nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(pReadScan[ 1 ], nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(pReadScan[ 0 ], nAlpha); #else data[ nOff++ ] = premultiply_table[nAlpha][pReadScan[ 2 ]]; data[ nOff++ ] = premultiply_table[nAlpha][pReadScan[ 1 ]]; @@ -988,9 +988,9 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un else nAlpha = data[ nOff++ ] = 255; #if ENABLE_WASM_STRIP_PREMULTIPLY - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, aColor.GetRed()); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, aColor.GetGreen()); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, aColor.GetBlue()); + data[ nOff++ ] = vcl::bitmap::premultiply(aColor.GetRed(), nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(aColor.GetGreen(), nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(aColor.GetBlue(), nAlpha); #else data[ nOff++ ] = premultiply_table[nAlpha][aColor.GetRed()]; data[ nOff++ ] = premultiply_table[nAlpha][aColor.GetGreen()]; @@ -1002,9 +1002,9 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un else nAlpha = data[ nOff + 3 ] = 255; #if ENABLE_WASM_STRIP_PREMULTIPLY - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, aColor.GetBlue()); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, aColor.GetGreen()); - data[ nOff++ ] = vcl::bitmap::premultiply(nAlpha, aColor.GetRed()); + data[ nOff++ ] = vcl::bitmap::premultiply(aColor.GetBlue(), nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(aColor.GetGreen(), nAlpha); + data[ nOff++ ] = vcl::bitmap::premultiply(aColor.GetRed(), nAlpha); #else data[ nOff++ ] = premultiply_table[nAlpha][aColor.GetBlue()]; data[ nOff++ ] = premultiply_table[nAlpha][aColor.GetGreen()]; |