diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-12-07 13:34:01 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-12-07 20:48:41 +0000 |
commit | bc45215ec6e5d508415465ad3f619c3dbe23f7c8 (patch) | |
tree | 09b3fd7124e8b4274f8d5331cd4bfed1c943efff /desktop/source | |
parent | 48f0ba92a6e9828805ce6f5d87147b9d0dcefe3b (diff) |
Resolves: tdf#96224 don't fiddle around with a separate alpha buffer
use a format that supports alpha directly
now we can unify the android and linux cases as well and drop the
BGRX support
Change-Id: I3c845913691d8194822423005d308cfa7ef13ec3
Reviewed-on: https://gerrit.libreoffice.org/20440
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'desktop/source')
-rw-r--r-- | desktop/source/lib/init.cxx | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index a9b4d304d10c..8dd6290cb22a 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -894,33 +894,17 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); -#elif defined(ANDROID) - ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT) ; - - boost::shared_array<sal_uInt8> aBuffer(pBuffer, NoDelete< sal_uInt8 >()); - - boost::shared_array<sal_uInt8> aAlphaBuffer; - - pDevice->SetOutputSizePixelScaleOffsetAndBuffer( - Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(), - aBuffer, aAlphaBuffer); - - pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, - nTilePosX, nTilePosY, nTileWidth, nTileHeight); #else ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT) ; +#if !defined(ANDROID) // Set background to transparent by default. pDevice->SetBackground(Wallpaper(Color(COL_TRANSPARENT))); +#endif boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() ); - // Allocate a separate buffer for the alpha device. - 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>()); + boost::shared_array<sal_uInt8> aAlphaBuffer; pDevice->SetOutputSizePixelScaleOffsetAndBuffer( Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(), @@ -941,21 +925,6 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, pDevice->DrawRect(aRect); pDevice->Pop(); } - - // Overwrite pBuffer's alpha channel with the separate alpha buffer. - for (int nRow = 0; nRow < nCanvasHeight; ++nRow) - { - for (int nCol = 0; nCol < nCanvasWidth; ++nCol) - { - const int nOffset = (nRow * nStride) + nCol * 4; - // VCL's transparent is 0, RGBA's transparent is 0xff. - 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 #else |