BugFix deep update views (depth and layout) and crop.

This commit is contained in:
brunoherbelin
2020-12-08 23:04:12 +01:00
parent 1677582034
commit b7a54d0512
8 changed files with 28 additions and 30 deletions

View File

@@ -86,13 +86,15 @@ void MediaSource::init()
// set the renderbuffer of the source and attach rendering nodes
attach(renderbuffer);
// force update of activation mode
active_ = true;
// deep update to reorder
View::need_deep_update_++;
// done init
initialized_ = true;
Log::Info("Source '%s' linked to Media %s.", name().c_str(), std::to_string(mediaplayer_->id()).c_str());
// force update of activation mode
active_ = true;
touch();
}
}

View File

@@ -212,8 +212,11 @@ void Mixer::update()
transition_.update(dt_);
// deep update was performed
if (View::need_deep_update_ > 0)
if (View::need_deep_update_ > 0) {
Log::Info("View::need_deep_update_ %d", View::need_deep_update_);
View::need_deep_update_--;
}
}
void Mixer::draw()
@@ -439,8 +442,6 @@ void Mixer::attach(Source *s)
geometry_.scene.ws()->attach( s->group(View::GEOMETRY) );
layer_.scene.ws()->attach( s->group(View::LAYER) );
appearance_.scene.ws()->attach( s->group(View::APPEARANCE) );
// reorder
View::need_deep_update_++;
}
}
@@ -852,9 +853,6 @@ void Mixer::swap()
// transfer fading
session_->setFading( MAX(back_session_->fading(), session_->fading()), true );
// request complete update for views
View::need_deep_update_++;
// no current source
current_source_ = session_->end();
current_source_index_ = -1;

View File

@@ -182,7 +182,7 @@ void FrameBufferSurface::init()
Surface::init();
// set aspect ratio
scale_.x = frame_buffer_->aspectRatio();
// scale_.x = frame_buffer_->aspectRatio();
}

View File

@@ -108,8 +108,6 @@ SourceList::iterator Session::addSource(Source *s)
if (its == sources_.end()) {
// insert the source in the rendering
render_.scene.ws()->attach(s->group(View::RENDERING));
// reorder
View::need_deep_update_++;
// insert the source to the beginning of the list
sources_.push_front(s);
}
@@ -155,10 +153,8 @@ void Session::removeSource(Source *s)
SourceList::iterator its = find(s);
// ok, its in the list !
if (its != sources_.end()) {
// remove Node from the rendering scene
render_.scene.ws()->detach( s->group(View::RENDERING) );
// erase the source from the update list & get next element
sources_.erase(its);
}
@@ -176,10 +172,8 @@ Source *Session::popSource()
if (its != sources_.end())
{
s = *its;
// remove Node from the rendering scene
render_.scene.ws()->detach( s->group(View::RENDERING) );
// erase the source from the update list & get next element
sources_.erase(its);
}

View File

@@ -166,7 +166,6 @@ void SessionSource::init()
initialized_ = true;
Log::Info("New Session created.");
}
}
}
@@ -175,10 +174,8 @@ void SessionSource::init()
Node *loader = overlays_[View::TRANSITION]->back();
overlays_[View::TRANSITION]->detach(loader);
delete loader;
// deep update to reorder
View::need_deep_update_++;
session_->update(dt_);
}
}
@@ -256,9 +253,11 @@ void RenderSource::init()
// set the renderbuffer of the source and attach rendering nodes
attach(renderbuffer);
// deep update to reorder
View::need_deep_update_++;
// done init
initialized_ = true;
Log::Info("Source Render linked to session (%d x %d).", int(fb->resolution().x), int(fb->resolution().y) );
}
}

View File

@@ -369,10 +369,10 @@ void Source::attach(FrameBuffer *renderbuffer)
}
// make the source visible
if ( mode_ == UNINITIALIZED ) {
if ( mode_ == UNINITIALIZED )
setMode(VISIBLE);
}
// request update
need_update_ = true;
}
@@ -442,7 +442,7 @@ void Source::update(float dt)
// Mixing and layer icons scaled based on GEOMETRY crop
mixingsurface_->scale_ = groups_[View::GEOMETRY]->crop_;
mixingsurface_->scale_.x *= renderbuffer_->aspectRatio();
// mixingsurface_->update(0.f);
mixingsurface_->update(dt_);
// MODIFY depth based on LAYER node
groups_[View::MIXING]->translation_.z = groups_[View::LAYER]->translation_.z;
@@ -570,9 +570,11 @@ void CloneSource::init()
// set the renderbuffer of the source and attach rendering nodes
attach(renderbuffer);
// deep update to reorder
View::need_deep_update_++;
// done init
initialized_ = true;
Log::Info("Source %s cloning source %s.", name().c_str(), origin_->name().c_str() );
}
}

View File

@@ -80,13 +80,15 @@ void StreamSource::init()
// set the renderbuffer of the source and attach rendering nodes
attach(renderbuffer);
// done init
initialized_ = true;
Log::Info("Source '%s' linked to Stream %s", name().c_str(), std::to_string(stream_->id()).c_str());
// deep update to reorder
View::need_deep_update_++;
// force update of activation mode
active_ = true;
touch();
// done init
initialized_ = true;
Log::Info("Source '%s' linked to Stream %s", name().c_str(), std::to_string(stream_->id()).c_str());
}
}

View File

@@ -1480,6 +1480,7 @@ float LayerView::setDepth(Source *s, float d)
// request reordering of scene at next update
View::need_deep_update_++;
// request update of source
s->touch();
return sourceNode->translation_.z;
@@ -2117,7 +2118,7 @@ void AppearanceView::adjustBackground()
// update rendering frame to match edit source AR
image_original_width = edit_source_->frame()->aspectRatio();
surfacepreview->setTextureIndex( edit_source_->frame()->texture() );
surfacepreview->scale_ = edit_source_->mixingsurface_->scale_;
// surfacepreview->scale_ = edit_source_->mixingsurface_->scale_;
// surfacepreview->scale_.x = image_original_width;
// image_crop_area.x *= image_original_width;