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
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/color.hpp>
|
||||
#include <mapnik/config_error.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/variant.hpp>
|
||||
|
||||
// stl
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
#include <iterator> // for std::back_insert_iterator
|
||||
|
||||
|
||||
namespace mapnik { namespace filter {
|
||||
|
||||
struct blur {};
|
||||
|
@ -66,7 +70,15 @@ struct scale_hsla
|
|||
l0(_l0),
|
||||
l1(_l1),
|
||||
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 {
|
||||
return (h0 == 0 &&
|
||||
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>
|
|
@ -1,7 +1,7 @@
|
|||
<Map srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" background-image="../../data/images/checker.jpg">
|
||||
|
||||
<Style name="ellipse"
|
||||
direct-image-filters=" scale-hsla(0,1,0,1,0,1,0,.5)"
|
||||
direct-image-filters="scale-hsla(0,1,0,1,0,1,0,.5)"
|
||||
image-filters="scale-hsla(.1,.9,.5,1,.5,1,.2,1)"
|
||||
>
|
||||
<Rule>
|
||||
|
|
Loading…
Reference in a new issue