PPGe: Allow overriding text drawer DPI scale.

This commit is contained in:
Unknown W. Brackets 2020-03-10 09:20:14 -07:00
parent 70b07f20c9
commit 5141dc7e91
2 changed files with 11 additions and 4 deletions

View File

@ -35,6 +35,8 @@ void TextDrawer::SetFontScale(float xscale, float yscale) {
}
float TextDrawer::CalculateDPIScale() {
if (ignoreGlobalDpi_)
return dpiScale_;
float scale = g_dpi_scale_y;
if (scale >= 1.0f) {
scale = 1.0f;

View File

@ -64,6 +64,10 @@ public:
virtual void OncePerFrame() = 0;
float CalculateDPIScale();
void SetForcedDPIScale(float dpi) {
dpiScale_ = dpi;
ignoreGlobalDpi_ = true;
}
// Factory function that selects implementation.
static TextDrawer *Create(Draw::DrawContext *draw);
@ -87,10 +91,11 @@ protected:
uint32_t fontHash;
};
int frameCount_;
float fontScaleX_;
float fontScaleY_;
float dpiScale_;
int frameCount_ = 0;
float fontScaleX_ = 1.0f;
float fontScaleY_ = 1.0f;
float dpiScale_ = 1.0f;
bool ignoreGlobalDpi_ = false;
};