summaryrefslogtreecommitdiffstats
path: root/desktop/source/lib/init.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/source/lib/init.cxx')
-rw-r--r--desktop/source/lib/init.cxx25
1 files changed, 14 insertions, 11 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 68eb01dd67ba..69ff1c3b1aaf 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -882,12 +882,12 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
SystemGraphicsData aData;
aData.rCGContext = reinterpret_cast<CGContextRef>(pBuffer);
// the Size argument is irrelevant, I hope
- ScopedVclPtrInstance<VirtualDevice> pDevice(&aData, Size(1, 1), DeviceFormat::FULLCOLOR);
+ ScopedVclPtrInstance<VirtualDevice> pDevice(&aData, Size(1, 1), DeviceFormat::DEFAULT);
pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight,
nTilePosX, nTilePosY, nTileWidth, nTileHeight);
#elif defined(ANDROID)
- ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), DeviceFormat::FULLCOLOR) ;
+ ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT) ;
boost::shared_array<sal_uInt8> aBuffer(pBuffer, NoDelete< sal_uInt8 >());
@@ -900,20 +900,19 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight,
nTilePosX, nTilePosY, nTileWidth, nTileHeight);
#else
- ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), DeviceFormat::FULLCOLOR) ;
+ ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT) ;
// Set background to transparent by default.
- memset(pBuffer, 0, nCanvasWidth * nCanvasHeight * 4);
pDevice->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() );
// Allocate a separate buffer for the alpha device.
- std::vector<sal_uInt8> aAlpha(nCanvasWidth * nCanvasHeight);
- memset(aAlpha.data(), 0, nCanvasWidth * nCanvasHeight);
-// TO_DO: enable alpha
-// boost::shared_array<sal_uInt8> aAlphaBuffer(aAlpha.data(), NoDelete<sal_uInt8>());
- boost::shared_array<sal_uInt8> aAlphaBuffer;
+ sal_Int32 nStride = basebmp::getBitmapDeviceStrideForWidth(basebmp::Format::ThirtyTwoBitTcMaskBGRX,
+ nCanvasWidth);
+ std::vector<sal_uInt8> aAlpha(nCanvasHeight * nStride);
+
+ boost::shared_array<sal_uInt8> aAlphaBuffer(aAlpha.data(), NoDelete<sal_uInt8>());
pDevice->SetOutputSizePixelScaleOffsetAndBuffer(
Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(),
@@ -927,11 +926,15 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
{
for (int nCol = 0; nCol < nCanvasWidth; ++nCol)
{
- const int nOffset = (nCanvasWidth * nRow) + nCol;
+ const int nOffset = (nRow * nStride) + nCol * 4;
// VCL's transparent is 0, RGBA's transparent is 0xff.
- pBuffer[nOffset * 4 +3] = 0xff - aAlpha[nOffset];
+ pBuffer[nOffset + 3] = 0xff - aAlpha[nOffset];
+ double fAlpha = pBuffer[nOffset + 3]/255.0;
+ for (int i = 0; i < 3; ++i)
+ pBuffer[nOffset + i] *= fAlpha;
}
}
+
#endif
static bool bDebug = getenv("LOK_DEBUG") != nullptr;