More on SDL2. Now compiles, still needs a lot of cleaning and work to deal with SDL_DisplayFormat* from 1.2
This commit is contained in:
parent
75089ea473
commit
8693724975
10 changed files with 129 additions and 78 deletions
BIN
dummy.o
Executable file
BIN
dummy.o
Executable file
Binary file not shown.
|
|
@ -134,10 +134,10 @@ void fisheye_draw(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas,
|
||||||
last_x = x;
|
last_x = x;
|
||||||
last_y = y;
|
last_y = y;
|
||||||
|
|
||||||
oryg=SDL_CreateRGBSurface(SDL_ANYFORMAT, 80, 80, canvas->format->BitsPerPixel,
|
oryg=SDL_CreateRGBSurface(SDL_SWSURFACE, 80, 80, canvas->format->BitsPerPixel,
|
||||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||||
|
|
||||||
output=SDL_CreateRGBSurface(SDL_ANYFORMAT, 80, 80, canvas->format->BitsPerPixel,
|
output=SDL_CreateRGBSurface(SDL_SWSURFACE, 80, 80, canvas->format->BitsPerPixel,
|
||||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||||
|
|
||||||
rect.x=x-40;
|
rect.x=x-40;
|
||||||
|
|
@ -149,7 +149,7 @@ void fisheye_draw(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas,
|
||||||
//do vertical fisheye
|
//do vertical fisheye
|
||||||
for (i=0; i<40; i++)
|
for (i=0; i<40; i++)
|
||||||
{
|
{
|
||||||
temp_src=SDL_CreateRGBSurface(SDL_ANYFORMAT, 1, 80, canvas->format->BitsPerPixel,
|
temp_src=SDL_CreateRGBSurface(SDL_SWSURFACE, 1, 80, canvas->format->BitsPerPixel,
|
||||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||||
|
|
||||||
//let's take a smooth bar of scaled bitmap and copy it to temp
|
//let's take a smooth bar of scaled bitmap and copy it to temp
|
||||||
|
|
@ -160,7 +160,7 @@ void fisheye_draw(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas,
|
||||||
|
|
||||||
SDL_BlitSurface(oryg, &rect, temp_src, NULL); //this bar is copied to temp_src
|
SDL_BlitSurface(oryg, &rect, temp_src, NULL); //this bar is copied to temp_src
|
||||||
|
|
||||||
temp_dest=SDL_CreateRGBSurface(SDL_ANYFORMAT, 1, 80+2*i, canvas->format->BitsPerPixel,
|
temp_dest=SDL_CreateRGBSurface(SDL_SWSURFACE, 1, 80+2*i, canvas->format->BitsPerPixel,
|
||||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||||
|
|
||||||
temp_dest=api->scale(temp_src, 1, 80+2*i, 0); //temp_dest stores scaled temp_src
|
temp_dest=api->scale(temp_src, 1, 80+2*i, 0); //temp_dest stores scaled temp_src
|
||||||
|
|
@ -186,10 +186,10 @@ void fisheye_draw(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas,
|
||||||
//do horizontal fisheye
|
//do horizontal fisheye
|
||||||
for (i=0; i<40; i++)
|
for (i=0; i<40; i++)
|
||||||
{
|
{
|
||||||
temp_src=SDL_CreateRGBSurface(SDL_ANYFORMAT, 80, 1, canvas->format->BitsPerPixel,
|
temp_src=SDL_CreateRGBSurface(SDL_SWSURFACE, 80, 1, canvas->format->BitsPerPixel,
|
||||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||||
|
|
||||||
temp_dest=SDL_CreateRGBSurface(SDL_ANYFORMAT, 80+2*i, 1, canvas->format->BitsPerPixel,
|
temp_dest=SDL_CreateRGBSurface(SDL_SWSURFACE, 80+2*i, 1, canvas->format->BitsPerPixel,
|
||||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||||
|
|
||||||
//upper side first
|
//upper side first
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ void fold_draw(magic_api * api, int which,
|
||||||
int left_y, right_x;
|
int left_y, right_x;
|
||||||
float w, h;
|
float w, h;
|
||||||
SDL_Surface * temp;
|
SDL_Surface * temp;
|
||||||
temp=SDL_CreateRGBSurface(SDL_ANYFORMAT, canvas->w, canvas->h, canvas->format->BitsPerPixel,
|
temp=SDL_CreateRGBSurface(SDL_SWSURFACE, canvas->w, canvas->h, canvas->format->BitsPerPixel,
|
||||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||||
SDL_BlitSurface(canvas,0,temp,0);
|
SDL_BlitSurface(canvas,0,temp,0);
|
||||||
|
|
||||||
|
|
@ -207,10 +207,10 @@ SDL_Surface * rotate(magic_api * api, SDL_Surface * canvas, int angle)
|
||||||
int a,b;
|
int a,b;
|
||||||
|
|
||||||
if (angle==180)
|
if (angle==180)
|
||||||
temp=SDL_CreateRGBSurface(SDL_ANYFORMAT, canvas->w, canvas->h, canvas->format->BitsPerPixel,
|
temp=SDL_CreateRGBSurface(SDL_SWSURFACE, canvas->w, canvas->h, canvas->format->BitsPerPixel,
|
||||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||||
else
|
else
|
||||||
temp=SDL_CreateRGBSurface(SDL_ANYFORMAT, canvas->h, canvas->w, canvas->format->BitsPerPixel,
|
temp=SDL_CreateRGBSurface(SDL_SWSURFACE, canvas->h, canvas->w, canvas->format->BitsPerPixel,
|
||||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||||
|
|
||||||
switch (angle)
|
switch (angle)
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,7 @@ void fretwork_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNU
|
||||||
{
|
{
|
||||||
//we've to compute the quantity of segments in each direction
|
//we've to compute the quantity of segments in each direction
|
||||||
|
|
||||||
canvas_backup=SDL_CreateRGBSurface(SDL_ANYFORMAT, canvas->w, canvas->h, canvas->format->BitsPerPixel,
|
canvas_backup=SDL_CreateRGBSurface(SDL_SWSURFACE, canvas->w, canvas->h, canvas->format->BitsPerPixel,
|
||||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||||
|
|
||||||
SDL_BlitSurface(canvas, NULL, canvas_backup, NULL);
|
SDL_BlitSurface(canvas, NULL, canvas_backup, NULL);
|
||||||
|
|
@ -466,10 +466,10 @@ static void fretwork_draw(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface *
|
||||||
|
|
||||||
fretwork_status_of_segments[segment]=image; //and write it to global table
|
fretwork_status_of_segments[segment]=image; //and write it to global table
|
||||||
|
|
||||||
result=SDL_CreateRGBSurface(SDL_ANYFORMAT, img_w, img_h, fretwork_one->format->BitsPerPixel,
|
result=SDL_CreateRGBSurface(SDL_SWSURFACE, img_w, img_h, fretwork_one->format->BitsPerPixel,
|
||||||
fretwork_one->format->Rmask, fretwork_one->format->Gmask, fretwork_one->format->Bmask, fretwork_one->format->Amask);
|
fretwork_one->format->Rmask, fretwork_one->format->Gmask, fretwork_one->format->Bmask, fretwork_one->format->Amask);
|
||||||
|
|
||||||
temp=SDL_CreateRGBSurface(SDL_ANYFORMAT, img_w, img_h, fretwork_one->format->BitsPerPixel,
|
temp=SDL_CreateRGBSurface(SDL_SWSURFACE, img_w, img_h, fretwork_one->format->BitsPerPixel,
|
||||||
fretwork_one->format->Rmask, fretwork_one->format->Gmask, fretwork_one->format->Bmask, fretwork_one->format->Amask);
|
fretwork_one->format->Rmask, fretwork_one->format->Gmask, fretwork_one->format->Bmask, fretwork_one->format->Amask);
|
||||||
|
|
||||||
SDL_BlitSurface(canvas_backup, &modification_rect, result, NULL);
|
SDL_BlitSurface(canvas_backup, &modification_rect, result, NULL);
|
||||||
|
|
|
||||||
|
|
@ -307,10 +307,10 @@ void halftone_switchin(magic_api * api, int which ATTRIBUTE_UNUSED,
|
||||||
int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas)
|
int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas)
|
||||||
{
|
{
|
||||||
if (canvas_backup == NULL)
|
if (canvas_backup == NULL)
|
||||||
canvas_backup = SDL_CreateRGBSurface(SDL_ANYFORMAT, api->canvas_w, api->canvas_h, canvas->format->BitsPerPixel, canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
canvas_backup = SDL_CreateRGBSurface(SDL_SWSURFACE, api->canvas_w, api->canvas_h, canvas->format->BitsPerPixel, canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||||
|
|
||||||
if (square == NULL)
|
if (square == NULL)
|
||||||
square = SDL_CreateRGBSurface(SDL_ANYFORMAT, 16, 16, canvas->format->BitsPerPixel, canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
square = SDL_CreateRGBSurface(SDL_SWSURFACE, 16, 16, canvas->format->BitsPerPixel, canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||||
|
|
||||||
/* FIXME: What to do if they come back NULL!? :( */
|
/* FIXME: What to do if they come back NULL!? :( */
|
||||||
|
|
||||||
|
|
|
||||||
2
magic/src/puzzle.c
Executable file → Normal file
2
magic/src/puzzle.c
Executable file → Normal file
|
|
@ -145,7 +145,7 @@ void puzzle_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSE
|
||||||
puzzle_gcd=RATIO*gcd(canvas->w, canvas->h);
|
puzzle_gcd=RATIO*gcd(canvas->w, canvas->h);
|
||||||
rects_w=(unsigned int)canvas->w/puzzle_gcd;
|
rects_w=(unsigned int)canvas->w/puzzle_gcd;
|
||||||
rects_h=(unsigned int)canvas->h/puzzle_gcd;
|
rects_h=(unsigned int)canvas->h/puzzle_gcd;
|
||||||
canvas_backup = SDL_CreateRGBSurface(SDL_ANYFORMAT,canvas->w, canvas->h, canvas->format->BitsPerPixel, canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
canvas_backup = SDL_CreateRGBSurface(SDL_SWSURFACE,canvas->w, canvas->h, canvas->format->BitsPerPixel, canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void puzzle_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
void puzzle_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ void rails_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED
|
||||||
{
|
{
|
||||||
//we've to compute the quantity of segments in each direction
|
//we've to compute the quantity of segments in each direction
|
||||||
|
|
||||||
canvas_backup=SDL_CreateRGBSurface(SDL_ANYFORMAT, canvas->w, canvas->h, canvas->format->BitsPerPixel,
|
canvas_backup=SDL_CreateRGBSurface(SDL_SWSURFACE, canvas->w, canvas->h, canvas->format->BitsPerPixel,
|
||||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||||
|
|
||||||
SDL_BlitSurface(canvas, NULL, canvas_backup, NULL);
|
SDL_BlitSurface(canvas, NULL, canvas_backup, NULL);
|
||||||
|
|
@ -392,10 +392,10 @@ static void rails_draw(void * ptr, int which ATTRIBUTE_UNUSED, ATTRIBUTE_UNUSED
|
||||||
rails_status_of_segments[segment]=image; //and write it to global table
|
rails_status_of_segments[segment]=image; //and write it to global table
|
||||||
|
|
||||||
|
|
||||||
result=SDL_CreateRGBSurface(SDL_ANYFORMAT, img_w, img_h, rails_one->format->BitsPerPixel,
|
result=SDL_CreateRGBSurface(SDL_SWSURFACE, img_w, img_h, rails_one->format->BitsPerPixel,
|
||||||
rails_one->format->Rmask, rails_one->format->Gmask, rails_one->format->Bmask, rails_one->format->Amask);
|
rails_one->format->Rmask, rails_one->format->Gmask, rails_one->format->Bmask, rails_one->format->Amask);
|
||||||
|
|
||||||
temp=SDL_CreateRGBSurface(SDL_ANYFORMAT, img_w, img_h, rails_one->format->BitsPerPixel,
|
temp=SDL_CreateRGBSurface(SDL_SWSURFACE, img_w, img_h, rails_one->format->BitsPerPixel,
|
||||||
rails_one->format->Rmask, rails_one->format->Gmask, rails_one->format->Bmask, rails_one->format->Amask);
|
rails_one->format->Rmask, rails_one->format->Gmask, rails_one->format->Bmask, rails_one->format->Amask);
|
||||||
|
|
||||||
SDL_BlitSurface(canvas_backup, &modification_rect, result, NULL);
|
SDL_BlitSurface(canvas_backup, &modification_rect, result, NULL);
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ void string_shutdown(__attribute__((unused)) magic_api * api)
|
||||||
|
|
||||||
void string_switchin(__attribute__((unused)) magic_api * api, __attribute__((unused)) int which, __attribute__((unused)) int mode, SDL_Surface * canvas, __attribute__((unused)) SDL_Surface * snapshot)
|
void string_switchin(__attribute__((unused)) magic_api * api, __attribute__((unused)) int which, __attribute__((unused)) int mode, SDL_Surface * canvas, __attribute__((unused)) SDL_Surface * snapshot)
|
||||||
{
|
{
|
||||||
canvas_backup=SDL_CreateRGBSurface(SDL_ANYFORMAT, canvas->w, canvas->h, canvas->format->BitsPerPixel,
|
canvas_backup=SDL_CreateRGBSurface(SDL_SWSURFACE, canvas->w, canvas->h, canvas->format->BitsPerPixel,
|
||||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,8 @@ void show_progress_bar(SDL_Surface * screen)
|
||||||
|
|
||||||
prog_bar_ctr++;
|
prog_bar_ctr++;
|
||||||
|
|
||||||
SDL_UpdateRect(screen, 0, screen->h - 24, screen->w, 24);
|
// FIXME SDL2
|
||||||
|
// SDL_UpdateRect(screen, 0, screen->h - 24, screen->w, 24);
|
||||||
}
|
}
|
||||||
oldtime = newtime;
|
oldtime = newtime;
|
||||||
|
|
||||||
|
|
|
||||||
166
src/tuxpaint.c
166
src/tuxpaint.c
|
|
@ -867,6 +867,7 @@ static void SDL_Flip(SDL_Surface *screen)
|
||||||
SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, screen);
|
SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, screen);
|
||||||
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
|
SDL_UpdateWindowSurface(window_screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SDL_UpdateRect(SDL_Surface * screen, Sint32 x, Sint32 y, Sint32 w, Sint32 h)
|
static void SDL_UpdateRect(SDL_Surface * screen, Sint32 x, Sint32 y, Sint32 w, Sint32 h)
|
||||||
|
|
@ -878,6 +879,7 @@ static void SDL_UpdateRect(SDL_Surface * screen, Sint32 x, Sint32 y, Sint32 w, S
|
||||||
r.h = h;
|
r.h = h;
|
||||||
SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, screen);
|
SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, screen);
|
||||||
SDL_RenderCopy(renderer, texture, &r, &r);
|
SDL_RenderCopy(renderer, texture, &r, &r);
|
||||||
|
SDL_UpdateWindowSurface(window_screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -7817,8 +7819,9 @@ static SDL_Surface *do_loadimage(const char *const fname, int abort_on_error)
|
||||||
|
|
||||||
|
|
||||||
/* Convert to the display format: */
|
/* Convert to the display format: */
|
||||||
|
// FIXME SDL2
|
||||||
disp_fmt_s = SDL_DisplayFormatAlpha(s);
|
//disp_fmt_s = SDL_DisplayFormatAlpha(s);
|
||||||
|
disp_fmt_s = s;
|
||||||
if (disp_fmt_s == NULL)
|
if (disp_fmt_s == NULL)
|
||||||
{
|
{
|
||||||
if (abort_on_error)
|
if (abort_on_error)
|
||||||
|
|
@ -7829,7 +7832,7 @@ static SDL_Surface *do_loadimage(const char *const fname, int abort_on_error)
|
||||||
"The Simple DirectMedia Layer error that occurred was:\n"
|
"The Simple DirectMedia Layer error that occurred was:\n"
|
||||||
"%s\n\n", fname, SDL_GetError());
|
"%s\n\n", fname, SDL_GetError());
|
||||||
|
|
||||||
SDL_FreeSurface(s);
|
// SDL_FreeSurface(s);
|
||||||
cleanup();
|
cleanup();
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
@ -7843,7 +7846,7 @@ static SDL_Surface *do_loadimage(const char *const fname, int abort_on_error)
|
||||||
|
|
||||||
/* Free the temp. surface & return the converted one: */
|
/* Free the temp. surface & return the converted one: */
|
||||||
|
|
||||||
SDL_FreeSurface(s);
|
// SDL_FreeSurface(s);
|
||||||
|
|
||||||
return (disp_fmt_s);
|
return (disp_fmt_s);
|
||||||
}
|
}
|
||||||
|
|
@ -11253,8 +11256,10 @@ static void load_starter(char *img_id)
|
||||||
|
|
||||||
if (tmp_surf != NULL)
|
if (tmp_surf != NULL)
|
||||||
{
|
{
|
||||||
img_starter = SDL_DisplayFormatAlpha(tmp_surf);
|
// FIXME SDL2
|
||||||
SDL_FreeSurface(tmp_surf);
|
// img_starter = SDL_DisplayFormatAlpha(tmp_surf);
|
||||||
|
img_starter = tmp_surf;
|
||||||
|
// SDL_FreeSurface(tmp_surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try to load the a background image: */
|
/* Try to load the a background image: */
|
||||||
|
|
@ -11293,8 +11298,10 @@ static void load_starter(char *img_id)
|
||||||
|
|
||||||
if (tmp_surf != NULL)
|
if (tmp_surf != NULL)
|
||||||
{
|
{
|
||||||
img_starter_bkgd = SDL_DisplayFormat(tmp_surf);
|
// FIXME SDL2
|
||||||
SDL_FreeSurface(tmp_surf);
|
// img_starter_bkgd = SDL_DisplayFormat(tmp_surf);
|
||||||
|
img_starter_bkgd = tmp_surf;
|
||||||
|
// SDL_FreeSurface(tmp_surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -11449,8 +11456,10 @@ static void load_template(char *img_id)
|
||||||
|
|
||||||
if (tmp_surf != NULL)
|
if (tmp_surf != NULL)
|
||||||
{
|
{
|
||||||
img_starter_bkgd = SDL_DisplayFormat(tmp_surf);
|
// FIXME SDL2
|
||||||
SDL_FreeSurface(tmp_surf);
|
// img_starter_bkgd = SDL_DisplayFormat(tmp_surf);
|
||||||
|
img_starter_bkgd = tmp_surf;
|
||||||
|
//SDL_FreeSurface(tmp_surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -11545,7 +11554,9 @@ static void load_current(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
org_surf = SDL_DisplayFormat(tmp);
|
// FIXME SDL2
|
||||||
|
// org_surf = SDL_DisplayFormat(tmp);
|
||||||
|
org_surf = tmp;
|
||||||
autoscale_copy_smear_free(tmp, canvas, SDL_BlitSurface);
|
autoscale_copy_smear_free(tmp, canvas, SDL_BlitSurface);
|
||||||
|
|
||||||
/* First we run this for compatibility, then we will chek if
|
/* First we run this for compatibility, then we will chek if
|
||||||
|
|
@ -13931,8 +13942,10 @@ static int do_open(void)
|
||||||
/* Loaded the thumbnail from one or the other location */
|
/* Loaded the thumbnail from one or the other location */
|
||||||
show_progress_bar(screen);
|
show_progress_bar(screen);
|
||||||
|
|
||||||
img1 = SDL_DisplayFormat(img);
|
// FIXME SDL2
|
||||||
SDL_FreeSurface(img);
|
// img1 = SDL_DisplayFormat(img);
|
||||||
|
img1 = img;
|
||||||
|
// SDL_FreeSurface(img);
|
||||||
|
|
||||||
/* if too big, or too small in both dimensions, rescale it
|
/* if too big, or too small in both dimensions, rescale it
|
||||||
(for now: using old thumbnail as source for high speed, low quality) */
|
(for now: using old thumbnail as source for high speed, low quality) */
|
||||||
|
|
@ -13993,14 +14006,18 @@ static int do_open(void)
|
||||||
{
|
{
|
||||||
/* Turn it into a thumbnail: */
|
/* Turn it into a thumbnail: */
|
||||||
|
|
||||||
img1 = SDL_DisplayFormatAlpha(img);
|
// FIXME SDL2
|
||||||
|
// img1 = SDL_DisplayFormatAlpha(img);
|
||||||
|
img1 = img;
|
||||||
img2 = thumbnail2(img1, THUMB_W - 20, THUMB_H - 20, 0, 0);
|
img2 = thumbnail2(img1, THUMB_W - 20, THUMB_H - 20, 0, 0);
|
||||||
SDL_FreeSurface(img1);
|
//SDL_FreeSurface(img1);
|
||||||
|
|
||||||
show_progress_bar(screen);
|
show_progress_bar(screen);
|
||||||
|
|
||||||
thumbs[num_files] = SDL_DisplayFormat(img2);
|
// FIXME SDL2
|
||||||
SDL_FreeSurface(img2);
|
// thumbs[num_files] = SDL_DisplayFormat(img2);
|
||||||
|
thumbs[num_files] = img2;
|
||||||
|
//SDL_FreeSurface(img2);
|
||||||
if (thumbs[num_files] == NULL)
|
if (thumbs[num_files] == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
|
@ -14735,8 +14752,10 @@ static int do_open(void)
|
||||||
starter_flipped = 0;
|
starter_flipped = 0;
|
||||||
starter_personal = 0;
|
starter_personal = 0;
|
||||||
|
|
||||||
org_surf = SDL_DisplayFormat(img); /* Keep a copy of the original image
|
// FIXME SDL2
|
||||||
unscaled to send to load_embedded_data */
|
// org_surf = SDL_DisplayFormat(img); /* Keep a copy of the original image
|
||||||
|
// unscaled to send to load_embedded_data */
|
||||||
|
org_surf =img;
|
||||||
autoscale_copy_smear_free(img, canvas, SDL_BlitSurface);
|
autoscale_copy_smear_free(img, canvas, SDL_BlitSurface);
|
||||||
|
|
||||||
cur_undo = 0;
|
cur_undo = 0;
|
||||||
|
|
@ -14985,8 +15004,10 @@ static int do_slideshow(void)
|
||||||
debug("Thumbnail loaded, scaling");
|
debug("Thumbnail loaded, scaling");
|
||||||
show_progress_bar(screen);
|
show_progress_bar(screen);
|
||||||
|
|
||||||
img1 = SDL_DisplayFormat(img);
|
// FIXME SDL2
|
||||||
SDL_FreeSurface(img);
|
// img1 = SDL_DisplayFormat(img);
|
||||||
|
img1 = img;
|
||||||
|
// SDL_FreeSurface(img);
|
||||||
|
|
||||||
if (img1 != NULL)
|
if (img1 != NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -15045,14 +15066,18 @@ static int do_slideshow(void)
|
||||||
{
|
{
|
||||||
/* Turn it into a thumbnail: */
|
/* Turn it into a thumbnail: */
|
||||||
|
|
||||||
img1 = SDL_DisplayFormatAlpha(img);
|
// FIXME SDL2
|
||||||
|
// img1 = SDL_DisplayFormatAlpha(img);
|
||||||
|
img1 = img;
|
||||||
img2 = thumbnail2(img1, THUMB_W - 20, THUMB_H - 20, 0, 0);
|
img2 = thumbnail2(img1, THUMB_W - 20, THUMB_H - 20, 0, 0);
|
||||||
SDL_FreeSurface(img1);
|
// SDL_FreeSurface(img1);
|
||||||
|
|
||||||
show_progress_bar(screen);
|
show_progress_bar(screen);
|
||||||
|
|
||||||
thumbs[num_files] = SDL_DisplayFormat(img2);
|
// FIXME SDL2
|
||||||
SDL_FreeSurface(img2);
|
// thumbs[num_files] = SDL_DisplayFormat(img2);
|
||||||
|
thumbs[num_files] = img2;
|
||||||
|
//SDL_FreeSurface(img2);
|
||||||
|
|
||||||
SDL_FreeSurface(img);
|
SDL_FreeSurface(img);
|
||||||
|
|
||||||
|
|
@ -17158,7 +17183,9 @@ static SDL_Surface *duplicate_surface(SDL_Surface * orig)
|
||||||
amask));
|
amask));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return (SDL_DisplayFormatAlpha(orig));
|
// FIXME SDL2
|
||||||
|
// return (SDL_DisplayFormatAlpha(orig));
|
||||||
|
return(orig);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mirror_starter(void)
|
static void mirror_starter(void)
|
||||||
|
|
@ -17475,8 +17502,10 @@ static SDL_Surface * load_svg(char * file)
|
||||||
|
|
||||||
|
|
||||||
/* Convert the SDL surface to the display format, for faster blitting: */
|
/* Convert the SDL surface to the display format, for faster blitting: */
|
||||||
sdl_surface = SDL_DisplayFormatAlpha(sdl_surface_tmp);
|
// FIXME SDL2
|
||||||
SDL_FreeSurface(sdl_surface_tmp);
|
// sdl_surface = SDL_DisplayFormatAlpha(sdl_surface_tmp);
|
||||||
|
sdl_surface = sdl_surface_tmp;
|
||||||
|
// SDL_FreeSurface(sdl_surface_tmp);
|
||||||
|
|
||||||
if (sdl_surface == NULL)
|
if (sdl_surface == NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -17637,8 +17666,10 @@ static SDL_Surface * load_svg(char * file)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert the SDL surface to the display format, for faster blitting: */
|
/* Convert the SDL surface to the display format, for faster blitting: */
|
||||||
sdl_surface = SDL_DisplayFormatAlpha(sdl_surface_tmp);
|
// FIXME SDL2
|
||||||
SDL_FreeSurface(sdl_surface_tmp);
|
// sdl_surface = SDL_DisplayFormatAlpha(sdl_surface_tmp);
|
||||||
|
sdl_surface = sdl_surface_tmp;
|
||||||
|
// SDL_FreeSurface(sdl_surface_tmp);
|
||||||
|
|
||||||
if (sdl_surface == NULL)
|
if (sdl_surface == NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -18771,8 +18802,10 @@ static int do_new_dialog(void)
|
||||||
/* Loaded the thumbnail from one or the other location */
|
/* Loaded the thumbnail from one or the other location */
|
||||||
show_progress_bar(screen);
|
show_progress_bar(screen);
|
||||||
|
|
||||||
img1 = SDL_DisplayFormat(img);
|
// FIXME SDL2
|
||||||
SDL_FreeSurface(img);
|
// img1 = SDL_DisplayFormat(img);
|
||||||
|
img1 =img;
|
||||||
|
// SDL_FreeSurface(img);
|
||||||
|
|
||||||
/* if too big, or too small in both dimensions, rescale it
|
/* if too big, or too small in both dimensions, rescale it
|
||||||
(for now: using old thumbnail as source for high speed,
|
(for now: using old thumbnail as source for high speed,
|
||||||
|
|
@ -18877,14 +18910,18 @@ static int do_new_dialog(void)
|
||||||
{
|
{
|
||||||
/* Turn it into a thumbnail: */
|
/* Turn it into a thumbnail: */
|
||||||
|
|
||||||
img1 = SDL_DisplayFormatAlpha(img);
|
// FIXME SDL2
|
||||||
|
// img1 = SDL_DisplayFormatAlpha(img);
|
||||||
|
img1 = img;
|
||||||
img2 = thumbnail2(img1, THUMB_W - 20, THUMB_H - 20, 0, 0);
|
img2 = thumbnail2(img1, THUMB_W - 20, THUMB_H - 20, 0, 0);
|
||||||
SDL_FreeSurface(img1);
|
// SDL_FreeSurface(img1);
|
||||||
|
|
||||||
show_progress_bar(screen);
|
show_progress_bar(screen);
|
||||||
|
|
||||||
thumbs[num_files] = SDL_DisplayFormat(img2);
|
// FIXME SDL2
|
||||||
SDL_FreeSurface(img2);
|
// thumbs[num_files] = SDL_DisplayFormat(img2);
|
||||||
|
thumbs[num_files] = img2;
|
||||||
|
//SDL_FreeSurface(img2);
|
||||||
if (thumbs[num_files] == NULL)
|
if (thumbs[num_files] == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
|
@ -23002,7 +23039,7 @@ static void do_lock_file(void)
|
||||||
free(lock_fname);
|
free(lock_fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
int TP_EventFilter(const SDL_Event * event, void *data)
|
int TP_EventFilter(void *data, const SDL_Event * event)
|
||||||
{
|
{
|
||||||
if (event->type == SDL_QUIT ||
|
if (event->type == SDL_QUIT ||
|
||||||
event->type == SDL_WINDOWEVENT ||
|
event->type == SDL_WINDOWEVENT ||
|
||||||
|
|
@ -23250,20 +23287,26 @@ static void setup(void)
|
||||||
#ifdef USE_HWSURFACE
|
#ifdef USE_HWSURFACE
|
||||||
/* screen = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT,
|
/* screen = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT,
|
||||||
VIDEO_BPP, SDL_FULLSCREEN | SDL_HWSURFACE);*/
|
VIDEO_BPP, SDL_FULLSCREEN | SDL_HWSURFACE);*/
|
||||||
SDL_Window *window_screen = SDL_CreateWindow("Tux Paint",
|
window_screen = SDL_CreateWindow("Tux Paint",
|
||||||
SDL_WINDOWPOS_UNDEFINED,
|
SDL_WINDOWPOS_UNDEFINED,
|
||||||
SDL_WINDOWPOS_UNDEFINED,
|
SDL_WINDOWPOS_UNDEFINED,
|
||||||
WINDOW_WIDTH, WINDOW_HEIGHT,
|
WINDOW_WIDTH, WINDOW_HEIGHT,
|
||||||
SDL_WINDOW_FULLSCREEN | SDL_WINDOW_HWSURFACE);
|
SDL_WINDOW_FULLSCREEN | SDL_WINDOW_HWSURFACE);
|
||||||
|
printf("1\n");
|
||||||
|
if (window_screen == NULL)
|
||||||
|
printf("window_screen = NULL 1\n");
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* screen = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT,
|
/* screen = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT,
|
||||||
VIDEO_BPP, SDL_FULLSCREEN | SDL_SWSURFACE);*/
|
VIDEO_BPP, SDL_FULLSCREEN | SDL_SWSURFACE);*/
|
||||||
SDL_Window *window_screen = SDL_CreateWindow("Tux Paint",
|
window_screen = SDL_CreateWindow("Tux Paint",
|
||||||
SDL_WINDOWPOS_UNDEFINED,
|
SDL_WINDOWPOS_UNDEFINED,
|
||||||
SDL_WINDOWPOS_UNDEFINED,
|
SDL_WINDOWPOS_UNDEFINED,
|
||||||
WINDOW_WIDTH, WINDOW_HEIGHT,
|
WINDOW_WIDTH, WINDOW_HEIGHT,
|
||||||
SDL_WINDOW_FULLSCREEN );
|
SDL_WINDOW_FULLSCREEN );
|
||||||
|
printf("2\n");
|
||||||
|
if (window_screen == NULL)
|
||||||
|
printf("window_screen = NULL 2\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
screen = SDL_GetWindowSurface(window_screen);
|
screen = SDL_GetWindowSurface(window_screen);
|
||||||
|
|
@ -23303,20 +23346,27 @@ static void setup(void)
|
||||||
#ifdef USE_HWSURFACE
|
#ifdef USE_HWSURFACE
|
||||||
/* screen = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT,
|
/* screen = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT,
|
||||||
VIDEO_BPP, SDL_HWSURFACE);*/
|
VIDEO_BPP, SDL_HWSURFACE);*/
|
||||||
SDL_Window *window_screen = SDL_CreateWindow("Tux Paint",
|
window_screen = SDL_CreateWindow("Tux Paint",
|
||||||
SDL_WINDOWPOS_UNDEFINED,
|
SDL_WINDOWPOS_UNDEFINED,
|
||||||
SDL_WINDOWPOS_UNDEFINED,
|
SDL_WINDOWPOS_UNDEFINED,
|
||||||
WINDOW_WIDTH, WINDOW_HEIGHT,
|
WINDOW_WIDTH, WINDOW_HEIGHT,
|
||||||
SDL_WINDOW_FULLSCREEN | SDL_WINDOW_HWSURFACE);
|
SDL_WINDOW_FULLSCREEN | SDL_WINDOW_HWSURFACE);
|
||||||
|
printf("3\n");
|
||||||
|
if (window_screen == NULL)
|
||||||
|
printf("window_screen = NULL 3\n");
|
||||||
#else
|
#else
|
||||||
SDL_Window *window_screen = SDL_CreateWindow("Tux Paint",
|
window_screen = SDL_CreateWindow("Tux Paint",
|
||||||
SDL_WINDOWPOS_UNDEFINED,
|
SDL_WINDOWPOS_UNDEFINED,
|
||||||
SDL_WINDOWPOS_UNDEFINED,
|
SDL_WINDOWPOS_UNDEFINED,
|
||||||
WINDOW_WIDTH, WINDOW_HEIGHT,
|
WINDOW_WIDTH, WINDOW_HEIGHT,
|
||||||
SDL_WINDOW_FULLSCREEN);
|
SDL_WINDOW_FULLSCREEN);
|
||||||
/* screen = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT,
|
/* screen = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT,
|
||||||
s
|
s
|
||||||
VIDEO_BPP, SDL_SWSURFACE);*/
|
VIDEO_BPP, SDL_SWSURFACE);*/
|
||||||
|
printf("4\n");
|
||||||
|
if (window_screen == NULL)
|
||||||
|
printf("window_screen = NULL 4\n");
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (set_window_pos)
|
if (set_window_pos)
|
||||||
|
|
@ -23328,7 +23378,7 @@ s
|
||||||
if (screen == NULL)
|
if (screen == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"\nError: I could not open the display.\n"
|
"\nError: 1 I could not open the display.\n"
|
||||||
"The Simple DirectMedia Layer error that occurred was:\n"
|
"The Simple DirectMedia Layer error that occurred was:\n"
|
||||||
"%s\n\n", SDL_GetError());
|
"%s\n\n", SDL_GetError());
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue