diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-12-25 03:27:23 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-12-25 03:27:23 +0300 |
commit | c456cb3f7eea27839c4b2689d77ddc09926fb8c6 (patch) | |
tree | 4e6025377c38bccaad05881b3f9257e7fe9e1226 | |
parent | 953949fa4a61b2c9c4e53ccea2c2f7b28f79e62d (diff) | |
download | manaverse-c456cb3f7eea27839c4b2689d77ddc09926fb8c6.tar.gz manaverse-c456cb3f7eea27839c4b2689d77ddc09926fb8c6.tar.bz2 manaverse-c456cb3f7eea27839c4b2689d77ddc09926fb8c6.tar.xz manaverse-c456cb3f7eea27839c4b2689d77ddc09926fb8c6.zip |
Add restrict to all methods in graphics.
-rw-r--r-- | src/render/graphics.cpp | 43 | ||||
-rw-r--r-- | src/render/mobileopengl2graphics.cpp | 2 | ||||
-rw-r--r-- | src/render/mobileopengl2graphics.h | 2 | ||||
-rw-r--r-- | src/render/modernopenglgraphics.cpp | 2 | ||||
-rw-r--r-- | src/render/modernopenglgraphics.h | 2 | ||||
-rw-r--r-- | src/render/sdl2softwaregraphics.cpp | 3 | ||||
-rw-r--r-- | src/render/sdl2softwaregraphics.h | 3 |
7 files changed, 33 insertions, 24 deletions
diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp index 8db05d850..3565e3273 100644 --- a/src/render/graphics.cpp +++ b/src/render/graphics.cpp @@ -158,7 +158,7 @@ Graphics::~Graphics() #endif } -void Graphics::setSync(const bool sync) +void Graphics::setSync(const bool sync) restrict2 { mSync = sync; } @@ -221,7 +221,7 @@ void Graphics::setScale(int scale) restrict2 mRect.h = static_cast<RectSize>(mHeight); } -int Graphics::getOpenGLFlags() const +int Graphics::getOpenGLFlags() const restrict2 { #ifdef USE_OPENGL @@ -256,7 +256,7 @@ int Graphics::getOpenGLFlags() const #endif // USE_OPENGL } -bool Graphics::setOpenGLMode() +bool Graphics::setOpenGLMode() restrict2 { #ifdef USE_OPENGL SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); @@ -359,7 +359,7 @@ bool Graphics::setOpenGLMode() #endif // USE_OPENGL } -int Graphics::getSoftwareFlags() const +int Graphics::getSoftwareFlags() const restrict2 { #ifdef USE_SDL2 int displayFlags = SDL_WINDOW_SHOWN; @@ -383,7 +383,7 @@ int Graphics::getSoftwareFlags() const } #ifdef USE_OPENGL -void Graphics::createGLContext() +void Graphics::createGLContext() restrict2 { #ifdef USE_SDL2 mGLContext = SDL_GL_CreateContext(mWindow); @@ -391,7 +391,7 @@ void Graphics::createGLContext() } #endif -void Graphics::updateMemoryInfo() +void Graphics::updateMemoryInfo() restrict2 { #ifdef USE_OPENGL if (mStartFreeMem) @@ -424,8 +424,9 @@ int Graphics::getMemoryUsage() const restrict2 } #ifdef USE_SDL2 -void Graphics::dumpRendererInfo(const char *const str, - const SDL_RendererInfo &info) +void Graphics::dumpRendererInfo(const char *restrict const str, + const SDL_RendererInfo &restrict info) + restrict2 { logger->log(str, info.name); logger->log("flags:"); @@ -440,7 +441,7 @@ void Graphics::dumpRendererInfo(const char *const str, } #endif -bool Graphics::videoInfo() +bool Graphics::videoInfo() restrict2 { logger->log("SDL video info"); #ifdef USE_SDL2 @@ -498,7 +499,7 @@ bool Graphics::videoInfo() return true; } -bool Graphics::setFullscreen(const bool fs) +bool Graphics::setFullscreen(const bool fs) restrict2 { if (mFullscreen == fs) return true; @@ -507,7 +508,8 @@ bool Graphics::setFullscreen(const bool fs) mHWAccel, mEnableResize, mNoFrame); } -bool Graphics::resizeScreen(const int width, const int height) +bool Graphics::resizeScreen(const int width, + const int height) restrict2 { #ifdef USE_SDL2 endDraw(); @@ -579,12 +581,12 @@ bool Graphics::resizeScreen(const int width, const int height) #endif // USE_SDL2 } -int Graphics::getWidth() const +int Graphics::getWidth() const restrict2 { return mWidth; } -int Graphics::getHeight() const +int Graphics::getHeight() const restrict2 { return mHeight; } @@ -600,13 +602,18 @@ void Graphics::drawNet(const int x1, const int y1, drawLine(x, y1, x, y2); } -void Graphics::setWindowSize(const int width A_UNUSED, - const int height A_UNUSED) -{ #ifdef USE_SDL2 +void Graphics::setWindowSize(const int width, + const int height) restrict2 +{ SDL_SetWindowSize(mWindow, width, height); -#endif } +#else +void Graphics::setWindowSize(const int width A_UNUSED, + const int height A_UNUSED) restrict2 +{ +} +#endif void Graphics::pushClipArea(const Rect &restrict area) restrict2 { @@ -679,7 +686,7 @@ void Graphics::popClipArea() restrict2 } #ifdef USE_OPENGL -void Graphics::setOpenGLFlags() +void Graphics::setOpenGLFlags() restrict2 { // here disable/enable probably need convert to mgl diff --git a/src/render/mobileopengl2graphics.cpp b/src/render/mobileopengl2graphics.cpp index e3e6b960f..229898770 100644 --- a/src/render/mobileopengl2graphics.cpp +++ b/src/render/mobileopengl2graphics.cpp @@ -1219,7 +1219,7 @@ void MobileOpenGL2Graphics::clearScreen() const restrict2 GL_STENCIL_BUFFER_BIT); } -void MobileOpenGL2Graphics::createGLContext() +void MobileOpenGL2Graphics::createGLContext() restrict2 { Graphics::createGLContext(); /* diff --git a/src/render/mobileopengl2graphics.h b/src/render/mobileopengl2graphics.h index 33e7d2f6d..70bb7f84e 100644 --- a/src/render/mobileopengl2graphics.h +++ b/src/render/mobileopengl2graphics.h @@ -71,7 +71,7 @@ class MobileOpenGL2Graphics final : public Graphics void removeArray(const uint32_t id, uint32_t *const arr) override final A_NONNULL(3); - void createGLContext() override final; + void createGLContext() restrict2 override final; #include "render/graphicsdef.hpp" diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp index 206755dd0..5fc6f27ac 100644 --- a/src/render/modernopenglgraphics.cpp +++ b/src/render/modernopenglgraphics.cpp @@ -1216,7 +1216,7 @@ void ModernOpenGLGraphics::clearScreen() const restrict2 GL_STENCIL_BUFFER_BIT); } -void ModernOpenGLGraphics::createGLContext() +void ModernOpenGLGraphics::createGLContext() restrict2 { if (mGLContext) SDL::makeCurrentContext(mGLContext); diff --git a/src/render/modernopenglgraphics.h b/src/render/modernopenglgraphics.h index 1e5f00d1a..d4a0516b7 100644 --- a/src/render/modernopenglgraphics.h +++ b/src/render/modernopenglgraphics.h @@ -71,7 +71,7 @@ class ModernOpenGLGraphics final : public Graphics void removeArray(const uint32_t id, uint32_t *const arr) override final A_NONNULL(3); - void createGLContext() override final; + void createGLContext() restrict2 override final; #include "render/graphicsdef.hpp" diff --git a/src/render/sdl2softwaregraphics.cpp b/src/render/sdl2softwaregraphics.cpp index 8e777fb15..4b8c9a469 100644 --- a/src/render/sdl2softwaregraphics.cpp +++ b/src/render/sdl2softwaregraphics.cpp @@ -1479,7 +1479,8 @@ bool SDL2SoftwareGraphics::setVideoMode(const int w, const int h, return videoInfo(); } -bool SDL2SoftwareGraphics::resizeScreen(const int width, const int height) +bool SDL2SoftwareGraphics::resizeScreen(const int width, + const int height) restrict2 { const bool ret = Graphics::resizeScreen(width, height); diff --git a/src/render/sdl2softwaregraphics.h b/src/render/sdl2softwaregraphics.h index 81d92e474..633a7a6e4 100644 --- a/src/render/sdl2softwaregraphics.h +++ b/src/render/sdl2softwaregraphics.h @@ -63,7 +63,8 @@ class SDL2SoftwareGraphics final : public Graphics #include "render/softwaregraphicsdef.hpp" - bool resizeScreen(const int width, const int height) override final; + bool resizeScreen(const int width, + const int height) restrict2 override final; protected: int SDL_FakeUpperBlit(const SDL_Surface *const src, |