Why do i always get this log, Infinite source rectangle to drawImage method
, is this such an error or there's something wrong with the code algorithm. I don't really understand about this, and i can't find any useful information on google. Hope i can find the answer on this site.
sorry, this is my drawRect method :
- (void)drawRect:(NSRect)rect {
// Drawing code here.
// drawBackground
[[NSColor colorWithCalibratedRed:0 green:0 blue:0 alpha:1.0] set];
[NSBezierPath fillRect:[self bounds]];
if (myCIImage != nil) {
//Create the CIContext
CIContext *context = [[NSGraphicsContext currentContext] CIContext];
//scale to fit in view rect
CIImage *drawnImage;
if (previewFilter == YES) {
drawnImage = [previewImage imageByApplyingTransform:[self imageTransformToFitView]];
} else {
drawnImage = [myCIImage imageByApplyingTransform:[self imageTransformToFitView]];
}
// center in view rect
NSRect viewBounds = [self bounds];
CGRect sRect = [drawnImage extent];
CGRect dRect = sRect;
dRect.origin.x = viewBounds.origin.x + (viewBounds.size.width - sRect.size.width)/2;
dRect.origin.y = viewBounds.origin.y + (viewBounds.size.height - sRect.size.height)/2;
[context drawImage:drawnImage
inRect:dRect
fromRect:sRect];
}
}
thanks -