blob: 14a06683b3b59a361c04754fdd55c1a7fabac43f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
PixelTimeRange = (function()
{
function PixelTimeRange(start_us, span_us, span_px)
{
this.Span_px = span_px;
this.Set(start_us, span_us);
}
PixelTimeRange.prototype.Set = function(start_us, span_us)
{
this.Start_us = start_us;
this.Span_us = span_us;
this.End_us = this.Start_us + span_us;
this.usPerPixel = this.Span_px / this.Span_us;
}
PixelTimeRange.prototype.SetStart = function(start_us)
{
this.Start_us = start_us;
this.End_us = start_us + this.Span_us;
}
PixelTimeRange.prototype.SetEnd = function(end_us)
{
this.End_us = end_us;
this.Start_us = end_us - this.Span_us;
}
PixelTimeRange.prototype.SetPixelSpan = function(span_px)
{
this.Span_px = span_px;
this.usPerPixel = this.Span_px / this.Span_us;
}
PixelTimeRange.prototype.PixelOffset = function(time_us)
{
return Math.floor((time_us - this.Start_us) * this.usPerPixel);
}
PixelTimeRange.prototype.PixelSize = function(time_us)
{
return Math.floor(time_us * this.usPerPixel);
}
PixelTimeRange.prototype.Clone = function()
{
return new PixelTimeRange(this.Start_us, this.Span_us, this.Span_px);
}
return PixelTimeRange;
})();
|