mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-25 05:58:35 +01:00
fixed empty nine patch regions stalling when using tile mode
closes #17
This commit is contained in:
parent
17b6a3297a
commit
ed5c4b44d4
1 changed files with 7 additions and 5 deletions
|
@ -158,11 +158,13 @@ namespace MLEM.Textures {
|
||||||
case NinePatchMode.Tile:
|
case NinePatchMode.Tile:
|
||||||
var width = src.Width * patchScale;
|
var width = src.Width * patchScale;
|
||||||
var height = src.Height * patchScale;
|
var height = src.Height * patchScale;
|
||||||
for (var x = 0F; x < rect.Width; x += width) {
|
if (width > 0 && height > 0) {
|
||||||
for (var y = 0F; y < rect.Height; y += height) {
|
for (var x = 0F; x < rect.Width; x += width) {
|
||||||
var size = new Vector2(Math.Min(rect.Width - x, width), Math.Min(rect.Height - y, height));
|
for (var y = 0F; y < rect.Height; y += height) {
|
||||||
var srcSize = (size / patchScale).CeilCopy().ToPoint();
|
var size = new Vector2(Math.Min(rect.Width - x, width), Math.Min(rect.Height - y, height));
|
||||||
batch.Draw(texture.Region.Texture, new RectangleF(rect.Location + new Vector2(x, y), size), new Rectangle(src.X, src.Y, srcSize.X, srcSize.Y), color, rotation, origin, effects, layerDepth);
|
var srcSize = (size / patchScale).CeilCopy().ToPoint();
|
||||||
|
batch.Draw(texture.Region.Texture, new RectangleF(rect.Location + new Vector2(x, y), size), new Rectangle(src.X, src.Y, srcSize.X, srcSize.Y), color, rotation, origin, effects, layerDepth);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue