srctree

Robin Linden parent f777b8c7 dfccc21f
render: Move the depth rendering into a debug namespace

inlinesplit
browser/gui/app.cpp added: 21, removed: 18, total 3
@@ -313,7 +313,7 @@ void App::clear_render_surface() {
 
void App::render_layout() {
if (layout_) {
render::render_layout(painter_, *layout_);
render::debug::render_layout_depth(painter_, *layout_);
}
}
 
 
render/render.cpp added: 21, removed: 18, total 3
@@ -15,17 +15,6 @@
#include <GL/gl.h>
 
namespace render {
namespace {
 
void render_layout_impl(gfx::IPainter &painter, layout::LayoutBox const &layout, int depth) {
auto color = static_cast<std::uint8_t>(255 / depth);
painter.fill_rect(layout.dimensions.content, {color, color, color});
for (auto const &child : layout.children) {
render_layout_impl(painter, child, depth + 1);
}
}
 
} // namespace
 
void render_setup(int width, int height) {
glMatrixMode(GL_PROJECTION);
@@ -36,8 +25,20 @@ void render_setup(int width, int height) {
glLoadIdentity();
}
 
void render_layout(gfx::IPainter &painter, layout::LayoutBox const &layout) {
render_layout_impl(painter, layout, 1);
namespace debug {
namespace {
void render_layout_depth_impl(gfx::IPainter &painter, layout::LayoutBox const &layout, int depth) {
auto color = static_cast<std::uint8_t>(255 / depth);
painter.fill_rect(layout.dimensions.content, {color, color, color});
for (auto const &child : layout.children) {
render_layout_depth_impl(painter, child, depth + 1);
}
}
} // namespace
 
void render_layout_depth(gfx::IPainter &painter, layout::LayoutBox const &layout) {
render_layout_depth_impl(painter, layout, 1);
}
 
} // namespace debug
} // namespace render
 
render/render.h added: 21, removed: 18, total 3
@@ -11,8 +11,10 @@
namespace render {
 
void render_setup(int width, int height);
void render_layout(gfx::IPainter &, layout::LayoutBox const &layout);
 
namespace debug {
void render_layout_depth(gfx::IPainter &, layout::LayoutBox const &);
} // namespace debug
} // namespace render
 
#endif