aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.GAL/Extents2D.cs
blob: bac44f83a121074e0b3e244ec35c1adf9bd4eeb9 (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
using Ryujinx.Common;

namespace Ryujinx.Graphics.GAL
{
    public readonly struct Extents2D
    {
        public int X1 { get; }
        public int Y1 { get; }
        public int X2 { get; }
        public int Y2 { get; }

        public Extents2D(int x1, int y1, int x2, int y2)
        {
            X1 = x1;
            Y1 = y1;
            X2 = x2;
            Y2 = y2;
        }

        public Extents2D Reduce(int level)
        {
            int div = 1 << level;
            
            return new Extents2D(
                X1 >> level, 
                Y1 >> level,
                BitUtils.DivRoundUp(X2, div),
                BitUtils.DivRoundUp(Y2, div));
        }
    }
}