mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-15 17:54:57 +00:00
Regenerate blur effects if canvas screen location has changed.
This should catch most cases of moving or resizing blurred windows.
This commit is contained in:
parent
990e25f9e2
commit
5a4271ea98
|
@ -483,6 +483,7 @@ void text_shape::draw(wfl::map_formula_callable& variables)
|
||||||
canvas::canvas()
|
canvas::canvas()
|
||||||
: shapes_()
|
: shapes_()
|
||||||
, blur_depth_(0)
|
, blur_depth_(0)
|
||||||
|
, blur_region_(sdl::empty_rect)
|
||||||
, deferred_(false)
|
, deferred_(false)
|
||||||
, w_(0)
|
, w_(0)
|
||||||
, h_(0)
|
, h_(0)
|
||||||
|
@ -494,6 +495,7 @@ canvas::canvas()
|
||||||
canvas::canvas(canvas&& c) noexcept
|
canvas::canvas(canvas&& c) noexcept
|
||||||
: shapes_(std::move(c.shapes_))
|
: shapes_(std::move(c.shapes_))
|
||||||
, blur_depth_(c.blur_depth_)
|
, blur_depth_(c.blur_depth_)
|
||||||
|
, blur_region_(c.blur_region_)
|
||||||
, deferred_(c.deferred_)
|
, deferred_(c.deferred_)
|
||||||
, w_(c.w_)
|
, w_(c.w_)
|
||||||
, h_(c.h_)
|
, h_(c.h_)
|
||||||
|
@ -510,6 +512,15 @@ bool canvas::update_blur(const rect& screen_region, bool force)
|
||||||
// No blurring needed.
|
// No blurring needed.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(screen_region != blur_region_) {
|
||||||
|
DBG_GUI_D << "blur region changed from " << blur_region_
|
||||||
|
<< " to " << screen_region;
|
||||||
|
// something has changed. regenerate the texture.
|
||||||
|
blur_texture_.reset();
|
||||||
|
blur_region_ = screen_region;
|
||||||
|
}
|
||||||
|
|
||||||
if(blur_texture_ && !force) {
|
if(blur_texture_ && !force) {
|
||||||
// We already made the blur. It's expensive, so don't do it again.
|
// We already made the blur. It's expensive, so don't do it again.
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -173,6 +173,9 @@ private:
|
||||||
/** Blurred background texture. */
|
/** Blurred background texture. */
|
||||||
texture blur_texture_;
|
texture blur_texture_;
|
||||||
|
|
||||||
|
/** The region of the screen we have blurred (if any). */
|
||||||
|
rect blur_region_;
|
||||||
|
|
||||||
/** Whether we have deferred rendering so we can capture for blur. */
|
/** Whether we have deferred rendering so we can capture for blur. */
|
||||||
bool deferred_;
|
bool deferred_;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user