Revision: 25358 http://sourceforge.net/p/bibdesk/svn/25358 Author: hofman Date: 2021-01-10 16:02:50 +0000 (Sun, 10 Jan 2021) Log Message: ----------- Set default image scale for icons to maximum backing scale factor for all screens at initialization time
Modified Paths: -------------- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon_Private.m trunk/bibdesk_vendorsrc/amaxwell/FileView/FVPDFIcon.m Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon_Private.m =================================================================== --- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon_Private.m 2021-01-10 15:15:52 UTC (rev 25357) +++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon_Private.m 2021-01-10 16:02:50 UTC (rev 25358) @@ -42,6 +42,14 @@ #import <objc/runtime.h> +#if !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 + +@interface NSScreen (FVLionDeclarations) +- (CGFloat)backingScaleFactor; +@end + +#endif + @interface _FVQueuedKeys : NSObject { NSCountedSet *_keys; @@ -102,6 +110,14 @@ // This is called /after/ +[FVIcon initialize] has set up statics and loaded the Leopard bundle, so all subclasses should be available by now. If a plugin architecture is ever implemented, the class will have to register for NSBundleDidLoadNotification and add new classes. [self _processIconSubclasses]; + + if ([NSScreen instancesRespondToSelector:@selector(backingScaleFactor)]) { + CGFloat scale; + for (NSScreen *screen in [NSScreen screens]) + scale = fmax(scale, [screen backingScaleFactor]); + if (scale > 1.0) + FVDefaultScale = scale; + } } + (void)_startRenderingForKey:(id)aKey; Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVPDFIcon.m =================================================================== --- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVPDFIcon.m 2021-01-10 15:15:52 UTC (rev 25357) +++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVPDFIcon.m 2021-01-10 16:02:50 UTC (rev 25358) @@ -252,20 +252,18 @@ } // roughly 50% of a typical page minimum dimension -#define FVMaxPDFThumbnailDimension 310 +#define FVMaxPDFThumbnailDimension 310.0 // used to constrain thumbnail size for huge pages static bool __FVPDFIconLimitThumbnailSize(NSSize *size) { CGFloat dimension = MAX(size->width, size->height); - if (dimension <= FVMaxPDFThumbnailDimension) + CGFloat maxDimension = FVMaxPDFThumbnailDimension * FVDefaultScale; + if (dimension <= maxDimension) return false; - while (dimension > FVMaxPDFThumbnailDimension) { - size->width *= 0.9; - size->height *= 0.9; - dimension = MAX(size->width, size->height); - } + size->width = round(size->width * maxDimension / dimension); + size->height = round(size->height * maxDimension / dimension); return true; } 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