platform/iphone/Classes/Signature/SignatureView.m in rhodes-2.2.3 vs platform/iphone/Classes/Signature/SignatureView.m in rhodes-2.2.4.beta.1

- old
+ new

@@ -114,12 +114,15 @@ } - (UIImage*)makeUIImage { - CGRect bound_box = CGPathGetBoundingBox(mPath); - CGRect rect = self.frame; + CGRect bound_box = self.bounds; + if (!CGPathIsEmpty(mPath)) { + bound_box = CGPathGetBoundingBox(mPath); + } + CGRect rect = self.bounds; if (rect.size.width < (bound_box.origin.x+bound_box.size.width)) { rect.size.width = (bound_box.origin.x+bound_box.size.width)+2; } if (rect.size.height < (bound_box.origin.y+bound_box.size.height)) { rect.size.height = (bound_box.origin.y+bound_box.size.height)+2; @@ -132,21 +135,24 @@ CGContextSetRGBFillColor(context,1,1,1,1); CGContextSetRGBStrokeColor(context, 0.4, 0, 0.6, 1); CGContextFillRect(context, rect); // draw signature - CGContextSetLineWidth(context, 3); - CGContextTranslateCTM (context, 0, rect.size.height); - CGContextScaleCTM(context, 1, -1); - CGContextBeginPath(context); - CGContextAddPath(context,mPath); - CGContextDrawPath(context, kCGPathStroke); + if (!CGPathIsEmpty(mPath)) { + CGContextSetLineWidth(context, 3); + CGContextTranslateCTM (context, 0, rect.size.height); + CGContextScaleCTM(context, 1, -1); + CGContextBeginPath(context); + CGContextAddPath(context,mPath); + CGContextDrawPath(context, kCGPathStroke); + } CGImageRef cg_image = CGBitmapContextCreateImage(context); UIImage* ui_image = [[UIImage alloc] initWithCGImage:cg_image];// scale:1 orientation:UIImageOrientationDownMirrored]; - [cg_image release]; + + CGImageRelease(cg_image); - [context release]; + CGContextRelease(context); return ui_image; } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {