annotate Framework/Viewport/SdlViewport.h @ 1236:358461330978 broker

global function GetWebGLViewportsRegistry()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 09 Dec 2019 20:45:47 +0100
parents 5147277850cf
children 0ca50d275b9a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 #pragma once
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 #if !defined(ORTHANC_ENABLE_SDL)
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 # error Macro ORTHANC_ENABLE_SDL must be defined
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #endif
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #if ORTHANC_ENABLE_SDL != 1
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 # error SDL must be enabled to use this file
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #endif
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 #if !defined(ORTHANC_ENABLE_OPENGL)
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 # error The macro ORTHANC_ENABLE_OPENGL must be defined
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #endif
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #if ORTHANC_ENABLE_OPENGL != 1
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 # error Support for OpenGL is disabled
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #endif
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
1047
efc5b62b9539 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1045
diff changeset
39 #include "../OpenGL/SdlOpenGLContext.h"
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 #include "../Scene2D/OpenGLCompositor.h"
905
88bf49aebc13 introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents: 893
diff changeset
41 #include "../Scene2D/CairoCompositor.h"
1215
9efa66d8d3f8 removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1213
diff changeset
42 #include "IViewport.h"
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
1205
6009c59d8676 fix to sdl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1203
diff changeset
44 #include <SDL_events.h>
6009c59d8676 fix to sdl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1203
diff changeset
45
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 namespace OrthancStone
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 {
1215
9efa66d8d3f8 removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1213
diff changeset
48 class SdlViewport : public IViewport
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 {
1205
6009c59d8676 fix to sdl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1203
diff changeset
50 private:
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
51 boost::mutex mutex_;
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
52 uint32_t refreshEvent_;
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
53 boost::shared_ptr<ViewportController> controller_;
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
54 std::auto_ptr<ICompositor> compositor_;
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
55
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
56 void SendRefreshEvent();
1203
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
57
1205
6009c59d8676 fix to sdl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1203
diff changeset
58 protected:
1215
9efa66d8d3f8 removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1213
diff changeset
59 class SdlLock : public ILock
1203
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
60 {
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
61 private:
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
62 SdlViewport& that_;
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
63 boost::mutex::scoped_lock lock_;
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
64
1203
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
65 public:
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
66 SdlLock(SdlViewport& that) :
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
67 that_(that),
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
68 lock_(that.mutex_)
1203
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
69 {
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
70 }
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
71
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
72 virtual bool HasCompositor() const ORTHANC_OVERRIDE
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
73 {
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
74 return true;
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
75 }
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
76
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
77 virtual ICompositor& GetCompositor() ORTHANC_OVERRIDE;
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
78
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
79 virtual ViewportController& GetController() ORTHANC_OVERRIDE
1203
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
80 {
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
81 return *that_.controller_;
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
82 }
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
83
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
84 virtual void Invalidate() ORTHANC_OVERRIDE
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
85 {
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
86 that_.SendRefreshEvent();
1203
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
87 }
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
88 };
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
89
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
90 void ClearCompositor()
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
91 {
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
92 compositor_.reset();
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
93 }
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
94
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
95 void AcquireCompositor(ICompositor* compositor /* takes ownership */);
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
96
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 public:
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
98 SdlViewport();
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
100 bool IsRefreshEvent(const SDL_Event& event) const
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
101 {
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
102 return (event.type == refreshEvent_);
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
103 }
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
1203
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
105 virtual ILock* Lock() ORTHANC_OVERRIDE
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 {
1203
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
107 return new SdlLock(*this);
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 }
909
7a7e4e1f558f SdlCairo resizable
Alain Mazy <alain@mazy.be>
parents: 907
diff changeset
109
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
110 virtual void UpdateSize(unsigned int width,
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
111 unsigned int height) = 0;
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
112
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
113 virtual void ToggleMaximize() = 0;
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
114
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
115 // Must be invoked from the main SDL thread
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
116 virtual void Paint() = 0;
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
117 };
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
118
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
119
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
120 class SdlOpenGLViewport : public SdlViewport
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
121 {
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
122 private:
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
123 SdlOpenGLContext context_;
1205
6009c59d8676 fix to sdl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1203
diff changeset
124
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
125 public:
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
126 SdlOpenGLViewport(const char* title,
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
127 unsigned int width,
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
128 unsigned int height,
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
129 bool allowDpiScaling = true);
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
130
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
131 virtual ~SdlOpenGLViewport();
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
132
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
133 virtual void Paint() ORTHANC_OVERRIDE;
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
134
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
135 virtual void UpdateSize(unsigned int width,
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
136 unsigned int height) ORTHANC_OVERRIDE;
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
137
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
138 virtual void ToggleMaximize() ORTHANC_OVERRIDE;
905
88bf49aebc13 introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents: 893
diff changeset
139 };
88bf49aebc13 introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents: 893
diff changeset
140
88bf49aebc13 introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents: 893
diff changeset
141
88bf49aebc13 introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents: 893
diff changeset
142 class SdlCairoViewport : public SdlViewport
88bf49aebc13 introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents: 893
diff changeset
143 {
88bf49aebc13 introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents: 893
diff changeset
144 private:
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
145 SdlWindow window_;
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
146 SDL_Surface* sdlSurface_;
1203
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
147
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
148 void CreateSdlSurfaceFromCompositor(CairoCompositor& compositor);
1053
32b403a47b19 simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1047
diff changeset
149
905
88bf49aebc13 introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents: 893
diff changeset
150 public:
88bf49aebc13 introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents: 893
diff changeset
151 SdlCairoViewport(const char* title,
88bf49aebc13 introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents: 893
diff changeset
152 unsigned int width,
88bf49aebc13 introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents: 893
diff changeset
153 unsigned int height,
88bf49aebc13 introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents: 893
diff changeset
154 bool allowDpiScaling = true);
88bf49aebc13 introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents: 893
diff changeset
155
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
156 virtual ~SdlCairoViewport();
1205
6009c59d8676 fix to sdl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1203
diff changeset
157
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
158 virtual void Paint() ORTHANC_OVERRIDE;
905
88bf49aebc13 introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents: 893
diff changeset
159
909
7a7e4e1f558f SdlCairo resizable
Alain Mazy <alain@mazy.be>
parents: 907
diff changeset
160 virtual void UpdateSize(unsigned int width,
942
685c9a2d115f Added missing ORTHANC_OVERRIDE + preparation for lost GL context handling + stubs for GL context event handlers
Benjamin Golinvaux <bgo@osimis.io>
parents: 909
diff changeset
161 unsigned int height) ORTHANC_OVERRIDE;
1205
6009c59d8676 fix to sdl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1203
diff changeset
162
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
163 virtual void ToggleMaximize() ORTHANC_OVERRIDE;
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 };
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 }