summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--canvas/source/directx/dx_canvasbitmap.cxx2
-rw-r--r--canvas/source/directx/dx_vcltools.cxx18
-rw-r--r--canvas/source/vcl/canvasbitmaphelper.cxx2
-rw-r--r--vcl/inc/bitmap/ScanlineTools.hxx2
-rw-r--r--vcl/qa/cppunit/ScanlineToolsTest.cxx10
-rw-r--r--vcl/qt5/Qt5Graphics_GDI.cxx2
-rw-r--r--vcl/skia/salbmp.cxx2
-rw-r--r--vcl/source/bitmap/BitmapEx.cxx2
-rw-r--r--vcl/source/gdi/gdimtf.cxx2
-rw-r--r--vcl/source/helper/canvasbitmap.cxx10
-rw-r--r--vcl/source/opengl/OpenGLHelper.cxx2
11 files changed, 22 insertions, 32 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;
}
diff --git a/vcl/inc/bitmap/ScanlineTools.hxx b/vcl/inc/bitmap/ScanlineTools.hxx
index c343cf34f61e..98e702549f2b 100644
--- a/vcl/inc/bitmap/ScanlineTools.hxx
+++ b/vcl/inc/bitmap/ScanlineTools.hxx
@@ -46,7 +46,7 @@ public:
virtual void writePixel(Color nColor) override
{
- *pData++ = 255 - nColor.GetAlpha();
+ *pData++ = nColor.GetAlpha();
*pData++ = nColor.GetRed();
*pData++ = nColor.GetGreen();
*pData++ = nColor.GetBlue();
diff --git a/vcl/qa/cppunit/ScanlineToolsTest.cxx b/vcl/qa/cppunit/ScanlineToolsTest.cxx
index c6751b827ca1..3a4fc7da9348 100644
--- a/vcl/qa/cppunit/ScanlineToolsTest.cxx
+++ b/vcl/qa/cppunit/ScanlineToolsTest.cxx
@@ -42,9 +42,9 @@ void ScanlineToolsTest::ScanlineTransformer_32_ARGB()
pScanlineTransformer->startLine(aScanLine.data());
std::vector<Color> aColors{
- Color(ColorTransparency, 0, 10, 250, 120), Color(ColorTransparency, 50, 30, 230, 110),
- Color(ColorTransparency, 100, 50, 210, 100), Color(ColorTransparency, 150, 70, 190, 90),
- Color(ColorTransparency, 200, 90, 170, 80),
+ Color(ColorAlpha, 255, 10, 250, 120), Color(ColorAlpha, 205, 30, 230, 110),
+ Color(ColorAlpha, 155, 50, 210, 100), Color(ColorAlpha, 105, 70, 190, 90),
+ Color(ColorAlpha, 55, 90, 170, 80),
};
for (Color const& aColor : aColors)
@@ -52,8 +52,8 @@ void ScanlineToolsTest::ScanlineTransformer_32_ARGB()
pScanlineTransformer->writePixel(aColor);
}
- std::vector<sal_uInt8> aExpectedBytes{ 0, 10, 250, 120, 50, 30, 230, 110, 100, 50,
- 210, 100, 150, 70, 190, 90, 200, 90, 170, 80 };
+ std::vector<sal_uInt8> aExpectedBytes{ 255, 10, 250, 120, 205, 30, 230, 110, 155, 50,
+ 210, 100, 105, 70, 190, 90, 55, 90, 170, 80 };
for (size_t i = 0; i < aScanLine.size(); ++i)
{
diff --git a/vcl/qt5/Qt5Graphics_GDI.cxx b/vcl/qt5/Qt5Graphics_GDI.cxx
index a40a96e9fb29..5c4db9ecceb3 100644
--- a/vcl/qt5/Qt5Graphics_GDI.cxx
+++ b/vcl/qt5/Qt5Graphics_GDI.cxx
@@ -592,7 +592,7 @@ static bool getAlphaImage(const SalBitmap& rSourceBitmap, const SalBitmap& rAlph
uchar* image_line = rAlphaImage.scanLine(y);
const uchar* alpha_line = pAlpha->scanLine(y);
for (int x = 0; x < rAlphaImage.width(); ++x, image_line += 4)
- image_line[3] = 255 - alpha_line[x];
+ image_line[3] = alpha_line[x];
}
}
else
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index e89a824f0d84..5d56abecbe79 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -1243,7 +1243,7 @@ OString SkiaSalBitmap::GetAlphaImageKey() const
{
std::stringstream ss;
ss << std::hex << std::setfill('0') << std::setw(2)
- << static_cast<int>(255 - SkColorGetA(fromEraseColorToAlphaImageColor(mEraseColor)));
+ << static_cast<int>(SkColorGetA(fromEraseColorToAlphaImageColor(mEraseColor)));
return OStringLiteral("E") + ss.str().c_str();
}
return OStringLiteral("I") + OString::number(GetAlphaSkImage()->uniqueID());
diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index 65698b6bbad9..c75aa12ed27b 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -1588,7 +1588,7 @@ void BitmapEx::AdjustTransparency(sal_uInt8 cTrans)
for( tools::Long nX = 0; nX < nWidth; nX++ )
{
nNewTrans = nTrans + *pAScan;
- *pAScan++ = static_cast<sal_uInt8>( ( nNewTrans & 0xffffff00 ) ? 255 : nNewTrans );
+ *pAScan++ = static_cast<sal_uInt8>( ( nNewTrans & 0xffffff00 ) ? 0 : (255 - nNewTrans) );
}
}
}
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index e42e7feedb87..96df06275afc 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -1751,7 +1751,7 @@ Color GDIMetaFile::ImplColConvertFnc( const Color& rColor, const void* pColParam
if( MtfConversion::N1BitThreshold == static_cast<const ImplColConvertParam*>(pColParam)->eConversion )
cLum = ( cLum < 128 ) ? 0 : 255;
- return Color( ColorTransparency, 255 - rColor.GetAlpha(), cLum, cLum, cLum );
+ return Color( ColorAlpha, rColor.GetAlpha(), cLum, cLum, cLum );
}
BitmapEx GDIMetaFile::ImplBmpConvertFnc( const BitmapEx& rBmpEx, const void* pBmpParam )
diff --git a/vcl/source/helper/canvasbitmap.cxx b/vcl/source/helper/canvasbitmap.cxx
index 9cef26b7a19b..97a1293bfad7 100644
--- a/vcl/source/helper/canvasbitmap.cxx
+++ b/vcl/source/helper/canvasbitmap.cxx
@@ -564,7 +564,8 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getPixel( rendering::Integer
{
// input less than a byte - copy via GetPixel()
*pOutBuf++ = m_pBmpAcc->GetPixelIndex(pos.Y,pos.X);
- *pOutBuf = m_pAlphaAcc->GetPixelIndex(pos.Y,pos.X);
+ // convert alpha to transparency to preserve UNO compat
+ *pOutBuf = 255 - m_pAlphaAcc->GetPixelIndex(pos.Y,pos.X);
}
else
{
@@ -574,7 +575,8 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getPixel( rendering::Integer
// input integer multiple of byte - copy directly
memcpy(pOutBuf, pScan+nScanlineLeftOffset, nNonAlphaBytes );
pOutBuf += nNonAlphaBytes;
- *pOutBuf++ = m_pAlphaAcc->GetPixelIndex(pos.Y,pos.X);
+ // convert alpha to transparency to preserve UNO compat
+ *pOutBuf++ = 255 - m_pAlphaAcc->GetPixelIndex(pos.Y,pos.X);
}
}
@@ -1320,7 +1322,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromARGB( co
m_pBmpAcc->SetPixelOnData(pColors,i,aCol2);
pColors += nNonAlphaBytes;
- *pColors++ = 255 - toByteColor(rgbColor[i].Alpha);
+ *pColors++ = toByteColor(rgbColor[i].Alpha);
}
}
else
@@ -1370,7 +1372,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromPARGB( c
m_pBmpAcc->SetPixelOnData(pColors,i,aCol2);
pColors += nNonAlphaBytes;
- *pColors++ = 255 - toByteColor(nAlpha);
+ *pColors++ = toByteColor(nAlpha);
}
}
else
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index 82e01da1dc8d..2d9d3ce8c713 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -597,7 +597,7 @@ BitmapEx OpenGLHelper::ConvertBufferToBitmapEx(const sal_uInt8* const pBuffer, t
*pScan++ = pBuffer[nCurPos+2];
nCurPos += 3;
- *pAlphaScan++ = static_cast<sal_uInt8>( 255 - pBuffer[nCurPos++] );
+ *pAlphaScan++ = pBuffer[nCurPos++];
}
}
}