diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:56:16 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:56:16 +0200 |
commit | a233dac0653f3f3054f7ad2da114ed989747e89a (patch) | |
tree | bf1e11438321c06125a94308649c496648061ccb /canvas/source/cairo | |
parent | acb6133d89abe071108577f821d7eaa381378879 (diff) | |
parent | e5647de7dd26775e45af24f11ac4f82a5518bd9e (diff) |
resyncing to master
Diffstat (limited to 'canvas/source/cairo')
-rw-r--r-- | canvas/source/cairo/cairo_canvashelper.cxx | 10 | ||||
-rw-r--r-- | canvas/source/cairo/cairo_quartz_cairo.cxx | 15 | ||||
-rw-r--r-- | canvas/source/cairo/cairo_quartz_cairo.hxx | 6 | ||||
-rw-r--r-- | canvas/source/cairo/cairo_spritecanvashelper.cxx | 4 | ||||
-rw-r--r-- | canvas/source/cairo/cairo_textlayout.cxx | 7 |
5 files changed, 29 insertions, 13 deletions
diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx index 2f1e39b8a19e..ebf0e1aac3e4 100644 --- a/canvas/source/cairo/cairo_canvashelper.cxx +++ b/canvas/source/cairo/cairo_canvashelper.cxx @@ -128,13 +128,11 @@ namespace cairocanvas { if( rColor.getLength() > 3 ) { - const double alpha = rColor[3]; - cairo_set_source_rgba( pCairo, - alpha*rColor[0], - alpha*rColor[1], - alpha*rColor[2], - alpha ); + rColor[0], + rColor[1], + rColor[2], + rColor[3] ); } else if( rColor.getLength() == 3 ) cairo_set_source_rgb( pCairo, 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_spritecanvashelper.cxx b/canvas/source/cairo/cairo_spritecanvashelper.cxx index cdac16cbf8b7..75a8884df252 100644 --- a/canvas/source/cairo/cairo_spritecanvashelper.cxx +++ b/canvas/source/cairo/cairo_spritecanvashelper.cxx @@ -524,8 +524,8 @@ namespace cairocanvas ::cairo::SurfaceSharedPtr SpriteCanvasHelper::getCompositingSurface( const ::basegfx::B2ISize& rNeededSize ) { - if( rNeededSize.getX() < maCompositingSurfaceSize.getX() || - rNeededSize.getY() < maCompositingSurfaceSize.getY() ) + if( rNeededSize.getX() > maCompositingSurfaceSize.getX() || + rNeededSize.getY() > maCompositingSurfaceSize.getY() ) { // need to give buffer more size mpCompositingSurface.reset(); 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) |