[Libreoffice-commits] core.git: 2 commits - ios/experimental
Tor Lillqvist
tml at collabora.com
Mon Mar 31 10:11:50 PDT 2014
ios/experimental/TiledLibreOffice/TiledLibreOffice/TiledView.m | 53 +++++++---
1 file changed, 38 insertions(+), 15 deletions(-)
New commits:
commit cde082f5f1072530cf7639eb5ce7c24dac9e6826
Author: Tor Lillqvist <tml at collabora.com>
Date: Mon Mar 31 20:10:17 2014 +0300
Bin a few since long commented-out lines
Change-Id: I4087f8f51dd6e8066818a98797c1e575ecca3442
diff --git a/ios/experimental/TiledLibreOffice/TiledLibreOffice/TiledView.m b/ios/experimental/TiledLibreOffice/TiledLibreOffice/TiledView.m
index a02fcfe..cea417a 100644
--- a/ios/experimental/TiledLibreOffice/TiledLibreOffice/TiledView.m
+++ b/ios/experimental/TiledLibreOffice/TiledLibreOffice/TiledView.m
@@ -110,13 +110,9 @@ static void updateTilesPerSecond(UILabel *label)
CGRect bb = CGContextGetClipBoundingBox(ctx);
- // double zoomScale = [(View *) [self superview] zoomScale];
- // CATiledLayer *catl = (CATiledLayer*) [self layer];
-
CGContextSaveGState(ctx);
CGContextTranslateCTM(ctx, bb.origin.x, bb.origin.y);
- // CGContextScaleCTM(ctx, 1/zoomScale, 1/zoomScale);
// CGSize tileSize = [catl tileSize];
CGSize tileSize = bb.size;
commit 7c4783f6a2cb7598ecc48f20379dad9784541d5b
Author: Tor Lillqvist <tml at collabora.com>
Date: Mon Mar 31 20:06:23 2014 +0300
Add possibility to show tile numbers and render just one tile
Useful for debugging. Also, make the tile border drawing
optional. These three debugging features are governed by environment
variales (set in Xcode before running with Alt+Product>Run...)
DRAW_ONLY_TILE, DRAW_TILE_BORDERS and DRAW_TILE_NUMBERS.
Change-Id: I81f952284676eafe5d204c819658e0225aabdb1c
diff --git a/ios/experimental/TiledLibreOffice/TiledLibreOffice/TiledView.m b/ios/experimental/TiledLibreOffice/TiledLibreOffice/TiledView.m
index 88c3095..a02fcfe 100644
--- a/ios/experimental/TiledLibreOffice/TiledLibreOffice/TiledView.m
+++ b/ios/experimental/TiledLibreOffice/TiledLibreOffice/TiledView.m
@@ -6,6 +6,8 @@
// 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/.
+#include <CoreText/CoreText.h>
+
#include <touch/touch.h>
#import "View.h"
@@ -131,22 +133,47 @@ static void updateTilesPerSecond(UILabel *label)
// as needed at the current zoom levels. I keep thinking about
// "pixels" incorrectly.
- touch_lo_draw_tile(ctx,
- tileSize.width, tileSize.height,
- CGPointMake(bb.origin.x/self.scale, bb.origin.y/self.scale),
- CGSizeMake(bb.size.width/self.scale, bb.size.height/self.scale));
+ volatile static int number = 0;
+ int thisTile = number++;
+
+ if (!getenv("DRAW_ONLY_TILE") || thisTile == atoi(getenv("DRAW_ONLY_TILE")))
+ touch_lo_draw_tile(ctx,
+ tileSize.width, tileSize.height,
+ CGPointMake(bb.origin.x/self.scale, bb.origin.y/self.scale),
+ CGSizeMake(bb.size.width/self.scale, bb.size.height/self.scale));
+ else {
+ CGContextSetRGBFillColor(ctx, 1, 1, 1, 1);
+ CGContextFillRect(ctx, CGRectMake(0, 0, bb.size.width, bb.size.height));
+ }
[self didRenderTile];
CGContextRestoreGState(ctx);
- // I am a bit confused about what tiles exactly I am drawing, so
- // make it perfectly obvious by drawing borders around the tiles
- CGContextSaveGState(ctx);
- CGContextSetStrokeColorWithColor(ctx, [[UIColor colorWithRed:1 green:0 blue:0 alpha:0.5] CGColor]);
- CGContextSetLineWidth(ctx, 1);
- CGContextStrokeRect(ctx, bb);
- CGContextRestoreGState(ctx);
+ if (getenv("DRAW_TILE_BORDERS")) {
+ // I am a bit confused about what tiles exactly I am drawing, so
+ // make it perfectly obvious by drawing borders around the tiles
+ CGContextSaveGState(ctx);
+ CGContextSetStrokeColorWithColor(ctx, [[UIColor colorWithRed:1 green:0 blue:0 alpha:0.5] CGColor]);
+ CGContextSetLineWidth(ctx, 1);
+ CGContextStrokeRect(ctx, bb);
+ CGContextRestoreGState(ctx);
+ }
+
+ if (getenv("DRAW_TILE_NUMBERS")) {
+ // Also draw the order number of the tile;)
+ CGContextSaveGState(ctx);
+ float scale = 1/[((View *) [self superview]) zoomScale];
+ NSString *s = [NSString stringWithFormat:@"%d", thisTile];
+ CFAttributedStringRef as = CFAttributedStringCreate(NULL, (__bridge CFStringRef)(s), NULL);
+ CTLineRef l = CTLineCreateWithAttributedString(as);
+ CGContextTranslateCTM(ctx, bb.origin.x, bb.origin.y);
+ CGContextScaleCTM(ctx, scale, scale);
+ CGContextSetTextPosition(ctx, 2, 12);
+ CGContextSetTextMatrix(ctx, CGAffineTransformScale(CGContextGetTextMatrix(ctx), 1, -1));
+ CTLineDraw(l, ctx);
+ CGContextRestoreGState(ctx);
+ }
}
@end
More information about the Libreoffice-commits
mailing list