|
|
@ -63,10 +63,10 @@ getpixel (SDL_Surface * surface, int x, int y)
|
|
|
|
void
|
|
|
|
void
|
|
|
|
putpixel (SDL_Surface * surface, int x, int y, Uint32 pixel)
|
|
|
|
putpixel (SDL_Surface * surface, int x, int y, Uint32 pixel)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int bpp = surface->format->BytesPerPixel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Here p is the address to the pixel we want to set */
|
|
|
|
/* Here p is the address to the pixel we want to set */
|
|
|
|
|
|
|
|
int bpp = surface->format->BytesPerPixel;
|
|
|
|
Uint8 *p = (Uint8 *) surface->pixels + y * surface->pitch + x * bpp;
|
|
|
|
Uint8 *p = (Uint8 *) surface->pixels + y * surface->pitch + x * bpp;
|
|
|
|
|
|
|
|
|
|
|
|
switch (bpp) {
|
|
|
|
switch (bpp) {
|
|
|
|
case 1:
|
|
|
|
case 1:
|
|
|
|
*p = pixel;
|
|
|
|
*p = pixel;
|
|
|
@ -163,6 +163,7 @@ scale_image (SDL_Surface * orginal, int newx, int newy)
|
|
|
|
amask = 0xff000000;
|
|
|
|
amask = 0xff000000;
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* */
|
|
|
|
#endif /* */
|
|
|
|
|
|
|
|
|
|
|
|
surface = SDL_CreateRGBSurface (SDL_SWSURFACE, newx, newy, 32, rmask, gmask, bmask, amask);
|
|
|
|
surface = SDL_CreateRGBSurface (SDL_SWSURFACE, newx, newy, 32, rmask, gmask, bmask, amask);
|
|
|
|
if (surface == NULL) {
|
|
|
|
if (surface == NULL) {
|
|
|
|
fprintf (stderr, "CreateRGBSurface failed: %s\n", SDL_GetError ());
|
|
|
|
fprintf (stderr, "CreateRGBSurface failed: %s\n", SDL_GetError ());
|
|
|
|