mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Minor tweaks and fixes
This commit is contained in:
parent
f16224793e
commit
c6374f7c12
@ -69,7 +69,7 @@ CanvasD2D::CanvasD2D() : Canvas(),
|
|||||||
|
|
||||||
CanvasD2D::~CanvasD2D()
|
CanvasD2D::~CanvasD2D()
|
||||||
{
|
{
|
||||||
DiscardDeviceResources();
|
Dispose();
|
||||||
Finalize();
|
Finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ void CanvasD2D::Finalize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CanvasD2D::DiscardDeviceResources()
|
void CanvasD2D::Dispose()
|
||||||
{
|
{
|
||||||
SafeRelease(&m_Target);
|
SafeRelease(&m_Target);
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ void CanvasD2D::Resize(int w, int h)
|
|||||||
{
|
{
|
||||||
__super::Resize(w, h);
|
__super::Resize(w, h);
|
||||||
|
|
||||||
DiscardDeviceResources();
|
Dispose();
|
||||||
|
|
||||||
m_Bitmap.Resize(w, h);
|
m_Bitmap.Resize(w, h);
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ private:
|
|||||||
static bool Initialize();
|
static bool Initialize();
|
||||||
static void Finalize();
|
static void Finalize();
|
||||||
|
|
||||||
void DiscardDeviceResources();
|
void Dispose();
|
||||||
|
|
||||||
bool BeginTargetDraw();
|
bool BeginTargetDraw();
|
||||||
void EndTargetDraw();
|
void EndTargetDraw();
|
||||||
|
@ -22,7 +22,7 @@ namespace Gfx {
|
|||||||
|
|
||||||
CanvasGDIP::CanvasGDIP() : Canvas(),
|
CanvasGDIP::CanvasGDIP() : Canvas(),
|
||||||
m_Graphics(),
|
m_Graphics(),
|
||||||
m_DoubleBuffer(),
|
m_Bitmap(),
|
||||||
m_DIBSectionBuffer(),
|
m_DIBSectionBuffer(),
|
||||||
m_DIBSectionBufferPixels()
|
m_DIBSectionBufferPixels()
|
||||||
{
|
{
|
||||||
@ -30,22 +30,30 @@ CanvasGDIP::CanvasGDIP() : Canvas(),
|
|||||||
|
|
||||||
CanvasGDIP::~CanvasGDIP()
|
CanvasGDIP::~CanvasGDIP()
|
||||||
{
|
{
|
||||||
delete m_DoubleBuffer;
|
Dispose();
|
||||||
if (m_DIBSectionBuffer) DeleteObject(m_DIBSectionBuffer);
|
}
|
||||||
|
|
||||||
|
void CanvasGDIP::Dispose()
|
||||||
|
{
|
||||||
|
delete m_Graphics;
|
||||||
|
m_Graphics = nullptr;
|
||||||
|
|
||||||
|
delete m_Bitmap;
|
||||||
|
m_Bitmap = nullptr;
|
||||||
|
|
||||||
|
if (m_DIBSectionBuffer)
|
||||||
|
{
|
||||||
|
DeleteObject(m_DIBSectionBuffer);
|
||||||
|
m_DIBSectionBuffer = nullptr;
|
||||||
|
m_DIBSectionBufferPixels = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CanvasGDIP::Resize(int w, int h)
|
void CanvasGDIP::Resize(int w, int h)
|
||||||
{
|
{
|
||||||
__super::Resize(w, h);
|
__super::Resize(w, h);
|
||||||
|
|
||||||
delete m_Graphics;
|
Dispose();
|
||||||
|
|
||||||
if (m_DIBSectionBuffer)
|
|
||||||
{
|
|
||||||
delete m_DoubleBuffer;
|
|
||||||
DeleteObject(m_DIBSectionBuffer);
|
|
||||||
m_DIBSectionBufferPixels = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
BITMAPV4HEADER bh = {sizeof(BITMAPV4HEADER)};
|
BITMAPV4HEADER bh = {sizeof(BITMAPV4HEADER)};
|
||||||
bh.bV4Width = w;
|
bh.bV4Width = w;
|
||||||
@ -67,14 +75,14 @@ void CanvasGDIP::Resize(int w, int h)
|
|||||||
0);
|
0);
|
||||||
|
|
||||||
// Create GDI+ bitmap from the DIBSection pixels
|
// Create GDI+ bitmap from the DIBSection pixels
|
||||||
m_DoubleBuffer = new Gdiplus::Bitmap(
|
m_Bitmap = new Gdiplus::Bitmap(
|
||||||
w,
|
w,
|
||||||
h,
|
h,
|
||||||
w * 4,
|
w * 4,
|
||||||
PixelFormat32bppPARGB,
|
PixelFormat32bppPARGB,
|
||||||
(BYTE*)m_DIBSectionBufferPixels);
|
(BYTE*)m_DIBSectionBufferPixels);
|
||||||
|
|
||||||
m_Graphics = new Gdiplus::Graphics(m_DoubleBuffer);
|
m_Graphics = new Gdiplus::Graphics(m_Bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CanvasGDIP::BeginDraw()
|
bool CanvasGDIP::BeginDraw()
|
||||||
|
@ -64,8 +64,10 @@ public:
|
|||||||
private:
|
private:
|
||||||
CanvasGDIP(const CanvasGDIP& other) {}
|
CanvasGDIP(const CanvasGDIP& other) {}
|
||||||
|
|
||||||
|
void Dispose();
|
||||||
|
|
||||||
Gdiplus::Graphics* m_Graphics;
|
Gdiplus::Graphics* m_Graphics;
|
||||||
Gdiplus::Bitmap* m_DoubleBuffer;
|
Gdiplus::Bitmap* m_Bitmap;
|
||||||
HBITMAP m_DIBSectionBuffer;
|
HBITMAP m_DIBSectionBuffer;
|
||||||
LPDWORD m_DIBSectionBufferPixels;
|
LPDWORD m_DIBSectionBufferPixels;
|
||||||
|
|
||||||
|
@ -432,15 +432,12 @@ bool CMeterString::DrawString(Gfx::Canvas& canvas, RectF* rect)
|
|||||||
|
|
||||||
canvas.SetTextAntiAliasing(m_AntiAlias);
|
canvas.SetTextAntiAliasing(m_AntiAlias);
|
||||||
|
|
||||||
//CharacterRange range(0, stringLen);
|
|
||||||
//stringFormat.SetMeasurableCharacterRanges(1, &range);
|
|
||||||
|
|
||||||
m_TextFormat->SetTrimming(
|
m_TextFormat->SetTrimming(
|
||||||
m_ClipType == CLIP_ON ||
|
m_ClipType == CLIP_ON ||
|
||||||
(m_ClipType == CLIP_AUTO && (m_NeedsClipping || (m_WDefined && m_HDefined))));
|
(m_ClipType == CLIP_AUTO && (m_NeedsClipping || (m_WDefined && m_HDefined))));
|
||||||
|
|
||||||
REAL x = (REAL)GetX();
|
const REAL x = (REAL)GetX();
|
||||||
REAL y = (REAL)GetY();
|
const REAL y = (REAL)GetY();
|
||||||
|
|
||||||
if (rect)
|
if (rect)
|
||||||
{
|
{
|
||||||
@ -598,15 +595,6 @@ void CMeterString::BindMeasures(CConfigParser& parser, const WCHAR* section)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
** Static function which frees the font cache.
|
|
||||||
** If collection is not NULL, frees the private font cache.
|
|
||||||
**
|
|
||||||
*/
|
|
||||||
void CMeterString::FreeFontCache(PrivateFontCollection* collection)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Static helper to log all installed font families.
|
** Static helper to log all installed font families.
|
||||||
**
|
**
|
||||||
@ -674,5 +662,4 @@ void CMeterString::InitializeStatic()
|
|||||||
|
|
||||||
void CMeterString::FinalizeStatic()
|
void CMeterString::FinalizeStatic()
|
||||||
{
|
{
|
||||||
FreeFontCache();
|
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,6 @@ public:
|
|||||||
virtual bool Draw(Gfx::Canvas& canvas);
|
virtual bool Draw(Gfx::Canvas& canvas);
|
||||||
Gdiplus::RectF GetRect() { return m_Rect; }
|
Gdiplus::RectF GetRect() { return m_Rect; }
|
||||||
|
|
||||||
static void FreeFontCache(Gdiplus::PrivateFontCollection* collection = NULL);
|
|
||||||
static void EnumerateInstalledFontFamilies();
|
static void EnumerateInstalledFontFamilies();
|
||||||
|
|
||||||
static void InitializeStatic();
|
static void InitializeStatic();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user