diff --git a/Classes/UIImage+StackBlur.m b/Classes/UIImage+StackBlur.m index 16c7dcf..6c63cad 100644 --- a/Classes/UIImage+StackBlur.m +++ b/Classes/UIImage+StackBlur.m @@ -92,8 +92,8 @@ - (UIImage*) stackBlur:(NSUInteger)inradius CGImageRef imageRef = CGBitmapContextCreateImage(ctx); CGContextRelease(ctx); - UIImage *finalImage = [UIImage imageWithCGImage:imageRef]; - CGImageRelease(imageRef); + UIImage *finalImage = [[UIImage alloc] initWithCGImage:imageRef scale:[UIScreen mainScreen].scale orientation:self.imageOrientation]; + CGImageRelease(imageRef); CFRelease(m_DataRef); free(m_PixelBuf); return finalImage; @@ -127,7 +127,7 @@ + (void) applyStackBlurToBuffer:(UInt8*)targetBuffer width:(const int)w height:( const size_t dvcount = 256 * divsum; int *dv = malloc(sizeof(int) * dvcount); - for (int i = 0;i < dvcount;i++) { + for (size_t i = 0;i < dvcount;i++) { dv[i] = (i / divsum); } @@ -321,7 +321,7 @@ - (UIImage *) normalize { CGContextDrawImage(thumbBitmapCtxt, destRect, self.CGImage); CGImageRef tmpThumbImage = CGBitmapContextCreateImage(thumbBitmapCtxt); CGContextRelease(thumbBitmapCtxt); - UIImage *result = [UIImage imageWithCGImage:tmpThumbImage]; + UIImage *result = [[UIImage alloc] initWithCGImage:tmpThumbImage scale:[UIScreen mainScreen].scale orientation:self.imageOrientation]; CGImageRelease(tmpThumbImage); return result;