2013-02-14 17:59:12 +04:00
|
|
|
/*
|
|
|
|
RDP Session View
|
2019-11-06 17:24:51 +03:00
|
|
|
|
2013-12-04 14:37:57 +04:00
|
|
|
Copyright 2013 Thincast Technologies GmbH, Author: Martin Fleisz
|
2019-11-06 17:24:51 +03:00
|
|
|
|
|
|
|
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
|
|
If a copy of the MPL was not distributed with this file, You can obtain one at
|
|
|
|
http://mozilla.org/MPL/2.0/.
|
2013-02-14 17:59:12 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#import "RDPSessionView.h"
|
|
|
|
|
|
|
|
@implementation RDPSessionView
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
- (void)setSession:(RDPSession *)session
|
2013-02-14 17:59:12 +04:00
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
_session = session;
|
2013-02-14 17:59:12 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)awakeFromNib
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
[super awakeFromNib];
|
|
|
|
_session = nil;
|
2013-02-14 17:59:12 +04:00
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
- (void)drawRect:(CGRect)rect
|
2013-02-14 17:59:12 +04:00
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
if (_session != nil && [_session bitmapContext])
|
2013-02-14 17:59:12 +04:00
|
|
|
{
|
|
|
|
CGContextRef context = UIGraphicsGetCurrentContext();
|
|
|
|
CGImageRef cgImage = CGBitmapContextCreateImage([_session bitmapContext]);
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
CGContextTranslateCTM(context, 0, [self bounds].size.height);
|
|
|
|
CGContextScaleCTM(context, 1.0, -1.0);
|
|
|
|
CGContextClipToRect(context,
|
|
|
|
CGRectMake(rect.origin.x,
|
|
|
|
[self bounds].size.height - rect.origin.y - rect.size.height,
|
|
|
|
rect.size.width, rect.size.height));
|
|
|
|
CGContextDrawImage(context,
|
|
|
|
CGRectMake(0, 0, [self bounds].size.width, [self bounds].size.height),
|
|
|
|
cgImage);
|
|
|
|
|
|
|
|
CGImageRelease(cgImage);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// just clear the screen with black
|
|
|
|
[[UIColor blackColor] set];
|
|
|
|
UIRectFill([self bounds]);
|
2013-02-14 17:59:12 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
- (void)dealloc
|
|
|
|
{
|
|
|
|
[super dealloc];
|
2013-02-14 17:59:12 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|