[Libreoffice-commits] core.git: Branch 'feature/tiledrendering' - 2 commits - ios/shared sw/source
Ptyl Dragon
ptyl at cloudon.com
Fri Nov 1 11:52:41 CET 2013
ios/shared/ios_sharedlo/objective_c/view_controllers/MLOTestingTileParameter.m | 117 ++++++++--
ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.h | 1
ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.m | 6
sw/source/core/view/viewsh.cxx | 11
4 files changed, 111 insertions(+), 24 deletions(-)
New commits:
commit 3bd4b54bcd18f6614fd1274b10fdd99c24a5cece
Author: Ptyl Dragon <ptyl at cloudon.com>
Date: Fri Nov 1 12:51:51 2013 +0200
removed DPX RIP (0,0) coords shift. played with rendering parameters
Change-Id: Ib2a3b017aa59bc1a8408b42f101fd041270494aa
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 6d1837c..8280222 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1810,10 +1810,11 @@ void touch_lo_draw_tile(void *context, int contextWidth, int contextHeight, MLOD
aMapMode.SetScaleX(scaleX);
aMapMode.SetScaleY(scaleY);
aDevice.SetMapMode(aMapMode);
+ SetSwVisArea( pViewShell, SwRect(Point(tilePosX, tilePosY), Size(tileWidth, tileHeight)) );
// resizes the virtual device so to contain the entrie context
aDevice.SetOutputSizePixel(Size(contextWidth, contextHeight));
// draw - works in logic coordinates
- pViewShell->PaintTile(&aDevice, Rectangle(Point(tilePosX, tilePosY), Size(tileWidth, tileHeight)));
+ pViewShell->PaintTile(&aDevice, Rectangle(Point(0, 0), Size(tileWidth, tileHeight)));
// copy the aDevice content to mpImage
Bitmap aBitmap(aDevice.GetBitmap(aDevice.PixelToLogic(Point(0,0)), aDevice.PixelToLogic(Size(contextWidth, contextHeight))));
BitmapReadAccess * readAccess = aBitmap.AcquireReadAccess();
@@ -1845,8 +1846,8 @@ MLODpxSize touch_lo_get_content_size()
extern "C"
MLORipPoint MLORipPointByDpxPoint(MLODpxPoint mloDpxPoint)
{
- MLODpxSize contentSize = touch_lo_get_content_size();
- MLORip x = MLORipByDpx(mloDpxPoint.x - (contentSize.width/2.0f));
+ //MLODpxSize contentSize = touch_lo_get_content_size();
+ MLORip x = MLORipByDpx(mloDpxPoint.x /*- (contentSize.width/2.0f)*/);
MLORip y = MLORipByDpx(mloDpxPoint.y);
return MLORipPointByRips(x,y);
}
@@ -1854,8 +1855,8 @@ MLORipPoint MLORipPointByDpxPoint(MLODpxPoint mloDpxPoint)
extern "C"
MLODpxPoint MLODpxPointByRipPoint(MLORipPoint mloRipPoint)
{
- MLODpxSize contentSize = touch_lo_get_content_size();
- MLODpx x = MLODpxByRip(mloRipPoint.x) + (contentSize.width/2.0f);
+ //MLODpxSize contentSize = touch_lo_get_content_size();
+ MLODpx x = MLODpxByRip(mloRipPoint.x)/* + (contentSize.width/2.0f)*/;
MLODpx y = MLODpxByRip(mloRipPoint.y);
return MLODpxPointByDpxes(x,y);
}
commit b75dd58ba7359d78a6cb241d92ff70ee1f01de20
Author: Ptyl Dragon <ptyl at cloudon.com>
Date: Fri Nov 1 12:48:31 2013 +0200
tiledrendering new stepper ui for tor
Change-Id: I3d4586c84adfa9f0416a043230c6227bda98d9dd
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOTestingTileParameter.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOTestingTileParameter.m
index f286390..22d98fa 100644
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOTestingTileParameter.m
+++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOTestingTileParameter.m
@@ -14,9 +14,14 @@
@property (nonatomic,strong) MLOTestingTileParameterExtractor extractor;
@property UILabel * label;
@property UITextField * data;
+ at property UITextField * step;
@property NSInteger defaultValue;
+ at property UIStepper * dataStepper;
+ at property UIStepper * stepStepper;
@end
+static const CGFloat DEFAULT_STEP_VALUE = 1;
+
@implementation MLOTestingTileParameter
-(MLOTestingTileParameter *)initWithParams:(MLOTestingTileParametersViewController *) params label:(NSString *)label extractor:(MLOTestingTileParameterExtractor) extractor defaultValue:(NSInteger) defaultValue{
@@ -26,13 +31,59 @@
self.params = params;
self.extractor = extractor;
self.defaultValue = defaultValue;
-
[self initLabel:label];
- [self initTextField];
+ self.dataStepper = [self createStepper];
+ self.stepStepper = [self createStepper];
+ [self initDataTextField];
+ [self initStepTextField];
}
return self;
}
+-(UIStepper *) createStepper{
+ UIStepper * stepper = [UIStepper new];
+ stepper.maximumValue = MAXFLOAT;
+ stepper.minimumValue = -MAXFLOAT;
+ stepper.stepValue = DEFAULT_STEP_VALUE;
+ stepper.autorepeat = YES;
+ stepper.continuous = NO;
+ [stepper addObserver:self forKeyPath:@"value"
+ options: NSKeyValueObservingOptionNew
+ context:0];
+ return stepper;
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+{
+
+ if (object == self.dataStepper) {
+ NSNumber * floatNumber = change[NSKeyValueChangeNewKey];
+ CGFloat value = [self currentDataValue] + [floatNumber floatValue];
+
+ if(value == ((NSInteger) value)){
+ self.data.text = [[NSNumber numberWithInteger:(NSInteger) value] stringValue];
+ }else{
+ self.data.text = [[NSNumber numberWithFloat:value] stringValue];
+ }
+ [self.params renderTile];
+ }else if (object == self.stepStepper){
+
+ NSNumber * floatNumber = change[NSKeyValueChangeNewKey];
+ NSInteger value = [floatNumber integerValue];
+ NSNumber * newValue = [NSNumber numberWithInteger:value];
+ self.step.text = [newValue stringValue];
+ self.dataStepper.stepValue = [newValue floatValue];
+ }
+}
+
+
+-(void)initStepTextField{
+
+ self.step =[[UITextField alloc] initWithFrame:CGRECT_ZERO];
+ self.data.textAlignment = NSTextAlignmentLeft;
+ self.step.text = [[NSNumber numberWithInteger:(NSInteger)DEFAULT_STEP_VALUE] stringValue];
+}
+
-(NSString *)description{
return [@"MLOTestingTileParameter: " stringByAppendingString:self.label.text];
}
@@ -40,10 +91,10 @@
-(void) initLabel:(NSString *) label{
self.label =[[UILabel alloc] initWithFrame:CGRECT_ZERO];
self.label.text = label;
- self.label.textAlignment = NSTextAlignmentRight;
+ self.label.textAlignment = NSTextAlignmentCenter;
}
--(void) initTextField{
+-(void) initDataTextField{
self.data = [[UITextField alloc] initWithFrame:CGRECT_ZERO];
[self.data setKeyboardType:UIKeyboardTypeNumberPad];
self.data.textAlignment = NSTextAlignmentLeft;
@@ -58,31 +109,65 @@
-(void)setParamFrame:(CGRect) paramFrame{
NSLog(@"%@ setParamFrame",self);
- self.label.frame=CGRectMake(paramFrame.origin.x,
- paramFrame.origin.y,
- paramFrame.size.width/2.0f,
- paramFrame.size.height);
- self.data.frame =CGRectMake(paramFrame.origin.x + paramFrame.size.width/2.0f,
- paramFrame.origin.y,
- paramFrame.size.width/2.0f,
- paramFrame.size.height);
+ CGFloat x = paramFrame.origin.x;
+ CGFloat y = paramFrame.origin.y;
+ CGFloat w = paramFrame.size.width;
+ CGFloat h = paramFrame.size.height;
+
+ CGFloat labelW = w/3.0f;
+ CGFloat otherW = w/6.0f;
+
+ self.label.frame=CGRectMake(x,
+ y,
+ labelW,
+ h);
+ self.data.frame =CGRectMake(x + labelW,
+ y,
+ otherW,
+ h);
+ self.dataStepper.frame = CGRectMake(x + labelW + otherW,
+ y,
+ otherW,
+ h);
+
+ self.step.frame = CGRectMake(x + labelW + 2*otherW,
+ y,
+ otherW,
+ h);
+ self.stepStepper.frame = CGRectMake(x + labelW + 3*otherW,
+ y,
+ otherW,
+ h);
+
}
-(void)addToSuperview{
NSLog(@"%@ addToSuperview",self);
[self.params.view addSubview:self.label];
[self.params.view addSubview:self.data];
+ [self.params.view addSubview:self.dataStepper];
+ [self.params.view addSubview:self.step];
+ [self.params.view addSubview:self.stepStepper];
}
--(void)extract{
- NSLog(@"%@ extract",self);
+-(BOOL)isNumber:(NSString *) string{
+
+ return [[NSNumberFormatter new]numberFromString:string] == nil;
+}
- if([[NSNumberFormatter new]numberFromString:self.data.text] == nil){
+-(CGFloat) currentDataValue{
+ if([self isNumber:self.data.text]){
NSLog(@"%@ got illegal value: %@, reseting to %d",self,self.data.text,self.defaultValue);
[self resetValue];
}
- self.extractor([self.data.text floatValue]);
+ return [self.data.text floatValue];
+}
+
+-(void)extract{
+ NSLog(@"%@ extract",self);
+
+ self.extractor([self currentDataValue]);
}
@end
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.h b/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.h
index 57060b7..47c6a6e 100644
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.h
+++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.h
@@ -11,4 +11,5 @@
@interface MLOTestingTileParametersViewController : MLOViewController<MLOTestingTileSubviewControllerProtocol>
@property CGFloat contextWidth, contextHeight, tilePosX, tilePosY, tileWidth, tileHeight;
+-(void)renderTile;
@end
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.m
index acd00c1..4feee1e 100644
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.m
+++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.m
@@ -41,10 +41,10 @@ static const CGFloat RENDER_BUTTON_HEIGHT = 50.0f;
-(void)initParams{
self.params = @[[self createParam:@"contextWidth" extractor:^(CGFloat value){self.contextWidth = value;} value:600],
[self createParam:@"contextHeight" extractor:^(CGFloat value){self.contextHeight = value;} value:600],
- [self createParam:@"tilePosX" extractor:^(CGFloat value){self.tilePosX = value;} value:600],
- [self createParam:@"tilePosY" extractor:^(CGFloat value){self.tilePosY = value;} value:600],
+ [self createParam:@"tilePosX" extractor:^(CGFloat value){self.tilePosX = value;} value:500],
+ [self createParam:@"tilePosY" extractor:^(CGFloat value){self.tilePosY = value;} value:620],
[self createParam:@"tileWidth" extractor:^(CGFloat value){self.tileWidth = value;} value:1000],
- [self createParam:@"tileHeight" extractor:^(CGFloat value){self.tileHeight = value;} value:1000]
+ [self createParam:@"tileHeight" extractor:^(CGFloat value){self.tileHeight = value;} value:1020]
];
}
More information about the Libreoffice-commits
mailing list