Skip to content

Commit 0f3efc8

Browse files
committed
[unix] Fix Unix builds using the SDL library.
1 parent 29a1082 commit 0f3efc8

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

unix/disp_sdl.cpp

+25-24
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "disp_sdl.h"
4343

4444
#include <algorithm>
45+
#include <memory>
4546

4647
#include <boost/format.hpp>
4748

@@ -54,7 +55,7 @@ namespace pov_frontend
5455
using namespace vfe;
5556
using namespace vfePlatform;
5657

57-
extern shared_ptr<Display> gDisplay;
58+
extern std::shared_ptr<Display> gDisplay;
5859

5960
const UnixOptionsProcessor::Option_Info UnixSDLDisplay::Options[] =
6061
{
@@ -181,8 +182,8 @@ namespace pov_frontend
181182
// [JG] about testing vs ...(-1), have a look at SDL_ListModes API (the return is very ugly).
182183
if ((modes != nullptr) && (reinterpret_cast<SDL_Rect**>(-1) != modes))
183184
{
184-
width = min(modes[0]->w - 10, width);
185-
height = min(modes[0]->h - 80, height);
185+
width = std::min(modes[0]->w - 10, width);
186+
height = std::min(modes[0]->h - 80, height);
186187
}
187188
}
188189

@@ -250,7 +251,7 @@ namespace pov_frontend
250251
* The difference is nearly invisible until the values of GetWidth and GetHeight are subtil (such as +W2596 +H1003 on a display of 1920 x 1080)
251252
* where in such situation, the computed ratio is not exactly the same as the other.
252253
*/
253-
m_display_scale = min(float(width) / GetWidth(), float(height) / GetHeight());
254+
m_display_scale = std::min(float(width) / GetWidth(), float(height) / GetHeight());
254255
}
255256

256257
SetCaption(false);
@@ -345,10 +346,10 @@ namespace pov_frontend
345346
{
346347
unsigned int rx2 = m_update_rect.x + m_update_rect.w;
347348
unsigned int ry2 = m_update_rect.y + m_update_rect.h;
348-
m_update_rect.x = min((unsigned int)m_update_rect.x, x);
349-
m_update_rect.y = min((unsigned int)m_update_rect.y, y);
350-
rx2 = max(rx2, x);
351-
ry2 = max(ry2, y);
349+
m_update_rect.x = std::min((unsigned int)m_update_rect.x, x);
350+
m_update_rect.y = std::min((unsigned int)m_update_rect.y, y);
351+
rx2 = std::max(rx2, x);
352+
ry2 = std::max(ry2, y);
352353
m_update_rect.w = rx2 - m_update_rect.x;
353354
m_update_rect.h = ry2 - m_update_rect.y;
354355
}
@@ -357,10 +358,10 @@ namespace pov_frontend
357358
{
358359
unsigned int rx2 = m_update_rect.x + m_update_rect.w;
359360
unsigned int ry2 = m_update_rect.y + m_update_rect.h;
360-
m_update_rect.x = min((unsigned int)m_update_rect.x, x1);
361-
m_update_rect.y = min((unsigned int)m_update_rect.y, y1);
362-
rx2 = max(rx2, x2);
363-
ry2 = max(ry2, y2);
361+
m_update_rect.x = std::min((unsigned int)m_update_rect.x, x1);
362+
m_update_rect.y = std::min((unsigned int)m_update_rect.y, y1);
363+
rx2 = std::max(rx2, x2);
364+
ry2 = std::max(ry2, y2);
364365
m_update_rect.w = rx2 - m_update_rect.x;
365366
m_update_rect.h = ry2 - m_update_rect.y;
366367
}
@@ -405,10 +406,10 @@ namespace pov_frontend
405406
if (!m_valid)
406407
return;
407408

408-
int ix1 = min(x1, GetWidth()-1);
409-
int ix2 = min(x2, GetWidth()-1);
410-
int iy1 = min(y1, GetHeight()-1);
411-
int iy2 = min(y2, GetHeight()-1);
409+
int ix1 = std::min(x1, GetWidth()-1);
410+
int ix2 = std::min(x2, GetWidth()-1);
411+
int iy1 = std::min(y1, GetHeight()-1);
412+
int iy2 = std::min(y2, GetHeight()-1);
412413

413414
if (SDL_MUSTLOCK(m_display) && SDL_LockSurface(m_display) < 0)
414415
return;
@@ -455,10 +456,10 @@ namespace pov_frontend
455456
if (!m_valid)
456457
return;
457458

458-
unsigned int ix1 = min(x1, GetWidth()-1);
459-
unsigned int ix2 = min(x2, GetWidth()-1);
460-
unsigned int iy1 = min(y1, GetHeight()-1);
461-
unsigned int iy2 = min(y2, GetHeight()-1);
459+
unsigned int ix1 = std::min(x1, GetWidth()-1);
460+
unsigned int ix2 = std::min(x2, GetWidth()-1);
461+
unsigned int iy1 = std::min(y1, GetHeight()-1);
462+
unsigned int iy2 = std::min(y2, GetHeight()-1);
462463

463464
if (m_display_scaled)
464465
{
@@ -487,10 +488,10 @@ namespace pov_frontend
487488
if (!m_valid)
488489
return;
489490

490-
unsigned int ix1 = min(x1, GetWidth()-1);
491-
unsigned int ix2 = min(x2, GetWidth()-1);
492-
unsigned int iy1 = min(y1, GetHeight()-1);
493-
unsigned int iy2 = min(y2, GetHeight()-1);
491+
unsigned int ix1 = std::min(x1, GetWidth()-1);
492+
unsigned int ix2 = std::min(x2, GetWidth()-1);
493+
unsigned int iy1 = std::min(y1, GetHeight()-1);
494+
unsigned int iy2 = std::min(y2, GetHeight()-1);
494495

495496
if (SDL_MUSTLOCK(m_display) && SDL_LockSurface(m_display) < 0)
496497
return;

0 commit comments

Comments
 (0)