Revision: 13721
http://sourceforge.net/p/skim-app/code/13721
Author: hofman
Date: 2023-11-02 15:18:31 +0000 (Thu, 02 Nov 2023)
Log Message:
-----------
Metal frameworks are now always available. No need for OpenGL.
Modified Paths:
--------------
trunk/SKTransitionController.m
trunk/Skim.xcodeproj/project.pbxproj
Modified: trunk/SKTransitionController.m
===================================================================
--- trunk/SKTransitionController.m 2023-11-02 15:14:20 UTC (rev 13720)
+++ trunk/SKTransitionController.m 2023-11-02 15:18:31 UTC (rev 13721)
@@ -47,8 +47,6 @@
#import "SKStringConstants.h"
#import "NSGraphics_SKExtensions.h"
#import <Quartz/Quartz.h>
-#import <OpenGL/OpenGL.h>
-#import <OpenGL/gl.h>
#import <Metal/Metal.h>
#import <MetalKit/MetalKit.h>
@@ -130,17 +128,6 @@
#pragma mark -
-@interface SKOpenGLTransitionView : NSOpenGLView <SKTransitionView> {
- CIImage *image;
- CGRect extent;
- CIFilter *filter;
- CIContext *context;
- BOOL needsReshape;
-}
-@end
-
-#pragma mark -
-
@interface SKMetalTransitionView : NSView <SKTransitionView, MTKViewDelegate> {
MTKView *metalView;
CIImage *image;
@@ -399,10 +386,7 @@
- (void)showTransitionViewForRect:(NSRect)rect image:(CIImage *)image
extent:(CGRect)extent {
if (transitionView == nil) {
- if ([MTKView class])
- transitionView = [[SKMetalTransitionView alloc] init];
- else
- transitionView = [[SKOpenGLTransitionView alloc] init];
+ transitionView = [[SKMetalTransitionView alloc] init];
[transitionView setAutoresizingMask:NSViewWidthSizable |
NSViewHeightSizable];
CAAnimation *animation = [CABasicAnimation animation];
[animation setTimingFunction:[CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
@@ -613,126 +597,6 @@
#pragma mark -
-@implementation SKOpenGLTransitionView
-
-@synthesize image, extent, filter;
-@dynamic progress;
-
-+ (NSOpenGLPixelFormat *)defaultPixelFormat {
- static NSOpenGLPixelFormat *pf;
-
- if (pf == nil) {
- NSOpenGLPixelFormatAttribute attr[] = {
- NSOpenGLPFAAccelerated,
- NSOpenGLPFANoRecovery,
- NSOpenGLPFAColorSize,
- 32,
- 0
- };
-
- pf = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr];
- }
-
- return pf;
-}
-
-- (id)init {
- self = [super init];
- if (self) {
- [self setWantsBestResolutionOpenGLSurface:YES];
- }
- return self;
-}
-
-- (void)dealloc {
- SKDESTROY(image);
- SKDESTROY(filter);
- SKDESTROY(context);
- [super dealloc];
-}
-
-- (CGFloat)progress {
- NSNumber *number = [filter valueForKey:kCIInputTimeKey];
- return number ? [number doubleValue] : 0.0;
-}
-
-- (void)setProgress:(CGFloat)newProgress {
- if (filter) {
- [filter setValue:[NSNumber numberWithDouble:newProgress]
forKey:kCIInputTimeKey];
- [self setImage:[filter outputImage]];
- [self setNeedsDisplay:YES];
- }
-}
-
-- (void)reshape {
- [super reshape];
- needsReshape = YES;
-}
-
-- (void)prepareOpenGL {
- [super prepareOpenGL];
-
- // Enable beam-synced updates.
- GLint parm = 1;
- [[self openGLContext] setValues:&parm forParameter:NSOpenGLCPSwapInterval];
-
- // Make sure that everything we don't need is disabled.
- // Some of these are enabled by default and can slow down rendering.
-
- glDisable(GL_ALPHA_TEST);
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_SCISSOR_TEST);
- glDisable(GL_BLEND);
- glDisable(GL_DITHER);
- glDisable(GL_CULL_FACE);
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- glDepthMask(GL_FALSE);
- glStencilMask(0);
- glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
- glHint(GL_TRANSFORM_HINT_APPLE, GL_FASTEST);
-
- needsReshape = YES;
-}
-
-- (void)drawRect:(NSRect)dirtyRect {
- NSRect bounds = [self bounds];
- CGRect rect = NSRectToCGRect([self wantsBestResolutionOpenGLSurface] ?
[self convertRectToBacking:bounds] : bounds);
-
- [[self openGLContext] makeCurrentContext];
-
- if (needsReshape) {
- [[self openGLContext] update];
-
- glViewport(0, 0, (GLint)CGRectGetWidth(rect),
(GLint)CGRectGetHeight(rect));
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(CGRectGetMinX(rect), CGRectGetMaxX(rect), CGRectGetMinY(rect),
CGRectGetMaxY(rect), -1, 1);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- needsReshape = NO;
- }
-
- glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT);
-
- if (image) {
- if (context == nil) {
- NSOpenGLPixelFormat *pf = [self pixelFormat] ?: [[self class]
defaultPixelFormat];
- context = [[CIContext contextWithCGLContext:[[self openGLContext]
CGLContextObj] pixelFormat:[pf CGLPixelFormatObj] colorSpace:nil options:nil]
retain];
- }
- [context drawImage:image inRect:rect fromRect:extent];
- }
-
- glFlush();
-}
-
-@end
-
-#pragma mark -
-
@implementation SKMetalTransitionView
@synthesize image, extent, filter;
Modified: trunk/Skim.xcodeproj/project.pbxproj
===================================================================
--- trunk/Skim.xcodeproj/project.pbxproj 2023-11-02 15:14:20 UTC (rev
13720)
+++ trunk/Skim.xcodeproj/project.pbxproj 2023-11-02 15:18:31 UTC (rev
13721)
@@ -210,8 +210,8 @@
CE8BF02A115F7C5C0029020F /* SKRightSideViewController.m in
Sources */ = {isa = PBXBuildFile; fileRef = CE8BF029115F7C5C0029020F /*
SKRightSideViewController.m */; };
CE8BF069115F859A0029020F /* LeftSideView.xib in Resources */ =
{isa = PBXBuildFile; fileRef = CE8BF068115F859A0029020F /* LeftSideView.xib */;
};
CE8BF070115F892A0029020F /* RightSideView.xib in Resources */ =
{isa = PBXBuildFile; fileRef = CE8BF06F115F892A0029020F /* RightSideView.xib
*/; };
- CE8DC47024620A7E00BD5D50 /* MetalKit.framework in Frameworks */
= {isa = PBXBuildFile; fileRef = CE8DC45E24620A7E00BD5D50 /* MetalKit.framework
*/; settings = {ATTRIBUTES = (Weak, ); }; };
- CE8DC47124620A7E00BD5D50 /* Metal.framework in Frameworks */ =
{isa = PBXBuildFile; fileRef = CE8DC46F24620A7E00BD5D50 /* Metal.framework */;
settings = {ATTRIBUTES = (Weak, ); }; };
+ CE8DC47024620A7E00BD5D50 /* MetalKit.framework in Frameworks */
= {isa = PBXBuildFile; fileRef = CE8DC45E24620A7E00BD5D50 /* MetalKit.framework
*/; settings = {ATTRIBUTES = (Required, ); }; };
+ CE8DC47124620A7E00BD5D50 /* Metal.framework in Frameworks */ =
{isa = PBXBuildFile; fileRef = CE8DC46F24620A7E00BD5D50 /* Metal.framework */;
settings = {ATTRIBUTES = (Required, ); }; };
CE8DEF0820D2702A00A10FFE /* NSDate_SKExtensions.m in Sources */
= {isa = PBXBuildFile; fileRef = CE8DEF0720D2702A00A10FFE /*
NSDate_SKExtensions.m */; };
CE91C7962449F56600D04039 /* SKFileShare.m in Sources */ = {isa
= PBXBuildFile; fileRef = CE91C7952449F56600D04039 /* SKFileShare.m */; };
CE94D17B125535DE0053A520 /* synctex_parser_utils.m in Sources
*/ = {isa = PBXBuildFile; fileRef = CE94D17A125535DE0053A520 /*
synctex_parser_utils.m */; };
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