minor code optimization for Rectangle::render()
This commit is contained in:
parent
9d99cc8b01
commit
5102d8fae1
|
@ -87,10 +87,6 @@ public:
|
|||
void set_outline_what (What);
|
||||
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:
|
||||
/** Our rectangle; note that x0 may not always be less than x1
|
||||
* and likewise with y0 and y1.
|
||||
|
|
|
@ -55,8 +55,8 @@ Rectangle::Rectangle (Item* parent, Rect const & rect)
|
|||
{
|
||||
}
|
||||
|
||||
Rect
|
||||
Rectangle::get_self_for_render () const
|
||||
void
|
||||
Rectangle::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
|
||||
{
|
||||
/* 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
|
||||
|
@ -64,20 +64,13 @@ Rectangle::get_self_for_render () const
|
|||
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
|
||||
Rectangle::render_self (Rect const & area, Cairo::RefPtr<Cairo::Context> context, Rect self) const
|
||||
{
|
||||
Rect r = self.intersection (area);
|
||||
|
||||
if (!r) {
|
||||
if (!draw) {
|
||||
return;
|
||||
}
|
||||
|
||||
Rect draw = r;
|
||||
|
||||
if (_fill && !_transparent) {
|
||||
if (_stops.empty()) {
|
||||
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
|
||||
Rectangle::compute_bounding_box () const
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user