[chronojump] Encoder analyze instant uses Cairo rectangle on CairoUtil
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder analyze instant uses Cairo rectangle on CairoUtil
- Date: Fri, 14 Feb 2020 17:38:17 +0000 (UTC)
commit e746199ddea139146d7d80aaf24e5493dc35c53d
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Feb 14 18:37:34 2020 +0100
Encoder analyze instant uses Cairo rectangle on CairoUtil
src/gui/app1/encoder.cs | 66 ++++++-------------------------------------------
1 file changed, 7 insertions(+), 59 deletions(-)
---
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index eeeee3d7..27eeaccd 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -6536,65 +6536,13 @@ public partial class ChronoJumpWindow
if(drawingarea_encoder_analyze_cairo_pixbuf == null)
return;
- DrawingArea area = (DrawingArea) o;
- using (Cairo.Context g = Gdk.CairoHelper.Create (area.GdkWindow))
- {
- //add image
- Gdk.CairoHelper.SetSourcePixbuf (g, drawingarea_encoder_analyze_cairo_pixbuf, 0, 0);
- g.Paint();
-
- //add rectangle
- g.SetSourceRGBA(0.906, 0.745, 0.098, 1); //Chronojump yellow
-
- int xposa =
eai.GetVerticalLinePosition(Convert.ToInt32(hscale_encoder_analyze_a.Value));
- encoderAnalyzeInstantVerticalLine(g, xposa);
-
- if(checkbutton_encoder_analyze_b.Active) {
- int xposb =
eai.GetVerticalLinePosition(Convert.ToInt32(hscale_encoder_analyze_b.Value));
-
- if(xposb != xposa) {
- //draw b vertical line
- encoderAnalyzeInstantVerticalLine(g, xposb);
-
- g.SetSourceRGBA(0.906, 0.745, 0.098, .5); //Chronojump yellow, half
transp
-
- //create rectangle
- int min = Math.Min(xposa, xposb) +1;
- int max = Math.Max(xposa, xposb) -1;
- if(min < max)
- {
- g.Rectangle(min ,9 , max-min,
drawingarea_encoder_analyze_cairo_pixbuf.Height -18);
- g.Fill();
- }
- }
- }
-
- g.Stroke();
-
- g.GetTarget ().Dispose ();
- }
- }
-
- private void encoderAnalyzeInstantVerticalLine(Cairo.Context g, int x)
- {
- //vertical line
- g.MoveTo(x, 9);
- g.LineTo(x, drawingarea_encoder_analyze_cairo_pixbuf.Height);
- g.Stroke();
-
- //top triangle
- g.MoveTo(x -4, 0);
- g.LineTo(x , 8);
- g.LineTo(x +4, 0);
- g.LineTo(x -4, 0);
- g.Fill();
-
- /*
- //bottom triangle currently not drawn because bottom space changes and half of triangle is
not shown
- g.MoveTo(x -4, drawingarea_encoder_analyze_cairo_pixbuf.Height);
- g.LineTo(x , drawingarea_encoder_analyze_cairo_pixbuf.Height -8);
- g.LineTo(x +4, drawingarea_encoder_analyze_cairo_pixbuf.Height);
- */
+ if(eai != null)
+ CairoUtil.PaintVerticalLinesAndRectangleOnSurface (
+ (DrawingArea) o,
+
eai.GetVerticalLinePosition(Convert.ToInt32(hscale_encoder_analyze_a.Value)),
+
eai.GetVerticalLinePosition(Convert.ToInt32(hscale_encoder_analyze_b.Value)),
+ checkbutton_encoder_analyze_b.Active,
+ drawingarea_encoder_analyze_cairo_pixbuf);
}
// -------------- end of drawingarea_encoder_analyze_instant
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]