diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-08-27 19:30:48 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-08-27 19:30:48 +0300 |
commit | eb9841897bbe93da6aa4ca2537a3e22b3a868d98 (patch) | |
tree | b909446a61e26056b69a9272a9b48e314fda3957 /src | |
parent | 0b3166a9a06313266b868785fc69a9dee76b0a1d (diff) | |
download | manaplus-eb9841897bbe93da6aa4ca2537a3e22b3a868d98.tar.gz manaplus-eb9841897bbe93da6aa4ca2537a3e22b3a868d98.tar.bz2 manaplus-eb9841897bbe93da6aa4ca2537a3e22b3a868d98.tar.xz manaplus-eb9841897bbe93da6aa4ca2537a3e22b3a868d98.zip |
fix compilation warnings.
Diffstat (limited to 'src')
-rw-r--r-- | src/graphics.cpp | 14 | ||||
-rw-r--r-- | src/gui/sdlinput.cpp | 2 | ||||
-rw-r--r-- | src/sdl2graphics.cpp | 16 | ||||
-rw-r--r-- | src/sdlgraphics.cpp | 72 | ||||
-rw-r--r-- | src/utils/physfsrwops.cpp | 4 |
5 files changed, 56 insertions, 52 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp index 4e2129cbf..604454e94 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -386,12 +386,9 @@ bool Graphics::resizeScreen(const int width, const int height) if (mWidth == width && mHeight == height) return true; - const int prevWidth = mWidth; - const int prevHeight = mHeight; - +#ifdef USE_SDL2 _endDraw(); -#ifdef USE_SDL2 mRect.w = width; mRect.h = height; mWidth = width; @@ -404,12 +401,17 @@ bool Graphics::resizeScreen(const int width, const int height) glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); #else // +++ need impliment resize in soft mode -#endif +#endif // USE_OPENGL _beginDraw(); return true; #else + const int prevWidth = mWidth; + const int prevHeight = mHeight; + + _endDraw(); + const bool success = setVideoMode(width, height, mBpp, mFullscreen, mHWAccel, mEnableResize, mNoFrame); @@ -427,7 +429,7 @@ bool Graphics::resizeScreen(const int width, const int height) _beginDraw(); return success; -#endif +#endif // USE_SDL2 } int Graphics::getWidth() const diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index ae8c6d7d4..4655bcbec 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -162,7 +162,7 @@ void SDLInput::pushInput(const SDL_Event &event) case SDL_MOUSEWHEEL: { - const int x = event.wheel.x; +// const int x = event.wheel.x; const int y = event.wheel.y; if (y) { diff --git a/src/sdl2graphics.cpp b/src/sdl2graphics.cpp index 51493eb0f..e76335f3e 100644 --- a/src/sdl2graphics.cpp +++ b/src/sdl2graphics.cpp @@ -95,14 +95,14 @@ bool SDLGraphics::drawRescaledImage(const Image *const image, int srcX, int srcY const gcn::ClipRectangle &top = mClipStack.top(); const SDL_Rect &bounds = image->mBounds; - const SDL_Rect srcRect + const SDL_Rect srcRect = { static_cast<int32_t>(srcX + bounds.x), static_cast<int32_t>(srcY + bounds.y), static_cast<int32_t>(width), static_cast<int32_t>(height) }; - const SDL_Rect dstRect + const SDL_Rect dstRect = { static_cast<int32_t>(dstX + top.xOffset), static_cast<int32_t>(dstY + top.yOffset), @@ -128,7 +128,7 @@ bool SDLGraphics::drawImage2(const Image *const image, int srcX, int srcY, return false; const SDL_Rect &bounds = image->mBounds; - const SDL_Rect srcRect + const SDL_Rect srcRect = { static_cast<int32_t>(srcX + bounds.x), static_cast<int32_t>(srcY + bounds.y), @@ -136,7 +136,7 @@ bool SDLGraphics::drawImage2(const Image *const image, int srcX, int srcY, static_cast<int32_t>(height) }; - const SDL_Rect dstRect + const SDL_Rect dstRect = { static_cast<int32_t>(dstX + top.xOffset), static_cast<int32_t>(dstY + top.yOffset), @@ -491,7 +491,7 @@ bool SDLGraphics::calcWindow(ImageCollection *const vertCol, void SDLGraphics::fillRectangle(const gcn::Rectangle &rectangle) { const gcn::ClipRectangle &top = mClipStack.top(); - const SDL_Rect rect + const SDL_Rect rect = { static_cast<int32_t>(rectangle.x + top.xOffset), static_cast<int32_t>(rectangle.y + top.yOffset), @@ -518,7 +518,7 @@ bool SDLGraphics::pushClipArea(gcn::Rectangle area) const bool result = gcn::Graphics::pushClipArea(area); const gcn::ClipRectangle &carea = mClipStack.top(); - const SDL_Rect rect + const SDL_Rect rect = { static_cast<int32_t>(carea.x), static_cast<int32_t>(carea.y), @@ -537,7 +537,7 @@ void SDLGraphics::popClipArea() return; const gcn::ClipRectangle &carea = mClipStack.top(); - const SDL_Rect rect + const SDL_Rect rect = { static_cast<int32_t>(carea.x), static_cast<int32_t>(carea.y), @@ -562,7 +562,7 @@ void SDLGraphics::drawPoint(int x, int y) return; SDL_SetRenderDrawColor(mRenderer, mColor.r, mColor.g, mColor.b, mColor.a); - const SDL_Point point + const SDL_Point point = { x, y diff --git a/src/sdlgraphics.cpp b/src/sdlgraphics.cpp index 2eb7c88df..4d7e49afa 100644 --- a/src/sdlgraphics.cpp +++ b/src/sdlgraphics.cpp @@ -83,7 +83,7 @@ bool SDLGraphics::drawRescaledImage(const Image *const image, int srcX, int srcY const gcn::ClipRectangle &top = mClipStack.top(); const SDL_Rect &bounds = image->mBounds; - SDL_Rect srcRect + SDL_Rect srcRect = { static_cast<int16_t>(srcX + bounds.x), static_cast<int16_t>(srcY + bounds.y), @@ -91,7 +91,7 @@ bool SDLGraphics::drawRescaledImage(const Image *const image, int srcX, int srcY static_cast<uint16_t>(height) }; - SDL_Rect dstRect + SDL_Rect dstRect = { static_cast<int16_t>(dstX + top.xOffset), static_cast<int16_t>(dstY + top.yOffset), @@ -176,7 +176,7 @@ bool SDLGraphics::drawImage2(const Image *const image, int srcX, int srcY, if (w > 0 && h > 0) { - SDL_Rect srcRect + SDL_Rect srcRect = { static_cast<int16_t>(srcX), static_cast<int16_t>(srcY), @@ -184,7 +184,7 @@ bool SDLGraphics::drawImage2(const Image *const image, int srcX, int srcY, static_cast<uint16_t>(h) }; - SDL_Rect dstRect + SDL_Rect dstRect = { static_cast<int16_t>(dstX), static_cast<int16_t>(dstY), @@ -229,73 +229,73 @@ void SDLGraphics::drawImagePattern(const Image *const image, const int dh = (py + ih >= h) ? h - py : ih; int dstY = py + yOffset; int y2 = srcY; - int h = dh; + int h2 = dh; if (y2 < 0) { - h += y2; + h2 += y2; dstY -= static_cast<int16_t>(y2); y2 = 0; } const int maxh = src->h - y2; - if (maxh < h) - h = maxh; + if (maxh < h2) + h2 = maxh; int dy = clipY - dstY; if (dy > 0) { - h -= dy; + h2 -= dy; dstY += static_cast<int16_t>(dy); y2 += dy; } - dy = dstY + h - clipY - clip->h; + dy = dstY + h2 - clipY - clip->h; if (dy > 0) - h -= dy; + h2 -= dy; - if (h > 0) + if (h2 > 0) { for (int px = 0; px < w; px += iw) { const int dw = (px + iw >= w) ? w - px : iw; int dstX = px + xOffset; int x2 = srcX; - int w = dw; + int w2 = dw; if (x2 < 0) { - w += x2; + w2 += x2; dstX -= static_cast<int16_t>(x2); x2 = 0; } const int maxw = src->w - x2; - if (maxw < w) - w = maxw; + if (maxw < w2) + w2 = maxw; int dx = clipX - dstX; if (dx > 0) { - w -= dx; + w2 -= dx; dstX += static_cast<int16_t>(dx); x2 += dx; } - dx = dstX + w - clipX - clip->w; + dx = dstX + w2 - clipX - clip->w; if (dx > 0) - w -= dx; + w2 -= dx; - if (w > 0) + if (w2 > 0) { - SDL_Rect srcRect + SDL_Rect srcRect = { static_cast<int16_t>(x2), static_cast<int16_t>(y2), - static_cast<uint16_t>(w), - static_cast<uint16_t>(h) + static_cast<uint16_t>(w2), + static_cast<uint16_t>(h2) }; - SDL_Rect dstRect + SDL_Rect dstRect = { static_cast<int16_t>(dstX), static_cast<int16_t>(dstY), - static_cast<uint16_t>(w), - static_cast<uint16_t>(h) + static_cast<uint16_t>(w2), + static_cast<uint16_t>(h2) }; SDL_LowerBlit(src, &srcRect, mWindow, &dstRect); @@ -349,7 +349,7 @@ void SDLGraphics::drawRescaledImagePattern(const Image *const image, const int dw = (px + iw >= w) ? w - px : iw; const int dstX = px + xOffset; - SDL_Rect srcRect + SDL_Rect srcRect = { static_cast<int16_t>(srcX), static_cast<int16_t>(srcY), @@ -357,7 +357,7 @@ void SDLGraphics::drawRescaledImagePattern(const Image *const image, static_cast<uint16_t>(dh) }; - SDL_Rect dstRect + SDL_Rect dstRect = { static_cast<int16_t>(dstX), static_cast<int16_t>(dstY), @@ -878,11 +878,13 @@ void SDLGraphics::fillRectangle(const gcn::Rectangle& rectangle) } else { - SDL_Rect rect; - rect.x = static_cast<int16_t>(area.x); - rect.y = static_cast<int16_t>(area.y); - rect.w = static_cast<uint16_t>(area.width); - rect.h = static_cast<uint16_t>(area.height); + SDL_Rect rect = + { + static_cast<int16_t>(area.x), + static_cast<int16_t>(area.y), + static_cast<uint16_t>(area.width), + static_cast<uint16_t>(area.height) + }; const uint32_t color = SDL_MapRGBA(mWindow->format, static_cast<int8_t>(mColor.r), @@ -907,7 +909,7 @@ bool SDLGraphics::pushClipArea(gcn::Rectangle area) { const bool result = gcn::Graphics::pushClipArea(area); const gcn::ClipRectangle &carea = mClipStack.top(); - const SDL_Rect rect + const SDL_Rect rect = { static_cast<int16_t>(carea.x), static_cast<int16_t>(carea.y), @@ -927,7 +929,7 @@ void SDLGraphics::popClipArea() return; const gcn::ClipRectangle &carea = mClipStack.top(); - const SDL_Rect rect + const SDL_Rect rect = { static_cast<int16_t>(carea.x), static_cast<int16_t>(carea.y), diff --git a/src/utils/physfsrwops.cpp b/src/utils/physfsrwops.cpp index d0560fb1e..8216e3794 100644 --- a/src/utils/physfsrwops.cpp +++ b/src/utils/physfsrwops.cpp @@ -115,7 +115,7 @@ static PHYSFSSIZE physfsrwops_read(SDL_RWops *const rw, void *ptr, PHYSFS_file *const handle = static_cast<PHYSFS_file *const>( rw->hidden.unknown.data1); const PHYSFS_sint64 rc = PHYSFS_read(handle, ptr, size, maxnum); - if (rc != maxnum) + if (rc != static_cast<PHYSFS_sint64>(maxnum)) { if (!PHYSFS_eof(handle)) /* not EOF? Must be an error. */ SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError()); @@ -131,7 +131,7 @@ static PHYSFSSIZE physfsrwops_write(SDL_RWops *const rw, const void *ptr, PHYSFS_file *const handle = static_cast<PHYSFS_file *const>( rw->hidden.unknown.data1); const PHYSFS_sint64 rc = PHYSFS_write(handle, ptr, size, num); - if (rc != num) + if (rc != static_cast<PHYSFS_sint64>(num)) SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError()); return static_cast<int>(rc); |