Revision: 16308
http://sourceforge.net/p/skim-app/code/16308
Author: hofman
Date: 2026-05-24 21:06:24 +0000 (Sun, 24 May 2026)
Log Message:
-----------
Don't draw app icon in thumbnails, nobody else is doing this
Modified Paths:
--------------
trunk/QuickLook-Skim/GenerateThumbnailForURL.m
trunk/QuickLook-Skim/QuickLook-Skim.xcodeproj/project.pbxproj
Removed Paths:
-------------
trunk/QuickLook-Skim/Skim.png
trunk/QuickLook-Skim/Skim_2x.png
Modified: trunk/QuickLook-Skim/GenerateThumbnailForURL.m
===================================================================
--- trunk/QuickLook-Skim/GenerateThumbnailForURL.m 2026-05-24 17:51:47 UTC
(rev 16307)
+++ trunk/QuickLook-Skim/GenerateThumbnailForURL.m 2026-05-24 21:06:24 UTC
(rev 16308)
@@ -43,23 +43,7 @@
// page margins 20 pt on all edges
static const CGFloat _horizontalMargin = 20;
static const CGFloat _verticalMargin = 20;
-static const NSSize _containerSize = (NSSize) { 572, 752 };
-static const NSRect _iconRect = (NSRect) { { 50, 140 }, { 512, 512 } };
-// wash the app icon over a white page background
-static void drawBackgroundAndApplicationIconInCurrentContext(CFBundleRef
bundle)
-{
- [[NSColor whiteColor] setFill];
- NSRect pageRect = { NSZeroPoint, _paperSize };
- NSRectFillUsingOperation(pageRect, NSCompositingOperationSourceOver);
- BOOL isHR =
CGContextGetUserSpaceToDeviceSpaceTransform([[NSGraphicsContext currentContext]
CGContext]).a > 1.0;
-
- NSURL *iconURL = (NSURL
*)CFBridgingRelease(CFBundleCopyResourceURL(bundle, isHR ? CFSTR("Skim_2x") :
CFSTR("Skim"), CFSTR("png"), NULL));
- NSImage *appIcon = [[NSImage alloc] initWithContentsOfURL:iconURL];
-
- [appIcon drawInRect:_iconRect fromRect:NSZeroRect
operation:NSCompositingOperationSourceOver fraction:0.3];
-}
-
// creates a new NSTextStorage/NSLayoutManager/NSTextContainer system suitable
for drawing in a thread
static NSTextStorage *createTextStorage()
{
@@ -66,7 +50,7 @@
NSTextStorage *textStorage = [[NSTextStorage alloc] init];
NSLayoutManager *lm = [[NSLayoutManager alloc] init];
NSTextContainer *tc = [[NSTextContainer alloc] init];
- [tc setContainerSize:_containerSize];
+ [tc setContainerSize:NSMakeSize(_paperSize.width - 2 * _horizontalMargin,
_paperSize.height - 2 * _verticalMargin)];
[lm addTextContainer:tc];
// don't let the layout manager use its threaded layout (see header)
[lm setBackgroundLayoutEnabled:NO];
@@ -77,8 +61,7 @@
return textStorage;
}
-// assumes that the current NSGraphicsContext is the destination
-static void drawAttributedStringInCurrentContext(NSAttributedString
*attrString)
+static void drawAttributedStringInContext(CGContextRef context,
NSAttributedString *attrString)
{
CGContextRef ctxt = [[NSGraphicsContext currentContext] CGContext];
@@ -90,13 +73,17 @@
NSRect stringRect = NSZeroRect;
stringRect.size = _paperSize;
- CGContextSaveGState(ctxt);
+ CGContextSaveGState(context);
CGAffineTransform t1 = CGAffineTransformMakeTranslation(_horizontalMargin,
_paperSize.height - _verticalMargin);
CGAffineTransform t2 = CGAffineTransformMakeScale(1, -1);
CGAffineTransform pageTransform = CGAffineTransformConcat(t2, t1);
- CGContextConcatCTM(ctxt, pageTransform);
+ CGContextConcatCTM(context, pageTransform);
+ CGFloat color[4] = {1.0, 1.0, 1.0, 1.0};
+ CGContextSetFillColor(context, color);
+ CGContextFillRect(context, CGRectMake(-_horizontalMargin,
-_verticalMargin, _paperSize.width, _paperSize.height));
+
// objectAtIndex:0 is safe, since we added these to the text storage (so
there's at least one)
NSLayoutManager *lm = [[textStorage layoutManagers] objectAtIndex:0];
NSTextContainer *tc = [[lm textContainers] objectAtIndex:0];
@@ -109,10 +96,16 @@
// NSRunStorage raises if we try drawing a zero length range (happens if
you have an empty text file)
if (glyphRange.length > 0) {
+ NSGraphicsContext *nsContext = [NSGraphicsContext
graphicsContextWithGraphicsPort:ctxt flipped:YES];
+ [NSGraphicsContext saveGraphicsState];
+ [NSGraphicsContext setCurrentContext:nsContext];
+
[lm drawBackgroundForGlyphRange:glyphRange atPoint:usedRect.origin];
[lm drawGlyphsForGlyphRange:glyphRange atPoint:usedRect.origin];
- }
- CGContextRestoreGState(ctxt);
+
+ [NSGraphicsContext restoreGraphicsState];
+ }
+ CGContextRestoreGState(context);
}
/*
-----------------------------------------------------------------------------
@@ -213,8 +206,7 @@
[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:nsContext];
- drawBackgroundAndApplicationIconInCurrentContext(bundle);
- drawAttributedStringInCurrentContext(attrString);
+ drawAttributedStringInContext(ctxt, attrString);
QLThumbnailRequestFlushContext(thumbnail, ctxt);
CGContextRelease(ctxt);
Modified: trunk/QuickLook-Skim/QuickLook-Skim.xcodeproj/project.pbxproj
===================================================================
--- trunk/QuickLook-Skim/QuickLook-Skim.xcodeproj/project.pbxproj
2026-05-24 17:51:47 UTC (rev 16307)
+++ trunk/QuickLook-Skim/QuickLook-Skim.xcodeproj/project.pbxproj
2026-05-24 21:06:24 UTC (rev 16308)
@@ -13,8 +13,6 @@
8D576314048677EA00EA77CD /* CoreFoundation.framework in
Frameworks */ = {isa = PBXBuildFile; fileRef = 0AA1909FFE8422F4C02AAC07 /*
CoreFoundation.framework */; };
8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */ =
{isa = PBXBuildFile; fileRef = 8D5B49A704867FD3000E48DA /* InfoPlist.strings
*/; };
C86B05270671AA6E00DD9006 /* CoreServices.framework in
Frameworks */ = {isa = PBXBuildFile; fileRef = C86B05260671AA6E00DD9006 /*
CoreServices.framework */; };
- CE0D53D52F2975DE00ED4023 /* Skim.png in Resources */ = {isa =
PBXBuildFile; fileRef = CE0D53D42F2975DD00ED4023 /* Skim.png */; };
- CE1B1AC02F282E66003B053C /* Skim_2x.png in Resources */ = {isa
= PBXBuildFile; fileRef = CE1B1ABF2F282E66003B053C /* Skim_2x.png */; };
CE4F80EB0CFB06EE00DBEA14 /* SKQLConverter.h in Headers */ =
{isa = PBXBuildFile; fileRef = CE4F80E90CFB06EE00DBEA14 /* SKQLConverter.h */;
};
CE4F80EC0CFB06EE00DBEA14 /* SKQLConverter.m in Sources */ =
{isa = PBXBuildFile; fileRef = CE4F80EA0CFB06EE00DBEA14 /* SKQLConverter.m */;
};
CE82D0AB0ED347B100020950 /* Ink.png in Resources */ = {isa =
PBXBuildFile; fileRef = CE82D0AA0ED347B100020950 /* Ink.png */; };
@@ -42,10 +40,8 @@
8D576316048677EA00EA77CD /* Skim.qlgenerator */ = {isa =
PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path
= Skim.qlgenerator; sourceTree = BUILT_PRODUCTS_DIR; };
8D576317048677EA00EA77CD /* Info.plist */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path =
Info.plist; sourceTree = "<group>"; };
C86B05260671AA6E00DD9006 /* CoreServices.framework */ = {isa =
PBXFileReference; lastKnownFileType = wrapper.framework; name =
CoreServices.framework; path =
/System/Library/Frameworks/CoreServices.framework; sourceTree = "<absolute>"; };
- CE0D53D42F2975DD00ED4023 /* Skim.png */ = {isa =
PBXFileReference; lastKnownFileType = image.png; path = Skim.png; sourceTree =
"<group>"; };
CE157F3512D4EE6900515B85 /* ja */ = {isa = PBXFileReference;
fileEncoding = 10; lastKnownFileType = text.plist.strings; name = ja; path =
ja.lproj/InfoPlist.strings; sourceTree = "<group>"; };
CE1632CD1582ACE000CFF419 /* zh_CN */ = {isa = PBXFileReference;
fileEncoding = 10; lastKnownFileType = text.plist.strings; name = zh_CN; path =
zh_CN.lproj/InfoPlist.strings; sourceTree = "<group>"; };
- CE1B1ABF2F282E66003B053C /* Skim_2x.png */ = {isa =
PBXFileReference; lastKnownFileType = image.png; path = Skim_2x.png; sourceTree
= "<group>"; };
CE4F80E90CFB06EE00DBEA14 /* SKQLConverter.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
SKQLConverter.h; sourceTree = "<group>"; };
CE4F80EA0CFB06EE00DBEA14 /* SKQLConverter.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= SKQLConverter.m; sourceTree = "<group>"; };
CE82D0AA0ED347B100020950 /* Ink.png */ = {isa =
PBXFileReference; lastKnownFileType = image.png; path = Ink.png; sourceTree =
"<group>"; };
@@ -121,8 +117,6 @@
089C167CFE841241C02AAC07 /* Resources */ = {
isa = PBXGroup;
children = (
- CE0D53D42F2975DD00ED4023 /* Skim.png */,
- CE1B1ABF2F282E66003B053C /* Skim_2x.png */,
CEC7BCDA0CF7639E008CCD63 /* StrikeOut.png */,
CEC7BCDB0CF7639E008CCD63 /* Note.png */,
CEC7BCDC0CF7639E008CCD63 /* Line.png */,
@@ -256,8 +250,6 @@
CEC7BCE90CF763A0008CCD63 /* Highlight.png in
Resources */,
CE861AAE2A0AABE6002FFA1D /* Widget.png in
Resources */,
CE82D0AB0ED347B100020950 /* Ink.png in
Resources */,
- CE1B1AC02F282E66003B053C /* Skim_2x.png in
Resources */,
- CE0D53D52F2975DE00ED4023 /* Skim.png in
Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Deleted: trunk/QuickLook-Skim/Skim.png
===================================================================
(Binary files differ)
Deleted: trunk/QuickLook-Skim/Skim_2x.png
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit