Canvas: container supports option to do fill & outline
This commit is contained in:
parent
55deb1261a
commit
5650d4f5bb
@ -46,6 +46,28 @@ Container::prepare_for_render (Rect const & area) const
|
||||
void
|
||||
Container::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
|
||||
{
|
||||
if (fill() || outline()) {
|
||||
|
||||
Rect bb (bounding_box());
|
||||
Rect self (item_to_window (bb, false));
|
||||
const Rect draw = self.intersection (area);
|
||||
|
||||
std::cerr << whoami() << " render bb " << bb << " self " << self << " area " << area << " draw " << draw << std::endl;
|
||||
|
||||
if (fill()) {
|
||||
setup_fill_context (context);
|
||||
context->rectangle (draw.x0, draw.y0, draw.width(), draw.height());
|
||||
context->fill_preserve ();
|
||||
}
|
||||
|
||||
if (outline()) {
|
||||
if (!fill()) {
|
||||
context->rectangle (draw.x0, draw.y0, draw.width(), draw.height());
|
||||
}
|
||||
setup_outline_context (context);
|
||||
context->stroke ();
|
||||
}
|
||||
}
|
||||
Item::render_children (area, context);
|
||||
}
|
||||
|
||||
@ -56,4 +78,3 @@ Container::compute_bounding_box () const
|
||||
add_child_bounding_boxes ();
|
||||
_bounding_box_dirty = false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user