Fixed wrong float.epsilon comparisons

This commit is contained in:
Flamefire committed 2013-04-23 15:14:47 +02:00
1 parent cf39a4b107
commit 9d481cabc1
5 files changed
+10 -14

No files matched your search

+1 -1
View File
@@ -732,7 +732,7 @@ namespace Vocaluxe.Lib.Draw
/// <param name="texture">The texture in which the frame is copied to</param> /// <param name="texture">The texture in which the frame is copied to</param>
public void CopyScreen(ref STexture texture) public void CopyScreen(ref STexture texture)
{ {
if (!_TextureExists(ref texture) || (Math.Abs(texture.Width - GetScreenWidth()) > float.Epsilon) || (Math.Abs(texture.Height - GetScreenHeight()) > float.Epsilon)) if (!_TextureExists(ref texture) || (int)texture.Width != GetScreenWidth() || (int)texture.Height != GetScreenHeight())
{ {
RemoveTexture(ref texture); RemoveTexture(ref texture);
texture = CopyScreen(); texture = CopyScreen();
+1 -1
View File
@@ -661,7 +661,7 @@ namespace Vocaluxe.Lib.Video
if (num >= 0) if (num >= 0)
{ {
if (frame.Index == -1 || Math.Abs(_Width - frame.Width) > float.Epsilon || Math.Abs(_Height - frame.Height) > float.Epsilon) if (frame.Index == -1 || _Width != (int) frame.Width || _Height != (int) frame.Height)
{ {
CDraw.RemoveTexture(ref frame); CDraw.RemoveTexture(ref frame);
frame = CDraw.AddTexture(_Width, _Height, ref _FrameBuffer[num].Data); frame = CDraw.AddTexture(_Width, _Height, ref _FrameBuffer[num].Data);
+2 -2
View File
@@ -27,7 +27,7 @@ namespace Vocaluxe.Lib.Video
class CVideoDecoderGstreamer : IVideoDecoder class CVideoDecoderGstreamer : IVideoDecoder
{ {
#region log #region log
public CGstreamerVideoWrapper.LogCallback Log; private CGstreamerVideoWrapper.LogCallback Log;
private void _LogHandler(string text) private void _LogHandler(string text)
{ {
@@ -121,7 +121,7 @@ namespace Vocaluxe.Lib.Video
{ {
if (data != null) if (data != null)
{ {
if (frame.Index == -1 || width != frame.Width || height != frame.Height || data.Length == 0) if (frame.Index == -1 || width != (int)frame.Width || height != (int)frame.Height || data.Length == 0)
{ {
CDraw.RemoveTexture(ref frame); CDraw.RemoveTexture(ref frame);
frame = CDraw.AddTexture(width, height, ref data); frame = CDraw.AddTexture(width, height, ref data);
+1 -1
View File
@@ -57,7 +57,7 @@ namespace Vocaluxe.Lib.Webcam
{ {
lock (_MutexData) lock (_MutexData)
{ {
if (frame.Index == -1 || Math.Abs(_Width - frame.Width) > float.Epsilon || Math.Abs(_Height - frame.Height) > float.Epsilon) if (frame.Index == -1 || _Width != (int) frame.Width || _Height != (int)frame.Height)
{ {
CDraw.RemoveTexture(ref frame); CDraw.RemoveTexture(ref frame);
frame = CDraw.AddTexture(_Width, _Height, ref _Data); frame = CDraw.AddTexture(_Width, _Height, ref _Data);
+5 -9
View File
@@ -499,17 +499,13 @@ namespace VocaluxeLib.Menu
if (_Notes[jumpNote].Type == ENoteType.Freestyle) if (_Notes[jumpNote].Type == ENoteType.Freestyle)
_Text.Style = EStyle.BoldItalic; _Text.Style = EStyle.BoldItalic;
float diff = _Notes[jumpNote].EndBeat - _Notes[jumpNote].StartBeat; int diff = _Notes[jumpNote].EndBeat - _Notes[jumpNote].StartBeat;
if (diff <= 0f) if (diff <= 0)
diff = 1f; diff = 1;
float p = (currentBeat - _Notes[jumpNote].StartBeat) / diff; float p = 1f-(currentBeat - _Notes[jumpNote].StartBeat) / diff;
if (p > 1f)
p = 1f;
p = 1f - p; if (Math.Abs(p) < float.Epsilon)
if (Math.Abs(diff - 1) < float.Epsilon)
_Text.Draw(); _Text.Draw();
else else
{ {