diff --git a/Library/TintedImage.cpp b/Library/TintedImage.cpp index af22b74c..772e5a89 100644 --- a/Library/TintedImage.cpp +++ b/Library/TintedImage.cpp @@ -425,7 +425,8 @@ void CTintedImage::ApplyCrop() } Rect r(0, 0, m_Crop.Width, m_Crop.Height); - m_BitmapTint = new Bitmap(r.Width, r.Height, AdjustNonAlphaPixelFormat(m_Bitmap)); + m_BitmapTint = new Bitmap(r.Width, r.Height, + AdjustNonAlphaPixelFormat(m_Bitmap, x >= 0 && y >= 0 && (x + m_Crop.Width) <= imageW && (y + m_Crop.Height) <= imageH)); Graphics graphics(m_BitmapTint); graphics.DrawImage(m_Bitmap, r, x, y, r.Width, r.Height, UnitPixel); diff --git a/Library/TintedImage.h b/Library/TintedImage.h index ddc48374..87b06bc3 100644 --- a/Library/TintedImage.h +++ b/Library/TintedImage.h @@ -85,8 +85,8 @@ public: void DisposeImage(); void LoadImage(const std::wstring& imageName, bool bLoadAlways); - static Gdiplus::PixelFormat AdjustNonAlphaPixelFormat(Gdiplus::Bitmap* bitmap) - { return (bitmap->GetPixelFormat() == PixelFormat24bppRGB) ? PixelFormat24bppRGB : PixelFormat32bppPARGB; } + static Gdiplus::PixelFormat AdjustNonAlphaPixelFormat(Gdiplus::Bitmap* bitmap, bool additionalCondition = true) + { return (bitmap->GetPixelFormat() == PixelFormat24bppRGB && additionalCondition) ? PixelFormat24bppRGB : PixelFormat32bppPARGB; } protected: enum CROPMODE