summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-12-25 20:25:38 +0300
committerAndrei Karas <akaras@inbox.ru>2015-12-25 20:25:38 +0300
commit104df5cae8521f4a234381567b19e6b4da3ff1f0 (patch)
tree2789b318f3f2d977bdd01921ae69c4f476954476 /src
parentc456cb3f7eea27839c4b2689d77ddc09926fb8c6 (diff)
downloadplus-104df5cae8521f4a234381567b19e6b4da3ff1f0.tar.gz
plus-104df5cae8521f4a234381567b19e6b4da3ff1f0.tar.bz2
plus-104df5cae8521f4a234381567b19e6b4da3ff1f0.tar.xz
plus-104df5cae8521f4a234381567b19e6b4da3ff1f0.zip
Add restrict keyword to all renderers.
Diffstat (limited to 'src')
-rw-r--r--src/render/imagegraphics.h63
-rw-r--r--src/render/mobileopengl2graphics.cpp47
-rw-r--r--src/render/mobileopengl2graphics.h37
-rw-r--r--src/render/mobileopenglgraphics.cpp46
-rw-r--r--src/render/mobileopenglgraphics.h16
-rw-r--r--src/render/modernopenglgraphics.cpp41
-rw-r--r--src/render/modernopenglgraphics.h37
-rw-r--r--src/render/normalopenglgraphics.cpp40
-rw-r--r--src/render/normalopenglgraphics.h29
-rw-r--r--src/render/nullopenglgraphics.cpp23
-rw-r--r--src/render/nullopenglgraphics.h21
-rw-r--r--src/render/safeopenglgraphics.cpp33
-rw-r--r--src/render/safeopenglgraphics.h2
-rw-r--r--src/render/sdl2graphics.cpp10
-rw-r--r--src/render/sdl2graphics.h2
-rw-r--r--src/render/sdl2softwaregraphics.cpp13
-rw-r--r--src/render/sdl2softwaregraphics.h14
-rw-r--r--src/render/sdlgraphics.cpp20
-rw-r--r--src/render/sdlgraphics.h12
-rw-r--r--src/render/surfacegraphics.h99
20 files changed, 333 insertions, 272 deletions
diff --git a/src/render/imagegraphics.h b/src/render/imagegraphics.h
index def080337..8928c9a01 100644
--- a/src/render/imagegraphics.h
+++ b/src/render/imagegraphics.h
@@ -45,36 +45,37 @@ class ImegeGraphics final : public Graphics
~ImegeGraphics();
- void setTarget(Image *const target)
+ void setTarget(Image *const target) restrict2
{ mTarget = target; }
- Image *getTarget() const
+ Image *getTarget() const restrict2
{ return mTarget; }
- void beginDraw() override final
+ void beginDraw() restrict2 override final
{ }
- void endDraw() override final
+ void endDraw() restrict2 override final
{ }
- void pushClipArea(const Rect &rect A_UNUSED) override final
+ void pushClipArea(const Rect &restrict rect A_UNUSED)
+ restrict2 override final
{ }
void popClipArea() restrict2 override final
{ }
- void drawRescaledImage(const Image *const image A_UNUSED,
+ void drawRescaledImage(const Image *restrict const image A_UNUSED,
int dstX A_UNUSED, int dstY A_UNUSED,
const int desiredWidth A_UNUSED,
const int desiredHeight A_UNUSED)
- override final
+ restrict2 override final
{ }
- void drawPattern(const Image *const image A_UNUSED,
+ void drawPattern(const Image *restrict const image A_UNUSED,
const int x A_UNUSED,
const int y A_UNUSED,
const int w A_UNUSED,
- const int h A_UNUSED) override final
+ const int h A_UNUSED) restrict2 override final
{ }
void drawRescaledPattern(const Image *const image A_UNUSED,
@@ -87,35 +88,37 @@ class ImegeGraphics final : public Graphics
override final
{ }
- void calcPattern(ImageVertexes *const vert A_UNUSED,
- const Image *const image A_UNUSED,
+ void calcPattern(ImageVertexes *restrict const vert A_UNUSED,
+ const Image *restrict const image A_UNUSED,
const int x A_UNUSED,
const int y A_UNUSED,
const int w A_UNUSED,
- const int h A_UNUSED) const override final
+ const int h A_UNUSED) const restrict2 override final
{ }
- void calcPattern(ImageCollection *const vert A_UNUSED,
- const Image *const image A_UNUSED,
+ void calcPattern(ImageCollection *restrict const vert A_UNUSED,
+ const Image *restrict const image A_UNUSED,
const int x A_UNUSED,
const int y A_UNUSED,
const int w A_UNUSED,
- const int h A_UNUSED) const override final
+ const int h A_UNUSED) const restrict2 override final
{ }
- void calcTileVertexes(ImageVertexes *const vert A_UNUSED,
- const Image *const image A_UNUSED,
+ void calcTileVertexes(ImageVertexes *restrict const vert A_UNUSED,
+ const Image *restrict const image A_UNUSED,
int x A_UNUSED,
- int y A_UNUSED) const override final
+ int y A_UNUSED) const restrict2 override final
{ }
- void calcTileSDL(ImageVertexes *const vert A_UNUSED,
- int x A_UNUSED, int y A_UNUSED) const override final
+ void calcTileSDL(ImageVertexes *restrict const vert A_UNUSED,
+ int x A_UNUSED,
+ int y A_UNUSED) const restrict2 override final
{ }
- void calcTileCollection(ImageCollection *const vertCol A_UNUSED,
- const Image *const image A_UNUSED,
- int x A_UNUSED, int y A_UNUSED) override final
+ 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
{ }
void drawTileVertexes(const ImageVertexes *const
@@ -137,10 +140,11 @@ class ImegeGraphics final : public Graphics
const int height A_UNUSED) override final
{ }
- void calcWindow(ImageCollection *const vertCol A_UNUSED,
+ void calcWindow(ImageCollection *restrict const vertCol A_UNUSED,
const int x A_UNUSED, const int y A_UNUSED,
const int w A_UNUSED, const int h A_UNUSED,
- const ImageRect &imgRect A_UNUSED) override final
+ const ImageRect &restrict imgRect A_UNUSED)
+ restrict2 override final
{ }
void fillRectangle(const Rect &rect A_UNUSED) override final
@@ -153,7 +157,8 @@ class ImegeGraphics final : public Graphics
{ }
void drawLine(int x1 A_UNUSED, int y1 A_UNUSED,
- int x2 A_UNUSED, int y2 A_UNUSED) override final
+ int x2 A_UNUSED, int y2 A_UNUSED)
+ restrict2 override final
{ }
bool setVideoMode(const int w A_UNUSED, const int h A_UNUSED,
@@ -173,14 +178,14 @@ class ImegeGraphics final : public Graphics
void drawImageCached(const Image *const image,
int x, int y) override final;
- void drawPatternCached(const Image *const image A_UNUSED,
+ void drawPatternCached(const Image *restrict const image A_UNUSED,
const int x A_UNUSED,
const int y A_UNUSED,
const int w A_UNUSED,
- const int h A_UNUSED) override final
+ const int h A_UNUSED) restrict2 override final
{ }
- void completeCache() override final;
+ void completeCache() restrict2 override final;
/**
* Draws a rectangle using images. 4 corner images, 4 side images and 1
diff --git a/src/render/mobileopengl2graphics.cpp b/src/render/mobileopengl2graphics.cpp
index 229898770..47faa6741 100644
--- a/src/render/mobileopengl2graphics.cpp
+++ b/src/render/mobileopengl2graphics.cpp
@@ -126,7 +126,7 @@ MobileOpenGL2Graphics::~MobileOpenGL2Graphics()
deleteGLObjects();
}
-void MobileOpenGL2Graphics::deleteGLObjects()
+void MobileOpenGL2Graphics::deleteGLObjects() restrict2
{
delete2(mProgram);
if (mVbo)
@@ -154,7 +154,7 @@ void MobileOpenGL2Graphics::initArrays(const int vertCount) restrict2
mFloatArrayCached = new GLfloat[sz];
}
-void MobileOpenGL2Graphics::postInit()
+void MobileOpenGL2Graphics::postInit() restrict2
{
#ifndef __native_client__
mglGenVertexArrays(1, &mVao);
@@ -203,7 +203,7 @@ void MobileOpenGL2Graphics::postInit()
mglActiveTexture(GL_TEXTURE0);
}
-void MobileOpenGL2Graphics::screenResized()
+void MobileOpenGL2Graphics::screenResized() restrict2
{
deleteGLObjects();
mVboBinded = 0U;
@@ -260,9 +260,12 @@ void MobileOpenGL2Graphics::setColorAlpha(const float alpha) restrict2
}
}
-void MobileOpenGL2Graphics::drawQuad(const int srcX, const int srcY,
- const int dstX, const int dstY,
- const int width, const int height)
+void MobileOpenGL2Graphics::drawQuad(const int srcX,
+ const int srcY,
+ const int dstX,
+ const int dstY,
+ const int width,
+ const int height) restrict2
{
const GLfloat texX2 = srcX + width;
const GLfloat texY2 = srcY + height;
@@ -293,7 +296,7 @@ void MobileOpenGL2Graphics::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)
+ const int desiredHeight) restrict2
{
const GLfloat texX2 = srcX + width;
const GLfloat texY2 = srcY + height;
@@ -357,7 +360,7 @@ void MobileOpenGL2Graphics::copyImage(const Image *restrict const image,
drawImageInline(image, dstX, dstY);
}
-void MobileOpenGL2Graphics::testDraw()
+void MobileOpenGL2Graphics::testDraw() restrict2
{
/*
GLfloat vertices[] =
@@ -718,8 +721,8 @@ void MobileOpenGL2Graphics::drawTileCollection(const ImageCollection
}
}
-void MobileOpenGL2Graphics::calcPattern(ImageCollection* const vertCol,
- const Image *const image,
+void MobileOpenGL2Graphics::calcPattern(ImageCollection *restrict const vertCol,
+ const Image *restrict const image,
const int x,
const int y,
const int w,
@@ -1098,7 +1101,7 @@ void MobileOpenGL2Graphics::drawNet(const int x1, const int y1,
}
void MobileOpenGL2Graphics::bindTexture2(const GLenum target,
- const Image *const image)
+ const Image *restrict const image)
{
const GLuint texture = image->mGLImage;
if (mTextureBinded != texture)
@@ -1129,7 +1132,7 @@ void MobileOpenGL2Graphics::bindTexture(const GLenum target,
}
void MobileOpenGL2Graphics::removeArray(const uint32_t sz,
- uint32_t *const arr)
+ uint32_t *restrict const arr) restrict2
{
mglDeleteBuffers(sz, arr);
for (size_t f = 0; f < sz; f ++)
@@ -1139,7 +1142,7 @@ void MobileOpenGL2Graphics::removeArray(const uint32_t sz,
}
}
-void MobileOpenGL2Graphics::bindArrayBuffer(const GLuint vbo)
+void MobileOpenGL2Graphics::bindArrayBuffer(const GLuint vbo) restrict2
{
if (mVboBinded != vbo)
{
@@ -1150,6 +1153,7 @@ void MobileOpenGL2Graphics::bindArrayBuffer(const GLuint vbo)
}
void MobileOpenGL2Graphics::bindArrayBufferAndAttributes(const GLuint vbo)
+ restrict2
{
if (mVboBinded != vbo)
{
@@ -1166,7 +1170,7 @@ void MobileOpenGL2Graphics::bindArrayBufferAndAttributes(const GLuint vbo)
}
}
-void MobileOpenGL2Graphics::bindAttributes()
+void MobileOpenGL2Graphics::bindAttributes() restrict2
{
if (mAttributesBinded != mVboBinded)
{
@@ -1230,7 +1234,8 @@ void MobileOpenGL2Graphics::createGLContext() restrict2
*/
}
-void MobileOpenGL2Graphics::finalize(ImageCollection *const col)
+void MobileOpenGL2Graphics::finalize(ImageCollection *restrict const col)
+ restrict2
{
if (!col)
return;
@@ -1238,7 +1243,8 @@ void MobileOpenGL2Graphics::finalize(ImageCollection *const col)
finalize(*it);
}
-void MobileOpenGL2Graphics::finalize(ImageVertexes *const vert)
+void MobileOpenGL2Graphics::finalize(ImageVertexes *restrict const vert)
+ restrict2
{
// in future need convert in each switchVp/continueVp
@@ -1275,7 +1281,7 @@ void MobileOpenGL2Graphics::finalize(ImageVertexes *const vert)
floatTexPool.clear();
}
-void MobileOpenGL2Graphics::drawTriangleArray(const int size)
+void MobileOpenGL2Graphics::drawTriangleArray(const int size) restrict2
{
mglBufferData(GL_ARRAY_BUFFER, size * sizeof(GLfloat),
mFloatArray, GL_STREAM_DRAW);
@@ -1285,8 +1291,9 @@ void MobileOpenGL2Graphics::drawTriangleArray(const int size)
mglDrawArrays(GL_TRIANGLES, 0, size / 4);
}
-void MobileOpenGL2Graphics::drawTriangleArray(const GLfloat *const array,
- const int size)
+void MobileOpenGL2Graphics::drawTriangleArray(const GLfloat *restrict const
+ array,
+ const int size) restrict2
{
mglBufferData(GL_ARRAY_BUFFER, size * sizeof(GLfloat),
array, GL_STREAM_DRAW);
@@ -1296,7 +1303,7 @@ void MobileOpenGL2Graphics::drawTriangleArray(const GLfloat *const array,
mglDrawArrays(GL_TRIANGLES, 0, size / 4);
}
-void MobileOpenGL2Graphics::drawLineArrays(const int size)
+void MobileOpenGL2Graphics::drawLineArrays(const int size) restrict2
{
mglBufferData(GL_ARRAY_BUFFER, size * sizeof(GLfloat),
mFloatArray, GL_STREAM_DRAW);
diff --git a/src/render/mobileopengl2graphics.h b/src/render/mobileopengl2graphics.h
index 70bb7f84e..ff7631f21 100644
--- a/src/render/mobileopengl2graphics.h
+++ b/src/render/mobileopengl2graphics.h
@@ -56,20 +56,23 @@ class MobileOpenGL2Graphics final : public Graphics
~MobileOpenGL2Graphics();
- void postInit() override final;
+ void postInit() restrict2 override final;
void setColor(const Color &restrict color) restrict2 override final;
- void screenResized() override final;
+ void screenResized() restrict2 override final;
- void finalize(ImageCollection *const col) override final;
+ void finalize(ImageCollection *restrict const col)
+ restrict2 override final;
- void finalize(ImageVertexes *const vert) override final;
+ void finalize(ImageVertexes *restrict const vert)
+ restrict2 override final;
- void testDraw() override final;
+ void testDraw() restrict2 override final;
void removeArray(const uint32_t id,
- uint32_t *const arr) override final A_NONNULL(3);
+ uint32_t *restrict const arr)
+ restrict2 override final A_NONNULL(3);
void createGLContext() restrict2 override final;
@@ -80,33 +83,33 @@ class MobileOpenGL2Graphics final : public Graphics
#include "render/openglgraphicsdefadvanced.hpp"
private:
- void deleteGLObjects();
+ void deleteGLObjects() restrict2;
inline void drawQuad(const int srcX, const int srcY,
const int dstX, const int dstY,
- const int width, const int height);
+ const int width, const int height) restrict2;
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);
+ const int desiredHeight) restrict2;
- inline void drawTriangleArray(const int size);
+ inline void drawTriangleArray(const int size) restrict2;
- inline void drawTriangleArray(const GLfloat *const array,
- const int size);
+ inline void drawTriangleArray(const GLfloat *restrict const array,
+ const int size) restrict2;
- inline void drawLineArrays(const int size);
+ inline void drawLineArrays(const int size) restrict2;
- inline void bindArrayBuffer(const GLuint vbo);
+ inline void bindArrayBuffer(const GLuint vbo) restrict2;
- inline void bindArrayBufferAndAttributes(const GLuint vbo);
+ inline void bindArrayBufferAndAttributes(const GLuint vbo) restrict2;
- inline void bindAttributes();
+ inline void bindAttributes() restrict2;
static void bindTexture2(const GLenum target,
- const Image *const image);
+ const Image *restrict const image);
static GLuint mTextureSizeUniform;
static int mTextureWidth;
diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp
index 11227325a..8ce7ddea3 100644
--- a/src/render/mobileopenglgraphics.cpp
+++ b/src/render/mobileopenglgraphics.cpp
@@ -101,7 +101,7 @@ MobileOpenGLGraphics::~MobileOpenGLGraphics()
deleteArraysInternal();
}
-void MobileOpenGLGraphics::postInit()
+void MobileOpenGLGraphics::postInit() restrict2
{
// glesTest();
}
@@ -157,15 +157,21 @@ bool MobileOpenGLGraphics::setVideoMode(const int w, const int h,
return setOpenGLMode();
}
-static inline void drawQuad(const Image *const image,
- const int srcX, const int srcY,
- const int dstX, const int dstY,
- const int width, const int height) A_NONNULL(1);
-
-static inline void drawQuad(const Image *const image,
- const int srcX, const int srcY,
- const int dstX, const int dstY,
- const int width, const int height)
+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);
+
+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)
{
// if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D)
{
@@ -204,14 +210,14 @@ static inline void drawQuad(const Image *const image,
}
}
-static inline void drawRescaledQuad(const Image *const image,
+static inline void drawRescaledQuad(const Image *restrict const image,
const int srcX, const int srcY,
const int dstX, const int dstY,
const int width, const int height,
const int desiredWidth,
const int desiredHeight) A_NONNULL(1);
-static inline void drawRescaledQuad(const Image *const image,
+static inline void drawRescaledQuad(const Image *restrict const image,
const int srcX, const int srcY,
const int dstX, const int dstY,
const int width, const int height,
@@ -1203,7 +1209,7 @@ void MobileOpenGLGraphics::bindTexture(const GLenum target,
}
}
-inline void MobileOpenGLGraphics::drawTriangleArrayfs(const int size)
+inline void MobileOpenGLGraphics::drawTriangleArrayfs(const int size) restrict2
{
glVertexPointer(2, GL_SHORT, 0, mShortVertArray);
glTexCoordPointer(2, GL_FLOAT, 0, mFloatTexArray);
@@ -1214,7 +1220,7 @@ inline void MobileOpenGLGraphics::drawTriangleArrayfs(const int size)
mglDrawArrays(GL_TRIANGLES, 0, size / 2);
}
-inline void MobileOpenGLGraphics::drawTriangleArrayfsCached(const int size)
+inline void MobileOpenGLGraphics::drawTriangleArrayfsCached(const int size) restrict2
{
glVertexPointer(2, GL_SHORT, 0, mShortVertArrayCached);
glTexCoordPointer(2, GL_FLOAT, 0, mFloatTexArrayCached);
@@ -1225,11 +1231,11 @@ inline void MobileOpenGLGraphics::drawTriangleArrayfsCached(const int size)
mglDrawArrays(GL_TRIANGLES, 0, size / 2);
}
-inline void MobileOpenGLGraphics::drawTriangleArrayfs(const GLshort *const
- shortVertArray,
- const GLfloat *const
- floatTexArray,
- const int size)
+inline void MobileOpenGLGraphics::drawTriangleArrayfs(const GLshort *restrict
+ const shortVertArray,
+ const GLfloat *restrict
+ const floatTexArray,
+ const int size) restrict2
{
glVertexPointer(2, GL_SHORT, 0, shortVertArray);
glTexCoordPointer(2, GL_FLOAT, 0, floatTexArray);
@@ -1240,7 +1246,7 @@ inline void MobileOpenGLGraphics::drawTriangleArrayfs(const GLshort *const
mglDrawArrays(GL_TRIANGLES, 0, size / 2);
}
-inline void MobileOpenGLGraphics::drawLineArrays(const int size)
+inline void MobileOpenGLGraphics::drawLineArrays(const int size) restrict2
{
glVertexPointer(2, GL_SHORT, 0, mShortVertArray);
diff --git a/src/render/mobileopenglgraphics.h b/src/render/mobileopenglgraphics.h
index ff722671e..e22acf203 100644
--- a/src/render/mobileopenglgraphics.h
+++ b/src/render/mobileopenglgraphics.h
@@ -55,17 +55,19 @@ class MobileOpenGLGraphics final : public Graphics
~MobileOpenGLGraphics();
- void postInit() override final;
+ void postInit() restrict2 override final;
- inline void drawTriangleArrayfs(const GLshort *const shortVertArray,
- const GLfloat *const floatTexArray,
- const int size);
+ inline void drawTriangleArrayfs(const GLshort *restrict const
+ shortVertArray,
+ const GLfloat *restrict const
+ floatTexArray,
+ const int size) restrict2;
- inline void drawTriangleArrayfs(const int size);
+ inline void drawTriangleArrayfs(const int size) restrict2;
- inline void drawTriangleArrayfsCached(const int size);
+ inline void drawTriangleArrayfsCached(const int size) restrict2;
- inline void drawLineArrays(const int size);
+ inline void drawLineArrays(const int size) restrict2;
#include "render/graphicsdef.hpp"
diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp
index 5fc6f27ac..f8e9e51f5 100644
--- a/src/render/modernopenglgraphics.cpp
+++ b/src/render/modernopenglgraphics.cpp
@@ -122,7 +122,7 @@ ModernOpenGLGraphics::~ModernOpenGLGraphics()
deleteGLObjects();
}
-void ModernOpenGLGraphics::deleteGLObjects()
+void ModernOpenGLGraphics::deleteGLObjects() restrict2
{
delete2(mProgram);
if (mVbo)
@@ -156,7 +156,7 @@ void ModernOpenGLGraphics::initArrays(const int vertCount) restrict2
mIntArrayCached = new GLint[sz];
}
-void ModernOpenGLGraphics::postInit()
+void ModernOpenGLGraphics::postInit() restrict2
{
mglGenVertexArrays(1, &mVao);
mglBindVertexArray(mVao);
@@ -202,7 +202,7 @@ void ModernOpenGLGraphics::postInit()
static_cast<float>(mHeight) / 2.0f);
}
-void ModernOpenGLGraphics::screenResized()
+void ModernOpenGLGraphics::screenResized() restrict2
{
deleteGLObjects();
mVboBinded = 0U;
@@ -260,9 +260,12 @@ void ModernOpenGLGraphics::setColorAlpha(const float alpha) restrict2
}
}
-void ModernOpenGLGraphics::drawQuad(const int srcX, const int srcY,
- const int dstX, const int dstY,
- const int width, const int height)
+void ModernOpenGLGraphics::drawQuad(const int srcX,
+ const int srcY,
+ const int dstX,
+ const int dstY,
+ const int width,
+ const int height) restrict2
{
const int texX2 = srcX + width;
const int texY2 = srcY + height;
@@ -290,7 +293,7 @@ void ModernOpenGLGraphics::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)
+ const int desiredHeight) restrict2
{
const int texX2 = srcX + width;
const int texY2 = srcY + height;
@@ -348,7 +351,7 @@ void ModernOpenGLGraphics::copyImage(const Image *restrict const image,
drawImageInline(image, dstX, dstY);
}
-void ModernOpenGLGraphics::testDraw()
+void ModernOpenGLGraphics::testDraw() restrict2
{
/*
GLint vertices[] =
@@ -1094,7 +1097,7 @@ void ModernOpenGLGraphics::bindTexture(const GLenum target,
}
void ModernOpenGLGraphics::removeArray(const uint32_t sz,
- uint32_t *const arr)
+ uint32_t *restrict const arr) restrict2
{
mglDeleteBuffers(sz, arr);
for (size_t f = 0; f < sz; f ++)
@@ -1105,7 +1108,7 @@ void ModernOpenGLGraphics::removeArray(const uint32_t sz,
}
}
-void ModernOpenGLGraphics::bindArrayBuffer(const GLuint vbo)
+void ModernOpenGLGraphics::bindArrayBuffer(const GLuint vbo) restrict2
{
if (mVboBinded != vbo)
{
@@ -1120,7 +1123,7 @@ void ModernOpenGLGraphics::bindArrayBuffer(const GLuint vbo)
}
}
-void ModernOpenGLGraphics::bindElementBuffer(const GLuint ebo)
+void ModernOpenGLGraphics::bindElementBuffer(const GLuint ebo) restrict2
{
if (mEboBinded != ebo)
{
@@ -1135,6 +1138,7 @@ void ModernOpenGLGraphics::bindElementBuffer(const GLuint ebo)
}
void ModernOpenGLGraphics::bindArrayBufferAndAttributes(const GLuint vbo)
+ restrict2
{
if (mVboBinded != vbo)
{
@@ -1162,7 +1166,7 @@ void ModernOpenGLGraphics::bindArrayBufferAndAttributes(const GLuint vbo)
}
}
-void ModernOpenGLGraphics::bindAttributes()
+void ModernOpenGLGraphics::bindAttributes() restrict2
{
if (mAttributesBinded != mVboBinded)
{
@@ -1205,6 +1209,7 @@ void ModernOpenGLGraphics::calcImageRect(ImageVertexes *restrict const vert,
const int x, const int y,
const int w, const int h,
const ImageRect &restrict imgRect)
+ restrict2
{
#include "render/graphics_calcImageRect.hpp"
}
@@ -1224,7 +1229,8 @@ void ModernOpenGLGraphics::createGLContext() restrict2
mGLContext = SDL::createGLContext(mWindow, 3, 3, 0x01);
}
-void ModernOpenGLGraphics::finalize(ImageCollection *const col)
+void ModernOpenGLGraphics::finalize(ImageCollection *restrict const col)
+ restrict2
{
if (!col)
return;
@@ -1232,7 +1238,8 @@ void ModernOpenGLGraphics::finalize(ImageCollection *const col)
finalize(*it);
}
-void ModernOpenGLGraphics::finalize(ImageVertexes *const vert)
+void ModernOpenGLGraphics::finalize(ImageVertexes *restrict const vert)
+ restrict2
{
// in future need convert in each switchVp/continueVp
@@ -1277,7 +1284,7 @@ void ModernOpenGLGraphics::finalize(ImageVertexes *const vert)
intTexPool.clear();
}
-void ModernOpenGLGraphics::drawTriangleArray(const int size)
+void ModernOpenGLGraphics::drawTriangleArray(const int size) restrict2
{
// logger->log("allocate: %d, %ld", mVboBinded, size * sizeof(GLint));
mglBufferData(GL_ARRAY_BUFFER, size * sizeof(GLint),
@@ -1288,8 +1295,8 @@ void ModernOpenGLGraphics::drawTriangleArray(const int size)
mglDrawArrays(GL_TRIANGLES, 0, size / 4);
}
-void ModernOpenGLGraphics::drawTriangleArray(const GLint *const array,
- const int size)
+void ModernOpenGLGraphics::drawTriangleArray(const GLint *restrict const array,
+ const int size) restrict2
{
// logger->log("allocate: %d, %ld", mVboBinded, size * sizeof(GLint));
mglBufferData(GL_ARRAY_BUFFER, size * sizeof(GLint),
diff --git a/src/render/modernopenglgraphics.h b/src/render/modernopenglgraphics.h
index d4a0516b7..5af03950f 100644
--- a/src/render/modernopenglgraphics.h
+++ b/src/render/modernopenglgraphics.h
@@ -56,20 +56,23 @@ class ModernOpenGLGraphics final : public Graphics
~ModernOpenGLGraphics();
- void postInit() override final;
+ void postInit() restrict2 override final;
void setColor(const Color &restrict color) restrict2 override final;
- void screenResized() override final;
+ void screenResized() restrict2 override final;
- void finalize(ImageCollection *const col) override final;
+ void finalize(ImageCollection *restrict const col)
+ restrict2 override final;
- void finalize(ImageVertexes *const vert) override final;
+ void finalize(ImageVertexes *restrict const vert)
+ restrict2 override final;
- void testDraw() override final;
+ void testDraw() restrict2 override final;
void removeArray(const uint32_t id,
- uint32_t *const arr) override final A_NONNULL(3);
+ uint32_t *restrict const arr)
+ restrict2 override final A_NONNULL(3);
void createGLContext() restrict2 override final;
@@ -80,32 +83,32 @@ class ModernOpenGLGraphics final : public Graphics
#include "render/openglgraphicsdefadvanced.hpp"
private:
- void deleteGLObjects();
+ void deleteGLObjects() restrict2;
inline void drawQuad(const int srcX, const int srcY,
const int dstX, const int dstY,
- const int width, const int height);
+ const int width, const int height) restrict2;
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);
+ const int desiredHeight) restrict2;
- inline void drawTriangleArray(const int size);
+ inline void drawTriangleArray(const int size) restrict2;
- inline void drawTriangleArray(const GLint *const array,
- const int size);
+ inline void drawTriangleArray(const GLint *restrict const array,
+ const int size) restrict2;
- inline void drawLineArrays(const int size);
+ inline void drawLineArrays(const int size) restrict2;
- inline void bindArrayBuffer(const GLuint vbo);
+ inline void bindArrayBuffer(const GLuint vbo) restrict2;
- inline void bindArrayBufferAndAttributes(const GLuint vbo);
+ inline void bindArrayBufferAndAttributes(const GLuint vbo) restrict2;
- inline void bindAttributes();
+ inline void bindAttributes() restrict2;
- inline void bindElementBuffer(const GLuint ebo);
+ inline void bindElementBuffer(const GLuint ebo) restrict2;
GLint *mIntArray A_NONNULLPOINTER;
GLint *mIntArrayCached A_NONNULLPOINTER;
diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp
index 942377a4c..36680c1ac 100644
--- a/src/render/normalopenglgraphics.cpp
+++ b/src/render/normalopenglgraphics.cpp
@@ -179,8 +179,8 @@ bool NormalOpenGLGraphics::setVideoMode(const int w, const int h,
return setOpenGLMode();
}
-static inline void bindPointerIntFloat(const GLint *const vert,
- const GLfloat *const tex)
+static inline void bindPointerIntFloat(const GLint *restrict const vert,
+ const GLfloat *restrict const tex)
{
if (vertPtr != vert)
{
@@ -190,8 +190,8 @@ static inline void bindPointerIntFloat(const GLint *const vert,
}
}
-static inline void bindPointerInt(const GLint *const vert,
- const GLint *const tex)
+static inline void bindPointerInt(const GLint *restrict const vert,
+ const GLint *restrict const tex)
{
if (vertPtr != vert)
{
@@ -201,12 +201,12 @@ static inline void bindPointerInt(const GLint *const vert,
}
}
-static inline void drawQuad(const Image *const image,
+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);
-static inline void drawQuad(const Image *const image,
+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)
@@ -268,14 +268,14 @@ static inline void drawQuad(const Image *const image,
}
}
-static inline void drawRescaledQuad(const Image *const image,
+static inline void drawRescaledQuad(const Image *restrict const image,
const int srcX, const int srcY,
const int dstX, const int dstY,
const int width, const int height,
const int desiredWidth,
const int desiredHeight) A_NONNULL(1);
-static inline void drawRescaledQuad(const Image *const image,
+static inline void drawRescaledQuad(const Image *restrict const image,
const int srcX, const int srcY,
const int dstX, const int dstY,
const int width, const int height,
@@ -370,7 +370,7 @@ void NormalOpenGLGraphics::copyImage(const Image *restrict const image,
drawImageInline(image, dstX, dstY);
}
-void NormalOpenGLGraphics::testDraw()
+void NormalOpenGLGraphics::testDraw() restrict2
{
if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D)
{
@@ -1508,7 +1508,7 @@ void NormalOpenGLGraphics::bindTexture(const GLenum target,
}
}
-inline void NormalOpenGLGraphics::drawQuadArrayfi(const int size)
+inline void NormalOpenGLGraphics::drawQuadArrayfi(const int size) restrict2
{
bindPointerIntFloat(&mIntVertArray[0], &mFloatTexArray[0]);
#ifdef DEBUG_DRAW_CALLS
@@ -1518,6 +1518,7 @@ inline void NormalOpenGLGraphics::drawQuadArrayfi(const int size)
}
inline void NormalOpenGLGraphics::drawQuadArrayfiCached(const int size)
+ restrict2
{
bindPointerIntFloat(&mIntVertArrayCached[0], &mFloatTexArrayCached[0]);
#ifdef DEBUG_DRAW_CALLS
@@ -1526,11 +1527,11 @@ inline void NormalOpenGLGraphics::drawQuadArrayfiCached(const int size)
glDrawArrays(GL_QUADS, 0, size / 2);
}
-inline void NormalOpenGLGraphics::drawQuadArrayfi(const GLint *const
+inline void NormalOpenGLGraphics::drawQuadArrayfi(const GLint *restrict const
intVertArray,
- const GLfloat *const
+ const GLfloat *restrict const
floatTexArray,
- const int size)
+ const int size) restrict2
{
vertPtr = intVertArray;
glVertexPointer(2, GL_INT, 0, intVertArray);
@@ -1541,7 +1542,7 @@ inline void NormalOpenGLGraphics::drawQuadArrayfi(const GLint *const
glDrawArrays(GL_QUADS, 0, size / 2);
}
-inline void NormalOpenGLGraphics::drawQuadArrayii(const int size)
+inline void NormalOpenGLGraphics::drawQuadArrayii(const int size) restrict2
{
bindPointerInt(&mIntVertArray[0], &mIntTexArray[0]);
#ifdef DEBUG_DRAW_CALLS
@@ -1551,6 +1552,7 @@ inline void NormalOpenGLGraphics::drawQuadArrayii(const int size)
}
inline void NormalOpenGLGraphics::drawQuadArrayiiCached(const int size)
+ restrict2
{
bindPointerInt(&mIntVertArrayCached[0], &mIntTexArrayCached[0]);
#ifdef DEBUG_DRAW_CALLS
@@ -1559,11 +1561,11 @@ inline void NormalOpenGLGraphics::drawQuadArrayiiCached(const int size)
glDrawArrays(GL_QUADS, 0, size / 2);
}
-inline void NormalOpenGLGraphics::drawQuadArrayii(const GLint *const
+inline void NormalOpenGLGraphics::drawQuadArrayii(const GLint *restrict const
intVertArray,
- const GLint *const
+ const GLint *restrict const
intTexArray,
- const int size)
+ const int size) restrict2
{
vertPtr = intVertArray;
glVertexPointer(2, GL_INT, 0, intVertArray);
@@ -1574,7 +1576,7 @@ inline void NormalOpenGLGraphics::drawQuadArrayii(const GLint *const
glDrawArrays(GL_QUADS, 0, size / 2);
}
-inline void NormalOpenGLGraphics::drawLineArrayi(const int size)
+inline void NormalOpenGLGraphics::drawLineArrayi(const int size) restrict2
{
glVertexPointer(2, GL_INT, 0, mIntVertArray);
vertPtr = nullptr;
@@ -1584,7 +1586,7 @@ inline void NormalOpenGLGraphics::drawLineArrayi(const int size)
glDrawArrays(GL_LINES, 0, size / 2);
}
-inline void NormalOpenGLGraphics::drawLineArrayf(const int size)
+inline void NormalOpenGLGraphics::drawLineArrayf(const int size) restrict2
{
glVertexPointer(2, GL_FLOAT, 0, mFloatTexArray);
vertPtr = nullptr;
diff --git a/src/render/normalopenglgraphics.h b/src/render/normalopenglgraphics.h
index fa8c8456a..3bde8b6d8 100644
--- a/src/render/normalopenglgraphics.h
+++ b/src/render/normalopenglgraphics.h
@@ -55,27 +55,28 @@ class NormalOpenGLGraphics final : public Graphics
~NormalOpenGLGraphics();
- inline void drawQuadArrayfi(const int size);
+ inline void drawQuadArrayfi(const int size) restrict2;
- inline void drawQuadArrayfiCached(const int size);
+ inline void drawQuadArrayfiCached(const int size) restrict2;
- inline void drawQuadArrayfi(const GLint *const intVertArray,
- const GLfloat *const floatTexArray,
- const int size);
+ inline void drawQuadArrayfi(const GLint *restrict const intVertArray,
+ const GLfloat *restrict const
+ floatTexArray,
+ const int size) restrict2;
- inline void drawQuadArrayii(const int size);
+ inline void drawQuadArrayii(const int size) restrict2;
- inline void drawQuadArrayiiCached(const int size);
+ inline void drawQuadArrayiiCached(const int size) restrict2;
- inline void drawQuadArrayii(const GLint *const intVertArray,
- const GLint *const intTexArray,
- const int size);
+ inline void drawQuadArrayii(const GLint *restrict const intVertArray,
+ const GLint *restrict const intTexArray,
+ const int size) restrict2;
- inline void drawLineArrayi(const int size);
+ inline void drawLineArrayi(const int size) restrict2;
- inline void drawLineArrayf(const int size);
+ inline void drawLineArrayf(const int size) restrict2;
- void testDraw() override final;
+ void testDraw() restrict2 override final;
#include "render/graphicsdef.hpp"
@@ -86,7 +87,7 @@ class NormalOpenGLGraphics final : public Graphics
#include "render/openglgraphicsdefadvanced.hpp"
#ifdef DEBUG_BIND_TEXTURE
- unsigned int getBinds() const
+ unsigned int getBinds() const restrict2
{ return mLastBinds; }
#endif
diff --git a/src/render/nullopenglgraphics.cpp b/src/render/nullopenglgraphics.cpp
index 16b1b5523..bce9360a4 100644
--- a/src/render/nullopenglgraphics.cpp
+++ b/src/render/nullopenglgraphics.cpp
@@ -106,13 +106,13 @@ bool NullOpenGLGraphics::setVideoMode(const int w, const int h,
return setOpenGLMode();
}
-static inline void drawQuad(const Image *const image A_UNUSED,
+static inline void drawQuad(const Image *restrict const image A_UNUSED,
const int srcX A_UNUSED, const int srcY A_UNUSED,
const int dstX A_UNUSED, const int dstY A_UNUSED,
const int width A_UNUSED,
const int height A_UNUSED) A_NONNULL(1);
-static inline void drawQuad(const Image *const image A_UNUSED,
+static inline void drawQuad(const Image *restrict const image A_UNUSED,
const int srcX A_UNUSED, const int srcY A_UNUSED,
const int dstX A_UNUSED, const int dstY A_UNUSED,
const int width A_UNUSED,
@@ -132,7 +132,7 @@ static inline void drawQuad(const Image *const image A_UNUSED,
}
}
-static inline void drawRescaledQuad(const Image *const image A_UNUSED,
+static inline void drawRescaledQuad(const Image *restrict const image A_UNUSED,
const int srcX A_UNUSED,
const int srcY A_UNUSED,
const int dstX A_UNUSED,
@@ -1118,35 +1118,37 @@ void NullOpenGLGraphics::bindTexture(const GLenum target A_UNUSED,
}
inline void NullOpenGLGraphics::drawQuadArrayfi(const int size A_UNUSED)
+ restrict2
{
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
}
-inline void NullOpenGLGraphics::drawQuadArrayfi(const GLint *const
+inline void NullOpenGLGraphics::drawQuadArrayfi(const GLint *restrict const
intVertArray A_UNUSED,
- const GLfloat *const
+ const GLfloat *restrict const
floatTexArray A_UNUSED,
const int size A_UNUSED)
+ restrict2
{
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
}
-inline void NullOpenGLGraphics::drawQuadArrayii(const int size A_UNUSED)
+inline void NullOpenGLGraphics::drawQuadArrayii(const int size A_UNUSED) restrict2
{
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
#endif
}
-inline void NullOpenGLGraphics::drawQuadArrayii(const GLint *const
+inline void NullOpenGLGraphics::drawQuadArrayii(const GLint *restrict const
intVertArray A_UNUSED,
- const GLint *const
+ const GLint *restrict const
intTexArray A_UNUSED,
- const int size A_UNUSED)
+ const int size A_UNUSED) restrict2
{
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
@@ -1154,6 +1156,7 @@ inline void NullOpenGLGraphics::drawQuadArrayii(const GLint *const
}
inline void NullOpenGLGraphics::drawLineArrayi(const int size A_UNUSED)
+ restrict2
{
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
@@ -1161,6 +1164,7 @@ inline void NullOpenGLGraphics::drawLineArrayi(const int size A_UNUSED)
}
inline void NullOpenGLGraphics::drawLineArrayf(const int size A_UNUSED)
+ restrict2
{
#ifdef DEBUG_DRAW_CALLS
mDrawCalls ++;
@@ -1201,6 +1205,7 @@ void NullOpenGLGraphics::calcImageRect(ImageVertexes *restrict const vert,
const int x, const int y,
const int w, const int h,
const ImageRect &restrict imgRect)
+ restrict2
{
#include "render/graphics_calcImageRect.hpp"
}
diff --git a/src/render/nullopenglgraphics.h b/src/render/nullopenglgraphics.h
index abd73a117..cbb9f5b8b 100644
--- a/src/render/nullopenglgraphics.h
+++ b/src/render/nullopenglgraphics.h
@@ -55,21 +55,22 @@ class NullOpenGLGraphics final : public Graphics
~NullOpenGLGraphics();
- inline void drawQuadArrayfi(const int size);
+ inline void drawQuadArrayfi(const int size) restrict2;
- inline void drawQuadArrayfi(const GLint *const intVertArray,
- const GLfloat *const floatTexArray,
- const int size);
+ inline void drawQuadArrayfi(const GLint *restrict const intVertArray,
+ const GLfloat *restrict const
+ floatTexArray,
+ const int size) restrict2;
- inline void drawQuadArrayii(const int size);
+ inline void drawQuadArrayii(const int size) restrict2;
- inline void drawQuadArrayii(const GLint *const intVertArray,
- const GLint *const intTexArray,
- const int size);
+ inline void drawQuadArrayii(const GLint *restrict const intVertArray,
+ const GLint *restrict const intTexArray,
+ const int size) restrict2;
- inline void drawLineArrayi(const int size);
+ inline void drawLineArrayi(const int size) restrict2;
- inline void drawLineArrayf(const int size);
+ inline void drawLineArrayf(const int size) restrict2;
#include "render/graphicsdef.hpp"
diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp
index 57337412c..83ce736ea 100644
--- a/src/render/safeopenglgraphics.cpp
+++ b/src/render/safeopenglgraphics.cpp
@@ -68,15 +68,21 @@ bool SafeOpenGLGraphics::setVideoMode(const int w, const int h,
return setOpenGLMode();
}
-static inline void drawQuad(const Image *image,
- const int srcX, const int srcY,
- const int dstX, const int dstY,
- const int width, const int height) A_NONNULL(1);
-
-static inline void drawQuad(const Image *image,
- const int srcX, const int srcY,
- const int dstX, const int dstY,
- const int width, const int height)
+static inline void drawQuad(const Image *restrict image,
+ const int srcX,
+ const int srcY,
+ const int dstX,
+ const int dstY,
+ const int width,
+ const int height) A_NONNULL(1);
+
+static inline void drawQuad(const Image *restrict image,
+ const int srcX,
+ const int srcY,
+ const int dstX,
+ const int dstY,
+ const int width,
+ const int height)
{
if (SafeOpenGLImageHelper::mTextureType == GL_TEXTURE_2D)
{
@@ -110,14 +116,14 @@ static inline void drawQuad(const Image *image,
}
}
-static inline void drawRescaledQuad(const Image *const image,
+static inline void drawRescaledQuad(const Image *restrict const image,
const int srcX, const int srcY,
const int dstX, const int dstY,
const int width, const int height,
const int desiredWidth,
const int desiredHeight) A_NONNULL(1);
-static inline void drawRescaledQuad(const Image *const image,
+static inline void drawRescaledQuad(const Image *restrict const image,
const int srcX, const int srcY,
const int dstX, const int dstY,
const int width, const int height,
@@ -187,7 +193,7 @@ void SafeOpenGLGraphics::copyImage(const Image *restrict const image,
drawImageInline(image, dstX, dstY);
}
-void SafeOpenGLGraphics::testDraw()
+void SafeOpenGLGraphics::testDraw() restrict2
{
if (SafeOpenGLImageHelper::mTextureType == GL_TEXTURE_2D)
{
@@ -687,7 +693,8 @@ void SafeOpenGLGraphics::drawRectangle(const Rect &restrict rect,
BLOCK_END("Graphics::drawRectangle")
}
-void SafeOpenGLGraphics::bindTexture(const GLenum target, const GLuint texture)
+void SafeOpenGLGraphics::bindTexture(const GLenum target,
+ const GLuint texture)
{
if (mTextureBinded != texture)
{
diff --git a/src/render/safeopenglgraphics.h b/src/render/safeopenglgraphics.h
index 8a162e8d6..bec04faa8 100644
--- a/src/render/safeopenglgraphics.h
+++ b/src/render/safeopenglgraphics.h
@@ -51,7 +51,7 @@ class SafeOpenGLGraphics final : public Graphics
~SafeOpenGLGraphics();
- void testDraw() override final;
+ void testDraw() restrict2 override final;
#include "render/graphicsdef.hpp"
diff --git a/src/render/sdl2graphics.cpp b/src/render/sdl2graphics.cpp
index a8a4962d9..dc14125c8 100644
--- a/src/render/sdl2graphics.cpp
+++ b/src/render/sdl2graphics.cpp
@@ -90,10 +90,10 @@
#define MSDL_RenderCopy(render, texture, src, dst) \
FakeSDL_RenderCopy(render, texture, src, dst)
-static int FakeSDL_RenderCopy(SDL_Renderer *const renderer,
- SDL_Texture *const texture,
- const SDL_Rect *const srcrect,
- const SDL_Rect *const dstrect)
+static int FakeSDL_RenderCopy(SDL_Renderer *restrict const renderer,
+ SDL_Texture *restrict const texture,
+ const SDL_Rect *restrict const srcrect,
+ const SDL_Rect *restrict const dstrect)
{
int ret = SDL_RenderCopy(renderer, texture, srcrect, dstrect);
if (ret)
@@ -780,7 +780,7 @@ void SDLGraphics::drawImageRect(const int x, const int y,
void SDLGraphics::calcImageRect(ImageVertexes *restrict const vert,
const int x, const int y,
const int w, const int h,
- const ImageRect &restrict imgRect)
+ const ImageRect &restrict imgRect) restrict2
{
#include "render/graphics_calcImageRect.hpp"
}
diff --git a/src/render/sdl2graphics.h b/src/render/sdl2graphics.h
index 7c4b883d6..294506bf4 100644
--- a/src/render/sdl2graphics.h
+++ b/src/render/sdl2graphics.h
@@ -97,7 +97,7 @@ class SDLGraphics final : public Graphics
*/
~SDLGraphics();
- void setRendererFlags(const uint32_t flags)
+ void setRendererFlags(const uint32_t flags) restrict
{ mRendererFlags = flags; }
#include "render/graphicsdef.hpp"
diff --git a/src/render/sdl2softwaregraphics.cpp b/src/render/sdl2softwaregraphics.cpp
index 4b8c9a469..5e7434e80 100644
--- a/src/render/sdl2softwaregraphics.cpp
+++ b/src/render/sdl2softwaregraphics.cpp
@@ -830,10 +830,13 @@ void SDL2SoftwareGraphics::calcWindow(ImageCollection *restrict const vertCol,
calcImageRect(vert, x, y, w, h, imgRect);
}
-int SDL2SoftwareGraphics::SDL_FakeUpperBlit(const SDL_Surface *const src,
- SDL_Rect *const srcrect,
- const SDL_Surface *const dst,
- SDL_Rect *dstrect) const
+int SDL2SoftwareGraphics::SDL_FakeUpperBlit(const SDL_Surface *restrict const
+ src,
+ SDL_Rect *restrict const srcrect,
+ const SDL_Surface *restrict const
+ dst,
+ SDL_Rect *restrict dstrect)
+ const restrict2
{
int srcx, srcy, w, h;
@@ -1154,7 +1157,7 @@ void SDL2SoftwareGraphics::drawPoint(int x, int y) restrict2
SDLputPixel(mSurface, x, y, mColor);
}
-void SDL2SoftwareGraphics::drawHLine(int x1, int y, int x2)
+void SDL2SoftwareGraphics::drawHLine(int x1, int y, int x2) restrict2
{
if (mClipStack.empty())
return;
diff --git a/src/render/sdl2softwaregraphics.h b/src/render/sdl2softwaregraphics.h
index 633a7a6e4..1bef95575 100644
--- a/src/render/sdl2softwaregraphics.h
+++ b/src/render/sdl2softwaregraphics.h
@@ -56,7 +56,7 @@ class SDL2SoftwareGraphics final : public Graphics
*/
~SDL2SoftwareGraphics();
- void setRendererFlags(const uint32_t flags) override final
+ void setRendererFlags(const uint32_t flags) restrict2 override final
{ mRendererFlags = flags; }
#include "render/graphicsdef.hpp"
@@ -67,14 +67,14 @@ class SDL2SoftwareGraphics final : public Graphics
const int height) restrict2 override final;
protected:
- int SDL_FakeUpperBlit(const SDL_Surface *const src,
- SDL_Rect *const srcrect,
- const SDL_Surface *const dst,
- SDL_Rect *dstrect) const;
+ int SDL_FakeUpperBlit(const SDL_Surface *restrict const src,
+ SDL_Rect *restrict const srcrect,
+ const SDL_Surface *restrict const dst,
+ SDL_Rect *restrict dstrect) const restrict2;
- void drawHLine(int x1, int y, int x2);
+ void drawHLine(int x1, int y, int x2) restrict2;
- void drawVLine(int x, int y1, int y2);
+ void drawVLine(int x, int y1, int y2) restrict2;
uint32_t mRendererFlags;
SDL_Surface *mSurface;
diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp
index 7743644f2..4fce63086 100644
--- a/src/render/sdlgraphics.cpp
+++ b/src/render/sdlgraphics.cpp
@@ -818,10 +818,10 @@ void SDLGraphics::calcWindow(ImageCollection *restrict const vertCol,
calcImageRect(vert, x, y, w, h, imgRect);
}
-int SDLGraphics::SDL_FakeUpperBlit(const SDL_Surface *const src,
- SDL_Rect *const srcrect,
- const SDL_Surface *const dst,
- SDL_Rect *dstrect) const
+int SDLGraphics::SDL_FakeUpperBlit(const SDL_Surface *restrict const src,
+ SDL_Rect *restrict const srcrect,
+ const SDL_Surface *restrict const dst,
+ SDL_Rect *restrict dstrect) const restrict2
{
int srcx, srcy, w, h;
@@ -903,7 +903,7 @@ void SDLGraphics::fillRectangle(const Rect &restrict rectangle) restrict2
if (mClipStack.empty())
return;
- const ClipRect& top = mClipStack.top();
+ const ClipRect &restrict top = mClipStack.top();
Rect area = rectangle;
area.x += top.xOffset;
@@ -1110,7 +1110,7 @@ void SDLGraphics::endDraw() restrict2
void SDLGraphics::pushClipArea(const Rect &restrict area) restrict2
{
Graphics::pushClipArea(area);
- const ClipRect &carea = mClipStack.top();
+ const ClipRect &restrict carea = mClipStack.top();
const SDL_Rect rect =
{
static_cast<int16_t>(carea.x),
@@ -1128,7 +1128,7 @@ void SDLGraphics::popClipArea() restrict2
if (mClipStack.empty())
return;
- const ClipRect &carea = mClipStack.top();
+ const ClipRect &restrict carea = mClipStack.top();
const SDL_Rect rect =
{
static_cast<int16_t>(carea.x),
@@ -1159,7 +1159,7 @@ void SDLGraphics::drawPoint(int x, int y) restrict2
SDLputPixel(mWindow, x, y, mColor);
}
-void SDLGraphics::drawHLine(int x1, int y, int x2)
+void SDLGraphics::drawHLine(int x1, int y, int x2) restrict2
{
if (mClipStack.empty())
return;
@@ -1286,12 +1286,12 @@ void SDLGraphics::drawHLine(int x1, int y, int x2)
SDL_UnlockSurface(mWindow);
}
-void SDLGraphics::drawVLine(int x, int y1, int y2)
+void SDLGraphics::drawVLine(int x, int y1, int y2) restrict2
{
if (mClipStack.empty())
return;
- const ClipRect& top = mClipStack.top();
+ const ClipRect &restrict top = mClipStack.top();
const int yOffset = top.yOffset;
x += top.xOffset;
diff --git a/src/render/sdlgraphics.h b/src/render/sdlgraphics.h
index 4e8e4d41e..2fa0258de 100644
--- a/src/render/sdlgraphics.h
+++ b/src/render/sdlgraphics.h
@@ -59,14 +59,14 @@ class SDLGraphics final : public Graphics
#include "render/softwaregraphicsdef.hpp"
protected:
- int SDL_FakeUpperBlit(const SDL_Surface *const src,
- SDL_Rect *const srcrect,
- const SDL_Surface *const dst,
- SDL_Rect *dstrect) const;
+ int SDL_FakeUpperBlit(const SDL_Surface *restrict const src,
+ SDL_Rect *restrict const srcrect,
+ const SDL_Surface *restrict const dst,
+ SDL_Rect *restrict dstrect) const restrict2;
- void drawHLine(int x1, int y, int x2);
+ void drawHLine(int x1, int y, int x2) restrict2;
- void drawVLine(int x, int y1, int y2);
+ void drawVLine(int x, int y1, int y2) restrict2;
uint32_t mOldPixel;
unsigned int mOldAlpha;
diff --git a/src/render/surfacegraphics.h b/src/render/surfacegraphics.h
index 8f9bcba99..a2071941a 100644
--- a/src/render/surfacegraphics.h
+++ b/src/render/surfacegraphics.h
@@ -47,36 +47,37 @@ class SurfaceGraphics final : public Graphics
~SurfaceGraphics();
- void setTarget(SDL_Surface *const target)
+ void setTarget(SDL_Surface *restrict const target) restrict2
{ mTarget = target; }
- SDL_Surface *getTarget() const
+ SDL_Surface *getTarget() const restrict2
{ return mTarget; }
- void beginDraw() override final
+ void beginDraw() restrict2 override final
{ }
- void endDraw() override final
+ void endDraw() restrict2 override final
{ }
- void pushClipArea(const Rect &rect A_UNUSED) override final
+ void pushClipArea(const Rect &restrict rect A_UNUSED)
+ restrict2 override final
{ }
void popClipArea() restrict2 override final
{ }
- void drawRescaledImage(const Image *const image A_UNUSED,
+ void drawRescaledImage(const Image *restrict const image A_UNUSED,
int dstX A_UNUSED, int dstY A_UNUSED,
const int desiredWidth A_UNUSED,
const int desiredHeight A_UNUSED)
- override final
+ restrict2 override final
{ }
- void drawPattern(const Image *const image A_UNUSED,
+ void drawPattern(const Image *restrict const image A_UNUSED,
const int x A_UNUSED,
const int y A_UNUSED,
const int w A_UNUSED,
- const int h A_UNUSED) override final
+ const int h A_UNUSED) restrict2 override final
{ }
void drawRescaledPattern(const Image *const image A_UNUSED,
@@ -89,43 +90,46 @@ class SurfaceGraphics final : public Graphics
override final
{ }
- void calcPattern(ImageVertexes *const vert A_UNUSED,
- const Image *const image A_UNUSED,
+ void calcPattern(ImageVertexes *restrict const vert A_UNUSED,
+ const Image *restrict const image A_UNUSED,
const int x A_UNUSED,
const int y A_UNUSED,
const int w A_UNUSED,
- const int h A_UNUSED) const override final
+ const int h A_UNUSED) const restrict2 override final
{ }
- void calcPattern(ImageCollection *const vert A_UNUSED,
- const Image *const image A_UNUSED,
+ void calcPattern(ImageCollection *restrict const vert A_UNUSED,
+ const Image *restrict const image A_UNUSED,
const int x A_UNUSED,
const int y A_UNUSED,
const int w A_UNUSED,
- const int h A_UNUSED) const override final
+ const int h A_UNUSED) const restrict2 override final
{ }
- void calcTileVertexes(ImageVertexes *const vert A_UNUSED,
- const Image *const image A_UNUSED,
+ void calcTileVertexes(ImageVertexes *restrict const vert A_UNUSED,
+ const Image *restrict const image A_UNUSED,
int x A_UNUSED,
- int y A_UNUSED) const override final
+ int y A_UNUSED) const restrict2 override final
{ }
- void calcTileSDL(ImageVertexes *const vert A_UNUSED,
- int x A_UNUSED, int y A_UNUSED) const override final
+ void calcTileSDL(ImageVertexes *restrict const vert A_UNUSED,
+ int x A_UNUSED,
+ int y A_UNUSED) const restrict2 override final
{ }
- void calcTileCollection(ImageCollection *const vertCol A_UNUSED,
- const Image *const image A_UNUSED,
- int x A_UNUSED, int y A_UNUSED) override final
+ 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
{ }
- void drawTileVertexes(const ImageVertexes *const
- vert A_UNUSED) override final
+ void drawTileVertexes(const ImageVertexes *restrict const
+ vert A_UNUSED) restrict2 override final
{ }
- void drawTileCollection(const ImageCollection *const vertCol A_UNUSED)
- override final
+ void drawTileCollection(const ImageCollection *restrict const
+ vertCol A_UNUSED)
+ restrict2 override final
{ }
void updateScreen() override final
@@ -136,32 +140,36 @@ class SurfaceGraphics final : public Graphics
const int x2 A_UNUSED,
const int y2 A_UNUSED,
const int width A_UNUSED,
- const int height A_UNUSED) override final
+ const int height A_UNUSED) restrict2 override final
{ }
- void calcWindow(ImageCollection *const vertCol A_UNUSED,
+ void calcWindow(ImageCollection *restrict const vertCol A_UNUSED,
const int x A_UNUSED, const int y A_UNUSED,
const int w A_UNUSED, const int h A_UNUSED,
- const ImageRect &imgRect A_UNUSED) override final
+ const ImageRect &restrict imgRect A_UNUSED)
+ restrict2 override final
{ }
- void setBlitMode(const BlitModeT mode)
+ void setBlitMode(const BlitModeT mode) restrict2
{ mBlitMode = mode; }
- BlitModeT getBlitMode() const A_WARN_UNUSED
+ BlitModeT getBlitMode() const restrict2 A_WARN_UNUSED
{ return mBlitMode; }
- void fillRectangle(const Rect &rect A_UNUSED) override final
+ void fillRectangle(const Rect &restrict rect A_UNUSED)
+ restrict2 override final
{ }
- void drawRectangle(const Rect &rect A_UNUSED) restrict2 override final
+ void drawRectangle(const Rect &restrict rect A_UNUSED)
+ restrict2 override final
{ }
- void drawPoint(int x A_UNUSED, int y A_UNUSED) override final
+ void drawPoint(int x A_UNUSED, int y A_UNUSED) restrict2 override final
{ }
void drawLine(int x1 A_UNUSED, int y1 A_UNUSED,
- int x2 A_UNUSED, int y2 A_UNUSED) override final
+ int x2 A_UNUSED, int y2 A_UNUSED)
+ restrict2 override final
{ }
bool setVideoMode(const int w A_UNUSED, const int h A_UNUSED,
@@ -172,23 +180,23 @@ class SurfaceGraphics final : public Graphics
const bool noFrame A_UNUSED) restrict2 override final
{ return false; }
- void drawImage(const Image *const image,
- int dstX, int dstY) override final;
+ void drawImage(const Image *restrict const image,
+ int dstX, int dstY) restrict2 override final;
- void copyImage(const Image *const image,
+ void copyImage(const Image *restrict const image,
int dstX, int dstY) restrict2 override final;
- void drawImageCached(const Image *const image,
- int x, int y) override final;
+ void drawImageCached(const Image *restrict const image,
+ int x, int y) restrict2 override final;
- void drawPatternCached(const Image *const image A_UNUSED,
+ void drawPatternCached(const Image *restrict const image A_UNUSED,
const int x A_UNUSED,
const int y A_UNUSED,
const int w A_UNUSED,
- const int h A_UNUSED) override final
+ const int h A_UNUSED) restrict2 override final
{ }
- void completeCache() override final;
+ void completeCache() restrict2 override final;
/**
* Draws a rectangle using images. 4 corner images, 4 side images and 1
@@ -196,7 +204,8 @@ class SurfaceGraphics final : public Graphics
*/
void drawImageRect(const int x A_UNUSED, const int y A_UNUSED,
const int w A_UNUSED, const int h A_UNUSED,
- const ImageRect &imgRect A_UNUSED) override final
+ const ImageRect &restrict imgRect A_UNUSED)
+ restrict2 override final
{ }
protected: