mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-16 19:39:17 +00:00
Fix some poor indentation, and tidy some TODOs
This commit is contained in:
parent
6991fcf5a8
commit
3835f9580b
|
@ -102,8 +102,11 @@ bool floating_label::create_texture()
|
|||
return false;
|
||||
}
|
||||
|
||||
// TODO: highdpi - this really does not need the extra indent
|
||||
if(tex_ == nullptr) {
|
||||
if(tex_ != nullptr) {
|
||||
// Already have a texture
|
||||
return true;
|
||||
}
|
||||
|
||||
DBG_FT << "creating floating label texture";
|
||||
font::pango_text& text = font::get_text_renderer();
|
||||
|
||||
|
@ -177,9 +180,8 @@ bool floating_label::create_texture()
|
|||
// adjust high-dpi text display scale
|
||||
tex_.set_draw_width(tex_.w() / ps);
|
||||
tex_.set_draw_height(tex_.h() / ps);
|
||||
}
|
||||
|
||||
return tex_ != nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
void floating_label::undraw()
|
||||
|
|
|
@ -139,7 +139,6 @@ std::string pango_word_wrap(const std::string& unwrapped_text, int font_size, in
|
|||
return res;
|
||||
}
|
||||
|
||||
// TODO: highdpi - cache results, especially size checks
|
||||
SDL_Rect pango_draw_text(CVideo* video, const SDL_Rect& area, int size, const color_t& color, const std::string& text, int x, int y, bool use_tooltips, pango_text::FONT_STYLE style)
|
||||
{
|
||||
auto& ptext = private_renderer();
|
||||
|
|
|
@ -500,7 +500,7 @@ void canvas::draw()
|
|||
return;
|
||||
}
|
||||
|
||||
// TODO: highdpi - it is assumed this will never move after blit
|
||||
// Note: this doesn't update if whatever is underneath changes.
|
||||
if(blur_depth_ && !blur_texture_) {
|
||||
// Cache a blurred image of whatever is underneath.
|
||||
SDL_Rect rect = draw::get_viewport();
|
||||
|
@ -510,7 +510,7 @@ void canvas::draw()
|
|||
}
|
||||
|
||||
// Draw blurred background.
|
||||
// TODO: highdpi - this should be able to be removed at some point with shaders
|
||||
// TODO: hwaccel - this should be able to be removed at some point with shaders
|
||||
if(blur_depth_ && blur_texture_) {
|
||||
draw::blit(blur_texture_);
|
||||
}
|
||||
|
|
51
src/halo.cpp
51
src/halo.cpp
|
@ -39,19 +39,16 @@ static lg::log_domain log_halo("halo");
|
|||
namespace halo
|
||||
{
|
||||
|
||||
// TODO: draw_manager - GH#1350 - halo issues on edge of screen - maybe fixed
|
||||
// TODO: draw_manager - GH#1354 - halo_mod doesn't mod halos - maybe not hard
|
||||
// TODO: draw_manager - GH#1960 - halos inherit alpha from unit - maybe not hard
|
||||
// TODO: draw_manager - GH#2458 - artifacts when zooming (probably fixed)
|
||||
// TODO: draw_manager - GH#6738 - (1) done already (2) halos off screen maybe done
|
||||
|
||||
// TODO: draw_manager - fucking indent, what the shit
|
||||
class halo_impl
|
||||
{
|
||||
|
||||
class effect
|
||||
{
|
||||
public:
|
||||
class effect
|
||||
{
|
||||
public:
|
||||
effect(
|
||||
int xpos, int ypos,
|
||||
const animated<image::locator>::anim_description& img,
|
||||
|
@ -75,7 +72,7 @@ public:
|
|||
bool on_location(const std::set<map_location>& locations) const;
|
||||
bool location_not_known() const;
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
const image::locator& current_image() const { return images_.get_current_frame(); }
|
||||
|
||||
|
@ -101,55 +98,55 @@ private:
|
|||
map_location map_loc_ = {-1, -1};
|
||||
|
||||
display* disp = nullptr;
|
||||
};
|
||||
};
|
||||
|
||||
std::map<int, effect> haloes;
|
||||
int halo_id;
|
||||
std::map<int, effect> haloes;
|
||||
int halo_id;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Upon unrendering, an invalidation list is send. All haloes in that area and
|
||||
* the other invalidated haloes are stored in this set. Then there'll be
|
||||
* tested which haloes overlap and they're also stored in this set.
|
||||
*/
|
||||
std::set<int> invalidated_haloes;
|
||||
std::set<int> invalidated_haloes;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Upon deleting, a halo isn't deleted but added to this set, upon unrendering
|
||||
* the image is unrendered and deleted.
|
||||
*/
|
||||
std::set<int> deleted_haloes;
|
||||
std::set<int> deleted_haloes;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Haloes that have an animation or expiration time need to be checked every
|
||||
* frame and are stored in this set.
|
||||
*/
|
||||
std::set<int> changing_haloes;
|
||||
std::set<int> changing_haloes;
|
||||
|
||||
public:
|
||||
/**
|
||||
public:
|
||||
/**
|
||||
* impl's of exposed functions
|
||||
*/
|
||||
|
||||
explicit halo_impl() :
|
||||
explicit halo_impl() :
|
||||
haloes(),
|
||||
halo_id(1),
|
||||
invalidated_haloes(),
|
||||
deleted_haloes(),
|
||||
changing_haloes()
|
||||
{}
|
||||
{}
|
||||
|
||||
|
||||
int add(int x, int y, const std::string& image, const map_location& loc,
|
||||
int add(int x, int y, const std::string& image, const map_location& loc,
|
||||
ORIENTATION orientation=NORMAL, bool infinite=true);
|
||||
|
||||
/** Set the position of an existing haloing effect, according to its handle. */
|
||||
void set_location(int handle, int x, int y);
|
||||
/** Set the position of an existing haloing effect, according to its handle. */
|
||||
void set_location(int handle, int x, int y);
|
||||
|
||||
/** Remove the halo with the given handle. */
|
||||
void remove(int handle);
|
||||
/** Remove the halo with the given handle. */
|
||||
void remove(int handle);
|
||||
|
||||
void update();
|
||||
void render();
|
||||
void update();
|
||||
void render();
|
||||
|
||||
}; //end halo_impl
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user