Fix compilation for iOS
This commit is contained in:
@@ -29,9 +29,9 @@
|
|||||||
// MARKER(update_precomp.py): autogen include statement, do not remove
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
||||||
#include "precompiled_canvas.hxx"
|
#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>
|
#include <osl/diagnose.h>
|
||||||
@@ -205,13 +205,19 @@ namespace cairo
|
|||||||
CGContextRef mrContext = getCGContext();
|
CGContextRef mrContext = getCGContext();
|
||||||
|
|
||||||
if (!mrContext) return;
|
if (!mrContext) return;
|
||||||
|
#ifndef IOS
|
||||||
[mpView lockFocus];
|
[mpView lockFocus];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef IOS
|
||||||
/**
|
/**
|
||||||
* This code is using same screen update code as in VCL (esp. AquaSalGraphics::UpdateWindow() )
|
* This code is using same screen update code as in VCL (esp. AquaSalGraphics::UpdateWindow() )
|
||||||
*/
|
*/
|
||||||
CGContextRef rViewContext = reinterpret_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
|
CGContextRef rViewContext = reinterpret_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
|
||||||
|
#else
|
||||||
|
// Just guessing for now...
|
||||||
|
CGContextRef rViewContext = UIGraphicsGetCurrentContext();
|
||||||
|
#endif
|
||||||
CGImageRef xImage = CGBitmapContextCreateImage(mrContext);
|
CGImageRef xImage = CGBitmapContextCreateImage(mrContext);
|
||||||
CGContextDrawImage(rViewContext,
|
CGContextDrawImage(rViewContext,
|
||||||
CGRectMake( 0, 0,
|
CGRectMake( 0, 0,
|
||||||
@@ -220,8 +226,9 @@ namespace cairo
|
|||||||
xImage);
|
xImage);
|
||||||
CGImageRelease( xImage );
|
CGImageRelease( xImage );
|
||||||
CGContextFlush( rViewContext );
|
CGContextFlush( rViewContext );
|
||||||
|
#ifndef IOS
|
||||||
[mpView unlockFocus];
|
[mpView unlockFocus];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -32,7 +32,13 @@
|
|||||||
#include "cairo_cairo.hxx"
|
#include "cairo_cairo.hxx"
|
||||||
|
|
||||||
#include "premac.h"
|
#include "premac.h"
|
||||||
|
#include <TargetConditionals.h>
|
||||||
|
#if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE
|
||||||
#include <Cocoa/Cocoa.h>
|
#include <Cocoa/Cocoa.h>
|
||||||
|
#else
|
||||||
|
#include <UIKit/UIKit.h>
|
||||||
|
#define NSView UIView
|
||||||
|
#endif
|
||||||
#include <cairo-quartz.h>
|
#include <cairo-quartz.h>
|
||||||
#include "postmac.h"
|
#include "postmac.h"
|
||||||
|
|
||||||
|
@@ -352,7 +352,7 @@ namespace cairocanvas
|
|||||||
**/
|
**/
|
||||||
bool TextLayout::isCairoRenderable(SystemFontData aSysFontData) const
|
bool TextLayout::isCairoRenderable(SystemFontData aSysFontData) const
|
||||||
{
|
{
|
||||||
#if defined UNX && !defined QUARTZ
|
#if defined UNX && !defined QUARTZ && !defined IOS
|
||||||
// is font usable?
|
// is font usable?
|
||||||
if (!aSysFontData.nFontId) return false;
|
if (!aSysFontData.nFontId) return false;
|
||||||
#endif
|
#endif
|
||||||
@@ -502,9 +502,14 @@ namespace cairocanvas
|
|||||||
cairo_font_face_t* font_face = NULL;
|
cairo_font_face_t* font_face = NULL;
|
||||||
|
|
||||||
#ifdef CAIRO_HAS_QUARTZ_SURFACE
|
#ifdef CAIRO_HAS_QUARTZ_SURFACE
|
||||||
|
|
||||||
|
#ifdef QUARTZ
|
||||||
// TODO: use cairo_quartz_font_face_create_for_cgfont(cgFont)
|
// 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.
|
// 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);
|
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
|
#elif defined CAIRO_HAS_WIN32_SURFACE
|
||||||
#if (OSL_DEBUG_LEVEL > 1)
|
#if (OSL_DEBUG_LEVEL > 1)
|
||||||
|
@@ -56,6 +56,10 @@ CFLAGS+=$(CAIRO_CFLAGS)
|
|||||||
CFLAGS+=-I$(SOLARINCDIR)/cairo
|
CFLAGS+=-I$(SOLARINCDIR)/cairo
|
||||||
.ENDIF
|
.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)"!=""
|
.IF "$(verbose)"!="" || "$(VERBOSE)"!=""
|
||||||
CDEFS+= -DVERBOSE
|
CDEFS+= -DVERBOSE
|
||||||
.ENDIF
|
.ENDIF
|
||||||
@@ -88,18 +92,18 @@ SHL1STDLIBS+= $(CAIRO_LIBS)
|
|||||||
SHL1STDLIBS+= -lcairo -lpixman-1
|
SHL1STDLIBS+= -lcairo -lpixman-1
|
||||||
.ENDIF
|
.ENDIF
|
||||||
|
|
||||||
.IF "$(GUIBASE)"=="aqua"
|
.IF "$(GUIBASE)"=="aqua" || "$(GUIBASE)"=="cocoatouch"
|
||||||
# native Mac OS X (Quartz)
|
# native Mac OS X (Quartz) or iOS
|
||||||
SLOFILES+= $(SLO)$/cairo_quartz_cairo.obj
|
SLOFILES+= $(SLO)$/cairo_quartz_cairo.obj
|
||||||
CFLAGSCXX+=$(OBJCXXFLAGS)
|
CFLAGSCXX+=$(OBJCXXFLAGS)
|
||||||
.ELSE # "$(GUIBASE)"=="aqua"
|
.ELSE # "$(GUIBASE)"=="aqua" || "$(GUIBASE)"=="cocoatouch"
|
||||||
|
|
||||||
# Xlib
|
# Xlib
|
||||||
SLOFILES+= $(SLO)$/cairo_xlib_cairo.obj
|
SLOFILES+= $(SLO)$/cairo_xlib_cairo.obj
|
||||||
SHL1STDLIBS+= $(FONTCONFIG_LIBS) -lX11 -lXrender $(FREETYPE_LIBS)
|
SHL1STDLIBS+= $(FONTCONFIG_LIBS) -lX11 -lXrender $(FREETYPE_LIBS)
|
||||||
CFLAGS+= $(FREETYPE_CFLAGS)
|
CFLAGS+= $(FREETYPE_CFLAGS)
|
||||||
|
|
||||||
.ENDIF # "$(GUIBASE)"=="aqua"
|
.ENDIF # "$(GUIBASE)"=="aqua" || "$(GUIBASE)"=="cocoatouch"
|
||||||
|
|
||||||
.ELSE # "$(GUI)"=="UNX"
|
.ELSE # "$(GUI)"=="UNX"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user