Merge branch 'master' into sdl2.0
There are problems with im that should be investigated...
This commit is contained in:
commit
9cf77f684c
184 changed files with 9413 additions and 8107 deletions
102
src/tuxpaint.c
102
src/tuxpaint.c
|
|
@ -22,7 +22,7 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
(See COPYING.txt)
|
||||
|
||||
June 14, 2002 - September 25, 2021
|
||||
June 14, 2002 - October 24, 2021
|
||||
*/
|
||||
|
||||
#include "platform.h"
|
||||
|
|
@ -351,29 +351,24 @@ typedef struct safer_dirent
|
|||
|
||||
#define mkdir(path,access) _mkdir(path)
|
||||
|
||||
/**
|
||||
* FIXME
|
||||
*/
|
||||
static void mtw(wchar_t * wtok, char *tok)
|
||||
static void mtw(wchar_t * wtok, char *tok, size_t size)
|
||||
{
|
||||
/* workaround using iconv to get a functionallity somewhat approximate as mbstowcs() */
|
||||
Uint16 *ui16;
|
||||
|
||||
ui16 = malloc(255);
|
||||
ui16 = malloc(size);
|
||||
char *wrptr = (char *)ui16;
|
||||
size_t n, in, out;
|
||||
size_t in, out, n;
|
||||
iconv_t trans;
|
||||
wchar_t *wch;
|
||||
|
||||
n = 255;
|
||||
in = 250;
|
||||
out = 250;
|
||||
wch = malloc(255);
|
||||
|
||||
in = size;
|
||||
out = size;
|
||||
n = size / sizeof(wchar_t);
|
||||
|
||||
trans = iconv_open("WCHAR_T", "UTF-8");
|
||||
iconv(trans, (const char **)&tok, &in, &wrptr, &out);
|
||||
iconv(trans, (char **)&tok, &in, &wrptr, &out);
|
||||
*((wchar_t *) wrptr) = L'\0';
|
||||
swprintf(wtok, L"%ls", ui16);
|
||||
swprintf(wtok, n, L"%ls", ui16);
|
||||
free(ui16);
|
||||
iconv_close(trans);
|
||||
}
|
||||
|
|
@ -772,10 +767,10 @@ static grid_dims gd_toolopt; /* was 2x7 */
|
|||
static grid_dims gd_colors; /* was 17x1 */
|
||||
|
||||
#define ORIGINAL_BUTTON_SIZE 48 /* Original Button Size */
|
||||
#define HEIGHTOFFSET (((WINDOW_HEIGHT - 480) / button_h) * button_h)
|
||||
#define TOOLOFFSET (HEIGHTOFFSET / button_h * 2)
|
||||
#define PROMPTOFFSETX (WINDOW_WIDTH - 640) / 2
|
||||
#define PROMPTOFFSETY (HEIGHTOFFSET / 2)
|
||||
#define HEIGHTOFFSET ((Sint16) (((WINDOW_HEIGHT - 480) / button_h) * button_h))
|
||||
#define TOOLOFFSET ((Sint16) (HEIGHTOFFSET / button_h * 2))
|
||||
#define PROMPTOFFSETX ((Sint16) (WINDOW_WIDTH - 640) / 2)
|
||||
#define PROMPTOFFSETY ((Sint16) (HEIGHTOFFSET / 2))
|
||||
|
||||
#define THUMB_W ((WINDOW_WIDTH - r_ttools.w - r_ttoolopt.w) / 4)
|
||||
#define THUMB_H (((button_h * buttons_tall + r_ttools.h) - button_h - button_h / 2) / 4)
|
||||
|
|
@ -2401,7 +2396,7 @@ static void mainloop(void)
|
|||
shape_tool_mode, shape_start_x, shape_start_y, shape_current_x, shape_current_y, old_stamp_group, which;
|
||||
int num_things;
|
||||
int *thing_scroll;
|
||||
int do_draw, max;
|
||||
int do_draw;
|
||||
int ignoring_motion;
|
||||
int motioner = 0;
|
||||
int hatmotioner = 0;
|
||||
|
|
@ -3532,15 +3527,6 @@ static void mainloop(void)
|
|||
draw_erasers();
|
||||
draw_colors(COLORSEL_DISABLE);
|
||||
}
|
||||
else if (cur_tool == TOOL_FILL)
|
||||
{
|
||||
keybd_flag = 0;
|
||||
cur_thing = cur_fill;
|
||||
num_things = NUM_FILLS;
|
||||
thing_scroll = &fill_scroll;
|
||||
draw_fills();
|
||||
draw_colors(COLORSEL_DISABLE);
|
||||
}
|
||||
else if (cur_tool == TOOL_UNDO)
|
||||
{
|
||||
if (cur_undo == newest_undo)
|
||||
|
|
@ -4973,6 +4959,12 @@ static void mainloop(void)
|
|||
fill_x, fill_y, old_x, old_y + 1, draw_color, sim_flood_touched);
|
||||
fill_drag_started = 1;
|
||||
}
|
||||
else if (cur_fill == FILL_BRUSH)
|
||||
{
|
||||
/* Start painting within the fill area */
|
||||
draw_brush_fill(canvas, sim_flood_x1, sim_flood_y1, sim_flood_x2, sim_flood_y2,
|
||||
fill_x, fill_y, old_x, old_y, draw_color, sim_flood_touched, &x1, &y1, &x2, &y2);
|
||||
}
|
||||
|
||||
update_canvas(x1, y1, x2, y2);
|
||||
}
|
||||
|
|
@ -5978,7 +5970,7 @@ static void mainloop(void)
|
|||
}
|
||||
else if (cur_tool == TOOL_FILL && cur_fill == FILL_GRADIENT_LINEAR && fill_drag_started)
|
||||
{
|
||||
Uint32 draw_color, canv_color;
|
||||
Uint32 draw_color;
|
||||
int undo_ctr;
|
||||
SDL_Surface * last;
|
||||
|
||||
|
|
@ -6000,6 +5992,23 @@ static void mainloop(void)
|
|||
|
||||
update_canvas(sim_flood_x1, sim_flood_y1, sim_flood_x2, sim_flood_y2);
|
||||
}
|
||||
else if (cur_tool == TOOL_FILL && cur_fill == FILL_BRUSH)
|
||||
{
|
||||
Uint32 draw_color;
|
||||
int x1, y1, x2, y2;
|
||||
|
||||
/* Pushing button and moving: Paint more within the fill area: */
|
||||
|
||||
draw_color = SDL_MapRGB(canvas->format,
|
||||
color_hexes[cur_color][0],
|
||||
color_hexes[cur_color][1],
|
||||
color_hexes[cur_color][2]);
|
||||
|
||||
draw_brush_fill(canvas, sim_flood_x1, sim_flood_y1, sim_flood_x2, sim_flood_y2,
|
||||
old_x, old_y, new_x, new_y, draw_color, sim_flood_touched, &x1, &y1, &x2, &y2);
|
||||
|
||||
update_canvas(x1, y1, x2, y2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -8658,7 +8667,7 @@ static SDL_Surface *do_render_button_label(const char *const label)
|
|||
tmp_surf = render_text(myfont, upstr, black);
|
||||
free(upstr);
|
||||
|
||||
surf = thumbnail(tmp_surf, min(button_w, tmp_surf->w), min(18 * button_scale + button_label_y_nudge, tmp_surf->h), 0);
|
||||
surf = thumbnail(tmp_surf, min(button_w, tmp_surf->w), min((int) (18 * button_scale + button_label_y_nudge), tmp_surf->h), 0);
|
||||
SDL_FreeSurface(tmp_surf);
|
||||
|
||||
return surf;
|
||||
|
|
@ -10162,7 +10171,7 @@ static void draw_erasers(void)
|
|||
int xx, yy, n;
|
||||
void (*putpixel) (SDL_Surface *, int, int, Uint32);
|
||||
SDL_Rect dest;
|
||||
int most, off_y, max;
|
||||
int most, off_y;
|
||||
|
||||
putpixel = putpixels[screen->format->BytesPerPixel];
|
||||
|
||||
|
|
@ -10177,7 +10186,6 @@ static void draw_erasers(void)
|
|||
{
|
||||
most = most - gd_toolopt.cols; /* was 12 */
|
||||
off_y = img_scroll_up->h;
|
||||
max = most + TOOLOFFSET;
|
||||
|
||||
dest.x = WINDOW_WIDTH - r_ttoolopt.w;
|
||||
dest.y = r_ttoolopt.h;
|
||||
|
|
@ -10206,7 +10214,6 @@ static void draw_erasers(void)
|
|||
else
|
||||
{
|
||||
off_y = 0;
|
||||
max = most + TOOLOFFSET;
|
||||
}
|
||||
|
||||
for (j = 0; j < most + TOOLOFFSET; j++)
|
||||
|
|
@ -10328,11 +10335,9 @@ static void draw_none(void)
|
|||
/* Draw Fill sub-tools */
|
||||
static void draw_fills(void)
|
||||
{
|
||||
int i, j, x, y, sz;
|
||||
int xx, yy, n;
|
||||
void (*putpixel) (SDL_Surface *, int, int, Uint32);
|
||||
int i, j;
|
||||
SDL_Rect dest;
|
||||
int most, off_y, max;
|
||||
int most, off_y;
|
||||
|
||||
draw_image_title(TITLE_FILLS, r_ttoolopt);
|
||||
|
||||
|
|
@ -10346,7 +10351,6 @@ static void draw_fills(void)
|
|||
{
|
||||
most = most - gd_toolopt.cols; /* was 12 */
|
||||
off_y = img_scroll_up->h;
|
||||
max = most + TOOLOFFSET;
|
||||
|
||||
dest.x = WINDOW_WIDTH - r_ttoolopt.w;
|
||||
dest.y = r_ttoolopt.h;
|
||||
|
|
@ -10375,7 +10379,6 @@ static void draw_fills(void)
|
|||
else
|
||||
{
|
||||
off_y = 0;
|
||||
max = most + TOOLOFFSET;
|
||||
}
|
||||
|
||||
for (j = 0; j < most + TOOLOFFSET; j++)
|
||||
|
|
@ -13183,8 +13186,8 @@ static int do_prompt_image_flash(const char *const text,
|
|||
return (do_prompt_image_flash_snd(text, btn_yes, btn_no, img1, img2, img3, animate, SND_NONE, ox, oy));
|
||||
}
|
||||
|
||||
#define PROMPT_W (min(canvas->w, 440 * button_scale))
|
||||
#define PROMPT_LEFT (r_tools.w - PROMPTOFFSETX + canvas->w / 2 - PROMPT_W / 2 - 4)
|
||||
#define PROMPT_W (min(canvas->w, ((int) (440 * button_scale))))
|
||||
#define PROMPT_LEFT ((Sint16) (r_tools.w - PROMPTOFFSETX + canvas->w / 2 - PROMPT_W / 2 - 4))
|
||||
|
||||
/**
|
||||
* FIXME
|
||||
|
|
@ -20026,7 +20029,7 @@ static void load_magic_plugins(void)
|
|||
else
|
||||
{
|
||||
fprintf(stderr, "Error: plugin %s mode # %d failed to load an icon\n",
|
||||
fname, i, group);
|
||||
fname, i);
|
||||
fflush(stderr);
|
||||
}
|
||||
}
|
||||
|
|
@ -21987,7 +21990,7 @@ static int do_color_picker(void)
|
|||
#endif
|
||||
SDL_Rect dest;
|
||||
int x, y, w;
|
||||
int ox, oy, oox, ooy, nx, ny;
|
||||
int ox, oy;
|
||||
int val_x, val_y, motioner;
|
||||
int valhat_x, valhat_y, hatmotioner;
|
||||
SDL_Surface *tmp_btn_up, *tmp_btn_down;
|
||||
|
|
@ -22002,7 +22005,7 @@ static int do_color_picker(void)
|
|||
int done, chose;
|
||||
SDL_Event event;
|
||||
SDLKey key;
|
||||
int color_picker_left, color_picker_top, color_picker_width, color_picker_height;
|
||||
int color_picker_left, color_picker_top;
|
||||
int back_left, back_top;
|
||||
SDL_Rect color_example_dest;
|
||||
SDL_Surface *backup;
|
||||
|
|
@ -22038,9 +22041,6 @@ static int do_color_picker(void)
|
|||
|
||||
for (w = 0; w <= stop; w = w + 4)
|
||||
{
|
||||
nx = PROMPT_LEFT + r_tools.w - w + PROMPTOFFSETX;
|
||||
ny = 2 + canvas->h / 2 - w;
|
||||
|
||||
dest.x = ox - ((ox -r_final.x) * w) / stop;
|
||||
dest.y = oy - ((oy -r_final.y) * w) / stop;
|
||||
dest.w = w * 4;
|
||||
|
|
@ -23070,7 +23070,7 @@ static void load_info_about_label_surface(FILE * lfi)
|
|||
tmpstr = malloc(1024);
|
||||
wtmpstr = malloc(1024);
|
||||
fgets(tmpstr, 1024, lfi);
|
||||
mtw(wtmpstr, tmpstr);
|
||||
mtw(wtmpstr, tmpstr, 1024);
|
||||
for (l = 0; l < new_node->save_texttool_len; l++)
|
||||
{
|
||||
new_node->save_texttool_str[l] = wtmpstr[l];
|
||||
|
|
@ -26182,7 +26182,7 @@ img_btnsm_up, img_btnsm_down, img_btnsm_off, img_btnsm_nav,
|
|||
free(td_str);
|
||||
tmp_surf = render_text(myfont, upstr, black);
|
||||
free(upstr);
|
||||
img_title_names[i] = thumbnail(tmp_surf, min(84 * button_scale, tmp_surf->w), tmp_surf->h, 0);
|
||||
img_title_names[i] = thumbnail(tmp_surf, min((int) (84 * button_scale), tmp_surf->w), tmp_surf->h, 0);
|
||||
SDL_FreeSurface(tmp_surf);
|
||||
}
|
||||
else
|
||||
|
|
@ -27668,7 +27668,7 @@ char * safe_strncat(char *dest, const char *src, size_t n) {
|
|||
|
||||
char * safe_strncpy(char *dest, const char *src, size_t n) {
|
||||
char * ptr;
|
||||
ptr = strncpy(dest, src, n - 1);
|
||||
ptr = strncpy(dest, src, n - 1); /* FIXME: Clean up, and keep safe, to avoid compiler warning (e.g., "output may be truncated copying 255 bytes from a string of length 255") */
|
||||
dest[n - 1] = '\0';
|
||||
return ptr;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue