summaryrefslogtreecommitdiff
path: root/vcl/ios
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2013-03-29 00:47:10 +0200
committerTor Lillqvist <tml@iki.fi>2013-03-30 07:53:40 +0200
commitbb0b2744af130d3f03939bd883d7f9fa9d373941 (patch)
treecf94a66650efa99fb7fe5bf556960b102a8f81f7 /vcl/ios
parent378d389620b50e172af3f488f1256aa950b0aea9 (diff)
Draw the frame virtual device bitmaps directly to the destination CGContext
Much faster. No need for the pixelBuffer inbetween. Change-Id: I6493faca6da3a3e9a1285e00c887928b85dca56e
Diffstat (limited to 'vcl/ios')
-rw-r--r--vcl/ios/iosinst.cxx34
1 files changed, 30 insertions, 4 deletions
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"