Mercurial > hg > orthanc-stone
comparison Framework/Viewport/IViewport.h @ 1203:f3bb9a6dd949 broker
locking abstraction in IViewport
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 29 Nov 2019 21:22:21 +0100 |
parents | 5e164c629923 |
children | 6009c59d8676 |
comparison
equal
deleted
inserted
replaced
1200:54cbffabdc45 | 1203:f3bb9a6dd949 |
---|---|
27 namespace OrthancStone | 27 namespace OrthancStone |
28 { | 28 { |
29 /** | 29 /** |
30 * Class that combines a Scene2D with a canvas where to draw the | 30 * Class that combines a Scene2D with a canvas where to draw the |
31 * scene. A call to "Refresh()" will update the content of the | 31 * scene. A call to "Refresh()" will update the content of the |
32 * canvas. | 32 * canvas. A "IViewport" can possibly be accessed from several |
33 * threads depending on the rendering back-end (e.g. in SDL or Qt): | |
34 * The "ILock" subclass implements the locking mechanism to modify | |
35 * the content of the scene. | |
36 * | |
37 * NB: The lock must be a "recursive_mutex", as the viewport | |
38 * controller can lock it a second time (TODO - Why so?). | |
33 **/ | 39 **/ |
34 class IViewport : public boost::noncopyable | 40 class IViewport : public boost::noncopyable |
35 { | 41 { |
36 public: | 42 public: |
43 class ILock : public boost::noncopyable | |
44 { | |
45 public: | |
46 virtual ~ILock() | |
47 { | |
48 } | |
49 | |
50 virtual Scene2D& GetScene() = 0; | |
51 | |
52 virtual ScenePoint2D GetPixelCenterCoordinates(int x, int y) = 0; | |
53 | |
54 virtual bool HasCompositor() const = 0; | |
55 | |
56 virtual ICompositor& GetCompositor() = 0; | |
57 }; | |
58 | |
37 virtual ~IViewport() | 59 virtual ~IViewport() |
38 { | 60 { |
39 } | 61 } |
40 | 62 |
41 virtual Scene2D& GetScene() = 0; | |
42 | |
43 virtual void Refresh() = 0; | 63 virtual void Refresh() = 0; |
44 | 64 |
45 virtual ScenePoint2D GetPixelCenterCoordinates(int x, int y) const = 0; | 65 virtual ILock* Lock() = 0; |
46 | |
47 virtual bool HasCompositor() const = 0; | |
48 | |
49 virtual ICompositor& GetCompositor() = 0; | |
50 | |
51 virtual const ICompositor& GetCompositor() const = 0; | |
52 }; | 66 }; |
53 } | 67 } |