summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-12-07 13:34:01 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-12-07 20:48:41 +0000
commitbc45215ec6e5d508415465ad3f619c3dbe23f7c8 (patch)
tree09b3fd7124e8b4274f8d5331cd4bfed1c943efff /desktop
parent48f0ba92a6e9828805ce6f5d87147b9d0dcefe3b (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')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx2
-rw-r--r--desktop/source/lib/init.cxx37
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 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