[longomatch] Only redraw the timeline area that's in the clip region
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Only redraw the timeline area that's in the clip region
- Date: Wed, 24 Sep 2014 20:22:16 +0000 (UTC)
commit eff46505d20b6a07df8f308f84f16cc4ecd8b010
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Tue Sep 2 15:39:11 2014 +0200
Only redraw the timeline area that's in the clip region
LongoMatch.Drawing/CanvasObjects/TimelineObject.cs | 3 +-
LongoMatch.Drawing/Widgets/Timerule.cs | 24 +++++++++++++------
2 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/LongoMatch.Drawing/CanvasObjects/TimelineObject.cs
b/LongoMatch.Drawing/CanvasObjects/TimelineObject.cs
index a96e2fe..debb449 100644
--- a/LongoMatch.Drawing/CanvasObjects/TimelineObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/TimelineObject.cs
@@ -107,8 +107,7 @@ namespace LongoMatch.Drawing.CanvasObjects
tk.StrokeColor = background;
tk.LineWidth = 0;
- tk.DrawRectangle (new Point (0, OffsetY), Width,
- Height);
+ tk.DrawRectangle (new Point (area.Start.X, OffsetY), area.Width, Height);
}
public override void Draw (IDrawingToolkit tk, Area area)
diff --git a/LongoMatch.Drawing/Widgets/Timerule.cs b/LongoMatch.Drawing/Widgets/Timerule.cs
index e8ca0b4..c2b93d1 100644
--- a/LongoMatch.Drawing/Widgets/Timerule.cs
+++ b/LongoMatch.Drawing/Widgets/Timerule.cs
@@ -69,9 +69,8 @@ namespace LongoMatch.Drawing.Widgets
public override void Draw (IContext context, Area area)
{
- double height = widget.Height;
- double width = widget.Width;
- double tpos;
+ int startX, start, stop;
+ double tpos, height, width;
if (Duration == null) {
return;
@@ -83,6 +82,9 @@ namespace LongoMatch.Drawing.Widgets
needle = tk.CreateSurface (img.Width, img.Height, img);
}
+ height = widget.Height;
+ width = widget.Width;
+
tk.Context = context;
tk.Begin ();
tk.Clear (Config.Style.PaletteBackgroundDark);
@@ -92,19 +94,25 @@ namespace LongoMatch.Drawing.Widgets
tk.LineWidth = Constants.TIMELINE_LINE_WIDTH;
tk.FontSlant = FontSlant.Normal;
tk.FontSize = 12;
- tk.DrawLine (new Point (0, height), new Point (width, height));
-
+ tk.DrawLine (new Point (area.Start.X, height),
+ new Point (area.Start.X + area.Width, height));
+
+ startX = (int) (area.Start.X + Scroll);
+ start = (startX - (startX % TIME_SPACING)) + TIME_SPACING;
+ stop = (int) (startX + area.Width);
+
/* Draw big lines each 10 * secondsPerPixel */
- for (int i=0; i <= Duration.Seconds / SecondsPerPixel; i += TIME_SPACING) {
+ for (int i=start; i <= stop; i += TIME_SPACING) {
double pos = i - Scroll;
tk.DrawLine (new Point (pos, height),
new Point (pos, height - BIG_LINE_HEIGHT));
tk.DrawText (new Point (pos - TEXT_WIDTH / 2, 0), TEXT_WIDTH, height -
BIG_LINE_HEIGHT - 4,
new Time { Seconds = (int) (i * SecondsPerPixel)
}.ToSecondsString ());
}
-
+
+ start = (startX - (startX % (TIME_SPACING / 10))) + (TIME_SPACING/10);
/* Draw small lines each 1 * secondsPerPixel */
- for (int i=0; i<= Duration.Seconds / SecondsPerPixel; i+= TIME_SPACING / 10) {
+ for (int i=start; i<= stop; i+= TIME_SPACING / 10) {
double pos;
if (i % TIME_SPACING == 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]