diff --git a/FastImageCache/FICImageTable.m b/FastImageCache/FICImageTable.m index 261113d..f329210 100644 --- a/FastImageCache/FICImageTable.m +++ b/FastImageCache/FICImageTable.m @@ -133,7 +133,7 @@ - (instancetype)initWithFormat:(FICImageFormat *)imageFormat { _screenScale = [[UIScreen mainScreen] scale]; int bytesPerPixel = 4; - _imageRowLength = FICByteAlignForCoreAnimation([_imageFormat pixelSize].width * bytesPerPixel, bytesPerPixel); + _imageRowLength = FICByteAlignForCoreAnimation([_imageFormat pixelSize].width * bytesPerPixel); _imageLength = _imageRowLength * (NSInteger)[_imageFormat pixelSize].height; _chunkDictionary = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, NULL, NULL); // Non-retained keys and values diff --git a/FastImageCache/FICImageTableEntry.m b/FastImageCache/FICImageTableEntry.m index e271dd4..1219a2f 100644 --- a/FastImageCache/FICImageTableEntry.m +++ b/FastImageCache/FICImageTableEntry.m @@ -77,7 +77,7 @@ - (void)dealloc { #pragma mark - Other Accessors + (NSInteger)metadataVersion { - return 7; + return 8; } - (FICImageTableEntryMetadata *)_metadata { diff --git a/FastImageCache/FICUtilities.h b/FastImageCache/FICUtilities.h index 156ee43..d6292e6 100644 --- a/FastImageCache/FICUtilities.h +++ b/FastImageCache/FICUtilities.h @@ -9,7 +9,7 @@ #import "FICImports.h" size_t FICByteAlign(size_t bytesPerRow, size_t alignment); -size_t FICByteAlignForCoreAnimation(size_t bytesPerRow, size_t bytesPerPixel); +size_t FICByteAlignForCoreAnimation(size_t bytesPerRow); NSString * FICStringWithUUIDBytes(CFUUIDBytes UUIDBytes); CFUUIDBytes FICUUIDBytesWithString(NSString *string); diff --git a/FastImageCache/FICUtilities.m b/FastImageCache/FICUtilities.m index 010f414..438d4c5 100644 --- a/FastImageCache/FICUtilities.m +++ b/FastImageCache/FICUtilities.m @@ -12,11 +12,9 @@ #pragma mark Internal Definitions -#define FIC_CA_BACKING_STORE_ALIGNMENT_PIXELS 8 // Core Animation will make a copy of any image that a client application provides whose backing store isn't properly byte-aligned. // This copy operation can be prohibitively expensive, so we want to avoid this by properly aligning any UIImages we're working with. -// To produce a UIImage that is properly aligned, we need to ensure that the backing store's bytes per row is a multiple of -// (bytes per pixel * FIC_CA_BACKING_STORE_ALIGNMENT_PIXELS). +// To produce a UIImage that is properly aligned, we need to ensure that the backing store's bytes per row is a multiple of 64. #pragma mark - Byte Alignment @@ -24,8 +22,8 @@ inline size_t FICByteAlign(size_t width, size_t alignment) { return ((width + (alignment - 1)) / alignment) * alignment; } -inline size_t FICByteAlignForCoreAnimation(size_t bytesPerRow, size_t bytesPerPixel) { - return FICByteAlign(bytesPerRow, (bytesPerPixel * FIC_CA_BACKING_STORE_ALIGNMENT_PIXELS)); +inline size_t FICByteAlignForCoreAnimation(size_t bytesPerRow) { + return FICByteAlign(bytesPerRow, 64); } #pragma mark - Strings and UUIDs