summaryrefslogtreecommitdiff
path: root/ios
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-04-07 17:48:22 +0300
committerTor Lillqvist <tml@collabora.com>2014-04-07 17:56:04 +0300
commit801a8cd336426327724b0157141a00c8d2a9ae96 (patch)
tree5806322eeb63c7d220b35d6f2b7aa1a9444f3786 /ios
parent57b44c3c66668794b5a180cc91f82e25a8fae92d (diff)
Add somewhat ridiculous debug hacks for CoreGrahics drawing debugging on iOS
When the environment variable DRAW_INCREMENTALLY_FROM is set to a number, we want TiledLibreOffice to loop, initially performing only that number of drawing operations in AquaSalGraphics, then wait for some seconds, and redraw. Next time perform one operation more. Repeat. Implemented in vcl by surrounding the entry and exit(s) of the drawing functions in AquaSalGraphics with macros. All this is active only for iOS and in a dbgutil build.
Diffstat (limited to 'ios')
-rw-r--r--ios/experimental/TiledLibreOffice/TiledLibreOffice/TiledView.m26
1 files changed, 24 insertions, 2 deletions
diff --git a/ios/experimental/TiledLibreOffice/TiledLibreOffice/TiledView.m b/ios/experimental/TiledLibreOffice/TiledLibreOffice/TiledView.m
index 80680dd52269..aafbd430682e 100644
--- a/ios/experimental/TiledLibreOffice/TiledLibreOffice/TiledView.m
+++ b/ios/experimental/TiledLibreOffice/TiledLibreOffice/TiledView.m
@@ -82,6 +82,20 @@ static void updateTilesPerSecond(UILabel *label)
}
}
+static int DBG_DRAW_DELAY = 10;
+int DBG_DRAW_ROUNDS = -1;
+int DBG_DRAW_COUNTER = 0;
+int DBG_DRAW_ROUNDS_MAX = INT_MAX;
+
+- (void)redraw
+{
+ DBG_DRAW_ROUNDS++;
+ DBG_DRAW_COUNTER = 0;
+ [self setNeedsDisplay];
+ if (DBG_DRAW_ROUNDS < DBG_DRAW_ROUNDS_MAX)
+ [NSTimer scheduledTimerWithTimeInterval:DBG_DRAW_DELAY target:self selector:@selector(redraw) userInfo:nil repeats:NO];
+}
+
- (id)initWithFrame:(CGRect)frame scale:(CGFloat)scale maxZoom:(int)maxZoom
{
self = [super initWithFrame:frame];
@@ -93,6 +107,13 @@ static void updateTilesPerSecond(UILabel *label)
catl.levelsOfDetailBias = catl.levelsOfDetail - 1;
[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(updateTilesPerSecond) userInfo:nil repeats:YES];
+ if (getenv("DRAW_INCREMENTALLY_FROM")) {
+ DBG_DRAW_ROUNDS = atoi(getenv("DRAW_INCREMENTALLY_FROM"));
+ if (getenv("DRAW_INCREMENTALLY_DELAY") &&
+ atoi(getenv("DRAW_INCREMENTALLY_DELAY")) > 1)
+ DBG_DRAW_DELAY = atoi(getenv("DRAW_INCREMENTALLY_DELAY"));
+ [NSTimer scheduledTimerWithTimeInterval:DBG_DRAW_DELAY target:self selector:@selector(redraw) userInfo:nil repeats:NO];
+ }
}
return self;
}
@@ -138,12 +159,13 @@ static bool tileMatches(const char *spec, CGRect bb)
// as needed at the current zoom levels. I keep thinking about
// "pixels" incorrectly.
- if (!getenv("DRAW_ONLY_TILE") || tileMatches(getenv("DRAW_ONLY_TILE"), bb))
+ if (!getenv("DRAW_ONLY_TILE") || tileMatches(getenv("DRAW_ONLY_TILE"), bb)) {
+ fprintf(stderr, "+++ rendering to context %p\n", ctx);
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 {
+ } else {
CGContextSetRGBFillColor(ctx, 1, 1, 1, 1);
CGContextFillRect(ctx, CGRectMake(0, 0, bb.size.width, bb.size.height));
}