Revision: 28724 http://sourceforge.net/p/bibdesk/svn/28724 Author: hofman Date: 2024-02-10 17:37:04 +0000 (Sat, 10 Feb 2024) Log Message: ----------- pass all parameters in private designated initializer
Modified Paths: -------------- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVImageBuffer.m Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVImageBuffer.m =================================================================== --- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVImageBuffer.m 2024-02-10 17:27:00 UTC (rev 28723) +++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVImageBuffer.m 2024-02-10 17:37:04 UTC (rev 28724) @@ -62,7 +62,7 @@ } // safe initializer for copy, in case there's a mismatch between width/height/rowBytes -- (id)_initWithBufferSize:(size_t)bufferSize +- (id)_initWithWidth:(size_t)w height:(size_t)h rowBytes:(size_t)r bufferSize:(size_t)bufferSize { self = [super init]; if (self) { @@ -71,9 +71,9 @@ self = nil; } else { - buffer->width = bufferSize; - buffer->height = 1; - buffer->rowBytes = bufferSize; + buffer->width = w; + buffer->height = h; + buffer->rowBytes = r; _bufferSize = bufferSize; buffer->data = CFAllocatorAllocate(FVAllocatorGetDefault(), bufferSize, 0); FVAtomicAdd64(_allocatedBytes, _bufferSize); @@ -89,13 +89,7 @@ - (id)initWithWidth:(size_t)w height:(size_t)h rowBytes:(size_t)r; { - self = [self _initWithBufferSize:(r * h)]; - if (self) { - buffer->width = w; - buffer->height = h; - buffer->rowBytes = r; - } - return self; + return [self _initWithWidth:w height:h rowBytes:r bufferSize:(r * h)]; } - (id)initWithWidth:(size_t)w height:(size_t)h bytesPerSample:(size_t)bps; @@ -105,10 +99,7 @@ - (id)copyWithZone:(NSZone *)aZone { - FVImageBuffer *copy = [[[self class] allocWithZone:aZone] _initWithBufferSize:_bufferSize]; - copy->buffer->rowBytes = buffer->rowBytes; - copy->buffer->height = buffer->height; - copy->buffer->width = buffer->width; + FVImageBuffer *copy = [[[self class] allocWithZone:aZone] _initWithWidth:buffer->width height:buffer->height rowBytes:buffer->rowBytes bufferSize:_bufferSize]; if (nil != copy) memcpy(copy->buffer->data, buffer->data, copy->_bufferSize); return copy; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit