aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/Ui/RenderingSurfaceInfo.cs
blob: 0b3d0a90901beeb1f4f596068aa91a112e45aecd (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
using Ryujinx.HLE.HOS.Services.SurfaceFlinger;
using System;

namespace Ryujinx.HLE.Ui
{
    /// <summary>
    /// Information about the indirect layer that is being drawn to.
    /// </summary>
    class RenderingSurfaceInfo : IEquatable<RenderingSurfaceInfo>
    {
        public ColorFormat ColorFormat { get; }
        public uint Width { get; }
        public uint Height { get; }
        public uint Pitch { get; }
        public uint Size { get; }

        public RenderingSurfaceInfo(ColorFormat colorFormat, uint width, uint height, uint pitch, uint size)
        {
            ColorFormat = colorFormat;
            Width = width;
            Height = height;
            Pitch = pitch;
            Size = size;
        }

        public bool Equals(RenderingSurfaceInfo other)
        {
            return ColorFormat == other.ColorFormat &&
                   Width == other.Width &&
                   Height == other.Height &&
                   Pitch == other.Pitch &&
                   Size == other.Size;
        }

        public override bool Equals(object obj)
        {
            return obj is RenderingSurfaceInfo info && Equals(info);
        }

        public override int GetHashCode()
        {
            return BitConverter.ToInt32(BitConverter.GetBytes(((ulong)ColorFormat) ^ Width ^ Height ^ Pitch ^ Size));
        }
    }
}