From 2ffb7509ecee55209beae73c3bc8df60e44d3e35 Mon Sep 17 00:00:00 2001 From: Ptyl Dragon Date: Wed, 23 Oct 2013 18:35:40 +0200 Subject: [PATCH] refactored to allow copying FixedImage to ios Change-Id: Icecdae8ea2bb68c228f038758af8fb688ce9dd4a --- include/touch/touch.h | 2 +- sw/source/core/view/viewsh.cxx | 10 +++++++++- vcl/ios/iosinst.cxx | 36 ++++++++++++++++++++++++++++++++-- 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/include/touch/touch.h b/include/touch/touch.h index 56e0eec63591..873a86f854ca 100644 --- a/include/touch/touch.h +++ b/include/touch/touch.h @@ -131,7 +131,7 @@ tilePosX, tilePosY, tileWidth, tileHeight address the part of the document to be context, contextHeight, contextWidth specify where to draw. */ void touch_lo_draw_tile(void *context, int contextWidth, int contextHeight, int tilePosX, int tilePosY, int tileWidth, int tileHeight); - +void touch_lo_copy_buffer(const void * source, size_t sourceWidth, size_t sourceHeight, size_t sourceBytesPerRow, void * target, size_t targetWidth, size_t targetHeight); void touch_lo_mouse_drag(int x, int y, MLOMouseButtonState state); // Move the start of the selection to (x,y) diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 1cdfd53c8568..b219ef02573b 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -17,6 +17,12 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#ifdef IOS + +#include + +#endif + #include #include #include @@ -1761,7 +1767,7 @@ void SwViewShell::PaintTile(OutputDevice *pOut, const Rectangle &rRect) #if !HAVE_FEATURE_DESKTOP extern "C" -void touch_lo_draw_tile(void * /*context*/, int contextWidth, int contextHeight, int tilePosX, int tilePosY, int tileWidth, int tileHeight) +void touch_lo_draw_tile(void * context, int contextWidth, int contextHeight, int tilePosX, int tilePosY, int tileWidth, int tileHeight) { // Currently we expect that only one document is open, so we are using the // current shell. Should it turn out that we need to have more documents @@ -1788,6 +1794,8 @@ void touch_lo_draw_tile(void * /*context*/, int contextWidth, int contextHeight, #endif +extern "C" void touch_ui_selection_none() {} + void SwViewShell::SetBrowseBorder( const Size& rNew ) { if( rNew != maBrowseBorder ) diff --git a/vcl/ios/iosinst.cxx b/vcl/ios/iosinst.cxx index c46ccce8b0a4..39208f53ca56 100644 --- a/vcl/ios/iosinst.cxx +++ b/vcl/ios/iosinst.cxx @@ -345,7 +345,14 @@ IMPL_LINK( IosSalInstance, RenderWindows, RenderWindowsArg*, arg ) CGRectIntersectsRect( invalidRect, bbox ) ) { const basebmp::BitmapDeviceSharedPtr aDevice = pFrame->getDevice(); - CGDataProviderRef provider = + touch_lo_copy_buffer(aDevice->getBuffer().get(), + aDevice->getSize().getX(), + aDevice->getSize().getY(), + aDevice->getScanlineStride(), + arg->context, + aGeom.nWidth, + aGeom.nHeight); + /*CGDataProviderRef provider = CGDataProviderCreateWithData( NULL, aDevice->getBuffer().get(), aDevice->getSize().getY() * aDevice->getScanlineStride(), @@ -360,7 +367,7 @@ IMPL_LINK( IosSalInstance, RenderWindows, RenderWindowsArg*, arg ) false, kCGRenderingIntentDefault ); CGContextDrawImage( arg->context, bbox, image ); - + */ // if current frame covers the whole invalidRect then break if (CGRectEqualToRect(CGRectIntersection(invalidRect, bbox), invalidRect)) { @@ -382,6 +389,31 @@ IMPL_LINK( IosSalInstance, RenderWindows, RenderWindowsArg*, arg ) return 0; } +extern "C" +void +touch_lo_copy_buffer(const void * source, size_t sourceWidth, size_t sourceHeight, size_t sourceBytesPerRow, void * target, size_t targetWidth, size_t targetHeight){ + + CGDataProviderRef provider =CGDataProviderCreateWithData(NULL, + source, + sourceHeight * sourceBytesPerRow, + NULL ); + CGImage *sourceImage = CGImageCreate(sourceWidth, + sourceHeight, + 8, + 32, + sourceBytesPerRow, + CGColorSpaceCreateDeviceRGB(), + kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Little, + provider, + NULL, + false, + kCGRenderingIntentDefault ); + CGContextRef context =(CGContextRef) target; + CGRect targetRect = CGRectMake( 0, 0, targetWidth, targetHeight ); + CGContextDrawImage( context, targetRect, sourceImage ); + CGImageRelease(sourceImage); +} + extern "C" void touch_lo_render_windows(void *context, int minX, int minY, int width, int height) {