Implement partial parallelisation of non-map mode viewport rendering

This commit is contained in:
Jonathan G Rennison
2022-11-09 22:24:31 +00:00
parent 07b752fe69
commit 7685c36f35
12 changed files with 479 additions and 269 deletions

View File

@@ -126,19 +126,19 @@ void InitTextEffects()
_free_text_effect = 0;
}
void DrawTextEffects(DrawPixelInfo *dpi)
void DrawTextEffects(ViewportDrawerDynamic *vdd, DrawPixelInfo *dpi, bool load_transparent)
{
/* Don't draw the text effects when zoomed out a lot */
if (dpi->zoom > ZOOM_LVL_OUT_8X) return;
const int bottom_threshold = dpi->top + dpi->height;
const int top_threshold = dpi->top - ScaleByZoom(VPSM_TOP + FONT_HEIGHT_NORMAL + VPSM_BOTTOM, dpi->zoom);
const bool show_loading = (_settings_client.gui.loading_indicators && !IsTransparencySet(TO_LOADING));
const bool show_loading = (_settings_client.gui.loading_indicators && !load_transparent);
for (TextEffect &te : _text_effects) {
if (te.string_id == INVALID_STRING_ID) continue;
if ((te.mode == TE_RISING || show_loading) && te.top > top_threshold && te.top < bottom_threshold) {
ViewportAddString(dpi, ZOOM_LVL_OUT_8X, &te, te.string_id, te.string_id - 1, STR_NULL, te.params_1, te.params_2);
ViewportAddString(vdd, dpi, ZOOM_LVL_OUT_8X, &te, te.string_id, te.string_id - 1, STR_NULL, te.params_1, te.params_2);
}
}
}