notify rec_loop on draw_commit
This commit is contained in:
@@ -431,6 +431,7 @@ void Canvas::stroke_draw()
|
||||
{
|
||||
if (!(m_current_stroke && m_current_stroke->has_sample()))
|
||||
{
|
||||
stroke_commit_timelapse();
|
||||
//stroke_draw_mix({ 0,0 }, { m_mixer.getWidth(), m_mixer.getHeight() });
|
||||
return;
|
||||
}
|
||||
@@ -741,7 +742,6 @@ void Canvas::stroke_commit()
|
||||
|
||||
m_dirty = false;
|
||||
m_dirty_stroke = true; // new stroke ready for timelapse capture
|
||||
m_disrty_stroke_time = std::chrono::steady_clock::now();
|
||||
App::I->redraw = true;
|
||||
|
||||
// save viewport and clear color states
|
||||
@@ -923,6 +923,25 @@ void Canvas::stroke_commit()
|
||||
action->m_canvas = this;
|
||||
//action->m_stroke = std::move(m_current_stroke);
|
||||
ActionManager::add(action);
|
||||
stroke_commit_timelapse();
|
||||
}
|
||||
|
||||
void Canvas::stroke_commit_timelapse()
|
||||
{
|
||||
if (m_encoder)
|
||||
{
|
||||
auto t_now = std::chrono::high_resolution_clock::now();
|
||||
float dt = std::chrono::duration<float>(t_now - m_disrty_stroke_time).count();
|
||||
if (dt > 2.f && m_dirty_stroke && App::I->rec_mutex.try_lock())
|
||||
{
|
||||
draw_merge(true);
|
||||
App::I->rec_mutex.unlock();
|
||||
App::I->rec_cv.notify_one();
|
||||
LOG("rec frame generated");
|
||||
m_dirty_stroke = false;
|
||||
m_disrty_stroke_time = std::chrono::steady_clock::now();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Canvas::draw_merge(bool draw_checkerboard, std::array<bool, 6> faces /*= SIXPLETTE(false)*/)
|
||||
@@ -1162,7 +1181,6 @@ void Canvas::draw_merge(bool draw_checkerboard, std::array<bool, 6> faces /*= SI
|
||||
|
||||
m_layers_merge.rtt(plane_index).unbindFramebuffer();
|
||||
}
|
||||
draw_merge(true);
|
||||
}
|
||||
|
||||
void Canvas::stroke_update(glm::vec3 point, float pressure)
|
||||
|
||||
Reference in New Issue
Block a user