Pass Cairo context down to child elements instead of recreating it.

This commit is contained in:
Adam Reichold
2015-12-05 09:14:41 +01:00
parent 48f0225104
commit 333f9013dd
5 changed files with 7 additions and 13 deletions

View File

@@ -705,14 +705,13 @@ void FileBrowserEntry::updateCursor (int x, int y)
}
}
void FileBrowserEntry::draw ()
void FileBrowserEntry::draw (Cairo::RefPtr<Cairo::Context> cc)
{
ThumbBrowserEntryBase::draw ();
ThumbBrowserEntryBase::draw (cc);
if (state == SRotateSelecting) {
Cairo::RefPtr<Cairo::Context> cr = parent->getDrawingArea ()->get_window()->create_cairo_context();
drawStraightenGuide (cr);
drawStraightenGuide (cc);
}
}

View File

@@ -70,7 +70,7 @@ public:
FileBrowserEntry (Thumbnail* thm, const Glib::ustring& fname);
~FileBrowserEntry ();
void draw ();
void draw (Cairo::RefPtr<Cairo::Context> cc);
void setImageAreaToolListener (ImageAreaToolListener* l)
{

View File

@@ -917,7 +917,7 @@ bool ThumbBrowserBase::Internal::on_draw(const ::Cairo::RefPtr< Cairo::Context>
parent->fd[i]->updatepriority = false;
} else {
parent->fd[i]->updatepriority = true;
parent->fd[i]->draw ();
parent->fd[i]->draw (cr);
}
}
}

View File

@@ -467,7 +467,7 @@ void ThumbBrowserEntryBase::drawFrame (Cairo::RefPtr<Cairo::Context> cc, const G
}
}
void ThumbBrowserEntryBase::draw ()
void ThumbBrowserEntryBase::draw (Cairo::RefPtr<Cairo::Context> cc)
{
if (!drawable || !parent) {
@@ -490,11 +490,6 @@ void ThumbBrowserEntryBase::draw ()
updateBackBuffer ();
}
Gtk::Widget* w = parent->getDrawingArea ();
Glib::RefPtr<Gdk::Window> win = w->get_window();
Cairo::RefPtr<Cairo::Context> cc = win->create_cairo_context();
int w_ = startx + ofsX;
int h_ = starty + ofsY;
cc->set_source(backBuffer->getSurface(), w_, h_);

View File

@@ -119,7 +119,7 @@ public:
void updateBackBuffer ();
void resize (int h);
virtual void draw ();
virtual void draw (Cairo::RefPtr<Cairo::Context> cc);
void addButtonSet (LWButtonSet* bs);
int getMinimalHeight ()