introduce GFX2_UpdateScreen()

This commit is contained in:
Thomas Bernard 2018-06-19 12:14:33 +02:00
parent bf29a6837c
commit 22e0bcc01f
3 changed files with 24 additions and 4 deletions

View File

@ -1093,11 +1093,17 @@ int Get_input(int sleep_time)
{
Compute_paintbrush_coordinates();
Display_cursor();
#if defined(USE_SDL2)
//GFX2_UpdateScreen();
#endif
return 1;
}
if (user_feedback_required)
return 1;
#if defined(USE_SDL2)
GFX2_UpdateScreen();
#endif
// Nothing significant happened
if (sleep_time)
SDL_Delay(sleep_time);

View File

@ -57,4 +57,8 @@ extern volatile int Allow_colorcycling;
/// Activates or desactivates file drag-dropping in program window.
void Allow_drag_and_drop(int flag);
#if defined(USE_SDL2)
void GFX2_UpdateScreen(void);
#endif
#endif // SCREEN_H_INCLUDED

View File

@ -178,8 +178,13 @@ static void GFX2_UpdateRect(int x, int y, int width, int height)
source_rect.x = x;
source_rect.y = y;
source_rect.w = width;
source_rect.h = height;
if (width == 0 && height == 0) {
source_rect.w = Screen_SDL->w;
source_rect.h = Screen_SDL->h;
} else {
source_rect.w = width;
source_rect.h = height;
}
if (RGBcopy == NULL)
{
@ -196,7 +201,12 @@ static void GFX2_UpdateRect(int x, int y, int width, int height)
memcpy(pixels + line * pitch, RGBcopy->pixels + source_rect.x * 4 + (source_rect.y+line)* RGBcopy->pitch, source_rect.w * 4 );
}
SDL_UnlockTexture(Texture_SDL);
SDL_RenderCopy(Renderer_SDL, Texture_SDL, &source_rect, &source_rect);
//SDL_RenderCopy(Renderer_SDL, Texture_SDL, &source_rect, &source_rect);
}
void GFX2_UpdateScreen(void)
{
SDL_RenderCopy(Renderer_SDL, Texture_SDL, NULL, NULL);
SDL_RenderPresent(Renderer_SDL);
}
#endif