Merged in GZDB r2477.

This commit is contained in:
MascaraSnake 2016-01-23 09:36:25 +01:00
parent dbca1989fc
commit 76cf91e418
1 changed files with 17 additions and 11 deletions

View File

@ -2430,7 +2430,10 @@ namespace CodeImp.DoomBuilder.Data
{
// Get averaged top and bottom colors from the original image
int tr = 0, tg = 0, tb = 0, br = 0, bg = 0, bb = 0;
const int colorsampleheight = 28; // TODO: is this value calculated from the image's height?
const int defaultcolorsampleheight = 28;
int colorsampleheight = Math.Max(1, Math.Min(defaultcolorsampleheight, img.Height / 2)); // TODO: is this value calculated from the image's height?
bool dogradients = colorsampleheight < img.Height / 2;
for (int w = 0; w < img.Width; w++)
{
for (int h = 0; h < colorsampleheight; h++)
@ -2486,6 +2489,8 @@ namespace CodeImp.DoomBuilder.Data
}
// Apply top/bottom gradients
if (dogradients)
{
using (Graphics g = Graphics.FromImage(skyimage))
{
Rectangle area = new Rectangle(0, 0, skyimage.Width, colorsampleheight);
@ -2501,6 +2506,7 @@ namespace CodeImp.DoomBuilder.Data
g.FillRectangle(b, area);
}
}
}
// Get Device and shader...
Device device = General.Map.Graphics.Device;