fixed: load dialog corruption when old files are big

This commit is contained in:
Albert Cahalan 2004-12-07 04:08:50 +00:00
parent 6836e565b4
commit 5c67b05102
2 changed files with 17 additions and 3 deletions

View file

@ -8,6 +8,10 @@ http://www.newbreedsoftware.com/tuxpaint/
2004.December.5 (0.9.15)
* fixed display corruption in load dialog when saved images are
from a larger display size
Albert Cahalan <albert@users.sf.net>
* getpixel function now considers edges as extending to infinity
Albert Cahalan <albert@users.sf.net>

View file

@ -10953,12 +10953,22 @@ static int do_open(int want_new_tool)
if (img != NULL)
{
/* Loaded the thumbnail from one or the other location */
show_progress_bar();
thumbs[num_files] = SDL_DisplayFormat(img);
img1 = SDL_DisplayFormat(img);
SDL_FreeSurface(img);
// if too big, or too small in both dimensions, rescale it
// ( for now: using old thumbnail as source for high speed, low quality)
if (img1->w > THUMB_W-20 || img1->h > THUMB_H-20 || (img1->w < THUMB_W-20 && img1->h < THUMB_H-20) )
{
img2 = thumbnail(img1, THUMB_W - 20, THUMB_H - 20, 0);
SDL_FreeSurface(img1);
img1 = img2;
}
thumbs[num_files] = img1;
if (thumbs[num_files] == NULL)
{
fprintf(stderr,