mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-17 20:02:54 +00:00
Fixed bug which caused buttons not to be displayed and game to crash
This commit is contained in:
parent
c3c0cc50c5
commit
4e954b84c9
@ -358,6 +358,8 @@ void display::draw(bool update,bool force)
|
|||||||
SDL_FreeSurface(image);
|
SDL_FreeSurface(image);
|
||||||
image = new_image;
|
image = new_image;
|
||||||
sidebarScaling_ = static_cast<double>(image->h)/768.0;
|
sidebarScaling_ = static_cast<double>(image->h)/768.0;
|
||||||
|
} else {
|
||||||
|
std::cerr << "Could not scale image\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,8 +52,8 @@ SDL_Surface* scale_surface(SDL_Surface* surface, int w, int h)
|
|||||||
|
|
||||||
const int dstpad = dstxpad*ydst;
|
const int dstpad = dstxpad*ydst;
|
||||||
|
|
||||||
srclock.pixels()[ydst*w + xdst + dstpad] =
|
dstlock.pixels()[ydst*w + xdst + dstpad] =
|
||||||
dstlock.pixels()[ysrcint*surface->w + xsrcint];
|
srclock.pixels()[ysrcint*surface->w + xsrcint];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
struct free_sdl_surface {
|
struct free_sdl_surface {
|
||||||
@ -89,14 +90,17 @@ struct surface_lock
|
|||||||
const int res = SDL_LockSurface(surface_);
|
const int res = SDL_LockSurface(surface_);
|
||||||
if(res == 0) {
|
if(res == 0) {
|
||||||
locked_ = true;
|
locked_ = true;
|
||||||
|
std::cerr << "locked surface\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~surface_lock()
|
~surface_lock()
|
||||||
{
|
{
|
||||||
if(locked_)
|
if(locked_) {
|
||||||
|
std::cerr << "unlocking surface\n";
|
||||||
SDL_UnlockSurface(surface_);
|
SDL_UnlockSurface(surface_);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
short* pixels() { return reinterpret_cast<short*>(surface_->pixels); }
|
short* pixels() { return reinterpret_cast<short*>(surface_->pixels); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user