mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-08 01:52:09 +00:00
remove image::BRIGHTENED and brightened image cache.
These were not being meaningfully used. Also removed code flushing image caches when zoom level changes. This is not necessary now that images are scaled on demand.
This commit is contained in:
parent
96ea7e1ccd
commit
eb040fd639
@ -2550,7 +2550,6 @@ void display::draw_hex(const map_location& loc)
|
||||
{
|
||||
int xpos = get_location_x(loc);
|
||||
int ypos = get_location_y(loc);
|
||||
image::TYPE image_type = get_image_type(loc);
|
||||
const bool on_map = get_map().on_board(loc);
|
||||
const time_of_day& tod = get_time_of_day(loc);
|
||||
const int zoom = int(zoom_);
|
||||
@ -2650,15 +2649,15 @@ void display::draw_hex(const map_location& loc)
|
||||
// to shroud the half-hexes too
|
||||
const std::string& shroud_image = get_variant(shroud_images_, loc);
|
||||
drawing_buffer_add(LAYER_FOG_SHROUD, loc, dest,
|
||||
image::get_texture(shroud_image, image_type));
|
||||
image::get_texture(shroud_image, image::TOD_COLORED));
|
||||
} else if(fogged(loc)) {
|
||||
const std::string& fog_image = get_variant(fog_images_, loc);
|
||||
drawing_buffer_add(LAYER_FOG_SHROUD, loc, dest,
|
||||
image::get_texture(fog_image, image_type));
|
||||
image::get_texture(fog_image, image::TOD_COLORED));
|
||||
}
|
||||
|
||||
if(!shrouded(loc)) {
|
||||
drawing_buffer_add(LAYER_FOG_SHROUD, loc, dest, get_fog_shroud_images(loc, image_type));
|
||||
drawing_buffer_add(LAYER_FOG_SHROUD, loc, dest, get_fog_shroud_images(loc, image::TOD_COLORED));
|
||||
}
|
||||
|
||||
if (on_map) {
|
||||
@ -2728,15 +2727,11 @@ void display::draw_hex(const map_location& loc)
|
||||
|
||||
if(debug_foreground) {
|
||||
drawing_buffer_add(LAYER_UNIT_DEFAULT, loc, dest,
|
||||
image::get_texture("terrain/foreground.png", image_type));
|
||||
image::get_texture("terrain/foreground.png", image::TOD_COLORED));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
image::TYPE display::get_image_type(const map_location& /*loc*/) {
|
||||
return image::TOD_COLORED;
|
||||
}
|
||||
|
||||
// TODO: highdpi - why is there all this faff to deal with textures that are fill of transparency? Just don't make your textures full of transparency. This should not be a thing.
|
||||
// Usage of this function has been removed.
|
||||
// If this turns out to raise no problems, remove the function too.
|
||||
|
@ -687,11 +687,6 @@ protected:
|
||||
*/
|
||||
virtual void draw_hex(const map_location& loc);
|
||||
|
||||
/**
|
||||
* @returns the image type to be used for the passed hex
|
||||
*/
|
||||
virtual image::TYPE get_image_type(const map_location& loc);
|
||||
|
||||
/**
|
||||
* Called near the end of a draw operation, derived classes can use this
|
||||
* to render a specific sidebar. Very similar to post_commit.
|
||||
|
@ -71,15 +71,6 @@ void editor_display::pre_draw()
|
||||
{
|
||||
}
|
||||
|
||||
// TODO: highdpi - remove BRIGHTENED?
|
||||
image::TYPE editor_display::get_image_type(const map_location& loc)
|
||||
{
|
||||
if (map().in_selection(loc)) {
|
||||
return image::BRIGHTENED;
|
||||
}
|
||||
return image::TOD_COLORED;
|
||||
}
|
||||
|
||||
void editor_display::draw_hex(const map_location& loc)
|
||||
{
|
||||
int xpos = get_location_x(loc);
|
||||
|
@ -44,11 +44,6 @@ public:
|
||||
|
||||
protected:
|
||||
void pre_draw() override;
|
||||
/**
|
||||
* The editor uses different rules for terrain highlighting (e.g. selections)
|
||||
*/
|
||||
image::TYPE get_image_type(const map_location& loc) override;
|
||||
|
||||
void draw_hex(const map_location& loc) override;
|
||||
|
||||
/** Inherited from display. */
|
||||
|
@ -78,6 +78,7 @@ std::vector<unsigned int> zoom_levels {36, 72, 144};
|
||||
//
|
||||
double hp_bar_scaling = 0.666;
|
||||
double xp_bar_scaling = 0.5;
|
||||
// TODO: highdpi - remove hex_brightening? it is and was not actually used
|
||||
double hex_brightening = 1.25;
|
||||
|
||||
//
|
||||
|
@ -152,8 +152,7 @@ namespace game_config
|
||||
extern std::string shroud_prefix, fog_prefix;
|
||||
|
||||
extern double hp_bar_scaling, xp_bar_scaling;
|
||||
extern double hex_brightening;
|
||||
extern double hex_semi_brightening;
|
||||
extern double hex_brightening; // UNUSED
|
||||
|
||||
extern std::string flag_rgb, unit_rgb;
|
||||
extern std::vector<color_t> red_green_scale;
|
||||
|
@ -260,8 +260,6 @@ void game_display::draw_hex(const map_location& loc)
|
||||
const int zoom = int(zoom_);
|
||||
const SDL_Rect dest{xpos, ypos, zoom, zoom};
|
||||
|
||||
// image::TYPE image_type = get_image_type(loc);
|
||||
|
||||
display::draw_hex(loc);
|
||||
|
||||
if(cursor::get() == cursor::WAIT) {
|
||||
|
@ -159,8 +159,7 @@ namespace
|
||||
image::locator::locator_finder_t locator_finder;
|
||||
|
||||
/** Definition of all image maps */
|
||||
image::image_cache images_, hexed_images_, tod_colored_images_,
|
||||
brightened_images_;
|
||||
image::image_cache images_, hexed_images_, tod_colored_images_;
|
||||
|
||||
/**
|
||||
* Texture caches.
|
||||
@ -195,7 +194,6 @@ std::set<std::string> precached_dirs;
|
||||
int red_adjust = 0, green_adjust = 0, blue_adjust = 0;
|
||||
|
||||
unsigned int zoom = tile_size;
|
||||
unsigned int cached_zoom = 0;
|
||||
|
||||
const std::string data_uri_prefix = "data:";
|
||||
struct parsed_data_URI{
|
||||
@ -239,7 +237,6 @@ void flush_cache()
|
||||
images_.flush();
|
||||
hexed_images_.flush();
|
||||
tod_colored_images_.flush();
|
||||
brightened_images_.flush();
|
||||
lit_images_.flush();
|
||||
lit_textures_.flush();
|
||||
in_hex_info_.flush();
|
||||
@ -719,7 +716,6 @@ void set_color_adjustment(int r, int g, int b)
|
||||
green_adjust = g;
|
||||
blue_adjust = b;
|
||||
tod_colored_images_.flush();
|
||||
brightened_images_.flush();
|
||||
lit_images_.flush();
|
||||
lit_textures_.flush();
|
||||
}
|
||||
@ -727,18 +723,8 @@ void set_color_adjustment(int r, int g, int b)
|
||||
|
||||
void set_zoom(unsigned int amount)
|
||||
{
|
||||
if(amount != zoom) {
|
||||
zoom = amount;
|
||||
tod_colored_images_.flush();
|
||||
brightened_images_.flush();
|
||||
|
||||
// We keep these caches if:
|
||||
// we use default zoom (it doesn't need those)
|
||||
// or if they are already at the wanted zoom.
|
||||
if(zoom != tile_size && zoom != cached_zoom) {
|
||||
cached_zoom = zoom;
|
||||
}
|
||||
}
|
||||
// This no longer has to do anything fancy.
|
||||
zoom = amount;
|
||||
}
|
||||
|
||||
static surface get_hexed(const locator& i_locator)
|
||||
@ -757,26 +743,9 @@ static surface get_tod_colored(const locator& i_locator)
|
||||
return adjust_surface_color(img, red_adjust, green_adjust, blue_adjust);
|
||||
}
|
||||
|
||||
static surface get_brightened(const locator& i_locator)
|
||||
{
|
||||
surface image(get_surface(i_locator, TOD_COLORED));
|
||||
return brighten_image(image, floating_to_fixed_point(game_config::hex_brightening));
|
||||
}
|
||||
|
||||
/** translate type to a simpler one when possible */
|
||||
static TYPE simplify_type(const image::locator& i_locator, TYPE type)
|
||||
{
|
||||
switch(type) {
|
||||
case BRIGHTENED:
|
||||
if(game_config::hex_brightening == 1.0) {
|
||||
type = TOD_COLORED;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if(type == TOD_COLORED) {
|
||||
if(red_adjust == 0 && green_adjust == 0 && blue_adjust == 0) {
|
||||
type = HEXED;
|
||||
@ -815,9 +784,6 @@ surface get_surface(const image::locator& i_locator, TYPE type)
|
||||
case HEXED:
|
||||
imap = &hexed_images_;
|
||||
break;
|
||||
case BRIGHTENED:
|
||||
imap = &brightened_images_;
|
||||
break;
|
||||
default:
|
||||
return res;
|
||||
}
|
||||
@ -847,9 +813,6 @@ surface get_surface(const image::locator& i_locator, TYPE type)
|
||||
case HEXED:
|
||||
res = get_hexed(i_locator);
|
||||
break;
|
||||
case BRIGHTENED:
|
||||
res = get_brightened(i_locator);
|
||||
break;
|
||||
default:
|
||||
return res;
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ struct manager
|
||||
/**
|
||||
* Changes Time of Day color tint for all applicable image types.
|
||||
*
|
||||
* In particular this affects TOD_COLORED and BRIGHTENED images, as well as
|
||||
* In particular this affects TOD_COLORED images, as well as
|
||||
* images with lightmaps applied. Changing the previous values automatically
|
||||
* invalidates all cached images of those types.
|
||||
*/
|
||||
@ -236,8 +236,6 @@ enum TYPE
|
||||
HEXED,
|
||||
/** Same as HEXED, but with Time of Day color tint applied. */
|
||||
TOD_COLORED,
|
||||
/** Same as TOD_COLORED, but also brightened. */
|
||||
BRIGHTENED
|
||||
};
|
||||
|
||||
enum class scale_quality { nearest, linear };
|
||||
|
Loading…
x
Reference in New Issue
Block a user