Revision: 16306
http://sourceforge.net/p/skim-app/code/16306
Author: hofman
Date: 2026-05-24 16:32:34 +0000 (Sun, 24 May 2026)
Log Message:
-----------
Don't bother drawing app icon in ql thumbnails, others also don't do that
Modified Paths:
--------------
trunk/Skim.xcodeproj/project.pbxproj
trunk/SkimQuickLookThumbnails/SKThumbnailProvider.m
Removed Paths:
-------------
trunk/SkimQuickLookThumbnails/Skim.png
trunk/SkimQuickLookThumbnails/Skim_2x.png
Modified: trunk/Skim.xcodeproj/project.pbxproj
===================================================================
--- trunk/Skim.xcodeproj/project.pbxproj 2026-05-24 14:48:18 UTC (rev
16305)
+++ trunk/Skim.xcodeproj/project.pbxproj 2026-05-24 16:32:34 UTC (rev
16306)
@@ -258,8 +258,6 @@
CED2D33A2FC108210044A3DC /* Highlight.png in Resources */ =
{isa = PBXBuildFile; fileRef = CED2D32E2FC108200044A3DC /* Highlight.png */; };
CED2D33B2FC108210044A3DC /* Note.png in Resources */ = {isa =
PBXBuildFile; fileRef = CED2D32F2FC108200044A3DC /* Note.png */; };
CED2D33C2FC108210044A3DC /* StrikeOut.png in Resources */ =
{isa = PBXBuildFile; fileRef = CED2D3302FC108200044A3DC /* StrikeOut.png */; };
- CED2D33D2FC108210044A3DC /* Skim_2x.png in Resources */ = {isa
= PBXBuildFile; fileRef = CED2D3312FC108210044A3DC /* Skim_2x.png */; };
- CED2D33E2FC108210044A3DC /* Skim.png in Resources */ = {isa =
PBXBuildFile; fileRef = CED2D3322FC108210044A3DC /* Skim.png */; };
CED2D3462FC10BA80044A3DC /* Quartz.framework in Frameworks */ =
{isa = PBXBuildFile; fileRef = CED2D2FB2FC0FDF70044A3DC /* Quartz.framework */;
};
CED2D34D2FC10BA80044A3DC /* SKPreviewProvider.m in Sources */ =
{isa = PBXBuildFile; fileRef = CED2D34C2FC10BA80044A3DC /* SKPreviewProvider.m
*/; };
CED2D3552FC10BA80044A3DC /* SkimQuickLookPreview.appex in
CopyFiles */ = {isa = PBXBuildFile; fileRef = CED2D3452FC10BA80044A3DC /*
SkimQuickLookPreview.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy,
); }; };
@@ -1238,8 +1236,6 @@
CED2D32E2FC108200044A3DC /* Highlight.png */ = {isa =
PBXFileReference; lastKnownFileType = image.png; path = Highlight.png;
sourceTree = "<group>"; };
CED2D32F2FC108200044A3DC /* Note.png */ = {isa =
PBXFileReference; lastKnownFileType = image.png; path = Note.png; sourceTree =
"<group>"; };
CED2D3302FC108200044A3DC /* StrikeOut.png */ = {isa =
PBXFileReference; lastKnownFileType = image.png; path = StrikeOut.png;
sourceTree = "<group>"; };
- CED2D3312FC108210044A3DC /* Skim_2x.png */ = {isa =
PBXFileReference; lastKnownFileType = image.png; path = Skim_2x.png; sourceTree
= "<group>"; };
- CED2D3322FC108210044A3DC /* Skim.png */ = {isa =
PBXFileReference; lastKnownFileType = image.png; path = Skim.png; sourceTree =
"<group>"; };
CED2D3402FC1092D0044A3DC /* SkimQuickLookThumbnails.xcconfig */
= {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path =
SkimQuickLookThumbnails.xcconfig; sourceTree = "<group>"; };
CED2D3452FC10BA80044A3DC /* SkimQuickLookPreview.appex */ =
{isa = PBXFileReference; explicitFileType = "wrapper.app-extension";
includeInIndex = 0; path = SkimQuickLookPreview.appex; sourceTree =
BUILT_PRODUCTS_DIR; };
CED2D34B2FC10BA80044A3DC /* SKPreviewProvider.h */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.c.h; path =
SKPreviewProvider.h; sourceTree = "<group>"; };
@@ -2232,8 +2228,6 @@
CED2D3262FC107C80044A3DC /* Resources */ = {
isa = PBXGroup;
children = (
- CED2D3322FC108210044A3DC /* Skim.png */,
- CED2D3312FC108210044A3DC /* Skim_2x.png */,
CED2D3302FC108200044A3DC /* StrikeOut.png */,
CED2D32F2FC108200044A3DC /* Note.png */,
CED2D32B2FC108200044A3DC /* Line.png */,
@@ -2904,7 +2898,6 @@
CED2D33B2FC108210044A3DC /* Note.png in
Resources */,
CED2D33A2FC108210044A3DC /* Highlight.png in
Resources */,
CED2D3352FC108210044A3DC /* Ink.png in
Resources */,
- CED2D33E2FC108210044A3DC /* Skim.png in
Resources */,
CED2D3342FC108210044A3DC /* FreeText.png in
Resources */,
CED2D33C2FC108210044A3DC /* StrikeOut.png in
Resources */,
CED2D3372FC108210044A3DC /* Line.png in
Resources */,
@@ -2912,7 +2905,6 @@
CED2D3382FC108210044A3DC /* Square.png in
Resources */,
CED2D3362FC108210044A3DC /* Circle.png in
Resources */,
CED2D3392FC108210044A3DC /* Widget.png in
Resources */,
- CED2D33D2FC108210044A3DC /* Skim_2x.png in
Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: trunk/SkimQuickLookThumbnails/SKThumbnailProvider.m
===================================================================
--- trunk/SkimQuickLookThumbnails/SKThumbnailProvider.m 2026-05-24 14:48:18 UTC
(rev 16305)
+++ trunk/SkimQuickLookThumbnails/SKThumbnailProvider.m 2026-05-24 16:32:34 UTC
(rev 16306)
@@ -47,22 +47,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()
-{
- [[NSColor whiteColor] setFill];
- NSRect pageRect = { NSZeroPoint, _paperSize };
- NSRectFillUsingOperation(pageRect, NSCompositingOperationSourceOver);
- BOOL isHR =
CGContextGetUserSpaceToDeviceSpaceTransform([[NSGraphicsContext currentContext]
CGContext]).a > 1.0;
-
- NSURL *iconURL = [[NSBundle mainBundle] URLForImageResource:isHR ?
@"Skim_2x" : @"Skim"];
- 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()
{
@@ -69,7 +54,7 @@
NSTextStorage *textStorage = [[NSTextStorage alloc] init];
NSLayoutManager *lm = [[NSLayoutManager alloc] init];
NSTextContainer *tc = [[NSTextContainer alloc] init];
- [tc setContainerSize:NSMakeSize(_containerSize.width,
_containerSize.height)];
+ [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];
@@ -80,11 +65,8 @@
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];
-
NSTextStorage *textStorage = createTextStorage();
[textStorage beginEditing];
[textStorage setAttributedString:attrString];
@@ -93,12 +75,14 @@
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);
+ CGFloat scale = CGContextGetClipBoundingBox(context).size.height /
_paperSize.height;
+ CGAffineTransform s1 = CGAffineTransformMakeScale(scale, scale);
+ CGAffineTransform t = CGAffineTransformMakeTranslation(_horizontalMargin,
_paperSize.height - _verticalMargin);
+ CGAffineTransform s2 = CGAffineTransformMakeScale(1, -1);
+ CGAffineTransform pageTransform = CGAffineTransformConcat(s2,
CGAffineTransformConcat(t, s1));
+ CGContextConcatCTM(context, pageTransform);
// objectAtIndex:0 is safe, since we added these to the text storage (so
there's at least one)
NSLayoutManager *lm = [[textStorage layoutManagers] objectAtIndex:0];
@@ -112,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
graphicsContextWithCGContext:context flipped:YES];
+ [NSGraphicsContext saveGraphicsState];
+ [NSGraphicsContext setCurrentContext:nsContext];
+
[lm drawBackgroundForGlyphRange:glyphRange atPoint:usedRect.origin];
[lm drawGlyphsForGlyphRange:glyphRange atPoint:usedRect.origin];
+
+ [NSGraphicsContext restoreGraphicsState];
}
- CGContextRestoreGState(ctxt);
+ CGContextRestoreGState(context);
}
@implementation SKThumbnailProvider
@@ -188,18 +178,7 @@
NSAttributedString *attrString = [SKQLConverter
attributedStringWithNotes:notes];
if (attrString) {
- CGFloat scale =
CGContextGetClipBoundingBox(context).size.height / _paperSize.height;
- CGContextScaleCTM(context, scale, scale);
-
- NSGraphicsContext *nsContext = [NSGraphicsContext
graphicsContextWithCGContext:context flipped:YES];
- [NSGraphicsContext saveGraphicsState];
- [NSGraphicsContext setCurrentContext:nsContext];
-
- drawBackgroundAndApplicationIconInCurrentContext();
- drawAttributedStringInCurrentContext(attrString);
-
- [NSGraphicsContext restoreGraphicsState];
-
+ drawAttributedStringInContext(context, attrString);
didGenerate = YES;
}
}
Deleted: trunk/SkimQuickLookThumbnails/Skim.png
===================================================================
(Binary files differ)
Deleted: trunk/SkimQuickLookThumbnails/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