Skip to content

Commit 18e5625

Browse files
committed
Removed Id from CaptureZone
1 parent 946dafe commit 18e5625

File tree

3 files changed

+3
-28
lines changed

3 files changed

+3
-28
lines changed

ScreenCapture.NET/Generic/AbstractScreenCapture.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ public abstract class AbstractScreenCapture<TColor> : IScreenCapture
1010
#region Properties & Fields
1111

1212
private bool _isDisposed;
13-
private int _indexCounter = 0;
1413

1514
protected HashSet<CaptureZone<TColor>> CaptureZones { get; } = new();
1615

@@ -93,7 +92,7 @@ public virtual CaptureZone<TColor> RegisterCaptureZone(int x, int y, int width,
9392
int unscaledHeight = height;
9493
(width, height, downscaleLevel) = CalculateScaledSize(unscaledWidth, unscaledHeight, downscaleLevel);
9594

96-
CaptureZone<TColor> captureZone = new(_indexCounter++, Display, x, y, width, height, downscaleLevel, unscaledWidth, unscaledHeight);
95+
CaptureZone<TColor> captureZone = new(Display, x, y, width, height, downscaleLevel, unscaledWidth, unscaledHeight);
9796
CaptureZones.Add(captureZone);
9897

9998
return captureZone;

ScreenCapture.NET/Model/CaptureZone.cs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,8 @@ public sealed class CaptureZone<TColor> : ICaptureZone
1717

1818
private readonly object _lock = new();
1919

20-
/// <summary>
21-
/// Gets the unique id of this <see cref="CaptureZone{T}"/>.
22-
/// </summary>
23-
public int Id { get; }
24-
2520
public Display Display { get; }
26-
21+
2722
public ColorFormat ColorFormat
2823
{
2924
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -133,9 +128,8 @@ IImage ICaptureZone.Image
133128
/// <param name="unscaledWidth">The original width of the region.</param>
134129
/// <param name="unscaledHeight">The original height of the region</param>
135130
/// <param name="buffer">The buffer containing the image data.</param>
136-
internal CaptureZone(int id, Display display, int x, int y, int width, int height, int downscaleLevel, int unscaledWidth, int unscaledHeight)
131+
internal CaptureZone(Display display, int x, int y, int width, int height, int downscaleLevel, int unscaledWidth, int unscaledHeight)
137132
{
138-
this.Id = id;
139133
this.Display = display;
140134
this.X = x;
141135
this.Y = y;
@@ -195,19 +189,6 @@ internal void Resize(int width, int height, int downscaleLevel, int unscaledWidt
195189
InternalBuffer = new byte[newBufferSize];
196190
}
197191

198-
/// <summary>
199-
/// Determines whether this <see cref="CaptureZone{T}"/> equals the given one.
200-
/// </summary>
201-
/// <param name="other">The <see cref="CaptureZone{T}"/> to compare.</param>
202-
/// <returns><c>true</c> if the specified object is equal to the current object; otherwise, <c>false</c>.</returns>
203-
public bool Equals(CaptureZone<TColor> other) => Id == other.Id;
204-
205-
/// <inheritdoc />
206-
public override bool Equals(object? obj) => obj is CaptureZone<TColor> other && Equals(other);
207-
208-
/// <inheritdoc />
209-
public override int GetHashCode() => Id;
210-
211192
#endregion
212193

213194
private class UnlockDisposable : IDisposable

ScreenCapture.NET/Model/ICaptureZone.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ namespace ScreenCapture.NET;
44

55
public interface ICaptureZone
66
{
7-
/// <summary>
8-
/// Gets the unique id of this <see cref="ICaptureZone"/>.
9-
/// </summary>
10-
int Id { get; }
11-
127
Display Display { get; }
138
/// <summary>
149
/// Gets the x-location of the region on the screen.

0 commit comments

Comments
 (0)