summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-08-25 23:40:50 +0300
committerAndrei Karas <akaras@inbox.ru>2013-08-25 23:40:50 +0300
commit847019ebb169d95d2ca00edcf4e209019513fb35 (patch)
treedfec2b6014e4cc72d5277be5584dd88002f003ff
parentd5847d54a527c41006cb4cade15d0b6346490e77 (diff)
downloadmv-847019ebb169d95d2ca00edcf4e209019513fb35.tar.gz
mv-847019ebb169d95d2ca00edcf4e209019513fb35.tar.bz2
mv-847019ebb169d95d2ca00edcf4e209019513fb35.tar.xz
mv-847019ebb169d95d2ca00edcf4e209019513fb35.zip
fix rescaled images draw in software mode in SDL2.
-rw-r--r--src/gui/widgets/desktop.cpp10
-rw-r--r--src/sdl2graphics.cpp18
2 files changed, 11 insertions, 17 deletions
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index 7daff45f0..0fd9fefef 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -99,6 +99,7 @@ void Desktop::draw(gcn::Graphics *graphics)
g->fillRectangle(gcn::Rectangle(0, 0, width, height));
}
+#ifndef USE_SDL2
if (!imageHelper->useOpenGL())
{
g->drawImage(mWallpaper,
@@ -106,6 +107,7 @@ void Desktop::draw(gcn::Graphics *graphics)
(height - wallpHeight) / 2);
}
else
+#endif
{
g->drawRescaledImage(mWallpaper, 0, 0, 0, 0,
wallpWidth, wallpHeight,
@@ -148,8 +150,12 @@ void Desktop::setBestFittingWallpaper()
const int width = rect.width;
const int height = rect.height;
- if (!imageHelper->useOpenGL()
- && (nWallPaper->getWidth() != width
+#ifdef USE_SDL2
+ if (false &&
+#else
+ if (!imageHelper->useOpenGL() &&
+#endif
+ (nWallPaper->getWidth() != width
|| nWallPaper->getHeight() != height))
{
// We rescale to obtain a fullscreen wallpaper...
diff --git a/src/sdl2graphics.cpp b/src/sdl2graphics.cpp
index 42f06a1cc..9801006d9 100644
--- a/src/sdl2graphics.cpp
+++ b/src/sdl2graphics.cpp
@@ -73,14 +73,6 @@ bool SDLGraphics::drawRescaledImage(const Image *const image, int srcX, int srcY
if (!image->mTexture)
return false;
- Image *const tmpImage = image->SDLgetScaledImage(
- desiredWidth, desiredHeight);
-
- if (!tmpImage)
- return false;
- if (!tmpImage->mTexture)
- return false;
-
dstX += mClipStack.top().xOffset;
dstY += mClipStack.top().yOffset;
@@ -95,15 +87,11 @@ bool SDLGraphics::drawRescaledImage(const Image *const image, int srcX, int srcY
srcRect.y = static_cast<int16_t>(srcY);
srcRect.w = static_cast<uint16_t>(width);
srcRect.h = static_cast<uint16_t>(height);
+ dstRect.w = static_cast<uint16_t>(desiredWidth);
+ dstRect.h = static_cast<uint16_t>(desiredHeight);
- // +++ dstRect.w/h
-
- const bool returnValue = (SDL_RenderCopy(mRenderer, tmpImage->mTexture,
+ return (SDL_RenderCopy(mRenderer, image->mTexture,
&srcRect, &dstRect) < 0);
-
- delete tmpImage;
-
- return returnValue;
}
bool SDLGraphics::drawImage2(const Image *const image, int srcX, int srcY,