Decouple <cstdint>
This commit is contained in:
@@ -3,10 +3,13 @@
|
||||
|
||||
#include "LowLevelWindow.h"
|
||||
#include "RageDisplay.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <objc/objc.h>
|
||||
|
||||
typedef const struct __CFDictionary *CFDictionaryRef;
|
||||
typedef uint32_t CGDirectDisplayID;
|
||||
typedef std::uint32_t CGDirectDisplayID;
|
||||
|
||||
class LowLevelWindow_MacOSX : public LowLevelWindow
|
||||
{
|
||||
@@ -21,7 +24,7 @@ public:
|
||||
LowLevelWindow_MacOSX();
|
||||
~LowLevelWindow_MacOSX();
|
||||
void *GetProcAddress( RString s );
|
||||
RString TryVideoMode( const VideoModeParams& p, bool& newDeviceOut );
|
||||
RString TryVideoMode( const VideoModeParams& p, bool& newDeviceOut );
|
||||
void GetDisplaySpecs( DisplaySpecs &specs ) const;
|
||||
|
||||
void SwapBuffers();
|
||||
@@ -51,7 +54,7 @@ private:
|
||||
/*
|
||||
* (c) 2005-2006, 2008 Steve Checkoway
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -61,7 +64,7 @@ private:
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#import "arch/ArchHooks/ArchHooks.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <OpenGL/OpenGL.h>
|
||||
@@ -189,7 +190,7 @@ public:
|
||||
RenderTarget_MacOSX( id shareContext );
|
||||
~RenderTarget_MacOSX();
|
||||
void Create( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut );
|
||||
uintptr_t GetTexture() const { return static_cast<uintptr_t>(m_iTexHandle); }
|
||||
std::uintptr_t GetTexture() const { return static_cast<std::uintptr_t>(m_iTexHandle); }
|
||||
void StartRenderingTo();
|
||||
void FinishRenderingTo();
|
||||
|
||||
@@ -325,11 +326,11 @@ void *LowLevelWindow_MacOSX::GetProcAddress( RString s )
|
||||
// http://developer.apple.com/qa/qa2001/qa1188.html
|
||||
// Both functions mentioned in there are deprecated in 10.4.
|
||||
const RString& symbolName( '_' + s );
|
||||
const uint32_t count = _dyld_image_count();
|
||||
const std::uint32_t count = _dyld_image_count();
|
||||
NSSymbol symbol = nil;
|
||||
const uint32_t options = NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR;
|
||||
const std::uint32_t options = NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR;
|
||||
|
||||
for( uint32_t i = 0; i < count && !symbol; ++i )
|
||||
for( std::uint32_t i = 0; i < count && !symbol; ++i )
|
||||
symbol = NSLookupSymbolInImage( _dyld_get_image_header(i), symbolName, options );
|
||||
return symbol ? NSAddressOfSymbol( symbol ) : nil;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include "RageDisplay_OGL_Helpers.h"
|
||||
#include "RageDisplay_OGL.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
static PIXELFORMATDESCRIPTOR g_CurrentPixelFormat;
|
||||
@@ -129,7 +131,7 @@ void DumpPixelFormat( const PIXELFORMATDESCRIPTOR &pfd )
|
||||
RString LowLevelWindow_Win32::TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut )
|
||||
{
|
||||
//LOG->Warn( "LowLevelWindow_Win32::TryVideoMode" );
|
||||
|
||||
|
||||
ASSERT_M( p.bpp == 16 || p.bpp == 32, ssprintf("%i", p.bpp) );
|
||||
|
||||
bNewDeviceOut = false;
|
||||
@@ -323,10 +325,10 @@ public:
|
||||
virtual ~RenderTarget_Win32();
|
||||
|
||||
void Create( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut );
|
||||
uintptr_t GetTexture() const { return static_cast<uintptr_t>(m_texHandle); }
|
||||
std::uintptr_t GetTexture() const { return static_cast<std::uintptr_t>(m_texHandle); }
|
||||
void StartRenderingTo();
|
||||
void FinishRenderingTo();
|
||||
|
||||
|
||||
virtual bool InvertY() const { return true; }
|
||||
|
||||
private:
|
||||
@@ -415,7 +417,7 @@ void RenderTarget_Win32::FinishRenderingTo()
|
||||
|
||||
BOOL successful = wglMakeCurrent(m_hOldDeviceContext, m_hOldRenderContext);
|
||||
ASSERT_M( successful == TRUE, "wglMakeCurrent failed in RenderTarget_Win32::FinishRenderingTo()" );
|
||||
|
||||
|
||||
m_hOldDeviceContext = 0;
|
||||
m_hOldRenderContext = 0;
|
||||
}
|
||||
@@ -428,7 +430,7 @@ RenderTarget* LowLevelWindow_Win32::CreateRenderTarget()
|
||||
/*
|
||||
* (c) 2004 Glenn Maynard
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -438,7 +440,7 @@ RenderTarget* LowLevelWindow_Win32::CreateRenderTarget()
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
@@ -13,7 +13,9 @@ using namespace RageDisplay_Legacy_Helpers;
|
||||
using namespace X11Helper;
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <set>
|
||||
|
||||
#include <GL/glxew.h>
|
||||
#define GLX_GLXEXT_PROTOTYPES
|
||||
#include <GL/glx.h> // All sorts of stuff...
|
||||
@@ -315,7 +317,7 @@ RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDe
|
||||
// If an output name has been specified, search for it
|
||||
RROutput targetOut = None;
|
||||
if (p.sDisplayId.length() > 0) {
|
||||
for (unsigned int i = 0; i < static_cast<uint32_t>(scrRes->noutput) && targetOut == None; ++i) {
|
||||
for (unsigned int i = 0; i < static_cast<std::uint32_t>(scrRes->noutput) && targetOut == None; ++i) {
|
||||
XRROutputInfo *outInfo = XRRGetOutputInfo(Dpy, scrRes, scrRes->outputs[i]);
|
||||
std::string outName = std::string(outInfo->name, static_cast<unsigned int> (outInfo->nameLen));
|
||||
if (p.sDisplayId == outName) {
|
||||
@@ -335,7 +337,7 @@ RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDe
|
||||
// (it is possible the connection state could be unknown), we'll at least
|
||||
// look for an output with a CRTC driving it
|
||||
RROutput connected = None, hasCrtc = None;
|
||||
for (unsigned int i = 0; i < static_cast<uint32_t>(scrRes->noutput); ++i) {
|
||||
for (unsigned int i = 0; i < static_cast<std::uint32_t>(scrRes->noutput); ++i) {
|
||||
XRROutputInfo *outInfo = XRRGetOutputInfo(Dpy, scrRes, scrRes->outputs[i]);
|
||||
if (outInfo->connection == RR_Connected) { // Check for CONNECTED state: Connected == 0
|
||||
connected = scrRes->outputs[i];
|
||||
@@ -362,7 +364,7 @@ RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDe
|
||||
RRCrtc tgtOutCrtc = tgtOutInfo->crtc;
|
||||
if (tgtOutCrtc == None)
|
||||
{
|
||||
for (unsigned int i = 0; i < static_cast<uint32_t>(tgtOutInfo->ncrtc); ++i)
|
||||
for (unsigned int i = 0; i < static_cast<std::uint32_t>(tgtOutInfo->ncrtc); ++i)
|
||||
{
|
||||
XRRCrtcInfo *crtcInfo = XRRGetCrtcInfo( Dpy, scrRes, tgtOutInfo->crtcs[i] );
|
||||
if (crtcInfo->mode == None)
|
||||
@@ -390,7 +392,7 @@ RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDe
|
||||
const XRRModeInfo &thisMI = scrRes->modes[i];
|
||||
const unsigned int modeWidth = bPortrait ? thisMI.height : thisMI.width;
|
||||
const unsigned int modeHeight = bPortrait ? thisMI.width : thisMI.height;
|
||||
if (p.width >= 0 && p.height >= 0 && modeWidth == static_cast<uint32_t>(p.width) && modeHeight == static_cast<uint32_t>(p.height)) {
|
||||
if (p.width >= 0 && p.height >= 0 && modeWidth == static_cast<std::uint32_t>(p.width) && modeHeight == static_cast<std::uint32_t>(p.height)) {
|
||||
float fTempRefresh = calcRandRRefresh(thisMI.dotClock, thisMI.hTotal, thisMI.vTotal);
|
||||
float fTempDiff = std::abs(p.rate - fTempRefresh);
|
||||
if ((p.rate != REFRESH_DEFAULT && fTempDiff < fRefreshDiff) ||
|
||||
@@ -660,11 +662,11 @@ void LowLevelWindow_X11::GetDisplaySpecs(DisplaySpecs &out) const {
|
||||
int nsizes = 0;
|
||||
XRRScreenSize *screenSizes = XRRSizes( Dpy, screenNum, &nsizes);
|
||||
DisplayMode screenCurMode{};
|
||||
for (unsigned int szIdx = 0, mode_idx = 0; nsizes >= 0 && szIdx < static_cast<uint32_t>(nsizes); ++szIdx) {
|
||||
for (unsigned int szIdx = 0, mode_idx = 0; nsizes >= 0 && szIdx < static_cast<std::uint32_t>(nsizes); ++szIdx) {
|
||||
XRRScreenSize &size = screenSizes[szIdx];
|
||||
int nrates = 0;
|
||||
short *rates = XRRRates(Dpy, screenNum, szIdx, &nrates);
|
||||
for (unsigned int rIdx = 0; nrates >=0 && rIdx < static_cast<uint32_t>(nrates); ++rIdx, ++mode_idx) {
|
||||
for (unsigned int rIdx = 0; nrates >=0 && rIdx < static_cast<std::uint32_t>(nrates); ++rIdx, ++mode_idx) {
|
||||
DisplayMode m = {static_cast<unsigned int> (size.width), static_cast<unsigned int> (size.height), static_cast<double> (rates[rIdx])};
|
||||
screenModes.insert(m);
|
||||
if (rates[rIdx] == curRate && szIdx == curSizeId) {
|
||||
@@ -694,7 +696,7 @@ void LowLevelWindow_X11::GetDisplaySpecs(DisplaySpecs &out) const {
|
||||
}
|
||||
|
||||
// Now, for each output, build a corresponding DisplaySpec
|
||||
for (unsigned int outIdx = 0; outIdx < static_cast<uint32_t>(scrRes->noutput); ++outIdx)
|
||||
for (unsigned int outIdx = 0; outIdx < static_cast<std::uint32_t>(scrRes->noutput); ++outIdx)
|
||||
{
|
||||
XRROutputInfo *outInfo = XRRGetOutputInfo( Dpy, scrRes, scrRes->outputs[outIdx] );
|
||||
if (outInfo->nmode > 0)
|
||||
@@ -717,7 +719,7 @@ void LowLevelWindow_X11::GetDisplaySpecs(DisplaySpecs &out) const {
|
||||
std::set<DisplayMode> outputSupported;
|
||||
DisplayMode outputCurMode{};
|
||||
RectI outBounds;
|
||||
for (unsigned int modeIdx = 0; modeIdx < static_cast<uint32_t>(outInfo->nmode); ++modeIdx)
|
||||
for (unsigned int modeIdx = 0; modeIdx < static_cast<std::uint32_t>(outInfo->nmode); ++modeIdx)
|
||||
{
|
||||
DisplayMode mode = outputModes[outInfo->modes[modeIdx]];
|
||||
unsigned int modeWidth = bPortrait ? mode.height : mode.width;
|
||||
@@ -758,7 +760,7 @@ public:
|
||||
~RenderTarget_X11();
|
||||
|
||||
void Create( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut );
|
||||
uintptr_t GetTexture() const { return static_cast<uintptr_t>(m_iTexHandle); }
|
||||
std::uintptr_t GetTexture() const { return static_cast<std::uintptr_t>(m_iTexHandle); }
|
||||
void StartRenderingTo();
|
||||
void FinishRenderingTo();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user