summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ios/experimental/LibreOffice/LibreOffice/AppDelegate.h5
-rw-r--r--ios/experimental/LibreOffice/LibreOffice/AppDelegate.m15
-rw-r--r--ios/experimental/LibreOffice/LibreOffice/View.h3
-rw-r--r--ios/experimental/LibreOffice/LibreOffice/View.m12
-rw-r--r--sal/inc/osl/detail/ios-bootstrap.h4
-rw-r--r--vcl/ios/iosinst.cxx34
6 files changed, 41 insertions, 32 deletions
diff --git a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.h b/ios/experimental/LibreOffice/LibreOffice/AppDelegate.h
index 79b0e56f4a02..c5c4560a6c57 100644
--- a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.h
+++ b/ios/experimental/LibreOffice/LibreOffice/AppDelegate.h
@@ -11,11 +11,6 @@
#import "View.h"
@interface AppDelegate : UIResponder <UIApplicationDelegate>
-{
- int nbytes;
- char *pixelBuffer;
- CGImageRef image;
-}
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) View *view;
diff --git a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m b/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m
index 93f995e3744e..2f74d483fb63 100644
--- a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m
+++ b/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m
@@ -44,17 +44,6 @@ static UIView *theView;
[self.window addGestureRecognizer: tapRecognizer];
- nbytes = bounds.size.width * bounds.size.height * 4;
-
- pixelBuffer = (char *) malloc(nbytes);
- memset(pixelBuffer, 0xFF, nbytes);
-
- CGDataProviderRef provider = CGDataProviderCreateWithData( NULL, pixelBuffer, nbytes, NULL);
- image = CGImageCreate(bounds.size.width, bounds.size.height, 8, 32, bounds.size.width*4, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaNoneSkipLast, provider, NULL, false, kCGRenderingIntentDefault);
-
- self.view.pixelBuffer = pixelBuffer;
- self.view.image = image;
-
lo_set_view_size(bounds.size.width, bounds.size.height);
NSThread* thread = [[NSThread alloc] initWithTarget:self
@@ -105,7 +94,9 @@ static UIView *theView;
void lo_damaged(CGRect rect)
{
(void) rect;
- [theView performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:NO];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [theView setNeedsDisplayInRect:rect];
+ });
// NSLog(@"lo_damaged: %dx%d@(%d,%d)", (int)rect.size.width, (int)rect.size.height, (int)rect.origin.x, (int)rect.origin.y);
}
diff --git a/ios/experimental/LibreOffice/LibreOffice/View.h b/ios/experimental/LibreOffice/LibreOffice/View.h
index d9537220244f..c128806409f4 100644
--- a/ios/experimental/LibreOffice/LibreOffice/View.h
+++ b/ios/experimental/LibreOffice/LibreOffice/View.h
@@ -11,9 +11,6 @@
@interface View : UIView
-@property char *pixelBuffer;
-@property CGImageRef image;
-
- (void)drawRect:(CGRect)rect;
- (void)tapGesture:(UIGestureRecognizer *)gestureRecognizer;
diff --git a/ios/experimental/LibreOffice/LibreOffice/View.m b/ios/experimental/LibreOffice/LibreOffice/View.m
index bcde7046b458..7968316102b6 100644
--- a/ios/experimental/LibreOffice/LibreOffice/View.m
+++ b/ios/experimental/LibreOffice/LibreOffice/View.m
@@ -14,18 +14,18 @@
- (void)drawRect:(CGRect)rect
{
- (void) rect;
-
// NSLog(@"drawRect: %fx%f@(%f,%f)", rect.size.width, rect.size.height, rect.origin.x, rect.origin.y);
NSDate *a = [NSDate date];
- lo_render_windows([self pixelBuffer], [self bounds].size.width, [self bounds].size.height);
-
- NSLog(@"drawRect: lo_render_windows took %f s", [[NSDate date] timeIntervalSinceDate: a]);
CGContextRef context = UIGraphicsGetCurrentContext();
+ CGContextSaveGState(context);
+ CGContextTranslateCTM(context, 0, self.frame.size.height);
+ CGContextScaleCTM(context, 1, -1);
+ lo_render_windows(context, rect);
+ CGContextRestoreGState(context);
- CGContextDrawImage(context, [self bounds], [self image]);
+ NSLog(@"drawRect: lo_render_windows took %f s", [[NSDate date] timeIntervalSinceDate: a]);
}
- (void) tapGesture:(UIGestureRecognizer *)gestureRecognizer
diff --git a/sal/inc/osl/detail/ios-bootstrap.h b/sal/inc/osl/detail/ios-bootstrap.h
index 6057b391855f..f0e09f73e97c 100644
--- a/sal/inc/osl/detail/ios-bootstrap.h
+++ b/sal/inc/osl/detail/ios-bootstrap.h
@@ -12,7 +12,7 @@
#if defined(IOS)
-#include <CoreGraphics/CGGeometry.h>
+#include <CoreGraphics/CoreGraphics.h>
#ifdef __cplusplus
extern "C" {
@@ -45,7 +45,7 @@ void lo_damaged(CGRect rect);
void lo_runMain();
void lo_set_view_size(int width, int height);
-void lo_render_windows(char *pixelBuffer, int width, int height);
+void lo_render_windows(CGContextRef context, CGRect rect);
void lo_tap(int x, int y);
#ifdef __cplusplus
diff --git a/vcl/ios/iosinst.cxx b/vcl/ios/iosinst.cxx
index 819fdec0e97a..905c0b3113e9 100644
--- a/vcl/ios/iosinst.cxx
+++ b/vcl/ios/iosinst.cxx
@@ -304,11 +304,37 @@ void lo_set_view_size(int width, int height)
}
extern "C"
-void lo_render_windows(char *pixelBuffer, int width, int height)
+void lo_render_windows( CGContextRef context, CGRect rect )
{
- // Hack: assume so far that we are asked to redraw the whole pixel buffer
- if (IosSalInstance::getInstance() != NULL)
- IosSalInstance::getInstance()->RedrawWindows(pixelBuffer, width, height, 0, 0, width, height);
+ if( IosSalInstance::getInstance() != NULL ) {
+ int i = 0;
+ std::list< SalFrame* >::const_iterator it;
+ for( it = IosSalInstance::getInstance()->getFrames().begin(); it != IosSalInstance::getInstance()->getFrames().end(); i++, it++ ) {
+ SvpSalFrame *pFrame = static_cast<SvpSalFrame *>(*it);
+ SalFrameGeometry aGeom = pFrame->GetGeometry();
+ CGRect bbox = CGRectMake( aGeom.nX, aGeom.nY, aGeom.nWidth, aGeom.nHeight );
+ if ( pFrame->IsVisible() &&
+ CGRectIntersectsRect( rect, bbox ) ) {
+
+ const basebmp::BitmapDeviceSharedPtr aDevice = pFrame->getDevice();
+ CGDataProviderRef provider =
+ CGDataProviderCreateWithData( NULL,
+ aDevice->getBuffer().get(),
+ aDevice->getSize().getY() * aDevice->getScanlineStride(),
+ NULL );
+ CGImage *image =
+ CGImageCreate( aDevice->getSize().getX(), aDevice->getSize().getY(),
+ 8, 32, aDevice->getScanlineStride(),
+ CGColorSpaceCreateDeviceRGB(),
+ kCGImageAlphaNoneSkipLast,
+ provider,
+ NULL,
+ false,
+ kCGRenderingIntentDefault );
+ CGContextDrawImage( context, bbox, image );
+ }
+ }
+ }
}
extern "C"