Window::setAlpha triggers texture invalidation and re-cache even if alpha is the same

Create issue
Issue #1031 resolved
Nick Enstein created an issue

The Window::setAlpha method will trigger texture invalidation and re-cache (also on all of it's children) even when setting an alpha value that is not different to the current one.

Reproducibility: always

Steps to reproduce: Call setAlpha(1.0f) on a layout every frame. Notice that every all contained autorenderingsurfaces are invalidated and re-cached each frame.

Additional information: I have a fix for this and I will attempt a pull request.

OS: All, OS build: All, Platform: CEGUI 0.8

Comments (4)

  1. Nick Enstein reporter

    Pull request generated with the following change in Window.cpp.

    void Window::setAlpha(const float alpha) { // clamp this to the valid range [0.0, 1.0] - d_alpha = ceguimax(ceguimin(alpha, 1.0f), 0.0f); + float newAlpha = ceguimax(ceguimin(alpha, 1.0f), 0.0f); + + // ensure that the new alpha value is actually different to avoid + // unneccesary invalidating and re-caching of textures (and children) + if (newAlpha==d_alpha) + return; + + d_alpha = newAlpha; WindowEventArgs args(this); onAlphaChanged(args); }

  2. Log in to comment