Skip to content

Commit

Permalink
Bring back support for 32-bit opaque images. Using an opaque image fo…
Browse files Browse the repository at this point in the history
…rmat allows Core Animation to skip blending the layer, which improves rendering performance.
  • Loading branch information
Mallory Paine committed Oct 25, 2013
1 parent 9902af7 commit 91c9e38
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions FastImageCache/FICImageFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ typedef NS_OPTIONS(NSUInteger, FICImageFormatDevices) {

typedef NS_OPTIONS(NSUInteger, FICImageFormatStyle) {
FICImageFormatStyle32BitBGRA,
FICImageFormatStyle32BitBGR,
FICImageFormatStyle16BitBGR,
FICImageFormatStyle8BitGrayscale,
};
Expand Down
6 changes: 6 additions & 0 deletions FastImageCache/FICImageFormat.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ - (CGBitmapInfo)bitmapInfo {
case FICImageFormatStyle32BitBGRA:
info = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host;
break;
case FICImageFormatStyle32BitBGR:
info = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host;
break;
case FICImageFormatStyle16BitBGR:
info = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder16Host;
break;
Expand All @@ -78,6 +81,7 @@ - (NSInteger)bytesPerPixel {
NSInteger bytesPerPixel;
switch (_style) {
case FICImageFormatStyle32BitBGRA:
case FICImageFormatStyle32BitBGR:
bytesPerPixel = 4;
break;
case FICImageFormatStyle16BitBGR:
Expand All @@ -94,6 +98,7 @@ - (NSInteger)bitsPerComponent {
NSInteger bitsPerComponent;
switch (_style) {
case FICImageFormatStyle32BitBGRA:
case FICImageFormatStyle32BitBGR:
case FICImageFormatStyle8BitGrayscale:
bitsPerComponent = 8;
break;
Expand All @@ -108,6 +113,7 @@ - (BOOL)isGrayscale {
BOOL isGrayscale;
switch (_style) {
case FICImageFormatStyle32BitBGRA:
case FICImageFormatStyle32BitBGR:
case FICImageFormatStyle16BitBGR:
isGrayscale = NO;
break;
Expand Down

0 comments on commit 91c9e38

Please sign in to comment.