From 8e257245396ec0f9edde494904a1c7d9835535bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= Date: Sat, 31 Oct 2015 13:59:46 +0100 Subject: [PATCH 251/398] android: don't use alpha VDev when painting tiles on Android Improves tile rendering speed. Change-Id: I6a4b87fbc1d9ed284f5c4a781d769eeacd9bc2ca (cherry picked from commit e0d68da3ff3ae81e35f4e7393fb998a41886831d) --- desktop/source/lib/init.cxx | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 6785ae2328d4..98747ea62e3a 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -773,7 +773,30 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, #if defined(UNX) && !defined(MACOSX) && !defined(ENABLE_HEADLESS) -#ifndef IOS +#if defined(IOS) + SystemGraphicsData aData; + aData.rCGContext = reinterpret_cast(pBuffer); + // the Size argument is irrelevant, I hope + ScopedVclPtrInstance pDevice(&aData, Size(1, 1), (sal_uInt16)0); + + pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, + nTilePosX, nTilePosY, nTileWidth, nTileHeight); +#elif defined(ANDROID) + InitSvpForLibreOfficeKit(); + + ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), (sal_uInt16)32) ; + + boost::shared_array aBuffer(pBuffer, NoDelete< sal_uInt8 >()); + + boost::shared_array aAlphaBuffer; + + pDevice->SetOutputSizePixelScaleOffsetAndBuffer( + Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(), + aBuffer, aAlphaBuffer, true); + + pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, + nTilePosX, nTilePosY, nTileWidth, nTileHeight); +#else InitSvpForLibreOfficeKit(); ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), (sal_uInt16)32) ; @@ -806,15 +829,6 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, pBuffer[nOffset * 4 +3] = 0xff - aAlpha[nOffset]; } } - -#else - SystemGraphicsData aData; - aData.rCGContext = reinterpret_cast(pBuffer); - // the Size argument is irrelevant, I hope - ScopedVclPtrInstance pDevice(&aData, Size(1, 1), (sal_uInt16)0); - - pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, - nTilePosX, nTilePosY, nTileWidth, nTileHeight); #endif static bool bDebug = getenv("LOK_DEBUG") != 0; -- 2.12.0