11#import "RDPSessionView.h" 
   26- (void)drawRect:(CGRect)rect
 
   28  if (_session != nil && [_session bitmapContext])
 
   30    CGContextRef context = UIGraphicsGetCurrentContext();
 
   31    CGImageRef cgImage = CGBitmapContextCreateImage([_session bitmapContext]);
 
   33    CGContextTranslateCTM(context, 0, [
self bounds].size.height);
 
   34    CGContextScaleCTM(context, 1.0, -1.0);
 
   35    CGContextClipToRect(context,
 
   36                        CGRectMake(rect.origin.x,
 
   37                                   [
self bounds].size.height - rect.origin.y - rect.size.height,
 
   38                                   rect.size.width, rect.size.height));
 
   39    CGContextDrawImage(context,
 
   40                       CGRectMake(0, 0, [
self bounds].size.width, [
self bounds].size.height),
 
   43    CGImageRelease(cgImage);
 
   48    [[UIColor blackColor] set];
 
   49    UIRectFill([
self bounds]);