Began proof-of-concept memory module.
[aesalon.git] / src / artisan / gviewport / Renderer.cpp
bloba45d332de6457fd536eee94cf902d0b34a69bc62
1 /** Aesalon, a tool to visualize program behaviour in real time.
2 Copyright (C) 2009-2011, Aesalon development team.
4 Aesalon is distributed under the terms of the GNU GPLv3. See
5 the included file LICENSE for more information.
7 @file src/artisan/gviewport/Renderer.cpp
8 */
10 #include <QThreadPool>
12 #include "artisan/gviewport/Renderer.h"
14 #include "artisan/gviewport/Object.h"
16 #include "util/MessageSystem.h"
18 namespace Artisan {
19 namespace GViewport {
21 Renderer::Renderer(const Rect &dataRange, const Rect &pixelRange, Data *data) : m_data(data) {
22 m_image = new RenderedImage(dataRange, pixelRange);
25 Renderer::~Renderer() {
29 void Renderer::enqueue() {
30 QThreadPool::globalInstance()->start(this);
33 void Renderer::run() {
34 m_data->startReading();
35 m_image->startPainting();
37 m_data->tree().search(m_image->dataRange().toTreeBound(), this);
39 m_image->stopPainting();
40 m_data->stopReading();
42 emit finishedRendering(m_image);
45 bool Renderer::process(const TreeType::Bound &bound, Object *value) {
46 value->renderOnto(*m_image);
47 return true;
50 } // namespace GViewport
51 } // namespace Artisan