Fix bugs that degraded Quick Look quality

This commit is contained in:
Lior Halphon
2024-12-07 20:02:00 +02:00
parent b5761c29d5
commit 1d5cb77464
2 changed files with 3 additions and 2 deletions

View File

@@ -12,8 +12,8 @@ extern OSStatus GBQuickLookRender(CGContextRef cgContext, CFURLRef url, bool sho
{
CGSize size = {64, 64};
CGSize maximumSize = request.maximumSize;
while (size.width < maximumSize.width / 2 &&
size.width < maximumSize.height / 2) {
while (size.width <= maximumSize.width / 2 &&
size.width <= maximumSize.height / 2) {
size.width *= 2;
}
size.height = size.width;

View File

@@ -83,6 +83,7 @@ OSStatus GBQuickLookRender(CGContextRef cgContext, CFURLRef url, bool showBorder
effectiveTemplate = template;
}
CGContextSetInterpolationQuality(cgContext, kCGInterpolationMedium);
/* Mask it with the template (The middle part of the template image is transparent) */
[effectiveTemplate drawInRect:(NSRect){{0, 0}, {CGBitmapContextGetWidth(cgContext), CGBitmapContextGetHeight(cgContext)}}];
}