Remove bounds from DrawTextureReflection because it was never used

This commit is contained in:
Flamefire committed 2014-09-22 15:55:31 +02:00
1 parent c9c907e3f0
commit f5f1a91481
11 files changed
+37 -77

No files matched your search

+2 -3
View File
@@ -403,12 +403,11 @@ namespace Vocaluxe.Base
/// <param name="textureRef"></param> /// <param name="textureRef"></param>
/// <param name="rect">(Original) rectangle to draw the reflection for</param> /// <param name="rect">(Original) rectangle to draw the reflection for</param>
/// <param name="color"></param> /// <param name="color"></param>
/// <param name="bounds"></param>
/// <param name="space">Spacing between the rect and the reflection</param> /// <param name="space">Spacing between the rect and the reflection</param>
/// <param name="height">Height of the reflection</param> /// <param name="height">Height of the reflection</param>
public static void DrawTextureReflection(CTextureRef textureRef, SRectF rect, SColorF color, SRectF bounds, float space, float height) public static void DrawTextureReflection(CTextureRef textureRef, SRectF rect, SColorF color, float space, float height)
{ {
_Draw.DrawTextureReflection(textureRef, rect, color, bounds, space, height); _Draw.DrawTextureReflection(textureRef, rect, color, space, height);
} }
} }
} }
+2 -2
View File
@@ -423,9 +423,9 @@ namespace Vocaluxe.Base
CDraw.DrawTexture(texture, rect, color, bounds, mirrored); CDraw.DrawTexture(texture, rect, color, bounds, mirrored);
} }
public void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float reflectionSpace, float reflectionHeight) public void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, float reflectionSpace, float reflectionHeight)
{ {
CDraw.DrawTextureReflection(texture, rect, color, bounds, reflectionSpace, reflectionHeight); CDraw.DrawTextureReflection(texture, rect, color, reflectionSpace, reflectionHeight);
} }
public CTextureRef AddTexture(string fileName) public CTextureRef AddTexture(string fileName)
+1 -1
View File
@@ -104,7 +104,7 @@ namespace Vocaluxe.Base.Fonts
CTextureRef texture; CTextureRef texture;
SRectF rect; SRectF rect;
GetOrAddGlyph(chr).GetTextureAndRect(x, y, z, out texture, out rect); GetOrAddGlyph(chr).GetTextureAndRect(x, y, z, out texture, out rect);
CDraw.DrawTextureReflection(texture, rect, color, rect, rspace, rheight); CDraw.DrawTextureReflection(texture, rect, color, rspace, rheight);
} }
public float GetWidth(char chr) public float GetWidth(char chr)
+13 -45
View File
@@ -568,7 +568,7 @@ namespace Vocaluxe.Lib.Draw
/// <param name="height">The height of the reflection</param> /// <param name="height">The height of the reflection</param>
public void DrawRectReflection(SColorF color, SRectF rect, float space, float height) public void DrawRectReflection(SColorF color, SRectF rect, float space, float height)
{ {
DrawTextureReflection(_BlankTexture, rect, color, rect, space, height); DrawTextureReflection(_BlankTexture, rect, color, space, height);
} }
#endregion Basic Draw Methods #endregion Basic Draw Methods
@@ -619,7 +619,7 @@ namespace Vocaluxe.Lib.Draw
//Calculate the position //Calculate the position
const float x1 = 0; const float x1 = 0;
float x2 = texture.WidthRatio; float x2 = texture.WidthRatio;
const float y1 = 0; float y1 = 0;
float y2 = texture.HeightRatio; float y2 = texture.HeightRatio;
//Calculate the size //Calculate the size
@@ -634,8 +634,9 @@ namespace Vocaluxe.Lib.Draw
if (mirrored) if (mirrored)
{ {
//y1 = -y1; float tmp = y2;
y2 = -y2; y2 = y1;
y1 = tmp;
} }
var vert = new STexturedColoredVertex[4]; var vert = new STexturedColoredVertex[4];
vert[0] = new STexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, y1), c.ToArgb()); vert[0] = new STexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, y1), c.ToArgb());
@@ -770,63 +771,30 @@ namespace Vocaluxe.Lib.Draw
/// <param name="textureRef">The texture of which a reflection should be drawn</param> /// <param name="textureRef">The texture of which a reflection should be drawn</param>
/// <param name="rect">A SRectF struct containing the destination coordinates</param> /// <param name="rect">A SRectF struct containing the destination coordinates</param>
/// <param name="color">A SColorF struct containing a color which the texture will be colored in</param> /// <param name="color">A SColorF struct containing a color which the texture will be colored in</param>
/// <param name="bounds">A SRectF struct containing which part of the texture should be drawn</param>
/// <param name="space">The space between the texture and the reflection</param> /// <param name="space">The space between the texture and the reflection</param>
/// <param name="height">The height of the reflection</param> /// <param name="height">The height of the reflection</param>
public void DrawTextureReflection(CTextureRef textureRef, SRectF rect, SColorF color, SRectF bounds, float space, float height) public void DrawTextureReflection(CTextureRef textureRef, SRectF rect, SColorF color, float space, float height)
{ {
CD3DTexture texture; CD3DTexture texture;
if (!_GetTexture(textureRef, out texture)) if (!_GetTexture(textureRef, out texture))
return; return;
if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(bounds.H) < float.Epsilon || Math.Abs(bounds.W) < float.Epsilon || if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(color.A) < float.Epsilon || height <= 0f)
Math.Abs(color.A) < float.Epsilon || height <= 0f)
return; return;
if (bounds.X > rect.X + rect.W || bounds.X + bounds.W < rect.X) if (height > rect.H)
return; height = rect.H;
if (bounds.Y > rect.Y + rect.H || bounds.Y + bounds.H < rect.Y)
return;
if (height > bounds.H)
height = bounds.H;
float x1 = (bounds.X - rect.X) / rect.W * texture.WidthRatio;
float x2 = (bounds.X + bounds.W - rect.X) / rect.W * texture.WidthRatio;
float y1 = (bounds.Y - rect.Y + rect.H - height) / rect.H * texture.HeightRatio;
float y2 = (bounds.Y + bounds.H - rect.Y) / rect.H * texture.HeightRatio;
if (x1 < 0)
x1 = 0f;
if (x2 > texture.WidthRatio)
x2 = texture.WidthRatio;
if (y1 < 0)
y1 = 0f;
if (y2 > texture.HeightRatio)
y2 = texture.HeightRatio;
const float x1 = 0;
float x2 = texture.WidthRatio;
float y1 = (rect.H - height) / rect.H * texture.HeightRatio;
float y2 = texture.HeightRatio;
float rx1 = rect.X; float rx1 = rect.X;
float rx2 = rect.X + rect.W; float rx2 = rect.X + rect.W;
float ry1 = rect.Y + rect.H + space; float ry1 = rect.Y + rect.H + space;
float ry2 = rect.Y + rect.H + space + height; float ry2 = rect.Y + rect.H + space + height;
if (rx1 < bounds.X)
rx1 = bounds.X;
if (rx2 > bounds.X + bounds.W)
rx2 = bounds.X + bounds.W;
if (ry1 < bounds.Y + space)
ry1 = bounds.Y + space;
if (ry2 > bounds.Y + bounds.H + space + height)
ry2 = bounds.Y + bounds.H + space + height;
//Align the pixels because Direct3D expects the pixels to be the left top corner //Align the pixels because Direct3D expects the pixels to be the left top corner
rx1 -= 0.5f; rx1 -= 0.5f;
ry1 -= 0.5f; ry1 -= 0.5f;
+1 -1
View File
@@ -434,7 +434,7 @@ namespace Vocaluxe.Lib.Draw
public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, float begin, float end) {} public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, float begin, float end) {}
public void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) {} public void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, float space, float height) {}
public int GetTextureCount() public int GetTextureCount()
{ {
+1 -1
View File
@@ -56,6 +56,6 @@ namespace Vocaluxe.Lib.Draw
void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false); void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false);
void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, float begin, float end); void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, float begin, float end);
void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float space, float height); void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, float space, float height);
} }
} }
+3 -4
View File
@@ -466,11 +466,10 @@ namespace Vocaluxe.Screens
background = _Background; background = _Background;
if (background != null) if (background != null)
{ {
var bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH); var bounds = new SRectF(0, 0, CSettings.RenderW, CSettings.RenderH, 0);
RectangleF rect; SRectF rect;
CHelper.SetRect(bounds, out rect, background.OrigAspect, aspect); CHelper.SetRect(bounds, out rect, background.OrigAspect, aspect);
CDraw.DrawTexture(background, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f), CDraw.DrawTexture(background, rect, background.Color);
background.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f));
} }
else if (_SlideShow != null) else if (_SlideShow != null)
_SlideShow.Draw(); _SlideShow.Draw();
+1 -1
View File
@@ -143,7 +143,7 @@ namespace VocaluxeLib
void DrawTexture(CTextureRef texture, SRectF rect); void DrawTexture(CTextureRef texture, SRectF rect);
void DrawTexture(CTextureRef texture, SRectF rect, SColorF color); void DrawTexture(CTextureRef texture, SRectF rect, SColorF color);
void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false); void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false);
void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float reflectionSpace, float reflectionHeight); void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, float reflectionSpace, float reflectionHeight);
CTextureRef AddTexture(string fileName); CTextureRef AddTexture(string fileName);
void RemoveTexture(ref CTextureRef texture); void RemoveTexture(ref CTextureRef texture);
+3 -3
View File
@@ -300,7 +300,7 @@ namespace VocaluxeLib.Menu
if (_Reflection) if (_Reflection)
{ {
CBase.Drawing.DrawTextureReflection(texture, Rect, Color, Rect, _ReflectionSpace, _ReflectionHeight); CBase.Drawing.DrawTextureReflection(texture, Rect, Color, _ReflectionSpace, _ReflectionHeight);
Text.DrawRelative(Rect.X, Rect.Y, _ReflectionHeight, _ReflectionSpace, Rect.H); Text.DrawRelative(Rect.X, Rect.Y, _ReflectionHeight, _ReflectionSpace, Rect.H);
} }
else else
@@ -314,7 +314,7 @@ namespace VocaluxeLib.Menu
if (_Reflection) if (_Reflection)
{ {
CBase.Drawing.DrawTextureReflection(texture, Rect, SelColor, Rect, _ReflectionSpace, _ReflectionHeight); CBase.Drawing.DrawTextureReflection(texture, Rect, SelColor, _ReflectionSpace, _ReflectionHeight);
Text.DrawRelative(Rect.X, Rect.Y, _ReflectionHeight, _ReflectionSpace, Rect.H); Text.DrawRelative(Rect.X, Rect.Y, _ReflectionHeight, _ReflectionSpace, Rect.H);
} }
else else
@@ -328,7 +328,7 @@ namespace VocaluxeLib.Menu
if (_Reflection) if (_Reflection)
{ {
CBase.Drawing.DrawTextureReflection(texture, Rect, SelColor, Rect, _ReflectionSpace, _ReflectionHeight); CBase.Drawing.DrawTextureReflection(texture, Rect, SelColor, _ReflectionSpace, _ReflectionHeight);
_SelText.DrawRelative(Rect.X, Rect.Y, _ReflectionHeight, _ReflectionSpace, Rect.H); _SelText.DrawRelative(Rect.X, Rect.Y, _ReflectionHeight, _ReflectionSpace, Rect.H);
} }
else else
+6 -9
View File
@@ -193,22 +193,19 @@ namespace VocaluxeLib.Menu
public void Draw(EAspect aspect, float scale = 1f, float zModify = 0f, bool forceDraw = false) public void Draw(EAspect aspect, float scale = 1f, float zModify = 0f, bool forceDraw = false)
{ {
CTextureRef texture = Texture; CTextureRef texture = Texture;
SRectF bounds = Rect.Scale(scale); SRectF rect = Rect.Scale(scale);
SRectF rect; rect.Z += zModify;
if (aspect != EAspect.Stretch && texture != null) if (texture != null)
CHelper.SetRect(bounds, out rect, texture.OrigAspect, aspect); CHelper.SetRect(rect, out rect, texture.OrigAspect, aspect);
else
rect = bounds;
rect.Z = Rect.Z + zModify;
var color = new SColorF(Color.R, Color.G, Color.B, Color.A * Alpha); var color = new SColorF(Color.R, Color.G, Color.B, Color.A * Alpha);
if (Visible || forceDraw || (CBase.Settings.GetProgramState() == EProgramState.EditTheme)) if (Visible || forceDraw || (CBase.Settings.GetProgramState() == EProgramState.EditTheme))
{ {
if (texture != null) if (texture != null)
{ {
CBase.Drawing.DrawTexture(texture, rect, color, bounds); CBase.Drawing.DrawTexture(texture, rect, color);
if (Reflection) if (Reflection)
CBase.Drawing.DrawTextureReflection(texture, rect, color, bounds, ReflectionSpace, ReflectionHeight); CBase.Drawing.DrawTextureReflection(texture, rect, color, ReflectionSpace, ReflectionHeight);
} }
else else
CBase.Drawing.DrawColor(color, rect); CBase.Drawing.DrawColor(color, rect);
@@ -473,14 +473,11 @@ namespace VocaluxeLib.Menu.SongMenu
{ {
if (vidtex.Color.A < 1) if (vidtex.Color.A < 1)
_CoverBig.Draw(EAspect.Crop); _CoverBig.Draw(EAspect.Crop);
var bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H); SRectF rect;
RectangleF rect; CHelper.SetRect(_CoverBig.Rect, out rect, vidtex.OrigAspect, EAspect.Crop);
CHelper.SetRect(bounds, out rect, vidtex.OrigAspect, EAspect.Crop);
var vidRect = new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z);
var vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f);
CBase.Drawing.DrawTexture(vidtex, vidRect, vidtex.Color, vidRectBounds); CBase.Drawing.DrawTexture(vidtex, rect);
CBase.Drawing.DrawTextureReflection(vidtex, vidRect, vidtex.Color, vidRectBounds, _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight); CBase.Drawing.DrawTextureReflection(vidtex, rect, vidtex.Color, _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight);
} }
else else
_CoverBig.Draw(EAspect.Crop); _CoverBig.Draw(EAspect.Crop);