summaryrefslogtreecommitdiffstats
path: root/ios/LibreOfficeLight
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2018-10-10 16:17:18 +0300
committerTor Lillqvist <tml@collabora.com>2018-10-10 16:25:20 +0300
commit1d279e9c9123d50788cefb186663ef3842aaa8c2 (patch)
tree2a9449cb1894ca63201919963b3ba893421d119d /ios/LibreOfficeLight
parentclean up column pos vs column id (diff)
downloadcore-1d279e9c9123d50788cefb186663ef3842aaa8c2.tar.gz
core-1d279e9c9123d50788cefb186663ef3842aaa8c2.zip
Move the iOS CGBitmapContextCreate() call do doc_paintTile()
Thus it now actually takes a buffer pointer also on iOS, like on Linux and Android. Less confusing, more uniform. Add a separate iOS-specific paintTileToCGContext() method to LibreOfficeKitDocumentClass that takes a CGContextRef. Adapt callers correspondingly. (The LibreOfficeLight code in particular needs the paintTileToCGContext().) Change-Id: I81084806d37b9aac9f2b2bc03d0c262e991eec81
Diffstat (limited to 'ios/LibreOfficeLight')
-rw-r--r--ios/LibreOfficeLight/LibreOfficeLight.xcodeproj/project.pbxproj5
-rw-r--r--ios/LibreOfficeLight/LibreOfficeLight/LOKit/Document.swift24
2 files changed, 17 insertions, 12 deletions
diff --git a/ios/LibreOfficeLight/LibreOfficeLight.xcodeproj/project.pbxproj b/ios/LibreOfficeLight/LibreOfficeLight.xcodeproj/project.pbxproj
index 42a71811d3f2..819a419620b5 100644
--- a/ios/LibreOfficeLight/LibreOfficeLight.xcodeproj/project.pbxproj
+++ b/ios/LibreOfficeLight/LibreOfficeLight.xcodeproj/project.pbxproj
@@ -549,6 +549,10 @@
ENABLE_TESTABILITY = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "LibreOfficeLight/LibreOfficeLight-Prefix.pch";
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "IOS=1",
+ );
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = (
"$(inherited)",
@@ -583,6 +587,7 @@
ENABLE_TESTABILITY = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "LibreOfficeLight/LibreOfficeLight-Prefix.pch";
+ GCC_PREPROCESSOR_DEFINITIONS = "IOS=1";
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/../../include",
diff --git a/ios/LibreOfficeLight/LibreOfficeLight/LOKit/Document.swift b/ios/LibreOfficeLight/LibreOfficeLight/LOKit/Document.swift
index 79e28d674595..218d203f61be 100644
--- a/ios/LibreOfficeLight/LibreOfficeLight/LOKit/Document.swift
+++ b/ios/LibreOfficeLight/LibreOfficeLight/LOKit/Document.swift
@@ -124,7 +124,7 @@ open class Document
* rendering at different zoom levels, as the number of rendered pixels and
* the rendered rectangle of the document are independent.
*
- * @param pBuffer pointer to the buffer, its size is determined by nCanvasWidth and nCanvasHeight.
+ * @param rCGContext Core Graphics context, cast to a UnsafeMutableRawPointer
* @param nCanvasWidth number of pixels in a row of pBuffer.
* @param nCanvasHeight number of pixels in a column of pBuffer.
* @param nTilePosX logical X position of the top left corner of the rendered rectangle, in TWIPs.
@@ -132,7 +132,7 @@ open class Document
* @param nTileWidth logical width of the rendered rectangle, in TWIPs.
* @param nTileHeight logical height of the rendered rectangle, in TWIPs.
*/
- public func paintTile( pBuffer: UnsafeMutablePointer<UInt8>,
+ public func paintTileToCGContext( rCGContext: UnsafeMutableRawPointer,
canvasWidth: Int32,
canvasHeight: Int32,
tilePosX: Int32,
@@ -141,8 +141,8 @@ open class Document
tileHeight: Int32)
{
print("paintTile canvasWidth=\(canvasWidth) canvasHeight=\(canvasHeight) tilePosX=\(tilePosX) tilePosY=\(tilePosY) tileWidth=\(tileWidth) tileHeight=\(tileHeight) ")
- return docClass.paintTile(pDoc, pBuffer, canvasWidth, canvasHeight,
- tilePosX, tilePosY, tileWidth, tileHeight);
+ return docClass.paintTileToCGContext(pDoc, rCGContext, canvasWidth, canvasHeight,
+ tilePosX, tilePosY, tileWidth, tileHeight);
}
/**
@@ -562,16 +562,16 @@ public extension Document
{
let ctx = UIGraphicsGetCurrentContext()
//print(ctx!)
- let ptr = unsafeBitCast(ctx, to: UnsafeMutablePointer<UInt8>.self)
+ let ptr = unsafeBitCast(ctx, to: UnsafeMutableRawPointer.self)
//print(ptr)
- self.paintTile(pBuffer:ptr,
- canvasWidth: Int32(canvasSize.width),
- canvasHeight: Int32(canvasSize.height),
- tilePosX: Int32(tileRect.minX),
- tilePosY: Int32(tileRect.minY),
- tileWidth: Int32(tileRect.size.width),
- tileHeight: Int32(tileRect.size.height))
+ self.paintTileToCGContext(rCGContext:ptr,
+ canvasWidth: Int32(canvasSize.width),
+ canvasHeight: Int32(canvasSize.height),
+ tilePosX: Int32(tileRect.minX),
+ tilePosY: Int32(tileRect.minY),
+ tileWidth: Int32(tileRect.size.width),
+ tileHeight: Int32(tileRect.size.height))
}
public func paintTileToImage(canvasSize: CGSize,