Extents2D.cs 689 B

12345678910111213141516171819202122232425262728293031
  1. using Ryujinx.Common;
  2. namespace Ryujinx.Graphics.GAL
  3. {
  4. public readonly struct Extents2D
  5. {
  6. public int X1 { get; }
  7. public int Y1 { get; }
  8. public int X2 { get; }
  9. public int Y2 { get; }
  10. public Extents2D(int x1, int y1, int x2, int y2)
  11. {
  12. X1 = x1;
  13. Y1 = y1;
  14. X2 = x2;
  15. Y2 = y2;
  16. }
  17. public Extents2D Reduce(int level)
  18. {
  19. int div = 1 << level;
  20. return new Extents2D(
  21. X1 >> level,
  22. Y1 >> level,
  23. BitUtils.DivRoundUp(X2, div),
  24. BitUtils.DivRoundUp(Y2, div));
  25. }
  26. }
  27. }