blob: 3a32769998b4df880c1eda8149229d0d7df6d9a9 (
plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
// Copyright (c) 2017 Eric Mellino
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
namespace Vulkan {
/// <summary>
/// Structure specifying a two-dimensional extent.
/// </summary>
public partial struct VkExtent2D : IEquatable<VkExtent2D>
{
/// <summary>
/// An <see cref="VkExtent2D"/> with all of its components set to zero.
/// </summary>
public static readonly VkExtent2D Zero = new VkExtent2D(0, 0);
/// <summary>
/// Initializes a new instance of <see cref="VkExtent2D"/> structure.
/// </summary>
/// <param name="width">The width component of the extent.</param>
/// <param name="height">The height component of the extent.</param>
public VkExtent2D(uint width, uint height)
{
this.width = width;
this.height = height;
}
/// <summary>
/// Initializes a new instance of <see cref="VkExtent2D"/> structure.
/// </summary>
/// <param name="width">The width component of the extent.</param>
/// <param name="height">The height component of the extent.</param>
public VkExtent2D(int width, int height)
{
this.width = (uint)width;
this.height = (uint)height;
}
/// <summary>
/// Determines whether the specified <see cref="VkExtent2D"/> is equal to this instance.
/// </summary>
/// <param name="other">The <see cref="VkExtent2D"/> to compare with this instance.</param>
/// <returns>
/// <c>true</c> if the specified <see cref="VkExtent2D"/> is equal to this instance; otherwise, <c>false</c>.
/// </returns>
public bool Equals(ref VkExtent2D other)
{
return other.width == width && other.height == height;
}
/// <summary>
/// Determines whether the specified <see cref="VkExtent2D"/> is equal to this instance.
/// </summary>
/// <param name="other">The <see cref="VkExtent2D"/> to compare with this instance.</param>
/// <returns>
/// <c>true</c> if the specified <see cref="VkExtent2D"/> is equal to this instance; otherwise, <c>false</c>.
/// </returns>
public bool Equals(VkExtent2D other)
{
return Equals(ref other);
}
/// <summary>
/// Determines whether the specified <see cref="object"/> is equal to this instance.
/// </summary>
/// <param name="obj">The <see cref="object"/> to compare with this instance.</param>
/// <returns>
/// <c>true</c> if the specified <see cref="object"/> is equal to this instance; otherwise, <c>false</c>.
/// </returns>
public override bool Equals(object obj)
{
return obj is VkExtent2D && Equals((VkExtent2D)obj);
}
/// <summary>
/// Returns the hash code for this instance.
/// </summary>
/// <returns>The hash code.</returns>
public override int GetHashCode()
{
unchecked
{
int hashCode = width.GetHashCode();
hashCode = (hashCode * 397) ^ height.GetHashCode();
return hashCode;
}
}
/// <summary>
/// Returns a boolean indicating whether the two given extents are equal.
/// </summary>
/// <param name="left">The first extent to compare.</param>
/// <param name="right">The second extent to compare.</param>
/// <returns><c>true</c> if the extents are equal; <c>false</c> otherwise.</returns>
public static bool operator ==(VkExtent2D left, VkExtent2D right) => left.Equals(ref right);
/// <summary>
/// Returns a boolean indicating whether the two given extents are not equal.
/// </summary>
/// <param name="left">The first extent to compare.</param>
/// <param name="right">The second extent to compare.</param>
/// <returns>
/// <c>true</c> if the extents are not equal; <c>false</c> if they are equal.
/// </returns>
public static bool operator !=(VkExtent2D left, VkExtent2D right) => !left.Equals(ref right);
}
}
|