diff --git a/sd/source/ui/tools/SlideshowLayerRenderer.cxx b/sd/source/ui/tools/SlideshowLayerRenderer.cxx index 4178cc4ec690..96cdc9cb6e6e 100644 --- a/sd/source/ui/tools/SlideshowLayerRenderer.cxx +++ b/sd/source/ui/tools/SlideshowLayerRenderer.cxx @@ -48,6 +48,33 @@ #include +#ifdef IOS +#include +namespace CoreGraphics +{ // Namespace here because iOS redefines Point and Size +#import + +SystemGraphicsData getiOSGraphicsData(unsigned char* pBuffer, long width, long height) +{ + double fDPIScale = 1.0; + + // Onine uses the LOK_TILEMODE_RGBA by default so flip the normal flags + // to kCGImageAlphaPremultipliedLast | kCGImageByteOrder32Big + CGContextRef pCGContext + = CGBitmapContextCreate(pBuffer, width, height, 8, width * 4, CGColorSpaceCreateDeviceRGB(), + kCGImageAlphaPremultipliedLast | kCGImageByteOrder32Big); + + CGContextTranslateCTM(pCGContext, 0, height); + CGContextScaleCTM(pCGContext, fDPIScale, -fDPIScale); + + SystemGraphicsData aData; + aData.rCGContext = reinterpret_cast(pCGContext); + + return aData; +} +} +#endif + using namespace ::com::sun::star; namespace sd @@ -67,7 +94,13 @@ public: RenderContext(unsigned char* pBuffer, SdrModel& rModel, const SdrPage& rPage, Size const& rSlideSize, const Fraction& rScale) : mrModel(rModel) +#if defined(IOS) + , maVirtualDevice( + CoreGraphics::getiOSGraphicsData(pBuffer, rSlideSize.Width(), rSlideSize.Height()), + Size(1, 1), DeviceFormat::WITHOUT_ALPHA) +#else , maVirtualDevice(DeviceFormat::WITHOUT_ALPHA) +#endif { SdrOutliner& rOutliner = mrModel.GetDrawOutliner(); @@ -103,6 +136,10 @@ public: SdrOutliner& rOutliner = mrModel.GetDrawOutliner(); rOutliner.SetControlWord(mnSavedControlBits); rOutliner.SetBackgroundColor(maSavedBackgroundColor); + +#ifdef IOS + CoreGraphics::CGContextRelease(maVirtualDevice->GetSystemGfxData().rCGContext); +#endif } };