aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Core/OsHle/Services/Vi
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-03-04 20:32:18 -0300
committergdkchan <gab.dark.100@gmail.com>2018-03-04 20:32:18 -0300
commit344fc8a55de471121d3f600cca9e95315d0e502f (patch)
tree60f13e524c071d4c7592022674868aa7b216b9bd /Ryujinx.Core/OsHle/Services/Vi
parent3edb66f389ac279bdcde26c5682aa39b9bf5f853 (diff)
Try fixing NvFlinger rotation with scaling, return correct error code on WaitSignal timeout, always display window at the center of the screen
Diffstat (limited to 'Ryujinx.Core/OsHle/Services/Vi')
-rw-r--r--Ryujinx.Core/OsHle/Services/Vi/NvFlinger.cs38
1 files changed, 22 insertions, 16 deletions
diff --git a/Ryujinx.Core/OsHle/Services/Vi/NvFlinger.cs b/Ryujinx.Core/OsHle/Services/Vi/NvFlinger.cs
index b745867e..4b5f9819 100644
--- a/Ryujinx.Core/OsHle/Services/Vi/NvFlinger.cs
+++ b/Ryujinx.Core/OsHle/Services/Vi/NvFlinger.cs
@@ -278,38 +278,44 @@ namespace Ryujinx.Core.OsHle.IpcServices.Android
int RealWidth = FbWidth;
int RealHeight = FbHeight;
+ float XSign = BufferQueue[Slot].Transform.HasFlag(HalTransform.FlipX) ? -1 : 1;
+ float YSign = BufferQueue[Slot].Transform.HasFlag(HalTransform.FlipY) ? -1 : 1;
+
float ScaleX = 1;
float ScaleY = 1;
+
float OffsX = 0;
float OffsY = 0;
if (Crop.Right != 0 &&
Crop.Bottom != 0)
{
+ //Who knows if this is right, I was never good with math...
RealWidth = Crop.Right - Crop.Left;
RealHeight = Crop.Bottom - Crop.Top;
- ScaleX = (float)FbWidth / RealWidth;
- ScaleY = (float)FbHeight / RealHeight;
+ if (BufferQueue[Slot].Transform.HasFlag(HalTransform.Rotate90))
+ {
+ ScaleY = (float)FbHeight / RealHeight;
+ ScaleX = (float)FbWidth / RealWidth;
- OffsX = -(float)Crop.Left / Crop.Right;
- OffsY = -(float)Crop.Top / Crop.Bottom;
+ OffsY = ((-(float)Crop.Left / Crop.Right) + ScaleX - 1) * -XSign;
+ OffsX = ((-(float)Crop.Top / Crop.Bottom) + ScaleY - 1) * -YSign;
+ }
+ else
+ {
+ ScaleX = (float)FbWidth / RealWidth;
+ ScaleY = (float)FbHeight / RealHeight;
- OffsX += ScaleX - 1;
- OffsY += ScaleY - 1;
+ OffsX = ((-(float)Crop.Left / Crop.Right) + ScaleX - 1) * XSign;
+ OffsY = ((-(float)Crop.Top / Crop.Bottom) + ScaleY - 1) * -YSign;
+ }
}
- float Rotate = 0;
-
- if (BufferQueue[Slot].Transform.HasFlag(HalTransform.FlipX))
- {
- ScaleX = -ScaleX;
- }
+ ScaleX *= XSign;
+ ScaleY *= YSign;
- if (BufferQueue[Slot].Transform.HasFlag(HalTransform.FlipY))
- {
- ScaleY = -ScaleY;
- }
+ float Rotate = 0;
if (BufferQueue[Slot].Transform.HasFlag(HalTransform.Rotate90))
{