Fixed wrong float.epsilon comparisons
This commit is contained in:
1 parent
cf39a4b107
commit
9d481cabc1
5 files changed
+10
-14
No files matched your search
@@ -732,7 +732,7 @@ namespace Vocaluxe.Lib.Draw
|
||||
/// <param name="texture">The texture in which the frame is copied to</param>
|
||||
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);
|
||||
texture = CopyScreen();
|
||||
|
||||
@@ -661,7 +661,7 @@ namespace Vocaluxe.Lib.Video
|
||||
|
||||
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);
|
||||
frame = CDraw.AddTexture(_Width, _Height, ref _FrameBuffer[num].Data);
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Vocaluxe.Lib.Video
|
||||
class CVideoDecoderGstreamer : IVideoDecoder
|
||||
{
|
||||
#region log
|
||||
public CGstreamerVideoWrapper.LogCallback Log;
|
||||
private CGstreamerVideoWrapper.LogCallback Log;
|
||||
|
||||
private void _LogHandler(string text)
|
||||
{
|
||||
@@ -121,7 +121,7 @@ namespace Vocaluxe.Lib.Video
|
||||
{
|
||||
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);
|
||||
frame = CDraw.AddTexture(width, height, ref data);
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Vocaluxe.Lib.Webcam
|
||||
{
|
||||
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);
|
||||
frame = CDraw.AddTexture(_Width, _Height, ref _Data);
|
||||
|
||||
@@ -499,17 +499,13 @@ namespace VocaluxeLib.Menu
|
||||
if (_Notes[jumpNote].Type == ENoteType.Freestyle)
|
||||
_Text.Style = EStyle.BoldItalic;
|
||||
|
||||
float diff = _Notes[jumpNote].EndBeat - _Notes[jumpNote].StartBeat;
|
||||
if (diff <= 0f)
|
||||
diff = 1f;
|
||||
int diff = _Notes[jumpNote].EndBeat - _Notes[jumpNote].StartBeat;
|
||||
if (diff <= 0)
|
||||
diff = 1;
|
||||
|
||||
float p = (currentBeat - _Notes[jumpNote].StartBeat) / diff;
|
||||
if (p > 1f)
|
||||
p = 1f;
|
||||
float p = 1f-(currentBeat - _Notes[jumpNote].StartBeat) / diff;
|
||||
|
||||
p = 1f - p;
|
||||
|
||||
if (Math.Abs(diff - 1) < float.Epsilon)
|
||||
if (Math.Abs(p) < float.Epsilon)
|
||||
_Text.Draw();
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user