Skip to content

Commit

Permalink
Removed unused code in gfx
Browse files Browse the repository at this point in the history
  • Loading branch information
midwan committed Jan 30, 2022
1 parent 8e275b5 commit d4e8406
Showing 1 changed file with 0 additions and 141 deletions.
141 changes: 0 additions & 141 deletions src/osdep/amiberry_gfx.cpp
Expand Up @@ -75,23 +75,6 @@ bool isModeAspectRatioExact(SDL_DisplayMode* mode, const int width, const int he
return mode->w % width == 0 && mode->h % height == 0;
}

#if 0
static bool SDL2_renderframe(int monid, int mode, bool immediate)
{
SDL_RenderCopyEx(sdl_renderer, amiga_texture, nullptr, &renderQuad, amiberry_options.rotation_angle, nullptr, SDL_FLIP_NONE);
return true;
}

static void SDL2_free()
{
if (amiga_texture)
{
SDL_DestroyTexture(amiga_texture);
amiga_texture = nullptr;
}
}
#endif

static float SDL2_getrefreshrate(int monid)
{
SDL_DisplayMode mode;
Expand All @@ -103,130 +86,6 @@ static float SDL2_getrefreshrate(int monid)
return static_cast<float>(mode.refresh_rate);
}

#if 0
static int SDL2_GetCurrentDepth()
{
SDL_DisplayMode dm;
if (SDL_GetDesktopDisplayMode(0, &dm) != 0) {
SDL_Log("SDL_GetDesktopDisplayMode failed: %s\n", SDL_GetError());
return 1;
}
return SDL_BITSPERPIXEL(dm.format);
}

static int SDL2_init(SDL_Window* ahwnd, int monid, int width, int height, int depth, int* freq, int mmulth, int mmultv)
{
struct amigadisplay* ad = &adisplays[monid];
struct apmode* apm = ad->picasso_on ? &currprefs.gfx_apmode[APMODE_RTG] : &currprefs.gfx_apmode[APMODE_NATIVE];
SDL_DisplayMode sdl_mode;

write_log(_T("SDL2 init start. (%d*%d) (%d*%d) RTG=%d Depth=%d.\n"), width, height, width, height, ad->picasso_on, depth);

pixel_format = depth == 32 ? SDL_PIXELFORMAT_RGBA32 : SDL_PIXELFORMAT_RGB565;

if (amiberry_options.rotation_angle == 0 || amiberry_options.rotation_angle == 180)
{
SDL_RenderSetLogicalSize(sdl_renderer, width, height);
renderQuad = { 0, 0, width, height };
}
else
{
SDL_RenderSetLogicalSize(sdl_renderer, height, width);
renderQuad = { -(width - height) / 2, (width - height) / 2, width, height };
}

if (isfullscreen() == 0)
SDL_SetWindowSize(ahwnd, width, height);

SDL_GetCurrentDisplayMode(0, &sdl_mode);
if (currprefs.scaling_method == -1)
{
if (isModeAspectRatioExact(&sdl_mode, width, height))
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest");
else
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
}
else if (currprefs.scaling_method == 0)
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest");
else if (currprefs.scaling_method == 1)
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");

return 0;
}

static bool SDL2_alloctexture(int monid, int w, int h)
{
if (amiga_texture == nullptr)
amiga_texture = SDL_CreateTexture(sdl_renderer, pixel_format, SDL_TEXTUREACCESS_STREAMING, w, h);
if (amiga_texture == nullptr)
{
write_log("SDL_CreateTexture failed!");
return false;
}
return true;
}

static void SDL2_refresh(int monid)
{
SDL2_renderframe(monid, true, true);
SDL_RenderPresent(sdl_renderer);
}

void SDL2_guimode(int monid, int guion)
{
struct AmigaMonitor* mon = &AMonitors[monid];

if (isfullscreen() <= 0)
return;

if (guion > 0)
{
SDL2_free();
SDL_HideWindow(mon->sdl_window);
}
}

void SDL2_getpixelformat(int depth, int* rb, int* gb, int* bb, int* rs, int* gs, int* bs, int* ab, int* as, int* a)
{
switch (depth)
{
case 32:
*rb = 8;
*gb = 8;
*bb = 8;
*ab = 8;
*rs = 16;
*gs = 8;
*bs = 0;
*as = 24;
*a = 0;
break;
case 15:
*rb = 5;
*gb = 5;
*bb = 5;
*ab = 1;
*rs = 10;
*gs = 5;
*bs = 0;
*as = 15;
*a = 0;
break;
case 16:
*rb = 5;
*gb = 6;
*bb = 5;
*ab = 0;
*rs = 11;
*gs = 5;
*bs = 0;
*as = 0;
*a = 0;
break;
}
}
#endif

struct PicassoResolution* DisplayModes;
struct MultiDisplay Displays[MAX_DISPLAYS];

Expand Down

0 comments on commit d4e8406

Please sign in to comment.