summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-08 22:47:46 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-08 22:47:46 +0300
commit454508376039429ad292de69cd491badda798062 (patch)
treed1b341cbfd0a348fc775ecf275bdf17b7356fad9 /src
parent64aabf79b5a10bdf8192bb1048804a3e36730905 (diff)
downloadManaVerse-454508376039429ad292de69cd491badda798062.tar.gz
ManaVerse-454508376039429ad292de69cd491badda798062.tar.bz2
ManaVerse-454508376039429ad292de69cd491badda798062.tar.xz
ManaVerse-454508376039429ad292de69cd491badda798062.zip
Fix code style in render.
Diffstat (limited to 'src')
-rw-r--r--src/render/graphics.cpp6
-rw-r--r--src/render/mobileopenglgraphics.cpp4
-rw-r--r--src/render/normalopenglgraphics.cpp4
-rw-r--r--src/render/nullopenglgraphics.cpp2
-rw-r--r--src/render/safeopenglgraphics.cpp2
-rw-r--r--src/render/sdlgraphics.cpp23
6 files changed, 23 insertions, 18 deletions
diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp
index 24c3ab69e..baceeacc1 100644
--- a/src/render/graphics.cpp
+++ b/src/render/graphics.cpp
@@ -300,8 +300,10 @@ bool Graphics::setOpenGLMode()
GLint texSize;
bool rectTex = graphicsManager.supportExtension(
"GL_ARB_texture_rectangle");
- if (rectTex && OpenGLImageHelper::getInternalTextureType() == 4
- && getOpenGL() != 3 && config.getBoolValue("rectangulartextures")
+ if (rectTex
+ && OpenGLImageHelper::getInternalTextureType() == 4
+ && getOpenGL() != RENDER_GLES_OPENGL
+ && config.getBoolValue("rectangulartextures")
&& !graphicsManager.isUseTextureSampler())
{
logger->log1("using GL_ARB_texture_rectangle");
diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp
index 9a420740b..dcb34ffd5 100644
--- a/src/render/mobileopenglgraphics.cpp
+++ b/src/render/mobileopenglgraphics.cpp
@@ -113,7 +113,7 @@ void MobileOpenGLGraphics::initArrays()
mMaxVertices = 1024;
// need alocate small size, after if limit reached reallocate to double size
- const int sz = mMaxVertices * 4 + 30;
+ const size_t sz = mMaxVertices * 4 + 30;
vertexBufSize = mMaxVertices;
if (!mFloatTexArray)
mFloatTexArray = new GLfloat[sz];
@@ -924,7 +924,7 @@ SDL_Surface* MobileOpenGLGraphics::getScreenshot()
if (SDL_MUSTLOCK(screenshot))
SDL_LockSurface(screenshot);
- const unsigned int lineSize = 3 * w;
+ const size_t lineSize = 3 * w;
GLubyte *const buf = new GLubyte[lineSize];
// Grap the pixel buffer and write it to the SDL surface
diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp
index bb8eed230..7130e2914 100644
--- a/src/render/normalopenglgraphics.cpp
+++ b/src/render/normalopenglgraphics.cpp
@@ -132,7 +132,7 @@ void NormalOpenGLGraphics::initArrays()
// need alocate small size, after if limit reached reallocate to double size
vertexBufSize = mMaxVertices;
- const int sz = mMaxVertices * 4 + 30;
+ const size_t sz = mMaxVertices * 4 + 30;
if (!mFloatTexArray)
mFloatTexArray = new GLfloat[sz];
if (!mIntTexArray)
@@ -1194,7 +1194,7 @@ SDL_Surface* NormalOpenGLGraphics::getScreenshot()
glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, screenshot->pixels);
// Flip the screenshot, as OpenGL has 0,0 in bottom left
- const unsigned int lineSize = 3 * w;
+ const size_t lineSize = 3 * w;
GLubyte *const buf = new GLubyte[lineSize];
const int h2 = h / 2;
diff --git a/src/render/nullopenglgraphics.cpp b/src/render/nullopenglgraphics.cpp
index 6497a7b5a..8eb88f060 100644
--- a/src/render/nullopenglgraphics.cpp
+++ b/src/render/nullopenglgraphics.cpp
@@ -76,7 +76,7 @@ void NullOpenGLGraphics::initArrays()
// need alocate small size, after if limit reached reallocate to double size
vertexBufSize = mMaxVertices;
- const int sz = mMaxVertices * 4 + 30;
+ const size_t sz = mMaxVertices * 4 + 30;
if (!mFloatTexArray)
mFloatTexArray = new GLfloat[sz];
if (!mIntTexArray)
diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp
index d5c9981a3..fcf4a7e68 100644
--- a/src/render/safeopenglgraphics.cpp
+++ b/src/render/safeopenglgraphics.cpp
@@ -500,7 +500,7 @@ SDL_Surface* SafeOpenGLGraphics::getScreenshot()
glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, screenshot->pixels);
// Flip the screenshot, as OpenGL has 0,0 in bottom left
- unsigned int lineSize = 3 * w;
+ size_t lineSize = 3 * w;
GLubyte* buf = new GLubyte[lineSize];
const int h2 = h / 2;
diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp
index 9b852689d..8720b4dc9 100644
--- a/src/render/sdlgraphics.cpp
+++ b/src/render/sdlgraphics.cpp
@@ -952,19 +952,22 @@ void SDLGraphics::fillRectangle(const Rect& rectangle)
for (y = y1; y < y2; y++)
{
uint8_t *const p = static_cast<uint8_t *>(mWindow->pixels)
- + y * mWindow->pitch;
+ + static_cast<size_t>(y * mWindow->pitch);
for (x = x1; x < x2; x++)
- *(p + x) = static_cast<uint8_t>(pixel);
+ {
+ *(p + static_cast<size_t>(x))
+ = static_cast<uint8_t>(pixel);
+ }
}
break;
case 2:
for (y = y1; y < y2; y++)
{
uint8_t *const p0 = static_cast<uint8_t *>(mWindow->pixels)
- + y * mWindow->pitch;
+ + static_cast<size_t>(y * mWindow->pitch);
for (x = x1; x < x2; x++)
{
- uint8_t *const p = p0 + x * 2;
+ uint8_t *const p = p0 + static_cast<size_t>(x * 2);
*reinterpret_cast<uint16_t *>(p) = SDLAlpha16(
static_cast<uint16_t>(pixel),
*reinterpret_cast<uint16_t *>(p),
@@ -982,10 +985,10 @@ void SDLGraphics::fillRectangle(const Rect& rectangle)
for (y = y1; y < y2; y++)
{
uint8_t *const p0 = static_cast<uint8_t *>(mWindow->pixels)
- + y * mWindow->pitch;
+ + static_cast<size_t>(y * mWindow->pitch);
for (x = x1; x < x2; x++)
{
- uint8_t *const p = p0 + x * 3;
+ uint8_t *const p = p0 + static_cast<size_t>(x * 3);
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
p[2] = static_cast<uint8_t>((p[2] * ca + cb) >> 8);
p[1] = static_cast<uint8_t>((p[1] * ca + cg) >> 8);
@@ -1074,10 +1077,10 @@ void SDLGraphics::fillRectangle(const Rect& rectangle)
{
uint32_t *const p0 = reinterpret_cast<uint32_t*>(
static_cast<uint8_t*>(mWindow->pixels)
- + y * mWindow->pitch);
+ + static_cast<size_t>(y * mWindow->pitch));
for (x = x1; x < x2; x++)
{
- uint32_t *const p = p0 + x;
+ uint32_t *const p = p0 + static_cast<size_t>(x);
const uint32_t dst = *p;
*p = cB[dst & bMask / bShift]
| cG[(dst & gMask) / gShift]
@@ -1222,7 +1225,7 @@ void SDLGraphics::drawHLine(int x1, int y, int x2)
SDL_LockSurface(mWindow);
uint8_t *p = static_cast<uint8_t*>(mWindow->pixels)
- + y * mWindow->pitch + x1 * bpp;
+ + static_cast<size_t>(y * mWindow->pitch + x1 * bpp);
const uint32_t pixel = SDL_MapRGB(mWindow->format,
static_cast<uint8_t>(mColor.r),
@@ -1347,7 +1350,7 @@ void SDLGraphics::drawVLine(int x, int y1, int y2)
SDL_LockSurface(mWindow);
uint8_t *p = static_cast<uint8_t*>(mWindow->pixels)
- + y1 * mWindow->pitch + x * bpp;
+ + static_cast<size_t>(y1 * mWindow->pitch + x * bpp);
const uint32_t pixel = SDL_MapRGB(mWindow->format,
static_cast<uint8_t>(mColor.r),