Fixed the problem with black lines in the minimap.

Crendgrim pointed me at the issue [1], which was caused by
2010-12-19T17:55:19Z!guillaume.melquiond@gmail.com.

[2] shows the visual difference of 2010-12-19T17:55:19Z!guillaume.melquiond@gmail.com in
more detail. This commit reverts 2010-12-19T17:55:19Z!guillaume.melquiond@gmail.com.

[1] http://forums.wesnoth.org/viewtopic.php?p=481758#p481758
[2] http://forums.wesnoth.org/viewtopic.php?p=481831#p481831
This commit is contained in:
Mark de Wever 2011-03-12 15:39:52 +00:00
parent 7276e9ec61
commit 5e98cf9345
3 changed files with 12 additions and 9 deletions

View file

@ -37,6 +37,7 @@ Version 1.9.4+svn:
(feature request #15713).
* Implemented: The expose event in gui2.
* Fixed: Image widget now honors its minimum and maximum size.
* Fixed: Black lines in the minimap.
* WML engine:
* Allow [color_range] and [color_palette] nodes to be inserted at top-level
by add-ons to globally define custom ranges and palettes.

View file

@ -24,6 +24,7 @@ Version 1.9.4+svn:
* User interface:
* Add 1.25, 1.75 and 3.0 animation speed factors to display preferences.
* Fixed the problem with black lines in the minimap.
* Miscellaneous and bugfixes:
* Removed support for TinyGUI: Devices with a resolution below 800x480 are

View file

@ -487,21 +487,22 @@ surface scale_surface(const surface &surf, int w, int h, bool optimize)
double xsrc = 0.0;
for(int xdst = 0; xdst != w; ++xdst, xsrc += xratio) {
double red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0;
double summation = 0.0;
// We now have a rectangle, (xsrc,ysrc,xratio,yratio)
// which we want to derive the pixel from
int xloc1 = int(xsrc), xloc2 = std::min<int>(int(xsrc + xratio), src->w - 1);
int yloc1 = int(ysrc), yloc2 = std::min<int>(int(ysrc + yratio), src->h - 1);
for (int xloc = xloc1; xloc <= xloc2; ++xloc)
{
double xsize = std::min<double>(std::min<double>(xloc + 1 - xsrc, xsrc + xratio - xloc), 1.0);
for (int yloc = yloc1; yloc <= yloc2; ++yloc)
{
double ysize = std::min<double>(std::min<double>(yloc + 1 - ysrc, ysrc + yratio - yloc), 1.0);
for(double xloc = xsrc; xloc < xsrc+xratio; xloc += 1.0) {
const double xsize = std::min<double>(std::floor(xloc+1.0)-xloc,xsrc+xratio-xloc);
for(double yloc = ysrc; yloc < ysrc+yratio; yloc += 1.0) {
const int xsrcint = std::max<int>(0,std::min<int>(src->w-1,static_cast<int>(xsrc)));
const int ysrcint = std::max<int>(0,std::min<int>(src->h-1,static_cast<int>(ysrc)));
const double ysize = std::min<double>(std::floor(yloc+1.0)-yloc,ysrc+yratio-yloc);
Uint8 r,g,b,a;
SDL_GetRGBA(src_pixels[yloc * src->w + xloc], src->format, &r, &g, &b, &a);
SDL_GetRGBA(src_pixels[ysrcint*src->w + xsrcint],src->format,&r,&g,&b,&a);
double value = xsize * ysize;
summation += value;
if (!a) continue;