@@ -81,10 +81,11 @@ - (UIImage*) applyFilter:(FilterCallback)filter context:(void*)context
81
81
}
82
82
83
83
CFDataRef m_DataRef = CGDataProviderCopyData (CGImageGetDataProvider (inImage));
84
- UInt8 * m_PixelBuf = (UInt8 *) CFDataGetBytePtr (m_DataRef);
85
-
86
84
int length = CFDataGetLength (m_DataRef);
87
-
85
+ CFMutableDataRef m_DataRefEdit = CFDataCreateMutableCopy (NULL ,length,m_DataRef);
86
+ UInt8 * m_PixelBuf = (UInt8 *) CFDataGetMutableBytePtr (m_DataRefEdit);
87
+ CFRelease (m_DataRefEdit);
88
+
88
89
for (int i=0 ; i<length; i+=4 )
89
90
{
90
91
filter (m_PixelBuf,i,context);
@@ -422,7 +423,10 @@ - (UIImage*) applyBlendFilter:(FilterBlendCallback)filter other:(UIImage*)other
422
423
}
423
424
424
425
CFDataRef m_DataRef = CGDataProviderCopyData (CGImageGetDataProvider (inImage));
425
- UInt8 * m_PixelBuf = (UInt8 *) CFDataGetBytePtr (m_DataRef);
426
+ int length = CFDataGetLength (m_DataRef);
427
+ CFMutableDataRef m_DataRefEdit = CFDataCreateMutableCopy (NULL ,length,m_DataRef);
428
+ UInt8 * m_PixelBuf = (UInt8 *) CFDataGetMutableBytePtr (m_DataRefEdit);
429
+ CFRelease (m_DataRefEdit);
426
430
427
431
CGImageRef otherImage = other.CGImage ;
428
432
CFDataRef m_OtherDataRef = CGDataProviderCopyData (CGImageGetDataProvider (otherImage));
@@ -767,8 +771,16 @@ - (UIImage*) applyConvolve:(NSArray*)kernel
767
771
CGImageRef inImage = self.CGImage ;
768
772
CFDataRef m_DataRef = CGDataProviderCopyData (CGImageGetDataProvider (inImage));
769
773
CFDataRef m_OutDataRef = CGDataProviderCopyData (CGImageGetDataProvider (inImage));
770
- UInt8 * m_PixelBuf = (UInt8 *) CFDataGetBytePtr (m_DataRef);
771
- UInt8 * m_OutPixelBuf = (UInt8 *) CFDataGetBytePtr (m_OutDataRef);
774
+
775
+ int length = CFDataGetLength (m_DataRef);
776
+ CFMutableDataRef m_DataRefEdit = CFDataCreateMutableCopy (NULL ,length,m_DataRef);
777
+ UInt8 * m_PixelBuf = (UInt8 *) CFDataGetMutableBytePtr (m_DataRefEdit);
778
+ CFRelease (m_DataRefEdit);
779
+
780
+ int outputLength = CFDataGetLength (m_OutDataRef);
781
+ CFMutableDataRef m_OutDataRefEdit = CFDataCreateMutableCopy (NULL ,outputLength,m_DataRef);
782
+ UInt8 * m_OutPixelBuf = (UInt8 *) CFDataGetMutableBytePtr (m_OutDataRefEdit);
783
+ CFRelease (m_OutDataRefEdit);
772
784
773
785
int h = CGImageGetHeight (inImage);
774
786
int w = CGImageGetWidth (inImage);
@@ -950,8 +962,10 @@ - (UIImage*) vignette
950
962
{
951
963
CGImageRef inImage = self.CGImage ;
952
964
CFDataRef m_DataRef = CGDataProviderCopyData (CGImageGetDataProvider (inImage));
953
- UInt8 * m_PixelBuf = (UInt8 *) CFDataGetBytePtr (m_DataRef);
954
965
int length = CFDataGetLength (m_DataRef);
966
+ CFMutableDataRef m_DataRefEdit = CFDataCreateMutableCopy (NULL ,length,m_DataRef);
967
+ UInt8 * m_PixelBuf = (UInt8 *) CFDataGetMutableBytePtr (m_DataRefEdit);
968
+ CFRelease (m_DataRefEdit);
955
969
memset (m_PixelBuf,0 ,length);
956
970
957
971
CGContextRef ctx = CGBitmapContextCreate (m_PixelBuf,
@@ -988,8 +1002,10 @@ - (UIImage*) darkVignette
988
1002
{
989
1003
CGImageRef inImage = self.CGImage ;
990
1004
CFDataRef m_DataRef = CGDataProviderCopyData (CGImageGetDataProvider (inImage));
991
- UInt8 * m_PixelBuf = (UInt8 *) CFDataGetBytePtr (m_DataRef);
992
1005
int length = CFDataGetLength (m_DataRef);
1006
+ CFMutableDataRef m_DataRefEdit = CFDataCreateMutableCopy (NULL ,length,m_DataRef);
1007
+ UInt8 * m_PixelBuf = (UInt8 *) CFDataGetMutableBytePtr (m_DataRefEdit);
1008
+ CFRelease (m_DataRefEdit);
993
1009
memset (m_PixelBuf,0 ,length);
994
1010
995
1011
CGContextRef ctx = CGBitmapContextCreate (m_PixelBuf,
0 commit comments