#include "Rasterizer.h"

#include "DrawingSurface.h"
#include "DrawingContext.h"
#include "Grid.h"

Rasterizer::Rasterizer()
     : mGrid(std::make_unique<Grid>(Rectangle(Point(0, 0), Point(100, 100))))
{

}

void Rasterizer::Paint(DrawingSurface* surface, DrawingContext* context)
{
    const auto width = surface->GetWidth();
    const auto height = surface->GetHeight();
    mGrid->ResetBounds(Rectangle(Point(0, 0), Point(width, height)));

    for (unsigned idx=0; idx< context->GetNumItems(); idx++)
    {
        context->GetDrawable(idx)->Sample(mGrid.get());
    }

    surface->Paint(mGrid.get());
}
