Revision: 14334
http://sourceforge.net/p/skim-app/code/14334
Author: hofman
Date: 2024-06-12 14:42:19 +0000 (Wed, 12 Jun 2024)
Log Message:
-----------
No need for translation or local variable
Modified Paths:
--------------
trunk/SKSnapshotConfiguration.m
Modified: trunk/SKSnapshotConfiguration.m
===================================================================
--- trunk/SKSnapshotConfiguration.m 2024-06-11 16:25:14 UTC (rev 14333)
+++ trunk/SKSnapshotConfiguration.m 2024-06-12 14:42:19 UTC (rev 14334)
@@ -66,9 +66,8 @@
}
- (NSBitmapImageRep *)bitmapImageRepWithSize:(CGFloat)aSize
scale:(CGFloat)scale {
- NSRect bounds = (NSRect){NSZeroPoint, size};
NSAffineTransform *transform = [NSAffineTransform transform];
- NSSize thumbnailSize = bounds.size;
+ NSSize thumbnailSize = size;
CGFloat shadowBlurRadius = 0.0;
CGFloat shadowOffset = 0.0;
NSBitmapImageRep *imageRep;
@@ -76,30 +75,28 @@
if (aSize > 0.0) {
shadowBlurRadius = round(scale * aSize / 32.0) / scale;
shadowOffset = -ceil(scale * shadowBlurRadius * 0.75) / scale;
- if (NSHeight(bounds) > NSWidth(bounds))
- thumbnailSize = NSMakeSize(round((aSize - 2.0 * shadowBlurRadius)
* NSWidth(bounds) / NSHeight(bounds) + 2.0 * shadowBlurRadius), aSize);
+ if (size.height > size.width)
+ thumbnailSize = NSMakeSize(round((aSize - 2.0 * shadowBlurRadius)
* size.width / size.height + 2.0 * shadowBlurRadius), aSize);
else
- thumbnailSize = NSMakeSize(aSize, round((aSize - 2.0 *
shadowBlurRadius) * NSHeight(bounds) / NSWidth(bounds) + 2.0 *
shadowBlurRadius));
+ thumbnailSize = NSMakeSize(aSize, round((aSize - 2.0 *
shadowBlurRadius) * size.height / size.width + 2.0 * shadowBlurRadius));
[transform translateXBy:shadowBlurRadius yBy:shadowBlurRadius -
shadowOffset];
- [transform scaleXBy:(thumbnailSize.width - 2.0 * shadowBlurRadius) /
NSWidth(bounds) yBy:(thumbnailSize.height - 2.0 * shadowBlurRadius) /
NSHeight(bounds)];
+ [transform scaleXBy:(thumbnailSize.width - 2.0 * shadowBlurRadius) /
size.width yBy:(thumbnailSize.height - 2.0 * shadowBlurRadius) / size.height];
}
- if (NSEqualPoints(bounds.origin, NSZeroPoint) == NO)
- [transform translateXBy:-NSMinX(bounds) yBy:-NSMinY(bounds)];
-
imageRep = [NSBitmapImageRep imageRepWithSize:thumbnailSize scale:scale
drawingHandler:^(NSRect dstRect){
[[NSGraphicsContext currentContext]
setImageInterpolation:NSImageInterpolationHigh];
- [transform concat];
+ if (aSize > 0.0)
+ [transform concat];
[NSGraphicsContext saveGraphicsState];
[[NSColor whiteColor] set];
if (shadowBlurRadius > 0.0)
[NSShadow setShadowWithWhite:0.0 alpha:0.3
blurRadius:shadowBlurRadius yOffset:shadowOffset];
- NSRectFill(bounds);
+ NSRectFill((NSRect){NSZeroPoint, size});
[[NSGraphicsContext currentContext]
setImageInterpolation:NSImageInterpolationDefault];
[NSGraphicsContext restoreGraphicsState];
- [[NSBezierPath bezierPathWithRect:bounds] addClip];
+ [[NSBezierPath bezierPathWithRect:(NSRect){NSZeroPoint, size}]
addClip];
CGContextRef context = [[NSGraphicsContext currentContext] CGContext];
CGContextSetInterpolationQuality(context, interpolationQuality + 1);
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