Revision: 2536
http://skim-app.svn.sourceforge.net/skim-app/?rev=2536&view=rev
Author: hofman
Date: 2007-07-19 11:21:15 -0700 (Thu, 19 Jul 2007)
Log Message:
-----------
Check whether CoreGraphics transition functions are defined at run time before
using them.
Modified Paths:
--------------
trunk/SKTransitionController.h
trunk/SKTransitionController.m
Modified: trunk/SKTransitionController.h
===================================================================
--- trunk/SKTransitionController.h 2007-07-19 16:45:29 UTC (rev 2535)
+++ trunk/SKTransitionController.h 2007-07-19 18:21:15 UTC (rev 2536)
@@ -90,6 +90,10 @@
extern OSStatus CGSInvokeTransition(const CGSConnection cid, int
transitionHandle, float duration);
extern OSStatus CGSReleaseTransition(const CGSConnection cid, int
transitionHandle);
+#pragma mark Check whether the above functions are actually defined at run time
+
+extern BOOL CoreGraphicsTransitionsDefined();
+
#pragma mark SKTransitionController
@class CIFilter, CIImage;
@@ -108,15 +112,6 @@
SKWarpFlipTransition = CGSFlip,
// Core Image transitions
SKCoreImageTransition
- /*
- SKCopyMachineTransition,
- SKDisintegrateTransition,
- SKDissolveTransition,
- SKFlashTransition,
- SKModTransition,
- SKPageCurlTransition,
- SKRippleTransition,
- SKSwipeTransition*/
} SKAnimationTransitionStyle;
@class SKTransitionView;
Modified: trunk/SKTransitionController.m
===================================================================
--- trunk/SKTransitionController.m 2007-07-19 16:45:29 UTC (rev 2535)
+++ trunk/SKTransitionController.m 2007-07-19 18:21:15 UTC (rev 2536)
@@ -49,6 +49,12 @@
#import <OpenGL/gl.h>
#import "SKFullScreenWindow.h"
+BOOL CoreGraphicsTransitionsDefined() {
+ return &_CGSDefaultConnection != kUnresolvedCFragSymbolAddress &&
+ &CGSNewTransition != kUnresolvedCFragSymbolAddress &&
+ &CGSInvokeTransition != kUnresolvedCFragSymbolAddress &&
+ &CGSReleaseTransition != kUnresolvedCFragSymbolAddress;
+}
@interface SKTransitionAnimation : NSAnimation {
CIFilter *filter;
@@ -201,8 +207,10 @@
if (transitionStyle == SKNoTransition) {
} else if (transitionStyle < SKCoreImageTransition) {
- // We don't want the window to draw the next state before the
animation is run
- [[view window] disableFlushWindow];
+ if (CoreGraphicsTransitionsDefined()) {
+ // We don't want the window to draw the next state before the
animation is run
+ [[view window] disableFlushWindow];
+ }
} else {
NSRect bounds = [view bounds];
[initialImage release];
@@ -221,37 +229,37 @@
if (transitionStyle == SKNoTransition) {
} else if (transitionStyle < SKCoreImageTransition) {
-
- // declare our variables
- int handle = -1;
- CGSTransitionSpec spec;
-
- // specify our specifications
- spec.unknown1 = 0;
- spec.type = transitionStyle;
- spec.option = direction;
- spec.backColour = NULL;
- spec.wid = [[view window] windowNumber];
-
- // Let's get a connection
- CGSConnection cgs = _CGSDefaultConnection();
-
- // Create a transition
- CGSNewTransition(cgs, &spec, &handle);
-
- // Redraw the window
- [[view window] display];
- // Remember we disabled flushing in the previous method, we need to
balance that.
- [[view window] enableFlushWindow];
- [[view window] flushWindow];
-
- CGSInvokeTransition(cgs, handle, duration);
- // We need to wait for the transition to finish before we get rid of
it, otherwise we'll get all sorts of nasty errors... or maybe not.
- usleep((useconds_t)(duration * 1000000));
-
- CGSReleaseTransition(cgs, handle);
- handle = 0;
-
+ if (CoreGraphicsTransitionsDefined()) {
+ // declare our variables
+ int handle = -1;
+ CGSTransitionSpec spec;
+
+ // specify our specifications
+ spec.unknown1 = 0;
+ spec.type = transitionStyle;
+ spec.option = direction;
+ spec.backColour = NULL;
+ spec.wid = [[view window] windowNumber];
+
+ // Let's get a connection
+ CGSConnection cgs = _CGSDefaultConnection();
+
+ // Create a transition
+ CGSNewTransition(cgs, &spec, &handle);
+
+ // Redraw the window
+ [[view window] display];
+ // Remember we disabled flushing in the previous method, we need
to balance that.
+ [[view window] enableFlushWindow];
+ [[view window] flushWindow];
+
+ CGSInvokeTransition(cgs, handle, duration);
+ // We need to wait for the transition to finish before we get rid
of it, otherwise we'll get all sorts of nasty errors... or maybe not.
+ usleep((useconds_t)(duration * 1000000));
+
+ CGSReleaseTransition(cgs, handle);
+ handle = 0;
+ }
} else {
if (initialImage == nil)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit