diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index 2f2e2f35..5f5e0023 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -2441,7 +2441,7 @@ bool CMeterWindow::ResizeWindow(bool reset) h = max(h, m_BackgroundSize.cy); } - Bitmap* background = new Bitmap(w, h, CTintedImage::AdjustNonAlphaPixelFormat(tempBackground)); + Bitmap* background = new Bitmap(w, h, PixelFormat32bppPARGB); Graphics graphics(background); if (m_BackgroundMode == BGMODE_IMAGE) @@ -2503,6 +2503,7 @@ bool CMeterWindow::ResizeWindow(bool reset) Rect r(0, h - m.bottom, m.left, m.bottom); graphics.DrawImage(tempBackground, r, 0, m_BackgroundSize.cy - m.bottom, m.left, m.bottom, UnitPixel); } + // Bottom Rect r(m.left, h - m.bottom, w - m.left - m.right, m.bottom); graphics.DrawImage(tempBackground, r, m.left, m_BackgroundSize.cy - m.bottom, m_BackgroundSize.cx - m.left - m.right, m.bottom, UnitPixel); diff --git a/Library/TintedImage.cpp b/Library/TintedImage.cpp index c90ba129..c84c923c 100644 --- a/Library/TintedImage.cpp +++ b/Library/TintedImage.cpp @@ -28,7 +28,7 @@ using namespace Gdiplus; class ImageCache { public: - ImageCache(Bitmap* bitmap, HGLOBAL hBuffer) : m_Bitmap(bitmap), m_hBuffer(hBuffer), m_Ref(1) {} + ImageCache(Bitmap* bitmap) : m_Bitmap(bitmap), m_Ref(1) {} ~ImageCache() { Dispose(); } void AddRef() { ++m_Ref; } @@ -42,10 +42,9 @@ private: ImageCache() {} ImageCache(const ImageCache& cache) {} - void Dispose() { delete m_Bitmap; m_Bitmap = NULL; if (m_hBuffer) { ::GlobalFree(m_hBuffer); m_hBuffer = NULL; } } + void Dispose() { delete m_Bitmap; m_Bitmap = NULL; } Bitmap* m_Bitmap; - HGLOBAL m_hBuffer; int m_Ref; }; @@ -240,7 +239,7 @@ Bitmap* CTintedImage::LoadImageFromFileHandle(HANDLE fileHandle, DWORD fileSize, hBuffer = NULL; } //////////////////////////////////////////// - *ppCache = new ImageCache(bitmap, hBuffer); + *ppCache = new ImageCache(bitmap); return bitmap; } @@ -380,7 +379,7 @@ void CTintedImage::ApplyCrop() { if (m_Crop.Width == 0 || m_Crop.Height == 0) { - m_BitmapTint = new Bitmap(0, 0, PixelFormat24bppRGB); // create dummy bitmap + m_BitmapTint = new Bitmap(0, 0, PixelFormat32bppPARGB); // create dummy bitmap } else { @@ -419,8 +418,7 @@ void CTintedImage::ApplyCrop() } Rect r(0, 0, m_Crop.Width, m_Crop.Height); - 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)); + m_BitmapTint = new Bitmap(r.Width, r.Height, PixelFormat32bppPARGB); Graphics graphics(m_BitmapTint); graphics.DrawImage(m_Bitmap, r, x, y, r.Width, r.Height, UnitPixel); @@ -489,7 +487,7 @@ Bitmap* CTintedImage::TurnGreyscale(Bitmap* source) // We need a blank bitmap to paint our greyscale to in case of alpha Rect r(0, 0, source->GetWidth(), source->GetHeight()); - Bitmap* bitmap = new Bitmap(r.Width, r.Height, AdjustNonAlphaPixelFormat(source)); + Bitmap* bitmap = new Bitmap(r.Width, r.Height, PixelFormat32bppPARGB); Graphics graphics(bitmap); graphics.DrawImage(source, r, 0, 0, r.Width, r.Height, UnitPixel, &ImgAttr); @@ -551,7 +549,7 @@ void CTintedImage::ApplyTransform() Bitmap* original = GetImage(); Rect r(0, 0, original->GetWidth(), original->GetHeight()); - Bitmap* transform = new Bitmap(r.Width, r.Height, AdjustNonAlphaPixelFormat(original)); + Bitmap* transform = new Bitmap(r.Width, r.Height, PixelFormat32bppPARGB); Graphics graphics(transform); diff --git a/Library/TintedImage.h b/Library/TintedImage.h index 61d4d7a0..f72c215b 100644 --- a/Library/TintedImage.h +++ b/Library/TintedImage.h @@ -85,9 +85,6 @@ public: void DisposeImage(); void LoadImage(const std::wstring& imageName, bool bLoadAlways); - static Gdiplus::PixelFormat AdjustNonAlphaPixelFormat(Gdiplus::Bitmap* bitmap, bool additionalCondition = true) - { return (bitmap->GetPixelFormat() == PixelFormat24bppRGB && additionalCondition) ? PixelFormat24bppRGB : PixelFormat32bppPARGB; } - protected: enum CROPMODE {