@@ -83,8 +83,8 @@ - (UIImage*) applyFilter:(FilterCallback)filter context:(void*)context
83
83
CFDataRef m_DataRef = CGDataProviderCopyData (CGImageGetDataProvider (inImage));
84
84
int length = CFDataGetLength (m_DataRef);
85
85
CFMutableDataRef m_DataRefEdit = CFDataCreateMutableCopy (NULL ,length,m_DataRef);
86
+ CFRelease (m_DataRef);
86
87
UInt8 * m_PixelBuf = (UInt8 *) CFDataGetMutableBytePtr (m_DataRefEdit);
87
- CFRelease (m_DataRefEdit);
88
88
89
89
for (int i=0 ; i<length; i+=4 )
90
90
{
@@ -107,7 +107,7 @@ - (UIImage*) applyFilter:(FilterCallback)filter context:(void*)context
107
107
scale: self .scale
108
108
orientation: self .imageOrientation];
109
109
CGImageRelease (imageRef);
110
- CFRelease (m_DataRef );
110
+ CFRelease (m_DataRefEdit );
111
111
return finalImage;
112
112
113
113
}
@@ -425,11 +425,14 @@ - (UIImage*) applyBlendFilter:(FilterBlendCallback)filter other:(UIImage*)other
425
425
CFDataRef m_DataRef = CGDataProviderCopyData (CGImageGetDataProvider (inImage));
426
426
int length = CFDataGetLength (m_DataRef);
427
427
CFMutableDataRef m_DataRefEdit = CFDataCreateMutableCopy (NULL ,length,m_DataRef);
428
+ CFRelease (m_DataRef);
428
429
UInt8 * m_PixelBuf = (UInt8 *) CFDataGetMutableBytePtr (m_DataRefEdit);
429
- CFRelease (m_DataRefEdit);
430
430
431
431
CGImageRef otherImage = other.CGImage ;
432
432
CFDataRef m_OtherDataRef = CGDataProviderCopyData (CGImageGetDataProvider (otherImage));
433
+ int otherLength = CFDataGetLength (m_OtherDataRef);
434
+ CFMutableDataRef m_OtherDataRefEdit = CFDataCreateMutableCopy (NULL ,otherLength,m_OtherDataRef);
435
+ CFRelease (m_OtherDataRef);
433
436
UInt8 * m_OtherPixelBuf = (UInt8 *) CFDataGetBytePtr (m_OtherDataRef);
434
437
435
438
int h = self.size .height ;
@@ -460,8 +463,8 @@ - (UIImage*) applyBlendFilter:(FilterBlendCallback)filter other:(UIImage*)other
460
463
CGContextRelease (ctx);
461
464
UIImage *finalImage = [UIImage imageWithCGImage: imageRef];
462
465
CGImageRelease (imageRef);
463
- CFRelease (m_DataRef );
464
- CFRelease (m_OtherDataRef );
466
+ CFRelease (m_DataRefEdit );
467
+ CFRelease (m_OtherDataRefEdit );
465
468
return finalImage;
466
469
467
470
}
@@ -774,13 +777,13 @@ - (UIImage*) applyConvolve:(NSArray*)kernel
774
777
775
778
int length = CFDataGetLength (m_DataRef);
776
779
CFMutableDataRef m_DataRefEdit = CFDataCreateMutableCopy (NULL ,length,m_DataRef);
780
+ CFRelease (m_DataRef);
777
781
UInt8 * m_PixelBuf = (UInt8 *) CFDataGetMutableBytePtr (m_DataRefEdit);
778
- CFRelease (m_DataRefEdit);
779
782
780
783
int outputLength = CFDataGetLength (m_OutDataRef);
781
784
CFMutableDataRef m_OutDataRefEdit = CFDataCreateMutableCopy (NULL ,outputLength,m_DataRef);
785
+ CFRelease (m_OutDataRef);
782
786
UInt8 * m_OutPixelBuf = (UInt8 *) CFDataGetMutableBytePtr (m_OutDataRefEdit);
783
- CFRelease (m_OutDataRefEdit);
784
787
785
788
int h = CGImageGetHeight (inImage);
786
789
int w = CGImageGetWidth (inImage);
@@ -827,8 +830,8 @@ - (UIImage*) applyConvolve:(NSArray*)kernel
827
830
CGContextRelease (ctx);
828
831
UIImage *finalImage = [UIImage imageWithCGImage: imageRef];
829
832
CGImageRelease (imageRef);
830
- CFRelease (m_DataRef );
831
- CFRelease (m_OutDataRef );
833
+ CFRelease (m_DataRefEdit );
834
+ CFRelease (m_OutDataRefEdit );
832
835
return finalImage;
833
836
834
837
}
@@ -964,8 +967,8 @@ - (UIImage*) vignette
964
967
CFDataRef m_DataRef = CGDataProviderCopyData (CGImageGetDataProvider (inImage));
965
968
int length = CFDataGetLength (m_DataRef);
966
969
CFMutableDataRef m_DataRefEdit = CFDataCreateMutableCopy (NULL ,length,m_DataRef);
970
+ CFRelease (m_DataRef);
967
971
UInt8 * m_PixelBuf = (UInt8 *) CFDataGetMutableBytePtr (m_DataRefEdit);
968
- CFRelease (m_DataRefEdit);
969
972
memset (m_PixelBuf,0 ,length);
970
973
971
974
CGContextRef ctx = CGBitmapContextCreate (m_PixelBuf,
@@ -990,8 +993,8 @@ - (UIImage*) vignette
990
993
CGContextRelease (ctx);
991
994
UIImage *finalImage = [UIImage imageWithCGImage: imageRef];
992
995
CGImageRelease (imageRef);
993
- CFRelease (m_DataRef );
994
-
996
+ CFRelease (m_DataRefEdit );
997
+
995
998
UIImage *mask = [finalImage gaussianBlur: 10 ];
996
999
UIImage *blurredSelf = [self gaussianBlur: 2 ];
997
1000
UIImage *maskedSelf = [self mask: mask];
@@ -1004,8 +1007,8 @@ - (UIImage*) darkVignette
1004
1007
CFDataRef m_DataRef = CGDataProviderCopyData (CGImageGetDataProvider (inImage));
1005
1008
int length = CFDataGetLength (m_DataRef);
1006
1009
CFMutableDataRef m_DataRefEdit = CFDataCreateMutableCopy (NULL ,length,m_DataRef);
1010
+ CFRelease (m_DataRef);
1007
1011
UInt8 * m_PixelBuf = (UInt8 *) CFDataGetMutableBytePtr (m_DataRefEdit);
1008
- CFRelease (m_DataRefEdit);
1009
1012
memset (m_PixelBuf,0 ,length);
1010
1013
1011
1014
CGContextRef ctx = CGBitmapContextCreate (m_PixelBuf,
@@ -1048,7 +1051,7 @@ - (UIImage*) darkVignette
1048
1051
CGContextRelease (ctx);
1049
1052
UIImage *blackSquare = [UIImage imageWithCGImage: imageRef];
1050
1053
CGImageRelease (imageRef);
1051
- CFRelease (m_DataRef);
1054
+ CFRelease (m_DataRefEdit);
1052
1055
UIImage *maskedSquare = [blackSquare mask: mask];
1053
1056
return [self overlay: [maskedSquare opacity: 1.0 ]];
1054
1057
}
0 commit comments