X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fbumps.c;h=64a02482748e95535f2d5d5300097319bb79cf10;hb=2d04c4f22466851aedb6ed0f2919d148f726b889;hp=be4c95b9755cec0b2c8d0c5d398df3a780f87a0c;hpb=c28aecf9fc41e3a03494bacf7279745425e2fa18;p=xscreensaver diff --git a/hacks/bumps.c b/hacks/bumps.c index be4c95b9..64a02482 100644 --- a/hacks/bumps.c +++ b/hacks/bumps.c @@ -306,10 +306,17 @@ void InitBumpMap( SBumps *pBumps, XWindowAttributes *pXWinAttribs ) uint16_ maxHeight; double softenMultiplier = 1.0f; BOOL bInvert = (BOOL)get_boolean_resource( "invert", "Boolean" ); + Pixmap p; aColors = (XColor*)malloc( pBumps->iWinWidth * sizeof(XColor) ); - grab_screen_image( pXWinAttribs->screen, pBumps->Win ); - pScreenImage = XGetImage( pBumps->pDisplay, pBumps->Win, 0, 0, pBumps->iWinWidth, pBumps->iWinHeight, ~0L, ZPixmap ); + + p = XCreatePixmap(pBumps->pDisplay, pBumps->Win, + pXWinAttribs->width, pXWinAttribs->height, + pXWinAttribs->depth); + load_random_image (pXWinAttribs->screen, pBumps->Win, p, NULL, NULL); + + pScreenImage = XGetImage( pBumps->pDisplay, p, 0, 0, pBumps->iWinWidth, pBumps->iWinHeight, ~0L, ZPixmap ); + XFreePixmap (pBumps->pDisplay, p); /* jwz: get the grabbed bits off the screen fast */ XClearWindow (pBumps->pDisplay, pBumps->Win); @@ -367,7 +374,7 @@ void InitBumpMap( SBumps *pBumps, XWindowAttributes *pXWinAttribs ) free( aColors ); } -/* Soften the bump map. This is to avoid pixellated-looking ridges. +/* Soften the bump map. This is to avoid pixelated-looking ridges. * |-----|-----|-----| * | 0% |12.5%| 0% | The adjacent pixels are averaged together * |-----|-----|-----| first. Then than value is averaged with @@ -435,7 +442,9 @@ void Execute( SBumps *pBumps ) if( iScreenY < 0 ) continue; else if( iScreenY >= pBumps->iWinHeight ) break; - pDOffset = &pBumps->pXImage->data[ (iLightY+pBumps->SpotLight.nLightRadius) * pBumps->pXImage->bytes_per_line ]; + /* warning: pointer targets in assignment differ in signedness + Should pDOffset be a int8? I can't tell. -jwz, 22-Jul-2003 */ + pDOffset = (int8_ *) &pBumps->pXImage->data[ (iLightY+pBumps->SpotLight.nLightRadius) * pBumps->pXImage->bytes_per_line ]; pBOffset = pBumps->aBumpMap + ( iScreenY * pBumps->iWinWidth ) + nLightXPos; for( iScreenX=nLightXPos, iLightX=-pBumps->SpotLight.nLightRadius; iLightXbytesPerPixel ) {