Revision: 28640
http://sourceforge.net/p/bibdesk/svn/28640
Author: hofman
Date: 2024-01-21 18:44:14 +0000 (Sun, 21 Jan 2024)
Log Message:
-----------
keep planar tiles buffers in single array
Modified Paths:
--------------
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVCGImageUtilities.mm
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVCGImageUtilities.mm
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVCGImageUtilities.mm
2024-01-21 18:17:26 UTC (rev 28639)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVCGImageUtilities.mm
2024-01-21 18:44:14 UTC (rev 28640)
@@ -821,9 +821,8 @@
std::vector <FVRegion> regions = __FVTileRegionsForImage(image, scale);
- // fixed size mutable arrays
- NS_VALID_UNTIL_END_OF_SCOPE NSMutableArray *planarTilesA =
[[NSMutableArray alloc] initWithCapacity:4];
- NS_VALID_UNTIL_END_OF_SCOPE NSMutableArray *planarTilesB =
[[NSMutableArray alloc] initWithCapacity:4];
+ // fixed size mutable array to retain planarA and planarB buffers
+ NS_VALID_UNTIL_END_OF_SCOPE NSMutableArray *planarTiles = [[NSMutableArray
alloc] initWithCapacity:8];
// first region is not necessarily the largest region anymore; figure out
the maximum height and width for tiles
size_t maxWidth = 0, maxHeight = 0;
@@ -841,30 +840,22 @@
FVImageBuffer *imageBuffer;
NSUInteger i;
- for (i = 0; i < 4 && kvImageNoError == ret; i++) {
+ for (i = 0; i < 8 && kvImageNoError == ret; i++) {
imageBuffer = [[FVImageBuffer alloc] initWithWidth:maxWidth
height:maxHeight bytesPerSample:1];
if (imageBuffer) {
- [planarTilesA addObject:imageBuffer];
+ [planarTiles addObject:imageBuffer];
}
else {
ret = kvImageMemoryAllocationError;
}
-
- imageBuffer = [[FVImageBuffer alloc] initWithWidth:maxWidth
height:maxHeight bytesPerSample:1];
- if (imageBuffer) {
- [planarTilesB addObject:imageBuffer];
- }
- else {
- ret = kvImageMemoryAllocationError;
- }
}
imageBuffer = nil;
const __unsafe_unretained FVImageBuffer *planarA[4];
- [planarTilesA getObjects:planarA range:NSMakeRange(0, 4)];
+ [planarTiles getObjects:planarA range:NSMakeRange(0, 4)];
const __unsafe_unretained FVImageBuffer *planarB[4];
- [planarTilesB getObjects:planarB range:NSMakeRange(0, 4)];
+ [planarTiles getObjects:planarB range:NSMakeRange(4, 4)];
// keep track of the next scanline/byte offset in the final image
NSUInteger nextScanline = 0;
@@ -1006,8 +997,7 @@
// cleanup is safe now
// dispose of the tiles
- planarTilesA = nil;
- planarTilesB = nil;
+ planarTiles = nil;
#if FV_LIMIT_TILEMEMORY_USAGE
__FVCGImageDiscardAllocationSize(0);
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