summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/headless/CairoCommon.cxx30
-rw-r--r--vcl/source/bitmap/BitmapTools.cxx78
-rw-r--r--vcl/source/filter/png/PngImageReader.cxx12
3 files changed, 60 insertions, 60 deletions
diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx
index 163007e46823..f72046ddda53 100644
--- a/vcl/headless/CairoCommon.cxx
+++ b/vcl/headless/CairoCommon.cxx
@@ -558,15 +558,15 @@ void CairoCommon::doXorOnRelease(sal_Int32 nExtentsLeft, sal_Int32 nExtentsTop,
sal_uInt8 a = true_data[SVP_CAIRO_ALPHA];
sal_uInt8 xor_a = xor_data[SVP_CAIRO_ALPHA];
#if ENABLE_WASM_STRIP_PREMULTIPLY
- sal_uInt8 b = vcl::bitmap::unpremultiply(a, true_data[SVP_CAIRO_BLUE])
- ^ vcl::bitmap::unpremultiply(xor_a, xor_data[SVP_CAIRO_BLUE]);
- sal_uInt8 g = vcl::bitmap::unpremultiply(a, true_data[SVP_CAIRO_GREEN])
- ^ vcl::bitmap::unpremultiply(xor_a, xor_data[SVP_CAIRO_GREEN]);
- sal_uInt8 r = vcl::bitmap::unpremultiply(a, true_data[SVP_CAIRO_RED])
- ^ vcl::bitmap::unpremultiply(xor_a, xor_data[SVP_CAIRO_RED]);
- true_data[SVP_CAIRO_BLUE] = vcl::bitmap::premultiply(a, b);
- true_data[SVP_CAIRO_GREEN] = vcl::bitmap::premultiply(a, g);
- true_data[SVP_CAIRO_RED] = vcl::bitmap::premultiply(a, r);
+ sal_uInt8 b = vcl::bitmap::unpremultiply(true_data[SVP_CAIRO_BLUE], a)
+ ^ vcl::bitmap::unpremultiply(xor_data[SVP_CAIRO_BLUE], xor_a);
+ sal_uInt8 g = vcl::bitmap::unpremultiply(true_data[SVP_CAIRO_GREEN], a)
+ ^ vcl::bitmap::unpremultiply(xor_data[SVP_CAIRO_GREEN], xor_a);
+ sal_uInt8 r = vcl::bitmap::unpremultiply(true_data[SVP_CAIRO_RED], a)
+ ^ vcl::bitmap::unpremultiply(xor_data[SVP_CAIRO_RED], xor_a);
+ true_data[SVP_CAIRO_BLUE] = vcl::bitmap::premultiply(b, a);
+ true_data[SVP_CAIRO_GREEN] = vcl::bitmap::premultiply(g, a);
+ true_data[SVP_CAIRO_RED] = vcl::bitmap::premultiply(r, a);
#else
sal_uInt8 b = unpremultiply_table[a][true_data[SVP_CAIRO_BLUE]]
^ unpremultiply_table[xor_a][xor_data[SVP_CAIRO_BLUE]];
@@ -731,9 +731,9 @@ Color CairoCommon::getPixel(cairo_surface_t* pSurface, tools::Long nX, tools::Lo
unsigned char* data = cairo_image_surface_get_data(target);
sal_uInt8 a = data[SVP_CAIRO_ALPHA];
#if ENABLE_WASM_STRIP_PREMULTIPLY
- sal_uInt8 b = vcl::bitmap::unpremultiply(a, data[SVP_CAIRO_BLUE]);
- sal_uInt8 g = vcl::bitmap::unpremultiply(a, data[SVP_CAIRO_GREEN]);
- sal_uInt8 r = vcl::bitmap::unpremultiply(a, data[SVP_CAIRO_RED]);
+ sal_uInt8 b = vcl::bitmap::unpremultiply(data[SVP_CAIRO_BLUE], a);
+ sal_uInt8 g = vcl::bitmap::unpremultiply(data[SVP_CAIRO_GREEN], a);
+ sal_uInt8 r = vcl::bitmap::unpremultiply(data[SVP_CAIRO_RED], a);
#else
sal_uInt8 b = unpremultiply_table[a][data[SVP_CAIRO_BLUE]];
sal_uInt8 g = unpremultiply_table[a][data[SVP_CAIRO_GREEN]];
@@ -1840,9 +1840,9 @@ void CairoCommon::drawMask(const SalTwoRect& rTR, const SalBitmap& rSalBitmap, C
{
sal_uInt8 a = data[SVP_CAIRO_ALPHA];
#if ENABLE_WASM_STRIP_PREMULTIPLY
- sal_uInt8 b = vcl::bitmap::unpremultiply(a, data[SVP_CAIRO_BLUE]);
- sal_uInt8 g = vcl::bitmap::unpremultiply(a, data[SVP_CAIRO_GREEN]);
- sal_uInt8 r = vcl::bitmap::unpremultiply(a, data[SVP_CAIRO_RED]);
+ sal_uInt8 b = vcl::bitmap::unpremultiply(data[SVP_CAIRO_BLUE], a);
+ sal_uInt8 g = vcl::bitmap::unpremultiply(data[SVP_CAIRO_GREEN], a);
+ sal_uInt8 r = vcl::bitmap::unpremultiply(data[SVP_CAIRO_RED], a);
#else
sal_uInt8 b = unpremultiply_table[a][data[SVP_CAIRO_BLUE]];
sal_uInt8 g = unpremultiply_table[a][data[SVP_CAIRO_GREEN]];
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()];
diff --git a/vcl/source/filter/png/PngImageReader.cxx b/vcl/source/filter/png/PngImageReader.cxx
index e64343dd0070..d52a13be4779 100644
--- a/vcl/source/filter/png/PngImageReader.cxx
+++ b/vcl/source/filter/png/PngImageReader.cxx
@@ -566,9 +566,9 @@ bool reader(SvStream& rStream, Graphic& rGraphic,
{
const sal_uInt8 alpha = pScanline[i + 3];
#if ENABLE_WASM_STRIP_PREMULTIPLY
- pScanline[i + 3] = vcl::bitmap::premultiply(alpha, pScanline[i + 2]);
- pScanline[i + 2] = vcl::bitmap::premultiply(alpha, pScanline[i + 1]);
- pScanline[i + 1] = vcl::bitmap::premultiply(alpha, pScanline[i]);
+ pScanline[i + 3] = vcl::bitmap::premultiply(pScanline[i + 2], alpha);
+ pScanline[i + 2] = vcl::bitmap::premultiply(pScanline[i + 1], alpha);
+ pScanline[i + 1] = vcl::bitmap::premultiply(pScanline[i], alpha);
#else
pScanline[i + 3] = premultiply[alpha][pScanline[i + 2]];
pScanline[i + 2] = premultiply[alpha][pScanline[i + 1]];
@@ -587,9 +587,9 @@ bool reader(SvStream& rStream, Graphic& rGraphic,
{
const sal_uInt8 alpha = pScanline[i + 3];
#if ENABLE_WASM_STRIP_PREMULTIPLY
- pScanline[i] = vcl::bitmap::premultiply(alpha, pScanline[i]);
- pScanline[i + 1] = vcl::bitmap::premultiply(alpha, pScanline[i + 1]);
- pScanline[i + 2] = vcl::bitmap::premultiply(alpha, pScanline[i + 2]);
+ pScanline[i] = vcl::bitmap::premultiply(pScanline[i], alpha);
+ pScanline[i + 1] = vcl::bitmap::premultiply(pScanline[i + 1], alpha);
+ pScanline[i + 2] = vcl::bitmap::premultiply(pScanline[i + 2], alpha);
#else
pScanline[i] = premultiply[alpha][pScanline[i]];
pScanline[i + 1] = premultiply[alpha][pScanline[i + 1]];