Garrett Moon
77e3fe563a
Need to release image if returning
2015-12-05 14:18:47 -08:00
Garrett Moon
1bac095042
Remove decode for CI progressive images
...
Previously, I'd speculatively decoded images returned from the progressive CIContext
because I'd read that doing so would move the memory from the GPU to the CPU, hopefully
making drawing faster.
I decided to test this hypothesis and by drawing the un-'decoded' image and the image
directly returned from CIContext. Here are some results:
When decoded is drawn before regular
[22486:30240049] decoded - 'regular': 0.000263
[22486:30240097] decoded - 'regular': 0.000242
[22486:30240306] decoded - 'regular': 0.000092
[22486:30240068] decoded - 'regular': 0.000384
[22486:30240096] decoded - 'regular': 0.000111
[22486:30240074] decoded - 'regular': 0.000089
[22486:30240046] decoded - 'regular': 0.000273
[22486:30240351] decoded - 'regular': 0.000250
[22486:30240307] decoded - 'regular': 0.000313
[22486:30240308] decoded - 'regular': 0.000684
[22486:30240307] decoded - 'regular': 0.000485
[22486:30240069] decoded - 'regular': 0.002414
[22486:30240052] decoded - 'regular': 0.000397
[22486:30240049] decoded - 'regular': 0.000293
[22486:30240351] decoded - 'regular': 0.000145
When regular is drawn before decoded
[22610:30246046] decoded - 'regular': 0.000056
[22610:30246030] decoded - 'regular': 0.000473
[22610:30246029] decoded - 'regular': 0.000138
[22610:30246053] decoded - 'regular': 0.000387
[22610:30246030] decoded - 'regular': -0.000006
[22610:30246026] decoded - 'regular': 0.000714
[22610:30246034] decoded - 'regular': 0.000097
[22610:30246621] decoded - 'regular': 0.000039
[22610:30246024] decoded - 'regular': 0.000121
[22610:30246662] decoded - 'regular': -0.000090
[22610:30246030] decoded - 'regular': -0.000057
[22610:30246619] decoded - 'regular': 0.000443
[22610:30246033] decoded - 'regular': 0.001297
[22610:30246623] decoded - 'regular': -0.000020
[22610:30246057] decoded - 'regular': 0.001249
[22610:30246660] decoded - 'regular': 0.000208
[22610:30246659] decoded - 'regular': 0.000048
[22610:30246709] decoded - 'regular': -0.000327
[22610:30246027] decoded - 'regular': 0.000953
[22610:30246025] decoded - 'regular': 0.001228
[22610:30246659] decoded - 'regular': 0.001141
Decoding the image makes little difference and that the difference shows that
the 'decoded' image actually takes longer to draw.
So, we'll save memory and processing time by returning the CGImage from the
context directly as opposed to attempting to decode it.
2015-12-05 13:09:14 -08:00
Garrett Moon
d09f83379b
CIImage doesn't retain its CGImage :(
2015-11-24 11:42:17 -08:00
Garrett Moon
b52d4a867a
Improve readability
2015-11-20 18:11:23 -08:00
Garrett Moon
db588e49cc
Respect the maximum size of CIContexts
2015-11-20 18:04:01 -08:00
Garrett Moon
dc0458ff3e
So, uh,
...
+ (UIImage * _Nonnull)imageWithCGImage:(CGImageRef _Nonnull)cgImage
says it returns a non-nil value but documentation says:
Return Value
A new image object for the specified Quartz image, or nil if the method could not initialize the image from the specified image reference.
So we're guarding against a nil inputImage
2015-10-14 14:40:33 -07:00
Sam Dean
c0e74f10eb
Replace @import with #import
2015-09-30 14:39:13 +01:00
Garrett Moon
4ba0affc3f
[CIFilter outputImage] can return nil, [CIContext createCGImage:fromRect:] requires a non-nil CIImage as input.
2015-09-28 17:00:16 -07:00
Garrett Moon
99b34850c7
Context should be nil'd before image source
2015-08-01 09:28:07 -07:00
Jon Parise
38d9f8e3c9
Name our locks.
2015-07-29 14:43:23 -07:00
Zev Eisenberg
c9f1796b3f
Prefix category methods.
2015-07-27 17:57:37 -04:00
Jared Sinclair
8dc2c2a4f5
fix(imports): change to module imports where relevant
2015-07-26 18:25:56 -04:00
Garrett Moon
9d2bd31f95
1.0
2015-07-22 17:29:31 -07:00