- performance improvement: only call SetTexCoord if the coords need to actually change this frame. brings cpu cost from 1% per bar to 0.5% per bar. WIP

This commit is contained in:
Parnic
2008-04-16 06:38:45 +00:00
parent 526194c142
commit 9555a3db77

View File

@ -514,6 +514,12 @@ function IceBarElement.prototype:CreateBar()
self.barFrame.bar:SetTexture(IceElement.TexturePath .. self.settings.barTexture)
self.barFrame.bar:SetAllPoints(self.frame)
if (self.moduleSettings.side == IceCore.Side.Left) then
self.barFrame.bar:SetTexCoord(1, 0, 1-self.CurrScale, 1)
else
self.barFrame.bar:SetTexCoord(0, 1, 1-self.CurrScale, 1)
end
self.barFrame:SetStatusBarTexture(self.barFrame.bar)
@ -605,12 +611,16 @@ end
function IceBarElement.prototype:SetScale(texture, scale)
local oldScale = self.CurrScale
self.CurrScale = self:LerpScale(scale)
if (self.moduleSettings.side == IceCore.Side.Left) then
texture:SetTexCoord(1, 0, 1-self.CurrScale, 1)
else
texture:SetTexCoord(0, 1, 1-self.CurrScale, 1)
if oldScale ~= self.CurrScale then
if (self.moduleSettings.side == IceCore.Side.Left) then
texture:SetTexCoord(1, 0, 1-self.CurrScale, 1)
else
texture:SetTexCoord(0, 1, 1-self.CurrScale, 1)
end
end
end