Fixed mistake in previous commits

This commit is contained in:
spx 2013-06-17 21:05:31 +09:00
parent bda6e3aa47
commit f15a8fa72e
2 changed files with 9 additions and 9 deletions

View File

@ -57,6 +57,7 @@ void MeterImage::Initialize()
if (m_Measures.empty() && !m_DynamicVariables && !m_ImageName.empty()) if (m_Measures.empty() && !m_DynamicVariables && !m_ImageName.empty())
{ {
m_ImageNameResult = m_ImageName;
LoadImage(m_ImageName, true); LoadImage(m_ImageName, true);
} }
} }
@ -159,33 +160,31 @@ bool MeterImage::Update()
{ {
if (!m_Measures.empty() || m_DynamicVariables) if (!m_Measures.empty() || m_DynamicVariables)
{ {
static std::wstring s_ImageNameResult;
// Store the current values so we know if the image needs to be updated // Store the current values so we know if the image needs to be updated
std::wstring oldResult = s_ImageNameResult; std::wstring oldResult = m_ImageNameResult;
if (!m_Measures.empty()) // read from the measures if (!m_Measures.empty()) // read from the measures
{ {
if (m_ImageName.empty()) if (m_ImageName.empty())
{ {
s_ImageNameResult = m_Measures[0]->GetStringOrFormattedValue(AUTOSCALE_OFF, 1, 0, false); m_ImageNameResult = m_Measures[0]->GetStringOrFormattedValue(AUTOSCALE_OFF, 1, 0, false);
} }
else else
{ {
s_ImageNameResult = m_ImageName; m_ImageNameResult = m_ImageName;
if (!ReplaceMeasures(s_ImageNameResult, AUTOSCALE_OFF)) if (!ReplaceMeasures(m_ImageNameResult, AUTOSCALE_OFF))
{ {
// ImageName doesn't contain any measures, so use the result of MeasureName. // ImageName doesn't contain any measures, so use the result of MeasureName.
s_ImageNameResult = m_Measures[0]->GetStringOrFormattedValue(AUTOSCALE_OFF, 1, 0, false); m_ImageNameResult = m_Measures[0]->GetStringOrFormattedValue(AUTOSCALE_OFF, 1, 0, false);
} }
} }
} }
else // read from the skin else // read from the skin
{ {
s_ImageNameResult = m_ImageName; m_ImageNameResult = m_ImageName;
} }
LoadImage(s_ImageNameResult, (wcscmp(oldResult.c_str(), s_ImageNameResult.c_str()) != 0)); LoadImage(m_ImageNameResult, (wcscmp(oldResult.c_str(), m_ImageNameResult.c_str()) != 0));
return true; return true;
} }
else if (m_NeedsRedraw) else if (m_NeedsRedraw)

View File

@ -53,6 +53,7 @@ private:
TintedImage m_Image; TintedImage m_Image;
std::wstring m_ImageName; std::wstring m_ImageName;
std::wstring m_ImageNameResult;
bool m_NeedsRedraw; bool m_NeedsRedraw;
DRAWMODE m_DrawMode; DRAWMODE m_DrawMode;