AGS: Removed check_font() from GUI, as font handling is now safer

From upstream dc24ac2493026cfecfd0664a057f61f99f4b28ae
This commit is contained in:
Paul Gilbert 2021-08-20 21:18:51 -07:00
parent 460d362bff
commit 91fa6ee386
7 changed files with 2 additions and 16 deletions

View File

@ -73,14 +73,6 @@ bool GUIMain::HasAlphaChannel() const {
_G(loaded_game_file_version) >= kGameVersion_320 && _GP(game).options[OPT_NEWGUIALPHA] != kGuiAlphaRender_Legacy;
}
//=============================================================================
// Engine-specific implementation split out of acgui.h
//=============================================================================
void check_font(int32_t *fontnum) {
// do nothing
}
//=============================================================================
// Engine-specific implementation split out of acgui.cpp
//=============================================================================

View File

@ -24,6 +24,7 @@
#define AGS_GLOBALS_H
#include "ags/shared/ac/game_version.h"
#include "ags/shared/util/stdio_compat.h"
#include "ags/shared/util/string.h"
#include "ags/shared/util/string_types.h"
#include "ags/shared/util/version.h"
@ -1334,7 +1335,7 @@ public:
StringMap *_transtree = nullptr;
String _trans_name, _trans_filename;
long _lang_offs_start = 0;
char _transFileName[MAX_PATH] = { 0 };
char _transFileName[MAX_PATH_SZ] = { 0 };
std::vector<uint16> _wcsbuf; // widechar buffer
std::vector<char> _mbbuf; // utf8 buffer

View File

@ -93,7 +93,6 @@ bool GUIButton::IsClippingImage() const {
void GUIButton::Draw(Bitmap *ds) {
bool draw_disabled = !IsGUIEnabled(this);
check_font(&Font);
// if it's "Unchanged when disabled" or "GUI Off", don't grey out
if (_G(gui_disabled_style) == GUIDIS_UNCHANGED ||
_G(gui_disabled_style) == GUIDIS_GUIOFF) {

View File

@ -50,8 +50,6 @@ GUILabelMacro GUILabel::GetTextMacros() const {
}
void GUILabel::Draw(Shared::Bitmap *ds) {
check_font(&Font);
// TODO: need to find a way to cache text prior to drawing;
// but that will require to update all gui controls when translation is changed in game
PrepareTextToDraw();

View File

@ -98,7 +98,6 @@ void GUIListBox::Draw(Shared::Bitmap *ds) {
const int height = Height - 1;
const int pixel_size = get_fixed_pixel_size(1);
check_font(&Font);
color_t text_color = ds->GetCompatibleColor(TextColor);
color_t draw_color = ds->GetCompatibleColor(TextColor);
if (IsBorderShown()) {
@ -256,7 +255,6 @@ void GUIListBox::OnMouseMove(int x_, int y_) {
void GUIListBox::OnResized() {
if (RowHeight == 0) {
check_font(&Font);
SetFont(Font);
}
if (RowHeight > 0)

View File

@ -250,7 +250,6 @@ extern AGS_INLINE int get_fixed_pixel_size(int pixels);
// Those function have distinct implementations in Engine and Editor
extern void wouttext_outline(Shared::Bitmap *ds, int xxp, int yyp, int usingfont, color_t text_color, const char *texx);
extern int wgettextwidth_compensate(Shared::Bitmap *ds, const char *tex, int font);
extern void check_font(int32_t *fontnum);
extern void set_our_eip(int eip);
#define SET_EIP(x) set_our_eip(x);

View File

@ -49,7 +49,6 @@ bool GUITextBox::IsBorderShown() const {
}
void GUITextBox::Draw(Bitmap *ds) {
check_font(&Font);
color_t text_color = ds->GetCompatibleColor(TextColor);
color_t draw_color = ds->GetCompatibleColor(TextColor);
if (IsBorderShown()) {