summaryrefslogtreecommitdiff
path: root/canvas
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2011-07-14 22:45:11 +0300
committerTor Lillqvist <tml@iki.fi>2011-07-14 23:58:07 +0300
commitd3abc64751208b690605c44dfd06c72be2af05e7 (patch)
tree2ad5a961deb50b9d0c4d7074da2e4d3927fbb438 /canvas
parent5a7834cd3e6e73ec9c19f3ff057aacba59e3f9a3 (diff)
Fix compilation for iOS
Diffstat (limited to 'canvas')
-rw-r--r--canvas/source/cairo/cairo_quartz_cairo.cxx15
-rw-r--r--canvas/source/cairo/cairo_quartz_cairo.hxx6
-rw-r--r--canvas/source/cairo/cairo_textlayout.cxx7
-rw-r--r--canvas/source/cairo/makefile.mk12
4 files changed, 31 insertions, 9 deletions
diff --git a/canvas/source/cairo/cairo_quartz_cairo.cxx b/canvas/source/cairo/cairo_quartz_cairo.cxx
index e24ba9c3ab80..23702f64b3ac 100644
--- a/canvas/source/cairo/cairo_quartz_cairo.cxx
+++ b/canvas/source/cairo/cairo_quartz_cairo.cxx
@@ -29,9 +29,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_canvas.hxx"
-#ifdef QUARTZ
+#if defined QUARTZ || defined IOS
/************************************************************************
- * Mac OS X/Quartz surface backend for OpenOffice.org Cairo Canvas *
+ * Mac OS X/Quartz and iOS surface backend for OpenOffice.org Cairo Canvas *
************************************************************************/
#include <osl/diagnose.h>
@@ -205,13 +205,19 @@ namespace cairo
CGContextRef mrContext = getCGContext();
if (!mrContext) return;
-
+#ifndef IOS
[mpView lockFocus];
+#endif
+#ifndef IOS
/**
* This code is using same screen update code as in VCL (esp. AquaSalGraphics::UpdateWindow() )
*/
CGContextRef rViewContext = reinterpret_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
+#else
+ // Just guessing for now...
+ CGContextRef rViewContext = UIGraphicsGetCurrentContext();
+#endif
CGImageRef xImage = CGBitmapContextCreateImage(mrContext);
CGContextDrawImage(rViewContext,
CGRectMake( 0, 0,
@@ -220,8 +226,9 @@ namespace cairo
xImage);
CGImageRelease( xImage );
CGContextFlush( rViewContext );
-
+#ifndef IOS
[mpView unlockFocus];
+#endif
}
/**
diff --git a/canvas/source/cairo/cairo_quartz_cairo.hxx b/canvas/source/cairo/cairo_quartz_cairo.hxx
index 0c6a7d56db95..5d131d735ab9 100644
--- a/canvas/source/cairo/cairo_quartz_cairo.hxx
+++ b/canvas/source/cairo/cairo_quartz_cairo.hxx
@@ -32,7 +32,13 @@
#include "cairo_cairo.hxx"
#include "premac.h"
+#include <TargetConditionals.h>
+#if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE
#include <Cocoa/Cocoa.h>
+#else
+#include <UIKit/UIKit.h>
+#define NSView UIView
+#endif
#include <cairo-quartz.h>
#include "postmac.h"
diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx
index 9c1501a8245b..eb5a3358b460 100644
--- a/canvas/source/cairo/cairo_textlayout.cxx
+++ b/canvas/source/cairo/cairo_textlayout.cxx
@@ -352,7 +352,7 @@ namespace cairocanvas
**/
bool TextLayout::isCairoRenderable(SystemFontData aSysFontData) const
{
-#if defined UNX && !defined QUARTZ
+#if defined UNX && !defined QUARTZ && !defined IOS
// is font usable?
if (!aSysFontData.nFontId) return false;
#endif
@@ -502,9 +502,14 @@ namespace cairocanvas
cairo_font_face_t* font_face = NULL;
#ifdef CAIRO_HAS_QUARTZ_SURFACE
+
+ #ifdef QUARTZ
// TODO: use cairo_quartz_font_face_create_for_cgfont(cgFont)
// when CGFont (Mac OS X 10.5 API) is provided by the AQUA VCL backend.
font_face = cairo_quartz_font_face_create_for_atsu_font_id((ATSUFontID) rSysFontData.aATSUFontID);
+ #else // iOS
+ font_face = cairo_quartz_font_face_create_for_cgfont( rSysFontData.rFont);
+ #endif
#elif defined CAIRO_HAS_WIN32_SURFACE
#if (OSL_DEBUG_LEVEL > 1)
diff --git a/canvas/source/cairo/makefile.mk b/canvas/source/cairo/makefile.mk
index 076deb2f17bf..59d1512701a7 100644
--- a/canvas/source/cairo/makefile.mk
+++ b/canvas/source/cairo/makefile.mk
@@ -56,6 +56,10 @@ CFLAGS+=$(CAIRO_CFLAGS)
CFLAGS+=-I$(SOLARINCDIR)/cairo
.ENDIF
+.IF "$(OS)" == "IOS"
+CFLAGS+= -x objective-c++ -fobjc-exceptions -fobjc-abi-version=2 -fobjc-legacy-dispatch -D__IPHONE_OS_VERSION_MIN_REQUIRED=40300
+.ENDIF
+
.IF "$(verbose)"!="" || "$(VERBOSE)"!=""
CDEFS+= -DVERBOSE
.ENDIF
@@ -88,18 +92,18 @@ SHL1STDLIBS+= $(CAIRO_LIBS)
SHL1STDLIBS+= -lcairo -lpixman-1
.ENDIF
-.IF "$(GUIBASE)"=="aqua"
-# native Mac OS X (Quartz)
+.IF "$(GUIBASE)"=="aqua" || "$(GUIBASE)"=="cocoatouch"
+# native Mac OS X (Quartz) or iOS
SLOFILES+= $(SLO)$/cairo_quartz_cairo.obj
CFLAGSCXX+=$(OBJCXXFLAGS)
-.ELSE # "$(GUIBASE)"=="aqua"
+.ELSE # "$(GUIBASE)"=="aqua" || "$(GUIBASE)"=="cocoatouch"
# Xlib
SLOFILES+= $(SLO)$/cairo_xlib_cairo.obj
SHL1STDLIBS+= $(FONTCONFIG_LIBS) -lX11 -lXrender $(FREETYPE_LIBS)
CFLAGS+= $(FREETYPE_CFLAGS)
-.ENDIF # "$(GUIBASE)"=="aqua"
+.ENDIF # "$(GUIBASE)"=="aqua" || "$(GUIBASE)"=="cocoatouch"
.ELSE # "$(GUI)"=="UNX"