mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 08:14:58 +01:00
minor code optimization for Rectangle::render()
This commit is contained in:
parent
9d99cc8b01
commit
5102d8fae1
2 changed files with 5 additions and 22 deletions
|
|
@ -87,10 +87,6 @@ public:
|
||||||
void set_outline_what (What);
|
void set_outline_what (What);
|
||||||
void set_outline_all () { set_outline_what (ArdourCanvas::Rectangle::ALL); }
|
void set_outline_all () { set_outline_what (ArdourCanvas::Rectangle::ALL); }
|
||||||
|
|
||||||
protected:
|
|
||||||
void render_self (Rect const &, Cairo::RefPtr<Cairo::Context>, Rect) const;
|
|
||||||
Rect get_self_for_render () const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Our rectangle; note that x0 may not always be less than x1
|
/** Our rectangle; note that x0 may not always be less than x1
|
||||||
* and likewise with y0 and y1.
|
* and likewise with y0 and y1.
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,8 @@ Rectangle::Rectangle (Item* parent, Rect const & rect)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect
|
void
|
||||||
Rectangle::get_self_for_render () const
|
Rectangle::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
|
||||||
{
|
{
|
||||||
/* In general, a Rectangle will have a _position of (0,0) within its
|
/* In general, a Rectangle will have a _position of (0,0) within its
|
||||||
parent, and its extent is actually defined by _rect. But in the
|
parent, and its extent is actually defined by _rect. But in the
|
||||||
|
|
@ -64,20 +64,13 @@ Rectangle::get_self_for_render () const
|
||||||
we should take that into account when rendering.
|
we should take that into account when rendering.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return item_to_window (_rect.translate (_position), false);
|
Rect self (item_to_window (_rect.translate (_position), false));
|
||||||
}
|
const Rect draw = self.intersection (area);
|
||||||
|
|
||||||
void
|
if (!draw) {
|
||||||
Rectangle::render_self (Rect const & area, Cairo::RefPtr<Cairo::Context> context, Rect self) const
|
|
||||||
{
|
|
||||||
Rect r = self.intersection (area);
|
|
||||||
|
|
||||||
if (!r) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect draw = r;
|
|
||||||
|
|
||||||
if (_fill && !_transparent) {
|
if (_fill && !_transparent) {
|
||||||
if (_stops.empty()) {
|
if (_stops.empty()) {
|
||||||
setup_fill_context (context);
|
setup_fill_context (context);
|
||||||
|
|
@ -142,12 +135,6 @@ Rectangle::render_self (Rect const & area, Cairo::RefPtr<Cairo::Context> context
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Rectangle::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
|
|
||||||
{
|
|
||||||
render_self (area, context, get_self_for_render ());
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Rectangle::compute_bounding_box () const
|
Rectangle::compute_bounding_box () const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue