annotate Framework/Viewport/SdlViewport.h @ 1313:f30905f5d246 broker

Added support for OnGenericSdlEvent to GuiAdapter. This makes it possible to piggyback app-specific logic to special events (here, to support the Viewport refresh events)
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 16 Mar 2020 11:12:39 +0100
parents adf234ecaa00
children ab81ee8fce1f
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
1270
2d8ab34c8c91 upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
891
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>
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
1307
8a28a9bf8876 ViewportController now gets a ref to its parent viewport for proper lock usage
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
46 // TODO: required for UndoStack injection
8a28a9bf8876 ViewportController now gets a ref to its parent viewport for proper lock usage
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
47 // I don't like it either :)
8a28a9bf8876 ViewportController now gets a ref to its parent viewport for proper lock usage
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
48 #include <boost/weak_ptr.hpp>
8a28a9bf8876 ViewportController now gets a ref to its parent viewport for proper lock usage
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
49
8a28a9bf8876 ViewportController now gets a ref to its parent viewport for proper lock usage
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
50 #include <boost/thread/recursive_mutex.hpp>
8a28a9bf8876 ViewportController now gets a ref to its parent viewport for proper lock usage
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
51
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 namespace OrthancStone
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 {
1307
8a28a9bf8876 ViewportController now gets a ref to its parent viewport for proper lock usage
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
54 class UndoStack;
8a28a9bf8876 ViewportController now gets a ref to its parent viewport for proper lock usage
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
55
1215
9efa66d8d3f8 removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1213
diff changeset
56 class SdlViewport : public IViewport
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 {
1205
6009c59d8676 fix to sdl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1203
diff changeset
58 private:
1307
8a28a9bf8876 ViewportController now gets a ref to its parent viewport for proper lock usage
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
59 boost::recursive_mutex mutex_;
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
60 uint32_t refreshEvent_;
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
61 boost::shared_ptr<ViewportController> controller_;
1299
c38c89684d83 replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1279
diff changeset
62 std::unique_ptr<ICompositor> compositor_;
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
63
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
64 void SendRefreshEvent();
1203
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
65
1205
6009c59d8676 fix to sdl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1203
diff changeset
66 protected:
1215
9efa66d8d3f8 removed ViewportBase, and removed dependency of ViewportController on IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1213
diff changeset
67 class SdlLock : public ILock
1053
32b403a47b19 simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1047
diff changeset
68 {
1203
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
69 private:
1307
8a28a9bf8876 ViewportController now gets a ref to its parent viewport for proper lock usage
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
70 SdlViewport& that_;
8a28a9bf8876 ViewportController now gets a ref to its parent viewport for proper lock usage
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
71 boost::recursive_mutex::scoped_lock lock_;
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
72
1203
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
73 public:
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
74 SdlLock(SdlViewport& that) :
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
75 that_(that),
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
76 lock_(that.mutex_)
1203
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
77 {
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
78 }
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
79
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
80 virtual bool HasCompositor() const ORTHANC_OVERRIDE
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
81 {
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
82 return true;
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
83 }
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
84
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
85 virtual ICompositor& GetCompositor() ORTHANC_OVERRIDE;
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
86
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
87 virtual ViewportController& GetController() ORTHANC_OVERRIDE
1203
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 return *that_.controller_;
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
90 }
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 virtual void Invalidate() ORTHANC_OVERRIDE
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 that_.SendRefreshEvent();
1203
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
95 }
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
96 };
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
97
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
98 void ClearCompositor()
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
99 {
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
100 compositor_.reset();
1053
32b403a47b19 simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1047
diff changeset
101 }
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
102
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
103 void AcquireCompositor(ICompositor* compositor /* takes ownership */);
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
104
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 public:
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
106 SdlViewport();
1307
8a28a9bf8876 ViewportController now gets a ref to its parent viewport for proper lock usage
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
107 SdlViewport(boost::weak_ptr<UndoStack> undoStackW);
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
109 bool IsRefreshEvent(const SDL_Event& event) const
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
110 {
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
111 return (event.type == refreshEvent_);
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
112 }
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
113
1203
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
114 virtual ILock* Lock() ORTHANC_OVERRIDE
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 {
1203
f3bb9a6dd949 locking abstraction in IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
116 return new SdlLock(*this);
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 }
909
7a7e4e1f558f SdlCairo resizable
Alain Mazy <alain@mazy.be>
parents: 907
diff changeset
118
7a7e4e1f558f SdlCairo resizable
Alain Mazy <alain@mazy.be>
parents: 907
diff changeset
119 virtual void UpdateSize(unsigned int width,
7a7e4e1f558f SdlCairo resizable
Alain Mazy <alain@mazy.be>
parents: 907
diff changeset
120 unsigned int height) = 0;
1216
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 virtual void ToggleMaximize() = 0;
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
123
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
124 // Must be invoked from the main SDL thread
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
125 virtual void Paint() = 0;
1053
32b403a47b19 simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1047
diff changeset
126 };
947
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 942
diff changeset
127
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
128
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
129 class SdlOpenGLViewport : 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
130 {
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 private:
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 SdlOpenGLContext context_;
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 public:
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
135 SdlOpenGLViewport(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
136 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
137 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
138 bool allowDpiScaling = true);
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139
1307
8a28a9bf8876 ViewportController now gets a ref to its parent viewport for proper lock usage
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
140 SdlOpenGLViewport(const char* title,
8a28a9bf8876 ViewportController now gets a ref to its parent viewport for proper lock usage
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
141 boost::weak_ptr<UndoStack> undoStackW,
8a28a9bf8876 ViewportController now gets a ref to its parent viewport for proper lock usage
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
142 unsigned int width,
8a28a9bf8876 ViewportController now gets a ref to its parent viewport for proper lock usage
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
143 unsigned int height,
8a28a9bf8876 ViewportController now gets a ref to its parent viewport for proper lock usage
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
144 bool allowDpiScaling = true);
8a28a9bf8876 ViewportController now gets a ref to its parent viewport for proper lock usage
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
145
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
146 virtual ~SdlOpenGLViewport();
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
148 virtual void Paint() ORTHANC_OVERRIDE;
1053
32b403a47b19 simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1047
diff changeset
149
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
150 virtual void UpdateSize(unsigned int width,
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
151 unsigned int height) ORTHANC_OVERRIDE;
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
152
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
153 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
154 };
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
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
156
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
157 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
158 {
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 private:
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
160 SdlWindow window_;
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
161 SDL_Surface* sdlSurface_;
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
162
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
163 void CreateSdlSurfaceFromCompositor(CairoCompositor& compositor);
1053
32b403a47b19 simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1047
diff changeset
164
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
165 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
166 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
167 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
168 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
169 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
170
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
171 virtual ~SdlCairoViewport();
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
172
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
173 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
174
909
7a7e4e1f558f SdlCairo resizable
Alain Mazy <alain@mazy.be>
parents: 907
diff changeset
175 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
176 unsigned int height) ORTHANC_OVERRIDE;
1053
32b403a47b19 simplifying IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1047
diff changeset
177
1216
5147277850cf better abstraction for IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1215
diff changeset
178 virtual void ToggleMaximize() ORTHANC_OVERRIDE;
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 };
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 }