fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / ios / shared / ios_sharedlo / objective_c / render / MLOScalingBuffer.m
blob488f253f47179af79d11c46239e1c881da107512
1 // -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 //
3 // This file is part of the LibreOffice project.
4 //
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;
20 @end
22 @implementation MLOScalingBuffer
24 -(id)initWithRenderManager:(MLORenderManager *) manager{
25     self= [self initWithFrame:manager.view.frame];
26     if(self){
27         self.didRender = NO;
28         self.didHideActive =NO;
29         self.manager = manager;
30         self.active  =[manager getActiveBuffer];
31         self.alpha = 1.0f;
32         self.backgroundColor = [UIColor clearColor];
33         [self.manager.view addSubview:self];
34         self.frame = manager.bufferFrame;
35         [self setNeedsDisplay];
36         
37     }
38     return self;
41 -(void)hideActive{
42     if(self.didRender && !self.didHideActive){
43         self.didHideActive = YES;
44         [self.active hide];
45     }
48 -(void)scale:(CGFloat) scale deltaX:(CGFloat) deltaX deltaY:(CGFloat) deltaY{
50     [self hideActive];
51     if(self.didHideActive){
52         self.layer.transform = CATransform3DMakeScale(scale,scale,1);
53     }
54     
55     [self moveDeltaX:deltaX deltaY:deltaY];
58 -(void)hide{
59     self.alpha = 0.0f;
60     [self removeFromSuperview];
61     self.manager.scaler = nil;
64 -(void)drawRect:(CGRect)rect{
66     if(!self.didRender){
67         
68         CGContextRef context = UIGraphicsGetCurrentContext();
69 //        CGContextSaveGState(context);
70 //        CGContextFillRect(context, self.bounds);
71         [self.active.layer renderInContext:context];
72 //        CGContextRestoreGState(context);
73         self.didRender = YES;
74     }else{
75         [self hideActive];
76         [super drawRect:rect];
77     }
79 @end