[GB.SDL2]
* BUG: Image.Load() automatically converts loaded image to default SDL image format. git-svn-id: svn://localhost/gambas/trunk@8035 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
558f5f2271
commit
8d43833241
@ -70,6 +70,7 @@ static void *temp_image(GB_IMG *img)
|
||||
|
||||
if (img && img->data)
|
||||
surface = SDL_CreateRGBSurfaceFrom(img->data, img->width, img->height, 32, img->width * sizeof(int), RMASK, GMASK, BMASK, AMASK);
|
||||
|
||||
|
||||
return SDL_CreateImage(surface);
|
||||
}
|
||||
@ -157,6 +158,7 @@ BEGIN_METHOD(Image_Load, GB_STRING path)
|
||||
char *addr;
|
||||
int len;
|
||||
SDL_Surface *surface;
|
||||
SDL_Surface *csurface;
|
||||
|
||||
if (GB.LoadFile(STRING(path), LENGTH(path), &addr, &len))
|
||||
return;
|
||||
@ -170,6 +172,13 @@ BEGIN_METHOD(Image_Load, GB_STRING path)
|
||||
return;
|
||||
}
|
||||
|
||||
if (surface->format->format != DEFAULT_SDL_IMAGE_FORMAT)
|
||||
{
|
||||
csurface = SDL_ConvertSurfaceFormat(surface, DEFAULT_SDL_IMAGE_FORMAT, 0);
|
||||
SDL_FreeSurface(surface);
|
||||
surface = csurface;
|
||||
}
|
||||
|
||||
GB.ReturnObject(IMAGE_create(SDL_CreateImage(surface)));
|
||||
|
||||
END_METHOD
|
||||
|
Loading…
x
Reference in New Issue
Block a user