Blame SOURCES/0251-android-don-t-use-alpha-VDev-when-painting-tiles-on-.patch

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