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:49:53 +0000 |
commit | 0b7776fac09797c910de6bce615409eeecdeb65c (patch) | |
tree | 4484f2946cfc3608251fc4168aed24fd9daf6b54 /desktop | |
parent | 2fbff6cdb3266a26a32390ddddd58ebd11947c49 (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>
(cherry picked from commit bc45215ec6e5d508415465ad3f619c3dbe23f7c8)
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 2 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 37 |
2 files changed, 4 insertions, 35 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 07607dd6b365..987ac1be9618 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -316,7 +316,7 @@ void DesktopLOKTest::testPaintTile() LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); int nCanvasWidth = 100; int nCanvasHeight = 300; - sal_Int32 nStride = basebmp::getBitmapDeviceStrideForWidth(basebmp::Format::ThirtyTwoBitTcMaskBGRX, + sal_Int32 nStride = basebmp::getBitmapDeviceStrideForWidth(basebmp::Format::ThirtyTwoBitTcMaskBGRA, nCanvasWidth); std::vector<unsigned char> aBuffer(nStride * nCanvasHeight); int nTilePosX = 0; diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 2bdea806e3cf..963bb1bcf072 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -886,33 +886,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(), @@ -933,21 +917,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 |