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:
@ -46,6 +46,7 @@
|
||||
};
|
||||
|
||||
class CConfigParser;
|
||||
class ImageCache;
|
||||
|
||||
class CTintedImage
|
||||
{
|
||||
@ -84,6 +85,9 @@ public:
|
||||
void DisposeImage();
|
||||
void LoadImage(const std::wstring& imageName, bool bLoadAlways);
|
||||
|
||||
static Gdiplus::PixelFormat AdjustNonAlphaPixelFormat(Gdiplus::Bitmap* bitmap)
|
||||
{ return (bitmap->GetPixelFormat() == PixelFormat24bppRGB) ? PixelFormat24bppRGB : PixelFormat32bppPARGB; }
|
||||
|
||||
protected:
|
||||
enum CROPMODE
|
||||
{
|
||||
@ -98,7 +102,7 @@ protected:
|
||||
void ApplyTint();
|
||||
void ApplyTransform();
|
||||
|
||||
static bool LoadImageFromFileHandle(HANDLE fileHandle, Gdiplus::Bitmap** pBitmap, HGLOBAL* phBuffer);
|
||||
Gdiplus::Bitmap* LoadImageFromFileHandle(HANDLE fileHandle, DWORD fileSize, ImageCache** ppCache);
|
||||
|
||||
static Gdiplus::Bitmap* TurnGreyscale(Gdiplus::Bitmap* source);
|
||||
static bool CompareColorMatrix(const Gdiplus::ColorMatrix* a, const Gdiplus::ColorMatrix* b);
|
||||
@ -106,9 +110,6 @@ protected:
|
||||
Gdiplus::Bitmap* m_Bitmap; // The bitmap
|
||||
Gdiplus::Bitmap* m_BitmapTint; // The tinted bitmap
|
||||
|
||||
HGLOBAL m_hBuffer;
|
||||
FILETIME m_Modified;
|
||||
|
||||
const std::wstring m_ConfigName;
|
||||
const WCHAR** m_ConfigArray;
|
||||
const bool m_DisableTransform;
|
||||
@ -124,6 +125,8 @@ protected:
|
||||
Gdiplus::RotateFlipType m_Flip;
|
||||
Gdiplus::REAL m_Rotate;
|
||||
|
||||
std::wstring m_CacheKey;
|
||||
|
||||
static const Gdiplus::ColorMatrix c_GreyScaleMatrix;
|
||||
static const Gdiplus::ColorMatrix c_IdentifyMatrix;
|
||||
|
||||
|
Reference in New Issue
Block a user