comparison 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
comparison
equal deleted inserted replaced
45:ecd96e563929 46:766d31dc5716
176 if (!started_ || 176 if (!started_ ||
177 centralWidget_.get() == NULL) 177 centralWidget_.get() == NULL)
178 { 178 {
179 return false; 179 return false;
180 } 180 }
181 181
182 if (backgroundChanged_) 182 Orthanc::ImageAccessor background = background_.GetAccessor();
183 { 183
184 Orthanc::ImageAccessor accessor = background_.GetAccessor(); 184 if (backgroundChanged_ &&
185 if (!centralWidget_->Render(accessor)) 185 !centralWidget_->Render(background))
186 { 186 {
187 return false; 187 return false;
188 } 188 }
189 } 189
190 190 if (background.GetWidth() != surface.GetWidth() ||
191 Orthanc::ImageProcessing::Copy(surface, background_.GetAccessor()); 191 background.GetHeight() != surface.GetHeight())
192 192 {
193 return false;
194 }
195
196 Orthanc::ImageProcessing::Convert(surface, background);
197
193 if (mouseTracker_.get() != NULL) 198 if (mouseTracker_.get() != NULL)
194 { 199 {
195 mouseTracker_->Render(surface); 200 mouseTracker_->Render(surface);
196 } 201 }
197 else if (isMouseOver_) 202 else if (isMouseOver_)
282 287
283 void WidgetViewport::MouseLeave() 288 void WidgetViewport::MouseLeave()
284 { 289 {
285 boost::mutex::scoped_lock lock(mutex_); 290 boost::mutex::scoped_lock lock(mutex_);
286 isMouseOver_ = false; 291 isMouseOver_ = false;
292
293 if (started_ &&
294 mouseTracker_.get() != NULL)
295 {
296 mouseTracker_->MouseUp();
297 mouseTracker_.reset(NULL);
298 }
299
287 observers_.NotifyChange(this); 300 observers_.NotifyChange(this);
288 } 301 }
289 302
290 303
291 void WidgetViewport::MouseWheel(MouseWheelDirection direction, 304 void WidgetViewport::MouseWheel(MouseWheelDirection direction,
317 mouseTracker_.get() == NULL) 330 mouseTracker_.get() == NULL)
318 { 331 {
319 centralWidget_->KeyPressed(key, modifiers); 332 centralWidget_->KeyPressed(key, modifiers);
320 } 333 }
321 } 334 }
335
336
337 bool WidgetViewport::HasUpdateContent()
338 {
339 boost::mutex::scoped_lock lock(mutex_);
340
341 if (centralWidget_.get() != NULL)
342 {
343 return centralWidget_->HasUpdateContent();
344 }
345 else
346 {
347 return false;
348 }
349 }
350
351
352 void WidgetViewport::UpdateContent()
353 {
354 boost::mutex::scoped_lock lock(mutex_);
355
356 if (centralWidget_.get() != NULL)
357 {
358 centralWidget_->UpdateContent();
359 }
360 }
322 } 361 }