mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
- Added image caching system internally.
It would reduce memory usage in case that you use the same image file repeatedly on some meters. (Eg. Crop a part from same image by using ImageCrop.) - Fixed an issue that Background image isn't drawn correctly when BackgroundMode=0 and tint option is set.
This commit is contained in:
@ -2122,23 +2122,26 @@ bool CMeterWindow::ResizeWindow(bool reset)
|
||||
|
||||
if (m_BackgroundMode == BGMODE_IMAGE)
|
||||
{
|
||||
PixelFormat format = tempBackground->GetPixelFormat();
|
||||
if (format == PixelFormat32bppARGB)
|
||||
{
|
||||
format = PixelFormat32bppPARGB;
|
||||
}
|
||||
m_Background = tempBackground->Clone(0, 0, m_BackgroundSize.cx, m_BackgroundSize.cy, format);
|
||||
w = m_BackgroundSize.cx;
|
||||
h = m_BackgroundSize.cy;
|
||||
}
|
||||
else
|
||||
{
|
||||
w = max(w, m_BackgroundSize.cx);
|
||||
h = max(h, m_BackgroundSize.cy);
|
||||
}
|
||||
|
||||
Bitmap* background = new Bitmap(w, h, CTintedImage::AdjustNonAlphaPixelFormat(tempBackground));
|
||||
Graphics graphics(background);
|
||||
|
||||
if (m_BackgroundMode == BGMODE_IMAGE)
|
||||
{
|
||||
Rect r(0, 0, w, h);
|
||||
graphics.DrawImage(tempBackground, r, 0, 0, w, h, UnitPixel);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Scale the background to fill the whole window
|
||||
Bitmap* background = new Bitmap(w, h, PixelFormat32bppPARGB);
|
||||
|
||||
Graphics graphics(background);
|
||||
|
||||
if (m_BackgroundMode == BGMODE_SCALED_IMAGE)
|
||||
{
|
||||
const RECT m = m_BackgroundMargins;
|
||||
@ -2210,10 +2213,10 @@ bool CMeterWindow::ResizeWindow(bool reset)
|
||||
Rect r(0, 0, w, h);
|
||||
graphics.DrawImage(tempBackground, r, 0, 0, w, h, UnitPixel, &imgAttr);
|
||||
}
|
||||
|
||||
m_Background = background;
|
||||
}
|
||||
|
||||
m_Background = background;
|
||||
|
||||
// Get the size form the background bitmap
|
||||
m_WindowW = m_Background->GetWidth();
|
||||
m_WindowH = m_Background->GetHeight();
|
||||
|
Reference in New Issue
Block a user