| 1 |
/* |
| 2 |
* Copyright (C) 2005-2018 Team Kodi |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#include "WinSystemOSXGL.h" |
| 10 |
|
| 11 |
#include "guilib/Texture.h" |
| 12 |
#include "rendering/gl/RenderSystemGL.h" |
| 13 |
#include "windowing/WindowSystemFactory.h" |
| 14 |
|
| 15 |
void CWinSystemOSXGL::Register() |
| 16 |
{ |
| 17 |
KODI::WINDOWING::CWindowSystemFactory::RegisterWindowSystem(CreateWinSystem); |
| 18 |
} |
| 19 |
|
| 20 |
std::unique_ptr<CWinSystemBase> CWinSystemOSXGL::CreateWinSystem() |
| 21 |
{ |
| 22 |
return std::make_unique<CWinSystemOSXGL>(); |
| 23 |
} |
| 24 |
|
| 25 |
void CWinSystemOSXGL::PresentRenderImpl(bool rendered) |
| 26 |
{ |
| 27 |
if (rendered) |
| 28 |
FlushBuffer(); |
| 29 |
|
| 30 |
if (m_delayDispReset && m_dispResetTimer.IsTimePast()) |
| 31 |
{ |
| 32 |
m_delayDispReset = false; |
| 33 |
AnnounceOnResetDevice(); |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
void CWinSystemOSXGL::SetVSyncImpl(bool enable) |
| 38 |
{ |
| 39 |
EnableVSync(false); |
| 40 |
|
| 41 |
if (enable) |
| 42 |
{ |
| 43 |
EnableVSync(true); |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
bool CWinSystemOSXGL::ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop) |
| 48 |
{ |
| 49 |
CWinSystemOSX::ResizeWindow(newWidth, newHeight, newLeft, newTop); |
| 50 |
CRenderSystemGL::ResetRenderSystem(newWidth, newHeight); |
| 51 |
|
| 52 |
if (m_bVSync) |
| 53 |
{ |
| 54 |
EnableVSync(m_bVSync); |
| 55 |
} |
| 56 |
|
| 57 |
return true; |
| 58 |
} |
| 59 |
|
| 60 |
bool CWinSystemOSXGL::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) |
| 61 |
{ |
| 62 |
CWinSystemOSX::SetFullScreen(fullScreen, res, blankOtherDisplays); |
| 63 |
CRenderSystemGL::ResetRenderSystem(res.iWidth - res.guiInsets.right - res.guiInsets.left, |
| 64 |
res.iHeight - res.guiInsets.top - res.guiInsets.bottom); |
| 65 |
|
| 66 |
if (m_bVSync) |
| 67 |
{ |
| 68 |
EnableVSync(m_bVSync); |
| 69 |
} |
| 70 |
|
| 71 |
return true; |
| 72 |
} |
| 73 |
|