Introduced OrigSize for original size of textures

This commit is contained in:
Flamefire committed 2013-05-03 22:29:47 +02:00
1 parent 151fab8857
commit 5bbfd07e01
15 files changed
+206 -229

No files matched your search

+6 -6
View File
@@ -203,11 +203,11 @@ namespace VocaluxeLib.Menu
private bool _DrawTexture()
{
STexture texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
if (texture.Height > 0)
if (texture.OrigSize.Height > 1)
{
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect;
CHelper.SetRect(bounds, out rect, (float)texture.Width / texture.Height, EAspect.Crop);
CHelper.SetRect(bounds, out rect, texture.OrigAspect, EAspect.Crop);
CBase.Drawing.DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
return true;
@@ -218,11 +218,11 @@ namespace VocaluxeLib.Menu
private bool _DrawVideo()
{
STexture videoTexture = CBase.Theme.GetSkinVideoTexture(_Theme.VideoName, _PartyModeID);
if (videoTexture.Height > 0)
if (videoTexture.OrigSize.Height > 1)
{
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect;
CHelper.SetRect(bounds, out rect, (float)videoTexture.Width / videoTexture.Height, EAspect.Crop);
CHelper.SetRect(bounds, out rect, videoTexture.OrigAspect, EAspect.Crop);
CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
return true;
@@ -233,11 +233,11 @@ namespace VocaluxeLib.Menu
private bool _DrawBackgroundMusicVideo()
{
STexture videoTexture = CBase.BackgroundMusic.GetVideoTexture();
if (videoTexture.Height > 0)
if (videoTexture.OrigSize.Height > 1)
{
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect;
CHelper.SetRect(bounds, out rect, (float)videoTexture.Width / videoTexture.Height, EAspect.Crop);
CHelper.SetRect(bounds, out rect, videoTexture.OrigAspect, EAspect.Crop);
CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
return true;
+1 -1
View File
@@ -253,7 +253,7 @@ namespace VocaluxeLib.Menu
{
RectangleF bounds2 = new RectangleF(bounds.X, bounds.Y, bounds.W, bounds.H);
RectangleF rect2;
CHelper.SetRect(bounds2, out rect2, (float)texture.Width / texture.Height, aspect);
CHelper.SetRect(bounds2, out rect2, texture.OrigAspect, aspect);
rect.X = rect2.X;
rect.Y = rect2.Y;
+3 -3
View File
@@ -481,7 +481,7 @@ namespace VocaluxeLib.Menu.SingNotes
//Width of each of the ends (round parts)
//Need 2 of them so use minimum
float endsW = Math.Min(noteRect.H * noteBegin.Width / noteBegin.Height, noteRect.W / 2);
float endsW = Math.Min(noteRect.H * noteBegin.OrigAspect, noteRect.W / 2);
CBase.Drawing.DrawTexture(noteBegin, new SRectF(noteRect.X, noteRect.Y, endsW, noteRect.H, noteRect.Z), color);
@@ -526,7 +526,7 @@ namespace VocaluxeLib.Menu.SingNotes
STexture noteBackgroundMiddle = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundMiddleName, _PartyModeID);
STexture noteBackgroundEnd = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundRightName, _PartyModeID);
float dx = noteBackgroundBegin.Width * r.H / noteBackgroundBegin.Height;
float dx = r.H * noteBackgroundBegin.OrigAspect;
if (2 * dx > r.W)
dx = r.W / 2;
@@ -618,7 +618,7 @@ namespace VocaluxeLib.Menu.SingNotes
);
STexture noteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID);
float dx = noteBegin.Width * r.H / noteBegin.Height;
float dx = r.H * noteBegin.OrigAspect;
if (2 * dx > r.W)
dx = r.W / 2;
@@ -459,7 +459,7 @@ namespace VocaluxeLib.Menu.SongMenu
_CoverBig.Draw(1f, EAspect.Crop);
RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H);
RectangleF rect;
CHelper.SetRect(bounds, out rect, (float)_Vidtex.Width / _Vidtex.Height, EAspect.Crop);
CHelper.SetRect(bounds, out rect, _Vidtex.OrigAspect, 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);
+27 -12
View File
@@ -108,32 +108,47 @@ namespace VocaluxeLib.Menu
public string TexturePath;
public int Width;
public int Height;
/// <summary>
/// Original size (e.g. of bmp)
/// </summary>
public readonly Size OrigSize;
public float OrigAspect
{
get { return (float)OrigSize.Width / OrigSize.Height; }
}
/// <summary>
/// Current size when drawn
/// </summary>
public SRectF Rect;
public int W2; //power of 2 width
public int H2; //power of 2 height
/// <summary>
/// Internal texture width (on device), a power of 2 if necessary
/// </summary>
public int W2;
/// <summary>
/// Internal texture height (on device), a power of 2 if necessary
/// </summary>
public int H2;
public float WidthRatio;
public float HeightRatio;
public SColorF Color;
public STexture(int index)
public STexture(int index, int origWidth = 1, int origHeight = 1)
{
Index = index;
PBO = 0;
ID = -1;
TexturePath = String.Empty;
Width = 1;
Height = 1;
Rect = new SRectF(0f, 0f, 1f, 1f, 0f);
OrigSize = new Size(origWidth, origHeight);
Rect = new SRectF(0f, 0f, origWidth, origHeight, 0f);
W2 = 1;
H2 = 1;
WidthRatio = 0.5f;
HeightRatio = 0.5f;
W2 = origWidth;
H2 = origHeight;
WidthRatio = 1;
HeightRatio = 1;
Color = new SColorF(1f, 1f, 1f, 1f);
}