From a8acf366d3e943fb636e24b69c8c67152770d2cc Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 26 Dec 2015 21:08:45 +0300 Subject: Fix code style. --- src/being/compoundsprite.cpp | 2 ++ src/being/compoundsprite.h | 2 ++ src/being/localplayer.cpp | 1 - src/enums/resources/spritedirection.h | 6 +++--- src/gui/fonts/textchunklist.h | 6 ++++-- src/gui/windows/whoisonline.cpp | 3 ++- src/render/graphics.h | 20 +++++++++++++------- src/render/graphicsdef.hpp | 3 ++- src/render/imagegraphics.h | 3 ++- src/render/mobileopengl2graphics.cpp | 21 ++++++++++++++------- src/render/mobileopenglgraphics.cpp | 18 ++++++++++++------ src/render/modernopenglgraphics.cpp | 21 ++++++++++++++------- src/render/normalopenglgraphics.cpp | 24 ++++++++++++++++-------- src/render/nullopenglgraphics.cpp | 9 ++++++--- src/render/opengl/mgl.h | 6 +++--- src/render/safeopenglgraphics.cpp | 3 ++- src/render/sdl2softwaregraphics.cpp | 12 ++++++++---- src/render/surfacegraphics.h | 3 ++- src/resources/atlas/atlasresource.h | 2 -- 19 files changed, 107 insertions(+), 58 deletions(-) (limited to 'src') diff --git a/src/being/compoundsprite.cpp b/src/being/compoundsprite.cpp index 3d01273bd..5b37738b2 100644 --- a/src/being/compoundsprite.cpp +++ b/src/being/compoundsprite.cpp @@ -67,7 +67,9 @@ CompoundSprite::CompoundSprite() : mOffsetX(0), mOffsetY(0), mSprites(), +#ifndef USE_SDL2 mNextRedrawTime(0), +#endif mNeedsRedraw(false), mEnableAlphaFix(config.getBoolValue("enableAlphaFix")), mDisableAdvBeingCaching(config.getBoolValue("disableAdvBeingCaching")), diff --git a/src/being/compoundsprite.h b/src/being/compoundsprite.h index 4a82855cf..4a7ed6fb0 100644 --- a/src/being/compoundsprite.h +++ b/src/being/compoundsprite.h @@ -138,7 +138,9 @@ class CompoundSprite notfinal : public Sprite mutable int mOffsetX; mutable int mOffsetY; std::vector mSprites; +#ifndef USE_SDL2 mutable int mNextRedrawTime; +#endif static bool mEnableDelay; mutable bool mNeedsRedraw; bool mEnableAlphaFix; diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 1526afd9d..9944a6eb4 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -2686,4 +2686,3 @@ void LocalPlayer::playerDeath() recalcSpritesOrder(); } } - diff --git a/src/enums/resources/spritedirection.h b/src/enums/resources/spritedirection.h index 92c7ac09e..1855999dc 100644 --- a/src/enums/resources/spritedirection.h +++ b/src/enums/resources/spritedirection.h @@ -20,8 +20,8 @@ * along with this program. If not, see . */ -#ifndef RESOURCES_SPRITEDIRECTION_H -#define RESOURCES_SPRITEDIRECTION_H +#ifndef ENUMS_RESOURCES_SPRITEDIRECTION_H +#define ENUMS_RESOURCES_SPRITEDIRECTION_H namespace SpriteDirection { @@ -40,4 +40,4 @@ namespace SpriteDirection }; } // namespace SpriteDirection -#endif // RESOURCES_SPRITEDIRECTION_H +#endif // ENUMS_RESOURCES_SPRITEDIRECTION_H diff --git a/src/gui/fonts/textchunklist.h b/src/gui/fonts/textchunklist.h index ce68d3931..f2cd7b63f 100644 --- a/src/gui/fonts/textchunklist.h +++ b/src/gui/fonts/textchunklist.h @@ -36,9 +36,11 @@ class TextChunkList final A_DELETE_COPY(TextChunkList) - void insertFirst(TextChunk *restrict const item) restrict2 A_NONNULL(2); + void insertFirst(TextChunk *restrict const item) + restrict2 A_NONNULL(2); - void moveToFirst(TextChunk *restrict const item) restrict2 A_NONNULL(2); + void moveToFirst(TextChunk *restrict const item) + restrict2 A_NONNULL(2); void remove(const TextChunk *restrict const item) restrict2; diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index f6d7173d0..a23e24437 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -496,7 +496,8 @@ size_t WhoIsOnline::memoryWrite(void *restrict ptr, if (!stream) return 0; - WhoIsOnline *restrict const wio = reinterpret_cast(stream); + WhoIsOnline *restrict const wio = + reinterpret_cast(stream); const size_t totalMem = size * nmemb; wio->mMemoryBuffer = static_cast(realloc(wio->mMemoryBuffer, static_cast(wio->mDownloadedBytes) + totalMem)); diff --git a/src/render/graphics.h b/src/render/graphics.h index 53877361b..52ecce258 100644 --- a/src/render/graphics.h +++ b/src/render/graphics.h @@ -213,7 +213,8 @@ class Graphics notfinal int x, int y) const restrict2 = 0; virtual void calcTileSDL(ImageVertexes *restrict const vert A_UNUSED, - int x A_UNUSED, int y A_UNUSED) const restrict2 + int x A_UNUSED, + int y A_UNUSED) const restrict2 { } @@ -223,16 +224,20 @@ class Graphics notfinal virtual void drawTileCollection(const ImageCollection *restrict const vertCol) restrict2 = 0; - virtual void calcTileCollection(ImageCollection *restrict const vertCol, + virtual void calcTileCollection(ImageCollection *restrict const + vertCol, const Image *restrict const image, - int x, int y) restrict2 = 0; + int x, + int y) restrict2 = 0; virtual void calcWindow(ImageCollection *restrict const vertCol, const int x, const int y, const int w, const int h, - const ImageRect &restrict imgRect) restrict2 = 0; + const ImageRect &restrict imgRect) + restrict2 = 0; - virtual void fillRectangle(const Rect &restrict rectangle) restrict2 = 0; + virtual void fillRectangle(const Rect &restrict rectangle) + restrict2 = 0; /** * Updates the screen. This is done by either copying the buffer to the @@ -240,10 +245,11 @@ class Graphics notfinal */ virtual void updateScreen() restrict2 = 0; + void setWindowSize(const int width, #ifdef USE_SDL2 - void setWindowSize(const int width, const int height) restrict2; + const int height) restrict2; #else - void setWindowSize(const int width, const int height) restrict2 A_CONST; + const int height) restrict2 A_CONST; #endif /** diff --git a/src/render/graphicsdef.hpp b/src/render/graphicsdef.hpp index 3eedd871f..767cb8084 100644 --- a/src/render/graphicsdef.hpp +++ b/src/render/graphicsdef.hpp @@ -89,7 +89,8 @@ public: void calcWindow(ImageCollection *restrict const vertCol, const int x, const int y, const int w, const int h, - const ImageRect &restrict imgRect) restrict2 override final; + const ImageRect &restrict imgRect) + restrict2 override final; void drawRectangle(const Rect &restrict rect) restrict2 override final; diff --git a/src/render/imagegraphics.h b/src/render/imagegraphics.h index 8928c9a01..21d0735e1 100644 --- a/src/render/imagegraphics.h +++ b/src/render/imagegraphics.h @@ -115,7 +115,8 @@ class ImegeGraphics final : public Graphics int y A_UNUSED) const restrict2 override final { } - void calcTileCollection(ImageCollection *restrict const vertCol A_UNUSED, + void calcTileCollection(ImageCollection *restrict const + vertCol A_UNUSED, const Image *restrict const image A_UNUSED, int x A_UNUSED, int y A_UNUSED) restrict2 override final diff --git a/src/render/mobileopengl2graphics.cpp b/src/render/mobileopengl2graphics.cpp index 47faa6741..a7d978d0d 100644 --- a/src/render/mobileopengl2graphics.cpp +++ b/src/render/mobileopengl2graphics.cpp @@ -405,7 +405,8 @@ void MobileOpenGL2Graphics::drawRescaledImage(const Image * restrict const image, int dstX, int dstY, const int desiredWidth, - const int desiredHeight) restrict2 + const int desiredHeight) + restrict2 { if (!image) return; @@ -700,7 +701,8 @@ void MobileOpenGL2Graphics::calcTileCollection(ImageCollection * } void MobileOpenGL2Graphics::drawTileCollection(const ImageCollection - *restrict const vertCol) restrict2 + *restrict const vertCol) + restrict2 { if (!vertCol) return; @@ -750,7 +752,8 @@ void MobileOpenGL2Graphics::calcPattern(ImageCollection *restrict const vertCol, void MobileOpenGL2Graphics::calcTileVertexes(ImageVertexes * restrict const vert, const Image *restrict const image, - int dstX, int dstY) const restrict2 + int dstX, + int dstY) const restrict2 { calcTileVertexesInline(vert, image, dstX, dstY); } @@ -998,7 +1001,8 @@ void MobileOpenGL2Graphics::fillRectangle(const Rect &restrict rect) restrict2 mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4); } -void MobileOpenGL2Graphics::setTexturingAndBlending(const bool enable) restrict2 +void MobileOpenGL2Graphics::setTexturingAndBlending(const bool enable) + restrict2 { if (enable) { @@ -1038,9 +1042,12 @@ void MobileOpenGL2Graphics::drawRectangle(const Rect &restrict rect A_UNUSED, { } -void MobileOpenGL2Graphics::drawNet(const int x1, const int y1, - const int x2, const int y2, - const int width, const int height) restrict2 +void MobileOpenGL2Graphics::drawNet(const int x1, + const int y1, + const int x2, + const int y2, + const int width, + const int height) restrict2 { unsigned int vp = 0; const unsigned int vLimit = mMaxVertices * 4; diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp index 8ce7ddea3..f77bcb843 100644 --- a/src/render/mobileopenglgraphics.cpp +++ b/src/render/mobileopenglgraphics.cpp @@ -465,8 +465,10 @@ void MobileOpenGLGraphics::drawPattern(const Image *restrict const image, } void MobileOpenGLGraphics::drawPatternInline(const Image *restrict const image, - const int x, const int y, - const int w, const int h) restrict2 + const int x, + const int y, + const int w, + const int h) restrict2 { FUNC_BLOCK("Graphics::drawPattern", 1) if (!image) @@ -535,7 +537,8 @@ void MobileOpenGLGraphics::drawRescaledPattern(const Image * const int x, const int y, const int w, const int h, const int scaledWidth, - const int scaledHeight) restrict2 + const int scaledHeight) + restrict2 { if (!image) return; @@ -640,8 +643,10 @@ inline void MobileOpenGLGraphics::drawVertexes(const void MobileOpenGLGraphics::calcPattern(ImageVertexes *restrict const vert, const Image *restrict const image, - const int x, const int y, - const int w, const int h) const restrict2 + const int x, + const int y, + const int w, + const int h) const restrict2 { calcPatternInline(vert, image, x, y, w, h); } @@ -1220,7 +1225,8 @@ inline void MobileOpenGLGraphics::drawTriangleArrayfs(const int size) restrict2 mglDrawArrays(GL_TRIANGLES, 0, size / 2); } -inline void MobileOpenGLGraphics::drawTriangleArrayfsCached(const int size) restrict2 +inline void MobileOpenGLGraphics::drawTriangleArrayfsCached(const int size) + restrict2 { glVertexPointer(2, GL_SHORT, 0, mShortVertArrayCached); glTexCoordPointer(2, GL_FLOAT, 0, mFloatTexArrayCached); diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp index f8e9e51f5..5d49695fa 100644 --- a/src/render/modernopenglgraphics.cpp +++ b/src/render/modernopenglgraphics.cpp @@ -377,7 +377,8 @@ void ModernOpenGLGraphics::testDraw() restrict2 void ModernOpenGLGraphics::drawImageCached(const Image *restrict const image A_UNUSED, - int A_UNUSED x, int y A_UNUSED) restrict2 + int A_UNUSED x, + int y A_UNUSED) restrict2 { } @@ -435,8 +436,10 @@ void ModernOpenGLGraphics::drawPattern(const Image *restrict const image, } void ModernOpenGLGraphics::drawPatternInline(const Image *restrict const image, - const int x, const int y, - const int w, const int h) restrict2 + const int x, + const int y, + const int w, + const int h) restrict2 { if (!image) return; @@ -499,7 +502,8 @@ void ModernOpenGLGraphics::drawRescaledPattern(const Image * const int x, const int y, const int w, const int h, const int scaledWidth, - const int scaledHeight) restrict2 + const int scaledHeight) + restrict2 { if (!image) return; @@ -683,7 +687,8 @@ void ModernOpenGLGraphics::calcTileCollection(ImageCollection * } void ModernOpenGLGraphics::drawTileCollection(const ImageCollection - *restrict const vertCol) restrict2 + *restrict const vertCol) + restrict2 { if (!vertCol) return; @@ -713,8 +718,10 @@ void ModernOpenGLGraphics::drawTileCollection(const ImageCollection void ModernOpenGLGraphics::calcPattern(ImageCollection *restrict const vertCol, const Image *restrict const image, - const int x, const int y, - const int w, const int h) const restrict2 + const int x, + const int y, + const int w, + const int h) const restrict2 { if (!vertCol || !image) return; diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp index 36680c1ac..c3945f388 100644 --- a/src/render/normalopenglgraphics.cpp +++ b/src/render/normalopenglgraphics.cpp @@ -495,8 +495,10 @@ void NormalOpenGLGraphics::drawImageCached(const Image *restrict const image, } void NormalOpenGLGraphics::drawPatternCached(const Image *restrict const image, - const int x, const int y, - const int w, const int h) restrict2 + const int x, + const int y, + const int w, + const int h) restrict2 { FUNC_BLOCK("Graphics::drawPatternCached", 1) if (!image) @@ -638,8 +640,10 @@ void NormalOpenGLGraphics::drawPattern(const Image *restrict const image, } void NormalOpenGLGraphics::drawPatternInline(const Image *restrict const image, - const int x, const int y, - const int w, const int h) restrict2 + const int x, + const int y, + const int w, + const int h) restrict2 { FUNC_BLOCK("Graphics::drawPattern", 1) if (!image) @@ -732,7 +736,8 @@ void NormalOpenGLGraphics::drawRescaledPattern(const Image * const int x, const int y, const int w, const int h, const int scaledWidth, - const int scaledHeight) restrict2 + const int scaledHeight) + restrict2 { if (!image) return; @@ -905,8 +910,10 @@ inline void NormalOpenGLGraphics::drawVertexes(const void NormalOpenGLGraphics::calcPattern(ImageVertexes *restrict const vert, const Image *restrict const image, - const int x, const int y, - const int w, const int h) const restrict2 + const int x, + const int y, + const int w, + const int h) const restrict2 { calcPatternInline(vert, image, x, y, w, h); } @@ -1029,7 +1036,8 @@ void NormalOpenGLGraphics::calcTileCollection(ImageCollection * } void NormalOpenGLGraphics::drawTileCollection(const ImageCollection - *restrict const vertCol) restrict2 + *restrict const vertCol) + restrict2 { if (!vertCol) return; diff --git a/src/render/nullopenglgraphics.cpp b/src/render/nullopenglgraphics.cpp index bce9360a4..45acf78d9 100644 --- a/src/render/nullopenglgraphics.cpp +++ b/src/render/nullopenglgraphics.cpp @@ -923,7 +923,8 @@ void NullOpenGLGraphics::drawTileVertexes(const ImageVertexes * void NullOpenGLGraphics::calcWindow(ImageCollection *restrict const vertCol, const int x, const int y, const int w, const int h, - const ImageRect &restrict imgRect) restrict2 + const ImageRect &restrict imgRect) + restrict2 { if (!vertCol) return; @@ -1137,7 +1138,8 @@ inline void NullOpenGLGraphics::drawQuadArrayfi(const GLint *restrict const #endif } -inline void NullOpenGLGraphics::drawQuadArrayii(const int size A_UNUSED) restrict2 +inline void NullOpenGLGraphics::drawQuadArrayii(const int size A_UNUSED) + restrict2 { #ifdef DEBUG_DRAW_CALLS mDrawCalls ++; @@ -1148,7 +1150,8 @@ inline void NullOpenGLGraphics::drawQuadArrayii(const GLint *restrict const intVertArray A_UNUSED, const GLint *restrict const intTexArray A_UNUSED, - const int size A_UNUSED) restrict2 + const int size A_UNUSED) + restrict2 { #ifdef DEBUG_DRAW_CALLS mDrawCalls ++; diff --git a/src/render/opengl/mgl.h b/src/render/opengl/mgl.h index 626e88d13..f34e644d4 100644 --- a/src/render/opengl/mgl.h +++ b/src/render/opengl/mgl.h @@ -18,8 +18,8 @@ * along with this program. If not, see . */ -#ifndef RENDER_OPENGLMGL_H -#define RENDER_OPENGLMGL_H +#ifndef RENDER_OPENGL_MGL_H +#define RENDER_OPENGL_MGL_H #include "main.h" @@ -35,4 +35,4 @@ #undef defName #endif // USE_OPENGL -#endif // RENDER_OPENGLMGL_H +#endif // RENDER_OPENGL_MGL_H diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp index 83ce736ea..a805d31b7 100644 --- a/src/render/safeopenglgraphics.cpp +++ b/src/render/safeopenglgraphics.cpp @@ -452,7 +452,8 @@ void SafeOpenGLGraphics::calcPatternInline(ImageVertexes *restrict const vert const int x A_UNUSED, const int y A_UNUSED, const int w A_UNUSED, - const int h A_UNUSED) const restrict2 + const int h A_UNUSED) + const restrict2 { } diff --git a/src/render/sdl2softwaregraphics.cpp b/src/render/sdl2softwaregraphics.cpp index 5e7434e80..0670b6f23 100644 --- a/src/render/sdl2softwaregraphics.cpp +++ b/src/render/sdl2softwaregraphics.cpp @@ -298,8 +298,10 @@ void SDL2SoftwareGraphics::drawImageCached(const Image *restrict const image, } void SDL2SoftwareGraphics::drawPatternCached(const Image *restrict const image, - const int x, const int y, - const int w, const int h) restrict2 + const int x, + const int y, + const int w, + const int h) restrict2 { FUNC_BLOCK("Graphics::drawPatternCached", 1) // Check that preconditions for blitting are met. @@ -419,8 +421,10 @@ void SDL2SoftwareGraphics::drawPattern(const Image *restrict const image, } void SDL2SoftwareGraphics::drawPatternInline(const Image *restrict const image, - const int x, const int y, - const int w, const int h) restrict2 + const int x, + const int y, + const int w, + const int h) restrict2 { FUNC_BLOCK("Graphics::drawPattern", 1) // Check that preconditions for blitting are met. diff --git a/src/render/surfacegraphics.h b/src/render/surfacegraphics.h index a2071941a..eb41a4b9f 100644 --- a/src/render/surfacegraphics.h +++ b/src/render/surfacegraphics.h @@ -117,7 +117,8 @@ class SurfaceGraphics final : public Graphics int y A_UNUSED) const restrict2 override final { } - void calcTileCollection(ImageCollection *restrict const vertCol A_UNUSED, + void calcTileCollection(ImageCollection *restrict const + vertCol A_UNUSED, const Image *restrict const image A_UNUSED, int x A_UNUSED, int y A_UNUSED) restrict2 override final diff --git a/src/resources/atlas/atlasresource.h b/src/resources/atlas/atlasresource.h index d0c9d6548..d2906f135 100644 --- a/src/resources/atlas/atlasresource.h +++ b/src/resources/atlas/atlasresource.h @@ -27,8 +27,6 @@ #include -class Resource; - struct TextureAtlas; class AtlasResource final : public Resource -- cgit v1.2.3-60-g2f50