X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fbumps.h;h=afac1b1c4048539d9b947159e5f7e73545cf82eb;hb=de460e831dc8578acfa8b72251ab9346c99c1f96;hp=120be96102a2fb322dcc87bd532c6f3ec5e97aba;hpb=cccbddbc4140cf9a06d7d95cc5c0ca36eb5d6e28;p=xscreensaver diff --git a/hacks/bumps.h b/hacks/bumps.h index 120be961..afac1b1c 100644 --- a/hacks/bumps.h +++ b/hacks/bumps.h @@ -18,6 +18,9 @@ * [10/01/99] - Shane Smit: Creation * [10/08/99] - Shane Smit: Port to C. (Ick) * [03/08/02] - Shane Smit: New movement code. + * [09/12/02] - Shane Smit: MIT-SHM XImages. + * Thanks to Kennett Galbraith + * for code optimization. */ @@ -27,7 +30,10 @@ #include #include "screenhack.h" -#include + +#ifdef HAVE_XSHM_EXTENSION +#include "xshm.h" +#endif /* HAVE_XSHM_EXTENSION */ /* Defines: */ @@ -44,28 +50,37 @@ typedef unsigned char BOOL; /* Globals: */ -char *progclass = "Bumps"; -char *defaults [] = { +static const char *bumps_defaults [] = { ".background: black", ".foreground: white", "*color: random", "*colorcount: 64", - "*delay: 50000", + "*delay: 30000", + "*duration: 120", "*soften: 1", "*invert: FALSE", #ifdef __sgi /* really, HAVE_READ_DISPLAY_EXTENSION */ - "*visualID: Best", + "*visualID: Best", #endif +#ifdef HAVE_XSHM_EXTENSION + "*useSHM: True", +#endif /* HAVE_XSHM_EXTENSION */ 0 }; -XrmOptionDescRec options [] = { +static XrmOptionDescRec bumps_options [] = { { "-color", ".color", XrmoptionSepArg, 0 }, { "-colorcount", ".colorcount", XrmoptionSepArg, 0 }, + { "-duration", ".duration", XrmoptionSepArg, 0 }, { "-delay", ".delay", XrmoptionSepArg, 0 }, { "-soften", ".soften", XrmoptionSepArg, 0 }, { "-invert", ".invert", XrmoptionNoArg, "TRUE" }, +#ifdef HAVE_XSHM_EXTENSION + { "-shm", ".useSHM", XrmoptionNoArg, "True" }, + { "-no-shm", ".useSHM", XrmoptionNoArg, "False" }, +#endif /* HAVE_XSHM_EXTENSION */ + { 0, 0, 0, 0 } }; @@ -75,7 +90,8 @@ XrmOptionDescRec options [] = { typedef struct { uint8_ *aLightMap; - uint16_ nDiameter, nRadius; + uint16_ nFalloffDiameter, nFalloffRadius; + uint16_ nLightDiameter, nLightRadius; float nAccelX, nAccelY; float nAccelMax; float nVelocityX, nVelocityY; @@ -83,35 +99,38 @@ typedef struct float nXPos, nYPos; } SSpotLight; -void CreateSpotLight( SSpotLight *, uint16_, uint16_ ); void CreateTables( SSpotLight * ); -void DestroySpotLight( SSpotLight *pSpotLight ) { free( pSpotLight->aLightMap ); } /* The entire program's operation is contained within this structure. */ typedef struct { /* XWindows specific variables. */ - Display *pDisplay; + Display *dpy; Window Win; + Screen *screen; + Pixmap source; GC GraphicsContext; - XColor *aXColors; + XColor *xColors; + uint32_ *aColors; XImage *pXImage; +#ifdef HAVE_XSHM_EXTENSION + XShmSegmentInfo XShmInfo; + Bool bUseShm; +#endif /* HAVE_XSHM_EXTENSION */ uint8_ nColorCount; /* Number of colors used. */ + uint8_ bytesPerPixel; uint16_ iWinWidth, iWinHeight; uint16_ *aBumpMap; /* The actual bump map. */ - SSpotLight SpotLight; -} SBumps; -void CreateBumps( SBumps *, Display *, Window ); -void Execute( SBumps * ); -void DestroyBumps( SBumps * ); + int delay; + int duration; + time_t start_time; -void SetPalette( SBumps *, XWindowAttributes * ); -void InitBumpMap( SBumps *, XWindowAttributes * ); -void SoftenBumpMap( SBumps * ); + async_load_state *img_loader; +} SBumps; #endif /* _BUMPS_H */