White appears first in New dialog.

This commit is contained in:
William Kendrick 2008-12-01 21:08:52 +00:00
parent 1bf48e6e15
commit d9068fe797
2 changed files with 47 additions and 22 deletions

View file

@ -8,7 +8,7 @@ http://www.tuxpaint.org/
$Id$ $Id$
2008.November.7 (0.9.21) 2008.December.1 (0.9.21)
* New Starters: * New Starters:
------------- -------------
* Silver Frame * Silver Frame
@ -88,6 +88,9 @@ $Id$
* Starter images no longer need to be created with alpha transparency. * Starter images no longer need to be created with alpha transparency.
Any solid white will be removed automatically by Tux Paint. Any solid white will be removed automatically by Tux Paint.
* White always appears as the first color in the "New" dialog,
regardless of its position (or even existence) in the color palette.
* New localizations: * New localizations:
------------------ ------------------
* Shuswap (Secwepemctín) translation * Shuswap (Secwepemctín) translation

View file

@ -22,7 +22,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt) (See COPYING.txt)
June 14, 2002 - October 26, 2008 June 14, 2002 - December 1, 2008
$Id$ $Id$
*/ */
@ -17681,6 +17681,8 @@ int do_new_dialog(void)
int places_to_look; int places_to_look;
int tot; int tot;
int first_starter; int first_starter;
int added;
Uint8 r, g, b;
do_setcursor(cursor_watch); do_setcursor(cursor_watch);
@ -17780,26 +17782,42 @@ int do_new_dialog(void)
/* Throw the color palette at the beginning: */ /* Throw the color palette at the beginning: */
for (j = 0; j < NUM_COLORS; j++) for (j = -1; j < NUM_COLORS; j++)
{ {
added = 0;
if (j < NUM_COLORS - 1) if (j < NUM_COLORS - 1)
{ {
/* Palette colors: */ if (j == -1 || /* (short circuit) */
color_hexes[j][0] != 255 || /* Ignore white, we'll have already added it */
thumbs[num_files] = SDL_CreateRGBSurface(screen->flags, color_hexes[j][1] != 255 ||
THUMB_W - 20, THUMB_H - 20, color_hexes[j][2] != 255)
screen->format->BitsPerPixel,
screen->format->Rmask,
screen->format->Gmask,
screen->format->Bmask, 0);
if (thumbs[num_files] != NULL)
{ {
SDL_FillRect(thumbs[num_files], NULL, /* Palette colors: */
SDL_MapRGB(thumbs[num_files]->format,
color_hexes[j][0], thumbs[num_files] = SDL_CreateRGBSurface(screen->flags,
color_hexes[j][1], THUMB_W - 20, THUMB_H - 20,
color_hexes[j][2])); screen->format->BitsPerPixel,
screen->format->Rmask,
screen->format->Gmask,
screen->format->Bmask, 0);
if (thumbs[num_files] != NULL)
{
if (j == -1)
{
r = g = b = 255; /* White */
}
else
{
r = color_hexes[j][0];
g = color_hexes[j][1];
b = color_hexes[j][2];
}
SDL_FillRect(thumbs[num_files], NULL,
SDL_MapRGB(thumbs[num_files]->format, r, g, b));
added = 1;
}
} }
} }
else else
@ -17807,13 +17825,17 @@ int do_new_dialog(void)
/* Color picker: */ /* Color picker: */
thumbs[num_files] = thumbnail(img_color_picker, THUMB_W - 20, THUMB_H - 20, 0); thumbs[num_files] = thumbnail(img_color_picker, THUMB_W - 20, THUMB_H - 20, 0);
added = 1;
} }
d_places[num_files] = PLACE_COLOR_PALETTE; if (added)
d_names[num_files] = NULL; {
d_exts[num_files] = NULL; d_places[num_files] = PLACE_COLOR_PALETTE;
d_names[num_files] = NULL;
d_exts[num_files] = NULL;
num_files++; num_files++;
}
} }
first_starter = num_files; first_starter = num_files;