- 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

@ -515,6 +515,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)
self:UpdateBar(1, "undef")
@ -605,14 +611,18 @@ end
function IceBarElement.prototype:SetScale(texture, scale)
local oldScale = self.CurrScale
self.CurrScale = self:LerpScale(scale)
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
function IceBarElement.prototype:LerpScale(scale)