From 489a2f92a1b9de77fffcd40f554c2ee13bc77b20 Mon Sep 17 00:00:00 2001 From: Eric Heien Date: Thu, 5 Jun 2003 20:44:41 +0000 Subject: [PATCH] remove unneeded files svn path=/trunk/boinc/; revision=1308 --- api/mac_carbon_dsp.c | 176 ------------------------------------------ api/mac_carbon_dsp.h | 74 ------------------ api/mac_carbon_gl.cpp | 142 +++++++++++++++++++++++++++++++++- api/mac_carbon_gl.h | 18 +++++ 4 files changed, 159 insertions(+), 251 deletions(-) delete mode 100755 api/mac_carbon_dsp.c delete mode 100755 api/mac_carbon_dsp.h diff --git a/api/mac_carbon_dsp.c b/api/mac_carbon_dsp.c deleted file mode 100755 index c5fc7da96d..0000000000 --- a/api/mac_carbon_dsp.c +++ /dev/null @@ -1,176 +0,0 @@ -// The contents of this file are subject to the Mozilla Public License -// Version 1.0 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.mozilla.org/MPL/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations -// under the License. -// -// The Original Code is the Berkeley Open Infrastructure for Network Computing. -// -// The Initial Developer of the Original Code is the SETI@home project. -// Portions created by the SETI@home project are Copyright (C) 2002 -// University of California at Berkeley. All Rights Reserved. -// -// Contributor(s): -// - -/* - Contains: Functions to enable building and destroying a DSp fullscreen context - - Written by: Geoff Stahl (ggs) - - Copyright: Copyright © 1999 Apple Computer, Inc., All Rights Reserved - - Disclaimer: You may incorporate this sample code into your applications without - restriction, though the sample code has been provided "AS IS" and the - responsibility for its operation is 100% yours. However, what you are - not permitted to do is to redistribute the source as "DSC Sample Code" - after having made changes. If you're going to re-distribute the source, - we require that you make it clear in the source that the code was - descended from Apple Sample Code, but that you've made changes. - - Adapted to BOINC by Eric Heien -*/ - -// project includes --------------------------------------------------------- - -#include "mac_carbon_dsp.h" - -// globals (internal/private) ----------------------------------------------- - -Boolean gDSpStarted = false; // will never be true unless DSp is installed and start succeeds - -// functions (public) ------------------------------------------------------- -// StartDSp -// handles starting up DrawSprocket - -OSStatus StartDSp (void) -{ - OSStatus err = noErr; - if (!gDSpStarted) { - // check for DSp - if ((Ptr) kUnresolvedCFragSymbolAddress == (Ptr) DSpStartup) { - ReportError ("DSp not installed"); - return kDSpNotInitializedErr; - } else { - err = DSpReportError (DSpStartup()); // start DSp - if (noErr != err) - return err; - else - gDSpStarted = true; - } - } - return err; -} - -// -------------------------------------------------------------------------- -// ShutdownDSpContext -// shuts down DrawSprocket - -void ShutdownDSp (void) -{ - if (gDSpStarted) { - DSpShutdown (); - gDSpStarted = false; - } -} - -#pragma mark - -// -------------------------------------------------------------------------- -// GetDSpDrawable -// Just returns the front buffer -// Inputs: *pdspContext -// pcontextInfo: request and requirements for cotext and drawable -// Outputs: returns CGrafPtr thaat is front buffer of context -// if error: will return NULL - -CGrafPtr GetDSpDrawable (DSpContextReference dspContext) -{ - CGrafPtr pCGraf = NULL; - if (noErr == DSpReportError (DSpContext_GetFrontBuffer (dspContext, &pCGraf))) - return pCGraf; - else - return NULL; -} - -//----------------------------------------------------------------------------------------------------------------------- - -// Deactivates and dumps context - -void DestroyDSpContext (DSpContextReference* pdspContext) -{ - if (gDSpStarted) { - if (*pdspContext) { - DSpReportError (DSpContext_SetState(*pdspContext, kDSpContextState_Inactive)); - DSpReportError (DSpContext_CustomFadeGammaIn (NULL, fadeTicks)); - DSpReportError (DSpContext_Release (*pdspContext)); - *pdspContext = NULL; - } - } -} - -#pragma mark - -//----------------------------------------------------------------------------------------------------------------------- - -OSStatus DSpContext_CustomFadeGammaIn (DSpContextReference inContext, long fadeTicks) -{ - OSStatus err = noErr; - RGBColor inZeroIntensityColor; - UInt32 currTick; - UInt16 step = (UInt16) (800 / fadeTicks); - long x, percent = 0; - - if (gDSpStarted) - { - if (fadeTicks == 0) - fadeTicks = 1; - inZeroIntensityColor.red = 0x0000; - inZeroIntensityColor.green = 0x0000; - inZeroIntensityColor.blue = 0x0000; - currTick = TickCount (); - for (x = 1; x <= fadeTicks; x++) - { - percent = step * x / 8; - err = DSpContext_FadeGamma(inContext, percent, &inZeroIntensityColor); - if (err != noErr) break; - while (currTick >= TickCount ()) {} - currTick = TickCount (); - } - if (err == noErr) - err = DSpContext_FadeGamma(inContext, 100, &inZeroIntensityColor); - } - return err; -} - -//----------------------------------------------------------------------------------------------------------------------- - -OSStatus DSpContext_CustomFadeGammaOut (DSpContextReference inContext, long fadeTicks ) -{ - OSStatus err = noErr; - RGBColor inZeroIntensityColor; - UInt32 currTick; - UInt16 step = (UInt16) (800 / fadeTicks); - long x, percent = 0; - - if (gDSpStarted) - { - if (fadeTicks == 0) - fadeTicks = 1; // ensure we do not have zero fade time - inZeroIntensityColor.red = 0x0000; - inZeroIntensityColor.green = 0x0000; - inZeroIntensityColor.blue = 0x0000; - currTick = TickCount (); - for (x = fadeTicks - 1; x >= 0; x--) - { - percent = step * x / 8; - err = DSpContext_FadeGamma(inContext, percent, &inZeroIntensityColor); - if (err != noErr) break; - while (currTick >= TickCount ()) {} - currTick = TickCount (); - } - } - return err; -} diff --git a/api/mac_carbon_dsp.h b/api/mac_carbon_dsp.h deleted file mode 100755 index acae861e72..0000000000 --- a/api/mac_carbon_dsp.h +++ /dev/null @@ -1,74 +0,0 @@ -// The contents of this file are subject to the Mozilla Public License -// Version 1.0 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.mozilla.org/MPL/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations -// under the License. -// -// The Original Code is the Berkeley Open Infrastructure for Network Computing. -// -// The Initial Developer of the Original Code is the SETI@home project. -// Portions created by the SETI@home project are Copyright (C) 2002 -// University of California at Berkeley. All Rights Reserved. -// -// Contributor(s): -// - -/* - Contains: Functions to enable building and destorying a DSp fullscreen context - - Written by: Geoff Stahl (ggs) - - Copyright: Copyright © 1999 Apple Computer, Inc., All Rights Reserved - - Change History (most recent first): - - Disclaimer: You may incorporate this sample code into your applications without - restriction, though the sample code has been provided "AS IS" and the - responsibility for its operation is 100% yours. However, what you are - not permitted to do is to redistribute the source as "DSC Sample Code" - after having made changes. If you're going to re-distribute the source, - we require that you make it clear in the source that the code was - descended from Apple Sample Code, but that you've made changes. - - Adapted to BOINC by Eric Heien -*/ - -// include control -------------------------------------------------- - -#ifndef SetupDSp_h -#define SetupDSp_h - -// includes --------------------------------------------------------- - -#include "mac_carbon_gl.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// structures (public) ----------------------------------------------- - -enum { fadeTicks = 10 }; - -// public function declarations ------------------------------------- - -OSStatus StartDSp (void); -void ShutdownDSp (void); - -CGrafPtr GetDSpDrawable (DSpContextReference dspContext); -void DestroyDSpContext (DSpContextReference* pdspContext); - -OSStatus DSpContext_CustomFadeGammaOut (DSpContextReference inContext, long fadeTicks); -OSStatus DSpContext_CustomFadeGammaIn (DSpContextReference inContext, long fadeTicks); - -extern Boolean gDSpStarted; - -#ifdef __cplusplus -} -#endif - -#endif // SetupDSp_h diff --git a/api/mac_carbon_gl.cpp b/api/mac_carbon_gl.cpp index 267f460264..a0d436f826 100755 --- a/api/mac_carbon_gl.cpp +++ b/api/mac_carbon_gl.cpp @@ -54,7 +54,6 @@ // project includes --------------------------------------------------------- -#include "mac_carbon_dsp.h" #include "mac_carbon_gl.h" #include "graphics_api.h" #include "mac_app_opengl.h" @@ -398,3 +397,144 @@ void DoUpdate (AGLContext aglContext) aglSwapBuffers(aglContext); // send swap command } } + +/* + Contains: Functions to enable building and destroying a DSp fullscreen context + +*/ + +// globals (internal/private) ----------------------------------------------- + +Boolean gDSpStarted = false; // will never be true unless DSp is installed and start succeeds + +// functions (public) ------------------------------------------------------- +// StartDSp +// handles starting up DrawSprocket + +OSStatus StartDSp (void) +{ + OSStatus err = noErr; + if (!gDSpStarted) { + // check for DSp + if ((Ptr) kUnresolvedCFragSymbolAddress == (Ptr) DSpStartup) { + ReportError ("DSp not installed"); + return kDSpNotInitializedErr; + } else { + err = DSpReportError (DSpStartup()); // start DSp + if (noErr != err) + return err; + else + gDSpStarted = true; + } + } + return err; +} + +// -------------------------------------------------------------------------- +// ShutdownDSpContext +// shuts down DrawSprocket + +void ShutdownDSp (void) +{ + if (gDSpStarted) { + DSpShutdown (); + gDSpStarted = false; + } +} + +#pragma mark - +// -------------------------------------------------------------------------- +// GetDSpDrawable +// Just returns the front buffer +// Inputs: *pdspContext +// pcontextInfo: request and requirements for cotext and drawable +// Outputs: returns CGrafPtr thaat is front buffer of context +// if error: will return NULL + +CGrafPtr GetDSpDrawable (DSpContextReference dspContext) +{ + CGrafPtr pCGraf = NULL; + if (noErr == DSpReportError (DSpContext_GetFrontBuffer (dspContext, &pCGraf))) + return pCGraf; + else + return NULL; +} + +//----------------------------------------------------------------------------------------------------------------------- + +// Deactivates and dumps context + +void DestroyDSpContext (DSpContextReference* pdspContext) +{ + if (gDSpStarted) { + if (*pdspContext) { + DSpReportError (DSpContext_SetState(*pdspContext, kDSpContextState_Inactive)); + DSpReportError (DSpContext_CustomFadeGammaIn (NULL, fadeTicks)); + DSpReportError (DSpContext_Release (*pdspContext)); + *pdspContext = NULL; + } + } +} + +#pragma mark - +//----------------------------------------------------------------------------------------------------------------------- + +OSStatus DSpContext_CustomFadeGammaIn (DSpContextReference inContext, long fadeTicks) +{ + OSStatus err = noErr; + RGBColor inZeroIntensityColor; + UInt32 currTick; + UInt16 step = (UInt16) (800 / fadeTicks); + long x, percent = 0; + + if (gDSpStarted) + { + if (fadeTicks == 0) + fadeTicks = 1; + inZeroIntensityColor.red = 0x0000; + inZeroIntensityColor.green = 0x0000; + inZeroIntensityColor.blue = 0x0000; + currTick = TickCount (); + for (x = 1; x <= fadeTicks; x++) + { + percent = step * x / 8; + err = DSpContext_FadeGamma(inContext, percent, &inZeroIntensityColor); + if (err != noErr) break; + while (currTick >= TickCount ()) {} + currTick = TickCount (); + } + if (err == noErr) + err = DSpContext_FadeGamma(inContext, 100, &inZeroIntensityColor); + } + return err; +} + +//----------------------------------------------------------------------------------------------------------------------- + +OSStatus DSpContext_CustomFadeGammaOut (DSpContextReference inContext, long fadeTicks ) +{ + OSStatus err = noErr; + RGBColor inZeroIntensityColor; + UInt32 currTick; + UInt16 step = (UInt16) (800 / fadeTicks); + long x, percent = 0; + + if (gDSpStarted) + { + if (fadeTicks == 0) + fadeTicks = 1; // ensure we do not have zero fade time + inZeroIntensityColor.red = 0x0000; + inZeroIntensityColor.green = 0x0000; + inZeroIntensityColor.blue = 0x0000; + currTick = TickCount (); + for (x = fadeTicks - 1; x >= 0; x--) + { + percent = step * x / 8; + err = DSpContext_FadeGamma(inContext, percent, &inZeroIntensityColor); + if (err != noErr) break; + while (currTick >= TickCount ()) {} + currTick = TickCount (); + } + } + return err; +} diff --git a/api/mac_carbon_gl.h b/api/mac_carbon_gl.h index 1ca656186b..99419e9e89 100755 --- a/api/mac_carbon_gl.h +++ b/api/mac_carbon_gl.h @@ -122,6 +122,24 @@ void DoUpdate (AGLContext aglContext); extern WindowRef appGLWindow; + +// structures (public) ----------------------------------------------- + +enum { fadeTicks = 10 }; + +// public function declarations ------------------------------------- + +OSStatus StartDSp (void); +void ShutdownDSp (void); + +CGrafPtr GetDSpDrawable (DSpContextReference dspContext); +void DestroyDSpContext (DSpContextReference* pdspContext); + +OSStatus DSpContext_CustomFadeGammaOut (DSpContextReference inContext, long fadeTicks); +OSStatus DSpContext_CustomFadeGammaIn (DSpContextReference inContext, long fadeTicks); + +extern Boolean gDSpStarted; + #ifdef __cplusplus } #endif