This is a multi-part message in MIME format.
--------------E3EF674E0BD8B2D0C4D58A5D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sam Lantinga wrote:
Improvements for the SDL 1.2 release:
- 1.2.0: Fix optimization related crash with assembly blitters
Hmm, FillRect doesn’t crash anymore, but FillRect or BlitSurface doesn
draw anymore 1 pixel surfaces it seems …
The attached routine draws nothing when I call it to draw pixels
onto the screen (i.e. ‘dst’ is ‘screen’). This used to work fine with
ver 1.1.7.
(Setup: CVS SDL, Mandrake72, 16bpp/Xfree402/MatroxG450)
The test programs that use FillRect seem to work fine. Any ideas?
Ciao
Andreas–
| Andreas Schiffler aschiffler at home.com |
| Senior Systems Engineer - Deskplayer Inc., Buffalo |
| 4707 Eastwood Cres., Niagara Falls, Ont L2E 1B4, Canada |
| +1-905-371-3652 (private) - +1-905-371-8834 (work/fax) |
--------------E3EF674E0BD8B2D0C4D58A5D
Content-Type: text/plain; charset=us-ascii;
name="pixel.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename=“pixel.c”
/* ----- Pixel - using single pixel blit with blending enabled. */
static SDL_Surface *gfxPrimitivesSinglePixel=NULL;
int pixelColor (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)
{
SDL_Rect srect;
SDL_Rect drect;
int result;
/* Setup source rectangle for pixel */
srect.x=0;
srect.y=0;
srect.w=1;
srect.h=1;
/* Setup destination rectangle for pixel */
drect.x=x;
drect.y=y;
drect.w=1;
drect.h=1;
/* Create single pixel from destination surface format and add alpha channel to it */
if (gfxPrimitivesSinglePixel==NULL) {
gfxPrimitivesSinglePixel=SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_HWSURFACE | SDL_SRCALPHA, 1, 1, 32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
SDL_SetAlpha (gfxPrimitivesSinglePixel, SDL_SRCALPHA, 255);
}
/* Draw color into pixel*/
SDL_FillRect (gfxPrimitivesSinglePixel, &srect, color);
/* Draw pixel onto destination surface */
result=SDL_BlitSurface (gfxPrimitivesSinglePixel, &srect, dst, &drect);
return(result);
}
/* Alpha weight the colors for AA-drawing */
int pixelColorWeight (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color, Uint32 weight)
{
Sint32 r,g,b,a;
r=((color >> 24) & 255);
g=((color >> 16) & 255);
b=((color >> 8) & 255);
a=(color & 255);
/* Modify Alpha by weight */
a -= weight;
if (a<0) a=0;
pixelColor (dst,x,y,((Uint32)r << 24) | ((Uint32)g << 16) | ((Uint32)b << 8) | (Uint32)a);
}
int pixelRGBA (SDL_Surface dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/ Draw */
return(pixelColor (dst, x, y, ((Uint32)r << 24) | ((Uint32)g << 16) | ((Uint32)b << 8) | (Uint32)a ));
}
--------------E3EF674E0BD8B2D0C4D58A5D–