Skip to content

Commit

Permalink
描画中に例外処理を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
yuto-trd committed Aug 28, 2023
1 parent dff60d2 commit 3448065
Showing 1 changed file with 43 additions and 25 deletions.
68 changes: 43 additions & 25 deletions src/Beutl.Engine/Rendering/Renderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,22 @@ public IRenderer.RenderResult RenderGraphics(TimeSpan timeSpan)
RenderThread.Dispatcher.VerifyAccess();
if (!IsGraphicsRendering)
{
IsGraphicsRendering = true;
_instanceClock.CurrentTime = timeSpan;
RenderScene.Clear();
using (_fpsText.StartRender(_immediateCanvas))
try
{
RenderGraphicsCore();
IsGraphicsRendering = true;
_instanceClock.CurrentTime = timeSpan;
RenderScene.Clear();
using (_fpsText.StartRender(_immediateCanvas))
{
RenderGraphicsCore();
}

return new IRenderer.RenderResult(_immediateCanvas.GetBitmap());
}
finally
{
IsGraphicsRendering = false;
}

IsGraphicsRendering = false;
return new IRenderer.RenderResult(_immediateCanvas.GetBitmap());
}
else
{
Expand All @@ -111,12 +117,18 @@ public IRenderer.RenderResult RenderAudio(TimeSpan timeSpan)
{
if (!IsAudioRendering)
{
IsAudioRendering = true;
_instanceClock.AudioStartTime = timeSpan;
RenderAudioCore();
try
{
IsAudioRendering = true;
_instanceClock.AudioStartTime = timeSpan;
RenderAudioCore();

IsAudioRendering = false;
return new IRenderer.RenderResult(Audio: _audio.GetPcm());
return new IRenderer.RenderResult(Audio: _audio.GetPcm());
}
finally
{
IsAudioRendering = false;
}
}
else
{
Expand All @@ -129,20 +141,26 @@ public IRenderer.RenderResult Render(TimeSpan timeSpan)
RenderThread.Dispatcher.VerifyAccess();
if (!IsGraphicsRendering && !IsAudioRendering)
{
IsGraphicsRendering = true;
IsAudioRendering = true;
_instanceClock.CurrentTime = timeSpan;
_instanceClock.AudioStartTime = timeSpan;
RenderScene.Clear();
using (_fpsText.StartRender(_immediateCanvas))
try
{
RenderGraphicsCore();
RenderAudioCore();
IsGraphicsRendering = true;
IsAudioRendering = true;
_instanceClock.CurrentTime = timeSpan;
_instanceClock.AudioStartTime = timeSpan;
RenderScene.Clear();
using (_fpsText.StartRender(_immediateCanvas))
{
RenderGraphicsCore();
RenderAudioCore();
}

return new IRenderer.RenderResult(_immediateCanvas.GetBitmap(), _audio.GetPcm());
}
finally
{
IsGraphicsRendering = false;
IsAudioRendering = false;
}

IsGraphicsRendering = false;
IsAudioRendering = false;
return new IRenderer.RenderResult(_immediateCanvas.GetBitmap(), _audio.GetPcm());
}
else
{
Expand Down

0 comments on commit 3448065

Please sign in to comment.