Reusing unified polygons from statistics

This commit is contained in:
tamasmeszaros 2019-03-26 18:51:27 +01:00
parent 34094bf1b8
commit 95b0467c85
5 changed files with 80 additions and 89 deletions

View file

@ -1,5 +1,5 @@
#include "Rasterizer.hpp"
#include <ExPolygon.hpp>
#include <Polygon.hpp>
#include <cstdint>
@ -72,22 +72,16 @@ public:
clear();
}
void draw(const ExPolygon &poly) {
void draw(const Polygon &poly) {
agg::rasterizer_scanline_aa<> ras;
agg::scanline_p8 scanlines;
auto&& path = to_path(poly.contour);
auto&& path = to_path(poly);
if(m_o == Origin::TOP_LEFT) flipy(path);
ras.add_path(path);
for(auto h : poly.holes) {
auto&& holepath = to_path(h);
if(m_o == Origin::TOP_LEFT) flipy(holepath);
ras.add_path(holepath);
}
agg::render_scanlines(ras, scanlines, m_renderer);
}
@ -169,7 +163,7 @@ void Raster::clear()
m_impl->clear();
}
void Raster::draw(const ExPolygon &poly)
void Raster::draw(const Polygon &poly)
{
assert(m_impl);
m_impl->draw(poly);