Skip to content

Commit

Permalink
Fixed alignment of odd rows.
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeniy-polyakov committed Oct 11, 2016
1 parent dbd46d0 commit 2e6da6a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ArcanumTextureSlicer/ArcanumTextureSlicer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public static void Main(string[] args)
var tileHeight = BitmapExtensions.SampleTile.Height;
var halfTileWidth = tileWidth/2;
var halfTileHeight = tileHeight/2;
var xSpace = 2;
const int xSpace = 2;
const int halfXSpace = 1;

if (!Directory.Exists(outputFolder))
{
Expand All @@ -41,8 +42,10 @@ public static void Main(string[] args)
{
for (var j = 0; j < m; j++)
{
var evenRow = j%2;
var oddRow = 1 - evenRow;
using (var outputBitmap = inputBitmap.CreateTile(
initTileX + i*tileWidth - halfTileWidth*(1 - j%2) + i*xSpace,
initTileX + i*tileWidth - halfTileWidth*oddRow + i*xSpace + halfXSpace*evenRow,
initTileY + j*halfTileHeight - halfTileHeight))
{
if (outputBitmap.IsTransparent())
Expand Down

0 comments on commit 2e6da6a

Please sign in to comment.