Skip to content

Commit

Permalink
* Resize emojis in a nicer manner
Browse files Browse the repository at this point in the history
  • Loading branch information
iProgramMC committed Jul 20, 2024
1 parent 200ad6f commit 97b4ae9
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/windows/TextInterface_Win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,21 @@ void MdDrawString(DrawingContext* context, const Rect& rect, const String& str,

bool hasAlpha = false;
HBITMAP hbm = GetAvatarCache()->GetBitmap(nameRaw, hasAlpha);
DrawBitmap(hdc, hbm, rect.left, rect.top, NULL, CLR_NONE, height, height, hasAlpha);

bool shouldResize = GetProfilePictureSize() != height;

if (shouldResize)
{
HBRUSH hbr = CreateSolidBrush(context->m_bkColor);
HBITMAP hnbm = ResizeWithBackgroundColor(hdc, hbm, hbr, hasAlpha, height, height, GetProfilePictureSize(), GetProfilePictureSize());
DrawBitmap(hdc, hnbm, rect.left, rect.top, NULL, CLR_NONE, height, height, false);
DeleteBitmap(hnbm);
DeleteBrush(hbr);
}
else
{
DrawBitmap(hdc, hbm, rect.left, rect.top, NULL, CLR_NONE, height, height, hasAlpha);
}
return;
}

Expand Down

0 comments on commit 97b4ae9

Please sign in to comment.