remove unused set_rectangle method

This commit is contained in:
Dane Springmeyer 2015-06-14 12:02:33 -07:00
parent 7e2028e9fd
commit 6d124cc229
2 changed files with 2 additions and 99 deletions

View file

@ -31,6 +31,8 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/algorithm/string/predicate.hpp>
#include <boost/optional.hpp>
#pragma GCC diagnostic pop
@ -196,12 +198,6 @@ MAPNIK_DECL void fill (image<gray64s_t> & data, T const&);
template <typename T>
MAPNIK_DECL void fill (image<gray64f_t> & data, T const&);
// SET RECTANGLE
MAPNIK_DECL void set_rectangle (image_any & dst, image_any const& src, int x = 0, int y = 0);
template <typename T>
MAPNIK_DECL void set_rectangle (T & dst, T const& src, int x = 0, int y = 0);
// CHECK BOUNDS
template <typename T>
inline bool check_bounds (T const& data, std::size_t x, std::size_t y)

View file

@ -1192,99 +1192,6 @@ template MAPNIK_DECL void fill(image_gray64f &, int8_t const&);
template MAPNIK_DECL void fill(image_gray64f &, float const&);
template MAPNIK_DECL void fill(image_gray64f &, double const&);
namespace detail {
struct visitor_set_rectangle
{
visitor_set_rectangle(image_any const & src, std::size_t x0, std::size_t y0)
: src_(src), x0_(x0), y0_(y0) {}
void operator()(image_rgba8 & dst) const
{
using pixel_type = image_rgba8::pixel_type;
image_rgba8 src = util::get<image_rgba8>(src_);
box2d<int> ext0(0,0,dst.width(),dst.height());
box2d<int> ext1(x0_,y0_,x0_+src.width(),y0_+src.height());
if (ext0.intersects(ext1))
{
box2d<int> box = ext0.intersect(ext1);
for (std::size_t y = box.miny(); y < box.maxy(); ++y)
{
pixel_type* row_to = dst.get_row(y);
pixel_type const * row_from = src.get_row(y-y0_);
for (std::size_t x = box.minx(); x < box.maxx(); ++x)
{
if (row_from[x-x0_] & 0xff000000) // Don't change if alpha == 0
{
row_to[x] = row_from[x-x0_];
}
}
}
}
}
void operator() (image_null &) const
{
throw std::runtime_error("Set rectangle not support for null images");
}
template <typename T>
void operator() (T & dst) const
{
using pixel_type = typename T::pixel_type;
T src = util::get<T>(src_);
box2d<int> ext0(0,0,dst.width(),dst.height());
box2d<int> ext1(x0_,y0_,x0_+src.width(),y0_+src.height());
if (ext0.intersects(ext1))
{
box2d<int> box = ext0.intersect(ext1);
for (std::size_t y = box.miny(); y < box.maxy(); ++y)
{
pixel_type* row_to = dst.get_row(y);
pixel_type const * row_from = src.get_row(y-y0_);
for (std::size_t x = box.minx(); x < box.maxx(); ++x)
{
row_to[x] = row_from[x-x0_];
}
}
}
}
private:
image_any const& src_;
std::size_t x0_;
std::size_t y0_;
};
} // end detail ns
MAPNIK_DECL void set_rectangle(image_any & dst, image_any const& src, std::size_t x, std::size_t y)
{
util::apply_visitor(detail::visitor_set_rectangle(src, x, y), dst);
}
template <typename T>
MAPNIK_DECL void set_rectangle (T & dst, T const& src, std::size_t x, std::size_t y)
{
detail::visitor_set_rectangle visit(src, x, y);
visit(dst);
}
template MAPNIK_DECL void set_rectangle(image_rgba8 &, image_rgba8 const&, std::size_t, std::size_t);
template MAPNIK_DECL void set_rectangle(image_gray8 &, image_gray8 const&, std::size_t, std::size_t);
template MAPNIK_DECL void set_rectangle(image_gray8s &, image_gray8s const&, std::size_t, std::size_t);
template MAPNIK_DECL void set_rectangle(image_gray16 &, image_gray16 const&, std::size_t, std::size_t);
template MAPNIK_DECL void set_rectangle(image_gray16s &, image_gray16s const&, std::size_t, std::size_t);
template MAPNIK_DECL void set_rectangle(image_gray32 &, image_gray32 const&, std::size_t, std::size_t);
template MAPNIK_DECL void set_rectangle(image_gray32s &, image_gray32s const&, std::size_t, std::size_t);
template MAPNIK_DECL void set_rectangle(image_gray32f &, image_gray32f const&, std::size_t, std::size_t);
template MAPNIK_DECL void set_rectangle(image_gray64 &, image_gray64 const&, std::size_t, std::size_t);
template MAPNIK_DECL void set_rectangle(image_gray64s &, image_gray64s const&, std::size_t, std::size_t);
template MAPNIK_DECL void set_rectangle(image_gray64f &, image_gray64f const&, std::size_t, std::size_t);
namespace detail
{