diff options
author | Ptyl Dragon <ptyl@cloudon.com> | 2013-10-23 18:35:40 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2013-11-15 16:51:51 +0100 |
commit | 2ffb7509ecee55209beae73c3bc8df60e44d3e35 (patch) | |
tree | 34e14dfae02fd074295821c8db60c45e49a5656b /vcl/ios/iosinst.cxx | |
parent | 9c253aeea11bdce01d96c52623ea04697ed9840f (diff) |
refactored to allow copying FixedImage to ios
Change-Id: Icecdae8ea2bb68c228f038758af8fb688ce9dd4a
Diffstat (limited to 'vcl/ios/iosinst.cxx')
-rw-r--r-- | vcl/ios/iosinst.cxx | 36 |
1 files changed, 34 insertions, 2 deletions
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)) { @@ -383,6 +390,31 @@ IMPL_LINK( IosSalInstance, RenderWindows, RenderWindowsArg*, arg ) } 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) { CGContextRef cgContext = (CGContextRef) context; |