diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-02-11 21:21:36 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-02-11 21:51:42 +0300 |
commit | 35d742677a59b4340b24f703bad666f3700b14b5 (patch) | |
tree | 4fba5450036a21c94064706258c5326252fda73a | |
parent | 2b60803357db480eb5214a758a54363d4172987e (diff) | |
download | mv-35d742677a59b4340b24f703bad666f3700b14b5.tar.gz mv-35d742677a59b4340b24f703bad666f3700b14b5.tar.bz2 mv-35d742677a59b4340b24f703bad666f3700b14b5.tar.xz mv-35d742677a59b4340b24f703bad666f3700b14b5.zip |
Use inline attribute in some critial performance functions.
-rw-r--r-- | src/being/being.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/widget2.h | 4 | ||||
-rw-r--r-- | src/render/graphicsdef.hpp | 17 | ||||
-rw-r--r-- | src/render/mobileopengl2graphics.h | 27 | ||||
-rw-r--r-- | src/render/mobileopenglgraphics.cpp | 5 | ||||
-rw-r--r-- | src/render/mobileopenglgraphics.h | 9 | ||||
-rw-r--r-- | src/render/modernopenglgraphics.h | 27 | ||||
-rw-r--r-- | src/render/normalopenglgraphics.cpp | 13 | ||||
-rw-r--r-- | src/render/normalopenglgraphics.h | 16 | ||||
-rw-r--r-- | src/render/nullopenglgraphics.h | 12 | ||||
-rw-r--r-- | src/render/openglgraphicsdef.hpp | 4 | ||||
-rw-r--r-- | src/render/openglgraphicsdefadvanced.hpp | 2 | ||||
-rw-r--r-- | src/render/safeopenglgraphics.cpp | 5 | ||||
-rw-r--r-- | src/resources/image.h | 4 |
14 files changed, 87 insertions, 60 deletions
diff --git a/src/being/being.h b/src/being/being.h index 6c1e09fa8..fb818aa4b 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -490,7 +490,7 @@ class Being notfinal : public ActorSprite, */ inline void setPosition(const float x, const float y, - const float z = 0.0F) restrict2 + const float z = 0.0F) restrict2 A_INLINE { setPosition(Vector(x, y, z)); } /** diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h index bbf9beff6..32e51d7c3 100644 --- a/src/gui/widgets/widget2.h +++ b/src/gui/widgets/widget2.h @@ -37,14 +37,14 @@ class Widget2 notfinal inline const Color &getThemeColor(const ThemeColorIdT type, const unsigned int alpha = 255U) - const A_WARN_UNUSED + const A_WARN_UNUSED A_INLINE { return theme->getColor(type + mPaletteOffset, alpha); } inline const Color &getThemeCharColor(const signed char c, bool &valid) - const A_WARN_UNUSED + const A_WARN_UNUSED A_INLINE { if (!theme) return Palette::BLACK; diff --git a/src/render/graphicsdef.hpp b/src/render/graphicsdef.hpp index 0b077d373..e7b775ff0 100644 --- a/src/render/graphicsdef.hpp +++ b/src/render/graphicsdef.hpp @@ -52,7 +52,7 @@ public: void inline drawPatternInline(const Image *restrict const image, const int x, const int y, - const int w, const int h) restrict2; + const int w, const int h) restrict2 A_INLINE; void drawRescaledPattern(const Image *restrict const image, const int x, const int y, @@ -128,16 +128,21 @@ private: void inline calcImageRect(ImageVertexes *restrict const vert, int x, int y, int w, int h, - const ImageRect &restrict imgRect) restrict2; + const ImageRect &restrict imgRect) + restrict2 A_INLINE; void inline calcPatternInline(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 A_INLINE; void inline calcTileVertexesInline(ImageVertexes *restrict const vert, const Image *restrict const image, - int x, int y) const restrict2; + int x, + int y) const restrict2 A_INLINE; void inline drawImageInline(const Image *restrict const image, - int dstX, int dstY) restrict2; + int dstX, + int dstY) restrict2 A_INLINE; diff --git a/src/render/mobileopengl2graphics.h b/src/render/mobileopengl2graphics.h index 5fbf32045..599c6fe80 100644 --- a/src/render/mobileopengl2graphics.h +++ b/src/render/mobileopengl2graphics.h @@ -85,31 +85,36 @@ class MobileOpenGL2Graphics final : public Graphics private: void deleteGLObjects() restrict2; - inline void drawQuad(const int srcX, const int srcY, - const int dstX, const int dstY, - const int width, const int height) restrict2; + inline void drawQuad(const int srcX, + const int srcY, + const int dstX, + const int dstY, + const int width, + const int height) restrict2 A_INLINE; inline void drawRescaledQuad(const int srcX, const int srcY, const int dstX, const int dstY, const int width, const int height, const int desiredWidth, - const int desiredHeight) restrict2; + const int desiredHeight) + restrict2 A_INLINE; - inline void drawTriangleArray(const int size) restrict2; + inline void drawTriangleArray(const int size) restrict2 A_INLINE; inline void drawTriangleArray(const GLfloat *restrict const array, - const int size) restrict2; + const int size) restrict2 A_INLINE; - inline void drawLineArrays(const int size) restrict2; + inline void drawLineArrays(const int size) restrict2 A_INLINE; - inline void bindArrayBuffer(const GLuint vbo) restrict2; + inline void bindArrayBuffer(const GLuint vbo) restrict2 A_INLINE; - inline void bindArrayBufferAndAttributes(const GLuint vbo) restrict2; + inline void bindArrayBufferAndAttributes(const GLuint vbo) + restrict2 A_INLINE; - inline void bindAttributes() restrict2; + inline void bindAttributes() restrict2 A_INLINE; static void bindTexture2(const GLenum target, - const Image *restrict const image); + const Image *restrict const image) A_INLINE; static GLuint mTextureSizeUniform; static int mTextureWidth; diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp index f703ff667..fb4651409 100644 --- a/src/render/mobileopenglgraphics.cpp +++ b/src/render/mobileopenglgraphics.cpp @@ -163,7 +163,7 @@ static inline void drawQuad(const Image *restrict const image, const int dstX, const int dstY, const int width, - const int height) A_NONNULL(1); + const int height) A_NONNULL(1) A_INLINE; static inline void drawQuad(const Image *restrict const image, const int srcX, @@ -215,7 +215,8 @@ static inline void drawRescaledQuad(const Image *restrict const image, const int dstX, const int dstY, const int width, const int height, const int desiredWidth, - const int desiredHeight) A_NONNULL(1); + const int desiredHeight) + A_NONNULL(1) A_INLINE; static inline void drawRescaledQuad(const Image *restrict const image, const int srcX, const int srcY, diff --git a/src/render/mobileopenglgraphics.h b/src/render/mobileopenglgraphics.h index d6356d8ce..7af81a4c8 100644 --- a/src/render/mobileopenglgraphics.h +++ b/src/render/mobileopenglgraphics.h @@ -61,13 +61,14 @@ class MobileOpenGLGraphics final : public Graphics shortVertArray, const GLfloat *restrict const floatTexArray, - const int size) restrict2; + const int size) restrict2 A_INLINE; - inline void drawTriangleArrayfs(const int size) restrict2; + inline void drawTriangleArrayfs(const int size) restrict2 A_INLINE; - inline void drawTriangleArrayfsCached(const int size) restrict2; + inline void drawTriangleArrayfsCached(const int size) + restrict2 A_INLINE; - inline void drawLineArrays(const int size) restrict2; + inline void drawLineArrays(const int size) restrict2 A_INLINE; #include "render/graphicsdef.hpp" diff --git a/src/render/modernopenglgraphics.h b/src/render/modernopenglgraphics.h index 9f2467a76..0c7d0d5c9 100644 --- a/src/render/modernopenglgraphics.h +++ b/src/render/modernopenglgraphics.h @@ -85,30 +85,35 @@ class ModernOpenGLGraphics final : public Graphics private: void deleteGLObjects() restrict2; - inline void drawQuad(const int srcX, const int srcY, - const int dstX, const int dstY, - const int width, const int height) restrict2; + inline void drawQuad(const int srcX, + const int srcY, + const int dstX, + const int dstY, + const int width, + const int height) restrict2 A_INLINE; inline void drawRescaledQuad(const int srcX, const int srcY, const int dstX, const int dstY, const int width, const int height, const int desiredWidth, - const int desiredHeight) restrict2; + const int desiredHeight) + restrict2 A_INLINE; - inline void drawTriangleArray(const int size) restrict2; + inline void drawTriangleArray(const int size) restrict2 A_INLINE; inline void drawTriangleArray(const GLint *restrict const array, - const int size) restrict2; + const int size) restrict2 A_INLINE; - inline void drawLineArrays(const int size) restrict2; + inline void drawLineArrays(const int size) restrict2 A_INLINE; - inline void bindArrayBuffer(const GLuint vbo) restrict2; + inline void bindArrayBuffer(const GLuint vbo) restrict2 A_INLINE; - inline void bindArrayBufferAndAttributes(const GLuint vbo) restrict2; + inline void bindArrayBufferAndAttributes(const GLuint vbo) + restrict2 A_INLINE; - inline void bindAttributes() restrict2; + inline void bindAttributes() restrict2 A_INLINE; - inline void bindElementBuffer(const GLuint ebo) restrict2; + inline void bindElementBuffer(const GLuint ebo) restrict2 A_INLINE; GLint *mIntArray A_NONNULLPOINTER; GLint *mIntArrayCached A_NONNULLPOINTER; diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp index 0e6419c21..74ba1d403 100644 --- a/src/render/normalopenglgraphics.cpp +++ b/src/render/normalopenglgraphics.cpp @@ -181,6 +181,10 @@ bool NormalOpenGLGraphics::setVideoMode(const int w, const int h, static inline void bindPointerIntFloat(const GLint *restrict const vert, const GLfloat *restrict const tex) + A_INLINE; + +static inline void bindPointerIntFloat(const GLint *restrict const vert, + const GLfloat *restrict const tex) { if (vertPtr != vert) { @@ -191,6 +195,9 @@ static inline void bindPointerIntFloat(const GLint *restrict const vert, } static inline void bindPointerInt(const GLint *restrict const vert, + const GLint *restrict const tex) A_INLINE; + +static inline void bindPointerInt(const GLint *restrict const vert, const GLint *restrict const tex) { if (vertPtr != vert) @@ -204,7 +211,8 @@ static inline void bindPointerInt(const GLint *restrict const vert, static inline void drawQuad(const Image *restrict const image, const int srcX, const int srcY, const int dstX, const int dstY, - const int width, const int height) A_NONNULL(1); + const int width, const int height) + A_NONNULL(1) A_INLINE; static inline void drawQuad(const Image *restrict const image, const int srcX, const int srcY, @@ -273,7 +281,8 @@ static inline void drawRescaledQuad(const Image *restrict const image, const int dstX, const int dstY, const int width, const int height, const int desiredWidth, - const int desiredHeight) A_NONNULL(1); + const int desiredHeight) + A_NONNULL(1) A_INLINE; static inline void drawRescaledQuad(const Image *restrict const image, const int srcX, const int srcY, diff --git a/src/render/normalopenglgraphics.h b/src/render/normalopenglgraphics.h index 4262b5aab..05014deed 100644 --- a/src/render/normalopenglgraphics.h +++ b/src/render/normalopenglgraphics.h @@ -55,26 +55,26 @@ class NormalOpenGLGraphics final : public Graphics ~NormalOpenGLGraphics(); - inline void drawQuadArrayfi(const int size) restrict2; + inline void drawQuadArrayfi(const int size) restrict2 A_INLINE; - inline void drawQuadArrayfiCached(const int size) restrict2; + inline void drawQuadArrayfiCached(const int size) restrict2 A_INLINE; inline void drawQuadArrayfi(const GLint *restrict const intVertArray, const GLfloat *restrict const floatTexArray, - const int size) restrict2; + const int size) restrict2 A_INLINE; - inline void drawQuadArrayii(const int size) restrict2; + inline void drawQuadArrayii(const int size) restrict2 A_INLINE; - inline void drawQuadArrayiiCached(const int size) restrict2; + inline void drawQuadArrayiiCached(const int size) restrict2 A_INLINE; inline void drawQuadArrayii(const GLint *restrict const intVertArray, const GLint *restrict const intTexArray, - const int size) restrict2; + const int size) restrict2 A_INLINE; - inline void drawLineArrayi(const int size) restrict2; + inline void drawLineArrayi(const int size) restrict2 A_INLINE; - inline void drawLineArrayf(const int size) restrict2; + inline void drawLineArrayf(const int size) restrict2 A_INLINE; void testDraw() restrict2 override final; diff --git a/src/render/nullopenglgraphics.h b/src/render/nullopenglgraphics.h index 57506125c..fb7cdc806 100644 --- a/src/render/nullopenglgraphics.h +++ b/src/render/nullopenglgraphics.h @@ -55,22 +55,22 @@ class NullOpenGLGraphics final : public Graphics ~NullOpenGLGraphics(); - inline void drawQuadArrayfi(const int size) restrict2; + inline void drawQuadArrayfi(const int size) restrict2 A_INLINE; inline void drawQuadArrayfi(const GLint *restrict const intVertArray, const GLfloat *restrict const floatTexArray, - const int size) restrict2; + const int size) restrict2 A_INLINE; - inline void drawQuadArrayii(const int size) restrict2; + inline void drawQuadArrayii(const int size) restrict2 A_INLINE; inline void drawQuadArrayii(const GLint *restrict const intVertArray, const GLint *restrict const intTexArray, - const int size) restrict2; + const int size) restrict2 A_INLINE; - inline void drawLineArrayi(const int size) restrict2; + inline void drawLineArrayi(const int size) restrict2 A_INLINE; - inline void drawLineArrayf(const int size) restrict2; + inline void drawLineArrayf(const int size) restrict2 A_INLINE; #include "render/graphicsdef.hpp" diff --git a/src/render/openglgraphicsdef.hpp b/src/render/openglgraphicsdef.hpp index 4b32c6442..42f61c2be 100644 --- a/src/render/openglgraphicsdef.hpp +++ b/src/render/openglgraphicsdef.hpp @@ -49,6 +49,6 @@ protected: void setTexturingAndBlending(const bool enable) restrict2; private: - void inline setColorAlpha(const float alpha) restrict2; + void inline setColorAlpha(const float alpha) restrict2 A_INLINE; - void inline restoreColor() restrict2; + void inline restoreColor() restrict2 A_INLINE; diff --git a/src/render/openglgraphicsdefadvanced.hpp b/src/render/openglgraphicsdefadvanced.hpp index 7e1017c23..c63c6ba7f 100644 --- a/src/render/openglgraphicsdefadvanced.hpp +++ b/src/render/openglgraphicsdefadvanced.hpp @@ -22,7 +22,7 @@ public: inline void drawVertexes(const OpenGLGraphicsVertexes &restrict ogl) - restrict2; + restrict2 A_INLINE; void initArrays(const int vertCount) restrict2 override final; diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp index 2a507808a..48fe5e2d2 100644 --- a/src/render/safeopenglgraphics.cpp +++ b/src/render/safeopenglgraphics.cpp @@ -74,7 +74,7 @@ static inline void drawQuad(const Image *restrict image, const int dstX, const int dstY, const int width, - const int height) A_NONNULL(1); + const int height) A_NONNULL(1) A_INLINE; static inline void drawQuad(const Image *restrict image, const int srcX, @@ -121,7 +121,8 @@ static inline void drawRescaledQuad(const Image *restrict const image, const int dstX, const int dstY, const int width, const int height, const int desiredWidth, - const int desiredHeight) A_NONNULL(1); + const int desiredHeight) + A_NONNULL(1) A_INLINE; static inline void drawRescaledQuad(const Image *restrict const image, const int srcX, const int srcY, diff --git a/src/resources/image.h b/src/resources/image.h index 046277d53..aa38f7a22 100644 --- a/src/resources/image.h +++ b/src/resources/image.h @@ -100,13 +100,13 @@ class Image notfinal : public Resource /** * Returns the width of the image. */ - inline int getWidth() const A_WARN_UNUSED + inline int getWidth() const A_WARN_UNUSED A_INLINE { return mBounds.w; } /** * Returns the height of the image. */ - inline int getHeight() const A_WARN_UNUSED + inline int getHeight() const A_WARN_UNUSED A_INLINE { return mBounds.h; } /** |