Skip to content

Commit

Permalink
Merge pull request #146 from vancura/master
Browse files Browse the repository at this point in the history
Antialiasing settings was never executed from constructor
  • Loading branch information
kjpou1 committed Aug 9, 2013
2 parents d53b55b + 0596d84 commit 76afba7
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions cocos2d/textures/CCTexture2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ public CCTexture2D()
{
m_samplerState = SamplerState.LinearClamp;
IsAntialiased = false; // We will set this to false by default

RefreshAntialiasSetting ();
}

public bool IsTextureDefined
Expand Down Expand Up @@ -159,30 +161,36 @@ public bool IsAntialiased
if (m_bAntialiased != value)
{
m_bAntialiased = value;
var saveState = m_samplerState;

if (m_bAntialiased)
{
m_samplerState = new SamplerState
{
Filter = TextureFilter.Linear
};
}
else
{
m_samplerState = new SamplerState
{
Filter = TextureFilter.Point
};
}

m_samplerState.AddressU = saveState.AddressU;
m_samplerState.AddressV = saveState.AddressV;
m_samplerState.AddressW = saveState.AddressW;
RefreshAntialiasSetting ();
}
}
}

void RefreshAntialiasSetting ()
{
var saveState = m_samplerState;

if (m_bAntialiased)
{
m_samplerState = new SamplerState
{
Filter = TextureFilter.Linear
};
}
else
{
m_samplerState = new SamplerState
{
Filter = TextureFilter.Point
};
}

m_samplerState.AddressU = saveState.AddressU;
m_samplerState.AddressV = saveState.AddressV;
m_samplerState.AddressW = saveState.AddressW;
}

public uint BitsPerPixelForFormat
{
//from MG: Microsoft.Xna.Framework.Graphics.GraphicsExtensions
Expand Down

0 comments on commit 76afba7

Please sign in to comment.