1 // -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 // This file is part of the LibreOffice project.
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 #import "MLOScalingBuffer.h"
10 #import "MLORenderBuffer.h"
11 #import "MLORenderingUIView.h"
13 #import "MLORenderManager_Impl.h"
14 #import <QuartzCore/QuartzCore.h>
16 @interface MLOScalingBuffer ()
17 @property MLORenderManager * manager;
18 @property MLORenderBuffer * active;
19 @property BOOL didHideActive;
22 @implementation MLOScalingBuffer
24 -(id)initWithRenderManager:(MLORenderManager *) manager{
25 self= [self initWithFrame:manager.view.frame];
28 self.didHideActive =NO;
29 self.manager = manager;
30 self.active =[manager getActiveBuffer];
32 self.backgroundColor = [UIColor clearColor];
33 [self.manager.view addSubview:self];
34 self.frame = manager.bufferFrame;
35 [self setNeedsDisplay];
42 if(self.didRender && !self.didHideActive){
43 self.didHideActive = YES;
48 -(void)scale:(CGFloat) scale deltaX:(CGFloat) deltaX deltaY:(CGFloat) deltaY{
51 if(self.didHideActive){
52 self.layer.transform = CATransform3DMakeScale(scale,scale,1);
55 [self moveDeltaX:deltaX deltaY:deltaY];
60 [self removeFromSuperview];
61 self.manager.scaler = nil;
64 -(void)drawRect:(CGRect)rect{
68 CGContextRef context = UIGraphicsGetCurrentContext();
69 // CGContextSaveGState(context);
70 // CGContextFillRect(context, self.bounds);
71 [self.active.layer renderInContext:context];
72 // CGContextRestoreGState(context);
76 [super drawRect:rect];