Skip to content

Commit 91c9e38

Browse files
author
Mallory Paine
committed
Bring back support for 32-bit opaque images. Using an opaque image format allows Core Animation to skip blending the layer, which improves rendering performance.
1 parent 9902af7 commit 91c9e38

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

FastImageCache/FICImageFormat.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ typedef NS_OPTIONS(NSUInteger, FICImageFormatDevices) {
2424

2525
typedef NS_OPTIONS(NSUInteger, FICImageFormatStyle) {
2626
FICImageFormatStyle32BitBGRA,
27+
FICImageFormatStyle32BitBGR,
2728
FICImageFormatStyle16BitBGR,
2829
FICImageFormatStyle8BitGrayscale,
2930
};

FastImageCache/FICImageFormat.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ - (CGBitmapInfo)bitmapInfo {
6464
case FICImageFormatStyle32BitBGRA:
6565
info = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host;
6666
break;
67+
case FICImageFormatStyle32BitBGR:
68+
info = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host;
69+
break;
6770
case FICImageFormatStyle16BitBGR:
6871
info = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder16Host;
6972
break;
@@ -78,6 +81,7 @@ - (NSInteger)bytesPerPixel {
7881
NSInteger bytesPerPixel;
7982
switch (_style) {
8083
case FICImageFormatStyle32BitBGRA:
84+
case FICImageFormatStyle32BitBGR:
8185
bytesPerPixel = 4;
8286
break;
8387
case FICImageFormatStyle16BitBGR:
@@ -94,6 +98,7 @@ - (NSInteger)bitsPerComponent {
9498
NSInteger bitsPerComponent;
9599
switch (_style) {
96100
case FICImageFormatStyle32BitBGRA:
101+
case FICImageFormatStyle32BitBGR:
97102
case FICImageFormatStyle8BitGrayscale:
98103
bitsPerComponent = 8;
99104
break;
@@ -108,6 +113,7 @@ - (BOOL)isGrayscale {
108113
BOOL isGrayscale;
109114
switch (_style) {
110115
case FICImageFormatStyle32BitBGRA:
116+
case FICImageFormatStyle32BitBGR:
111117
case FICImageFormatStyle16BitBGR:
112118
isGrayscale = NO;
113119
break;

0 commit comments

Comments
 (0)