enforce valid hsla values - refs #1954
This commit is contained in:
parent
7c63b666f9
commit
eaeccc3c3a
3 changed files with 18 additions and 2 deletions
|
@ -26,13 +26,17 @@
|
||||||
// mapnik
|
// mapnik
|
||||||
#include <mapnik/config.hpp>
|
#include <mapnik/config.hpp>
|
||||||
#include <mapnik/color.hpp>
|
#include <mapnik/color.hpp>
|
||||||
|
#include <mapnik/config_error.hpp>
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
#include <boost/variant.hpp>
|
#include <boost/variant.hpp>
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <iterator> // for std::back_insert_iterator
|
#include <iterator> // for std::back_insert_iterator
|
||||||
|
|
||||||
|
|
||||||
namespace mapnik { namespace filter {
|
namespace mapnik { namespace filter {
|
||||||
|
|
||||||
struct blur {};
|
struct blur {};
|
||||||
|
@ -66,7 +70,15 @@ struct scale_hsla
|
||||||
l0(_l0),
|
l0(_l0),
|
||||||
l1(_l1),
|
l1(_l1),
|
||||||
a0(_a0),
|
a0(_a0),
|
||||||
a1(_a1) {}
|
a1(_a1) {
|
||||||
|
if (h0 < 0 || h1 > 1 ||
|
||||||
|
s0 < 0 || s1 > 1 ||
|
||||||
|
l0 < 0 || l1 > 1 ||
|
||||||
|
a0 < 0 || a1 > 1)
|
||||||
|
{
|
||||||
|
throw config_error("scale-hsla values must be between 0 and 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
inline bool is_identity() const {
|
inline bool is_identity() const {
|
||||||
return (h0 == 0 &&
|
return (h0 == 0 &&
|
||||||
h1 == 1 &&
|
h1 == 1 &&
|
||||||
|
|
4
tests/data/broken_maps/invalid-scale-hsla-filter.xml
Normal file
4
tests/data/broken_maps/invalid-scale-hsla-filter.xml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<Map>
|
||||||
|
<Style name="style" image-filters="scale-hsla(-1,1.1,0,1,0,1,0,1)">
|
||||||
|
</Style>
|
||||||
|
</Map>
|
Loading…
Add table
Reference in a new issue