From f1cb311723f3a8bb1c3d923a5104321250ab39a6 Mon Sep 17 00:00:00 2001 From: Brian Ferguson Date: Fri, 7 Jun 2013 23:45:28 -0600 Subject: [PATCH] ImagePath: Fixed that the image was not reloaded when changing with !SetOption --- Library/TintedImage.cpp | 7 ++++++- Library/TintedImage.h | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Library/TintedImage.cpp b/Library/TintedImage.cpp index b78dc8a8..a0ab820d 100644 --- a/Library/TintedImage.cpp +++ b/Library/TintedImage.cpp @@ -166,7 +166,8 @@ TintedImage::TintedImage(const WCHAR* name, const WCHAR** optionArray, bool disa m_Flip(RotateNoneFlipNone), m_Rotate(), m_UseExifOrientation(false), - m_MeterWindow(meterWindow) + m_MeterWindow(meterWindow), + m_HasPathChanged(false) { } @@ -318,6 +319,7 @@ void TintedImage::LoadImage(const std::wstring& imageName, bool bLoadAlways) { std::wstring filename = m_Path + imageName; if (m_MeterWindow) m_MeterWindow->MakePathAbsolute(filename); + m_HasPathChanged = false; // Check extension and if it is missing, add .png size_t pos = filename.rfind(L'\\'); @@ -626,6 +628,7 @@ void TintedImage::ReadOptions(ConfigParser& parser, const WCHAR* section, const ColorMatrix oldColorMatrix = *m_ColorMatrix; RotateFlipType oldFlip = m_Flip; REAL oldRotate = m_Rotate; + std::wstring oldPath = m_Path; m_Path = parser.ReadString(section, m_OptionArray[OptionIndexImagePath], imagePath); if (!m_Path.empty()) @@ -636,6 +639,8 @@ void TintedImage::ReadOptions(ConfigParser& parser, const WCHAR* section, const } } + m_HasPathChanged = (oldPath != m_Path); + if (!m_DisableTransform) { m_Crop.X = m_Crop.Y = m_Crop.Width = m_Crop.Height = -1; diff --git a/Library/TintedImage.h b/Library/TintedImage.h index 572e736e..63eb16f4 100644 --- a/Library/TintedImage.h +++ b/Library/TintedImage.h @@ -76,8 +76,8 @@ public: bool IsLoaded() { return (m_Bitmap != nullptr); } bool IsTinted() { return (m_BitmapTint != nullptr); } - bool IsOptionsChanged() { return m_NeedsCrop || m_NeedsTinting || m_NeedsTransform; } - void ClearOptionFlags() { m_NeedsCrop = m_NeedsTinting = m_NeedsTransform = false; } + bool IsOptionsChanged() { return m_NeedsCrop || m_NeedsTinting || m_NeedsTransform || m_HasPathChanged; } + void ClearOptionFlags() { m_NeedsCrop = m_NeedsTinting = m_NeedsTransform = m_HasPathChanged = false; } Gdiplus::Bitmap* GetOriginalImage() { return m_Bitmap; } Gdiplus::Bitmap* GetTintedImage() { return m_BitmapTint; } @@ -123,7 +123,9 @@ protected: Gdiplus::RotateFlipType m_Flip; Gdiplus::REAL m_Rotate; bool m_UseExifOrientation; + std::wstring m_Path; + bool m_HasPathChanged; std::wstring m_CacheKey;