add missing image scaling property meta type + replace to integer conversion with comparison operator in enumeration_wrapper + change order in value_base_type (ref #4045)

This commit is contained in:
Artem Pavlenko 2019-06-12 09:40:10 +01:00
parent b890dc2775
commit e90a4fca7d
3 changed files with 11 additions and 4 deletions

View file

@ -97,6 +97,7 @@ enum class property_types : std::uint8_t
target_font_feature_settings,
target_line_pattern,
target_smooth_algorithm,
target_scaling_method
};
template <typename T>

View file

@ -68,10 +68,11 @@ struct enumeration_wrapper
explicit enumeration_wrapper(T value_)
: value(value_) {}
inline operator int() const
inline bool operator==(enumeration_wrapper const& rhs) const
{
return value;
return value == rhs.value;
}
};
using dash_array = std::vector<std::pair<double,double> >;
@ -82,8 +83,8 @@ using text_placements_ptr = std::shared_ptr<text_placements>;
namespace detail {
using value_base_type = util::variant<value_bool,
value_integer,
enumeration_wrapper,
value_integer,
value_double,
std::string,
color,

View file

@ -90,7 +90,12 @@ static const property_meta_type key_meta[const_max_key] =
property_meta_type{ "shield-dy", nullptr, property_types::target_double },
property_meta_type{ "unlock-image", nullptr, property_types::target_bool },
property_meta_type{ "mode", nullptr, property_types::target_double },
property_meta_type{ "scaling", nullptr, property_types::target_double },
property_meta_type{ "scaling",
[](enumeration_wrapper e)
{
return *scaling_method_to_string(scaling_method_e(e.value));
},
property_types::target_scaling_method},
property_meta_type{ "filter-factor", nullptr, property_types::target_double },
property_meta_type{ "mesh-size", nullptr, property_types::target_double },
property_meta_type{ "premultiplied", nullptr, property_types::target_bool },