Revision: 28706
http://sourceforge.net/p/bibdesk/svn/28706
Author: hofman
Date: 2024-02-08 10:39:04 +0000 (Thu, 08 Feb 2024)
Log Message:
-----------
create CFData object from bytes pointer lazily when needed, when using a bytes
pointer we should never need it anyway
Modified Paths:
--------------
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVCGImageDescription.m
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVCGImageDescription.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVCGImageDescription.m
2024-02-08 10:32:56 UTC (rev 28705)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVCGImageDescription.m
2024-02-08 10:39:04 UTC (rev 28706)
@@ -76,12 +76,8 @@
if (NULL == _bitmapPtr) {
_bitmapData =
CGDataProviderCopyData(CGImageGetDataProvider(_image));
}
- else {
- // wrap in a non-copying, non-freeing CFData for archiving access
- _bitmapData = CFDataCreateWithBytesNoCopy(CFAllocatorGetDefault(),
_bitmapPtr, _bitmapPtrSize, kCFAllocatorNull);
- }
- NSAssert3((size_t)CFDataGetLength(_bitmapData) == _bytesPerRow *
_height, @"strange data length %ld for %@ (should be >= %lu)",
CFDataGetLength(_bitmapData), _image, (unsigned long)(_bytesPerRow * _height));
+ NSAssert3((size_t)(_bitmapPtrSize ?: CFDataGetLength(_bitmapData)) ==
_bytesPerRow * _height, @"strange data length %ld for %@ (should be >= %lu)",
(_bitmapPtrSize ?: CFDataGetLength(_bitmapData)), _image, (unsigned
long)(_bytesPerRow * _height));
}
return self;
}
@@ -97,6 +93,10 @@
- (CGImageRef)newImage;
{
if (NULL == _image) {
+ if (_bitmapData == NULL && _bitmapPtr != NULL) {
+ // wrap in a non-copying, non-freeing CFData for archiving access
+ _bitmapData = CFDataCreateWithBytesNoCopy(CFAllocatorGetDefault(),
_bitmapPtr, _bitmapPtrSize, kCFAllocatorNull);
+ }
CGColorSpaceRef cspace = [_colorSpaceDescription newColorSpace];
CGDataProviderRef provider =
CGDataProviderCreateWithCFData(_bitmapData);
_image = CGImageCreate(_width, _height, _bitsPerComponent,
_bitsPerPixel, _bytesPerRow, cspace, _bitmapInfo, provider, _decode,
_shouldInterpolate, _renderingIntent);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit