Bugfix: Curve's bg and Histogram's bg wasn't cleaned upon refresh

This commit is contained in:
Hombre
2016-10-17 01:31:49 +02:00
parent bb9c184af7
commit 0c78885d25
3 changed files with 26 additions and 17 deletions

View File

@@ -956,7 +956,10 @@ SSEFUNCTION void HistogramArea::updateBackBuffer ()
Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surface);
const Glib::RefPtr<Gtk::StyleContext> style = get_style_context();
style->render_background(cr, 0, 0, surface->get_width(), surface->get_height());
cr->set_source_rgba (0., 0., 0., 0.);
cr->set_operator (Cairo::OPERATOR_CLEAR);
cr->paint ();
cr->set_operator (Cairo::OPERATOR_OVER);
if (valid) {
// For RAW mode use the other hists
@@ -1215,6 +1218,8 @@ bool HistogramArea::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr)
updateBackBuffer ();
}
Glib::RefPtr<Gtk::StyleContext> style = get_style_context();
style->render_background(cr, winx, winy, winw, winh);
copySurface(cr, NULL);
return true;

View File

@@ -210,9 +210,7 @@ void MyDiagonalCurve::draw (int handle)
return;
}
Glib::RefPtr<Gdk::Window > win = get_window();
if (!surfaceCreated() || !win) {
if (!surfaceCreated()) {
return;
}
@@ -232,7 +230,10 @@ void MyDiagonalCurve::draw (int handle)
cr->set_line_cap(Cairo::LINE_CAP_SQUARE);
// clear background
style->render_background(cr, 0., 0., double(getWidth()), double(getHeight()));
cr->set_source_rgba (0., 0., 0., 0.);
cr->set_operator (Cairo::OPERATOR_CLEAR);
cr->paint ();
cr->set_operator (Cairo::OPERATOR_OVER);
Gdk::RGBA c;
@@ -425,7 +426,7 @@ void MyDiagonalCurve::draw (int handle)
// first the background
int bWidth = CBAR_WIDTH;
BackBuffer *bb = this;
leftBar->setDrawRectangle(win, 1, graphY - graphH + 1, bWidth - 2, graphH - 2);
leftBar->setDrawRectangle(Cairo::FORMAT_ARGB32, 1, graphY - graphH + 1, bWidth - 2, graphH - 2);
leftBar->expose(bb);
// now the border
@@ -440,7 +441,7 @@ void MyDiagonalCurve::draw (int handle)
// first the background
int bWidth = CBAR_WIDTH;
BackBuffer *bb = this;
bottomBar->setDrawRectangle(win, graphX + 1, graphY + CBAR_MARGIN + 1, graphW - 2, bWidth - 2);
bottomBar->setDrawRectangle(Cairo::FORMAT_ARGB32, graphX + 1, graphY + CBAR_MARGIN + 1, graphW - 2, bWidth - 2);
bottomBar->expose(bb);
// now the border
@@ -497,13 +498,12 @@ void MyDiagonalCurve::draw (int handle)
bool MyDiagonalCurve::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr)
{
Glib::RefPtr<Gdk::Window> win = get_window();
Gtk::Allocation allocation = get_allocation();
allocation.set_x(0);
allocation.set_y(0);
// setDrawRectangle will allocate the backbuffer Surface
if (setDrawRectangle(win, allocation)) {
if (setDrawRectangle(Cairo::FORMAT_ARGB32, allocation)) {
setDirty(true);
if (prevGraphW > GRAPH_SIZE || graphW > GRAPH_SIZE) {
@@ -511,6 +511,8 @@ bool MyDiagonalCurve::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr)
}
}
Glib::RefPtr<Gtk::StyleContext> style = get_style_context();
style->render_background(cr, 0., 0., (double)get_width(), (double)get_height());
draw (lit_point);
copySurface(cr);
return false;

View File

@@ -116,9 +116,7 @@ void MyFlatCurve::draw ()
return;
}
Glib::RefPtr<Gdk::Window> win = get_window();
if (!surfaceCreated() || !win) {
if (!surfaceCreated()) {
return;
}
@@ -139,7 +137,10 @@ void MyFlatCurve::draw ()
cr->set_line_cap(Cairo::LINE_CAP_SQUARE);
// clear background
style->render_background(cr, 0., 0., double(getWidth()), double(getHeight()));
cr->set_source_rgba (0., 0., 0., 0.);
cr->set_operator (Cairo::OPERATOR_CLEAR);
cr->paint ();
cr->set_operator (Cairo::OPERATOR_OVER);
Gdk::RGBA c;
@@ -166,7 +167,7 @@ void MyFlatCurve::draw ()
// first the background
int bWidth = CBAR_WIDTH;
BackBuffer *bb = this;
leftBar->setDrawRectangle(win, 1, graphY - graphH + 1, bWidth - 2, graphH - 2);
leftBar->setDrawRectangle(Cairo::FORMAT_ARGB32, 1, graphY - graphH + 1, bWidth - 2, graphH - 2);
leftBar->expose(bb);
// now the border
@@ -181,7 +182,7 @@ void MyFlatCurve::draw ()
// first the background
int bWidth = CBAR_WIDTH;
BackBuffer *bb = this;
bottomBar->setDrawRectangle(win, graphX + 1, graphY + CBAR_MARGIN + 1, graphW - 2, bWidth - 2);
bottomBar->setDrawRectangle(Cairo::FORMAT_ARGB32, graphX + 1, graphY + CBAR_MARGIN + 1, graphW - 2, bWidth - 2);
bottomBar->expose(bb);
// now the border
@@ -501,13 +502,12 @@ void MyFlatCurve::draw ()
bool MyFlatCurve::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr)
{
Glib::RefPtr<Gdk::Window> win = get_window();
Gtk::Allocation allocation = get_allocation();
allocation.set_x(0);
allocation.set_y(0);
// setDrawRectangle will allocate the backbuffer Surface
if (setDrawRectangle(win, allocation)) {
if (setDrawRectangle(Cairo::FORMAT_ARGB32, allocation)) {
setDirty(true);
if (prevGraphW > GRAPH_SIZE || graphW > GRAPH_SIZE) {
@@ -515,6 +515,8 @@ bool MyFlatCurve::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr)
}
}
Glib::RefPtr<Gtk::StyleContext> style = get_style_context();
style->render_background(cr, 0., 0., (double)get_width(), (double)get_height());
draw ();
copySurface(cr);
return false;