Fixed EAspect.Letterbox
Removed "Vd" prefixes on IVideo functions
This commit is contained in:
1 parent
c89b9dc8be
commit
2018f3a16b
10 files changed
+101
-117
No files matched your search
@@ -206,8 +206,8 @@ namespace VocaluxeLib.Menu
|
||||
if (texture.Height > 0)
|
||||
{
|
||||
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
|
||||
RectangleF rect = new RectangleF(0f, 0f, texture.Width, texture.Height);
|
||||
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
|
||||
RectangleF rect;
|
||||
CHelper.SetRect(bounds, out rect, texture.Width / texture.Height, EAspect.Crop);
|
||||
|
||||
CBase.Drawing.DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
|
||||
return true;
|
||||
@@ -221,8 +221,8 @@ namespace VocaluxeLib.Menu
|
||||
if (videoTexture.Height > 0)
|
||||
{
|
||||
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
|
||||
RectangleF rect = new RectangleF(0f, 0f, videoTexture.Width, videoTexture.Height);
|
||||
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
|
||||
RectangleF rect;
|
||||
CHelper.SetRect(bounds, out rect, videoTexture.Width / videoTexture.Height, EAspect.Crop);
|
||||
|
||||
CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
|
||||
return true;
|
||||
@@ -236,8 +236,8 @@ namespace VocaluxeLib.Menu
|
||||
if (videoTexture.Height > 0)
|
||||
{
|
||||
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
|
||||
RectangleF rect = new RectangleF(0f, 0f, videoTexture.Width, videoTexture.Height);
|
||||
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
|
||||
RectangleF rect;
|
||||
CHelper.SetRect(bounds, out rect, videoTexture.Width / videoTexture.Height, EAspect.Crop);
|
||||
|
||||
CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
|
||||
return true;
|
||||
|
||||
+18
-21
@@ -91,9 +91,9 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public static void SetRect(RectangleF bounds, out RectangleF rect, float rectAspect, EAspect aspect)
|
||||
{
|
||||
float rW = bounds.Right - bounds.Left;
|
||||
float rH = bounds.Bottom - bounds.Top;
|
||||
float rA = rW / rH;
|
||||
float boundsW = bounds.Width;
|
||||
float boundsH = bounds.Height;
|
||||
float boundsAspect = boundsW / boundsH;
|
||||
|
||||
float scaledWidth;
|
||||
float scaledHeight;
|
||||
@@ -101,42 +101,39 @@ namespace VocaluxeLib.Menu
|
||||
switch (aspect)
|
||||
{
|
||||
case EAspect.Crop:
|
||||
if (rA >= rectAspect)
|
||||
if (boundsAspect >= rectAspect)
|
||||
{
|
||||
scaledWidth = rW;
|
||||
scaledHeight = rH * rA / rectAspect;
|
||||
scaledWidth = boundsW;
|
||||
scaledHeight = boundsW / rectAspect;
|
||||
}
|
||||
else
|
||||
{
|
||||
scaledHeight = rH;
|
||||
scaledWidth = rW * rectAspect / rA;
|
||||
scaledHeight = boundsH;
|
||||
scaledWidth = boundsH * rectAspect;
|
||||
}
|
||||
break;
|
||||
case EAspect.LetterBox:
|
||||
if (rectAspect >= 1)
|
||||
if (boundsAspect <= rectAspect)
|
||||
{
|
||||
scaledWidth = rW;
|
||||
scaledHeight = rH * rA / rectAspect;
|
||||
scaledWidth = boundsW;
|
||||
scaledHeight = boundsW / rectAspect;
|
||||
}
|
||||
else
|
||||
{
|
||||
scaledHeight = rH;
|
||||
scaledWidth = rW * rectAspect / rA;
|
||||
scaledHeight = boundsH;
|
||||
scaledWidth = boundsH * rectAspect;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
scaledWidth = rW;
|
||||
scaledHeight = rH;
|
||||
scaledWidth = boundsW;
|
||||
scaledHeight = boundsH;
|
||||
break;
|
||||
}
|
||||
|
||||
float left = (rW - scaledWidth) / 2 + bounds.Left;
|
||||
float rigth = left + scaledWidth;
|
||||
float left = (boundsW - scaledWidth) / 2 + bounds.Left;
|
||||
float upper = (boundsH - scaledHeight) / 2 + bounds.Top;
|
||||
|
||||
float upper = (rH - scaledHeight) / 2 + bounds.Top;
|
||||
float lower = upper + scaledHeight;
|
||||
|
||||
rect = new RectangleF(left, upper, rigth - left, lower - upper);
|
||||
rect = new RectangleF(left, upper, scaledWidth, scaledHeight);
|
||||
}
|
||||
|
||||
public static List<string> ListFiles(string path, string cast, bool recursive = false, bool fullpath = false)
|
||||
|
||||
@@ -458,8 +458,8 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (_Vidtex.Color.A < 1)
|
||||
_CoverBig.Draw(1f, EAspect.Crop);
|
||||
RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H);
|
||||
RectangleF rect = new RectangleF(0f, 0f, _Vidtex.Width, _Vidtex.Height);
|
||||
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
|
||||
RectangleF rect;
|
||||
CHelper.SetRect(bounds, out rect, _Vidtex.Width / _Vidtex.Height, EAspect.Crop);
|
||||
SRectF vidRect = new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z);
|
||||
SRectF vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f);
|
||||
|
||||
|
||||
Reference in new issue
Block a user