comparison Framework/Viewport/SdlViewport.cpp @ 1213:86a8266b8888 broker

moving the scene from IViewport to ViewportController
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 04 Dec 2019 17:54:10 +0100
parents d10d2acb8a02
children 5147277850cf
comparison
equal deleted inserted replaced
1212:ab06dfdf3b75 1213:86a8266b8888
56 void SdlOpenGLViewport::Invalidate() 56 void SdlOpenGLViewport::Invalidate()
57 { 57 {
58 SendRefreshEvent(); 58 SendRefreshEvent();
59 } 59 }
60 60
61 void SdlOpenGLViewport::Paint() 61 void SdlOpenGLViewport::Paint(const Scene2D& scene)
62 { 62 {
63 boost::mutex::scoped_lock lock(mutex_); 63 boost::mutex::scoped_lock lock(mutex_);
64 compositor_->Refresh(GetScene()); 64 compositor_->Refresh(scene);
65 } 65 }
66 66
67 67
68 SdlCairoViewport::SdlCairoViewport(const char* title, 68 SdlCairoViewport::SdlCairoViewport(const char* title,
69 unsigned int width, 69 unsigned int width,
81 { 81 {
82 SDL_FreeSurface(sdlSurface_); 82 SDL_FreeSurface(sdlSurface_);
83 } 83 }
84 } 84 }
85 85
86 void SdlCairoViewport::InvalidateInternal() // Assumes that the mutex is locked 86 void SdlCairoViewport::Paint(const Scene2D& scene)
87 {
88 compositor_.Refresh(GetScene());
89 CreateSdlSurfaceFromCompositor();
90 }
91
92 void SdlCairoViewport::Paint()
93 { 87 {
94 boost::mutex::scoped_lock lock(mutex_); 88 boost::mutex::scoped_lock lock(mutex_);
89
90 compositor_.Refresh(scene);
91 CreateSdlSurfaceFromCompositor();
95 92
96 if (sdlSurface_ != NULL) 93 if (sdlSurface_ != NULL)
97 { 94 {
98 window_.Render(sdlSurface_); 95 window_.Render(sdlSurface_);
99 } 96 }
100 } 97 }
101 98
102 void SdlCairoViewport::Invalidate() 99 void SdlCairoViewport::Invalidate()
103 { 100 {
104 {
105 boost::mutex::scoped_lock lock(mutex_);
106 InvalidateInternal();
107 }
108
109 SendRefreshEvent(); 101 SendRefreshEvent();
110 } 102 }
111 103
112 void SdlCairoViewport::UpdateSize(unsigned int width, 104 void SdlCairoViewport::UpdateSize(unsigned int width,
113 unsigned int height) 105 unsigned int height)
114 { 106 {
115 boost::mutex::scoped_lock lock(mutex_); 107 {
116 compositor_.UpdateSize(width, height); 108 boost::mutex::scoped_lock lock(mutex_);
117 InvalidateInternal(); 109 compositor_.UpdateSize(width, height);
110 }
111
112 Invalidate();
118 } 113 }
119 114
120 void SdlCairoViewport::CreateSdlSurfaceFromCompositor() // Assumes that the mutex is locked 115 void SdlCairoViewport::CreateSdlSurfaceFromCompositor() // Assumes that the mutex is locked
121 { 116 {
122 static const uint32_t rmask = 0x00ff0000; 117 static const uint32_t rmask = 0x00ff0000;