Mercurial > hg > orthanc-stone
diff Framework/Viewport/WidgetViewport.cpp @ 46:766d31dc5716 wasm
removing threads for wasm
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 19 Apr 2017 14:33:06 +0200 |
parents | 7207a407bcd8 |
children | 25befef48c35 |
line wrap: on
line diff
--- a/Framework/Viewport/WidgetViewport.cpp Wed Apr 19 10:28:08 2017 +0200 +++ b/Framework/Viewport/WidgetViewport.cpp Wed Apr 19 14:33:06 2017 +0200 @@ -178,18 +178,23 @@ { return false; } + + Orthanc::ImageAccessor background = background_.GetAccessor(); - if (backgroundChanged_) + if (backgroundChanged_ && + !centralWidget_->Render(background)) { - Orthanc::ImageAccessor accessor = background_.GetAccessor(); - if (!centralWidget_->Render(accessor)) - { - return false; - } + return false; } - Orthanc::ImageProcessing::Copy(surface, background_.GetAccessor()); + if (background.GetWidth() != surface.GetWidth() || + background.GetHeight() != surface.GetHeight()) + { + return false; + } + Orthanc::ImageProcessing::Convert(surface, background); + if (mouseTracker_.get() != NULL) { mouseTracker_->Render(surface); @@ -284,6 +289,14 @@ { boost::mutex::scoped_lock lock(mutex_); isMouseOver_ = false; + + if (started_ && + mouseTracker_.get() != NULL) + { + mouseTracker_->MouseUp(); + mouseTracker_.reset(NULL); + } + observers_.NotifyChange(this); } @@ -319,4 +332,30 @@ centralWidget_->KeyPressed(key, modifiers); } } + + + bool WidgetViewport::HasUpdateContent() + { + boost::mutex::scoped_lock lock(mutex_); + + if (centralWidget_.get() != NULL) + { + return centralWidget_->HasUpdateContent(); + } + else + { + return false; + } + } + + + void WidgetViewport::UpdateContent() + { + boost::mutex::scoped_lock lock(mutex_); + + if (centralWidget_.get() != NULL) + { + centralWidget_->UpdateContent(); + } + } }