comparison Framework/Viewport/ViewportBase.cpp @ 1053:32b403a47b19

simplifying IViewport
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 10 Oct 2019 15:24:48 +0200
parents 0aff28f15ea2
children af456106576c
comparison
equal deleted inserted replaced
1052:0cc62db7e61b 1053:32b403a47b19
43 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); 43 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer);
44 } 44 }
45 } 45 }
46 46
47 47
48 ScenePoint2D ViewportBase::GetPixelCenterCoordinates(int x, int y) const 48 ScenePoint2D ViewportBase::GetPixelCenterCoordinates(int x, int y)
49 { 49 {
50 return ScenePoint2D( 50 if (HasCompositor())
51 static_cast<double>(x) + 0.5 - static_cast<double>(GetCanvasWidth()) / 2.0, 51 {
52 static_cast<double>(y) + 0.5 - static_cast<double>(GetCanvasHeight()) / 2.0); 52 const ICompositor& compositor = GetCompositor();
53 return ScenePoint2D(
54 static_cast<double>(x) + 0.5 - static_cast<double>(compositor.GetCanvasWidth()) / 2.0,
55 static_cast<double>(y) + 0.5 - static_cast<double>(compositor.GetCanvasHeight()) / 2.0);
56 }
57 else
58 {
59 return ScenePoint2D(0, 0);
60 }
53 } 61 }
54 } 62 }