forked from pyrite-dev/milsko
fix font rendering
This commit is contained in:
parent
974947b400
commit
85b66d0d9a
9 changed files with 25 additions and 24 deletions
|
|
@ -34,7 +34,6 @@ struct _MwLLGDI {
|
|||
struct _MwLLGDIColor {
|
||||
struct _MwLLCommonColor common;
|
||||
|
||||
COLORREF color;
|
||||
HBRUSH brush;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@
|
|||
#define MwNsubForeground "SsubForeground"
|
||||
#define MwNtitleForeground "StitleForeground"
|
||||
|
||||
|
||||
#define MwNvulkanExtension "SEvulkanExtension"
|
||||
#define MwNvulkanLayer "SEvulkanLayer"
|
||||
#define MwNvulkanConfig "VEvulkanConfig"
|
||||
|
|
|
|||
|
|
@ -525,6 +525,7 @@ static MwLLColor MwLLAllocColorImpl(MwLL handle, int r, int g, int b) {
|
|||
|
||||
static void MwLLColorUpdateImpl(MwLL handle, MwLLColor c, int r, int g, int b) {
|
||||
HDC dc = GetDC(handle->gdi.hWnd);
|
||||
COLORREF color;
|
||||
|
||||
if(r > 255) r = 255;
|
||||
if(g > 255) g = 255;
|
||||
|
|
@ -533,9 +534,10 @@ static void MwLLColorUpdateImpl(MwLL handle, MwLLColor c, int r, int g, int b) {
|
|||
if(g < 0) g = 0;
|
||||
if(b < 0) b = 0;
|
||||
|
||||
color = GetNearestColor(dc, RGB(r, g, b));
|
||||
|
||||
if(c->gdi.brush != NULL) DeleteObject(c->gdi.brush);
|
||||
c->gdi.color = GetNearestColor(dc, RGB(r, g, b));
|
||||
c->gdi.brush = CreateSolidBrush(c->gdi.color);
|
||||
c->gdi.brush = CreateSolidBrush(color);
|
||||
c->common.red = r;
|
||||
c->common.green = g;
|
||||
c->common.blue = b;
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@ static int GDI_MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const c
|
|||
tw = MwTextWidth(handle, ttf, text);
|
||||
th = MwTextHeight(handle, ttf, text);
|
||||
|
||||
if(handle->lowlevel->common.type == MwLLBackendGDI && MwGetInteger(handle, MwNmodernLook) == MwFALSE) {
|
||||
if(handle->lowlevel->common.type == MwLLBackendGDI) {
|
||||
HFONT old_font = SelectObject(handle->lowlevel->gdi.hDC, ttf->font);
|
||||
int old_bkmode = SetBkMode(handle->lowlevel->gdi.hDC, TRANSPARENT);
|
||||
COLORREF old_color = SetTextColor(handle->lowlevel->gdi.hDC, color->gdi.color);
|
||||
COLORREF old_color = SetTextColor(handle->lowlevel->gdi.hDC, RGB(color->common.red, color->common.green, color->common.blue));
|
||||
|
||||
TextOut(handle->lowlevel->gdi.hDC, point->x, point->y - th / 2, t, strlen(t));
|
||||
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ void MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text,
|
|||
fadedColor->common.red = fadedColor->common.red + (c->common.red - fadedColor->common.red) * 0.5;
|
||||
fadedColor->common.green = fadedColor->common.green + (c->common.green - fadedColor->common.green) * 0.5;
|
||||
fadedColor->common.blue = fadedColor->common.blue + (c->common.blue - fadedColor->common.blue) * 0.5;
|
||||
MwLLColorUpdate(handle->lowlevel, fadedColor, fadedColor->common.red, fadedColor->common.green, fadedColor->common.blue);
|
||||
|
||||
MwLLFreeColor(c);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue