@@ -136,64 +136,6 @@ display_surface::native_handle_type display_surface::native_handle() const {
136136 return { { _Surface.get (), _Context.get () }, _Display.get (), _Wndw, _Display_mutex, _Display_ref_count };
137137}
138138
139- // display_surface::display_surface(display_surface&& other) noexcept
140- // : surface(move(other))
141- // , _Default_brush(move(other._Default_brush))
142- // , _Display_width(move(other._Display_width))
143- // , _Display_height(move(other._Display_height))
144- // , _Scaling(move(other._Scaling))
145- // , _Width(move(other._Width))
146- // , _Height(move(other._Height))
147- // , _Draw_fn(move(other._Draw_fn))
148- // , _Size_change_fn(move(other._Size_change_fn))
149- // , _User_scaling_fn(move(other._User_scaling_fn))
150- // , _Letterbox_brush(move(other._Letterbox_brush))
151- // , _Auto_clear(move(other._Auto_clear))
152- // , _Wndw(move(other._Wndw))
153- // , _Can_draw(move(other._Can_draw))
154- // , _Refresh_rate(move(other._Refresh_rate))
155- // , _Desired_frame_rate(move(other._Desired_frame_rate))
156- // , _Redraw_requested(other._Redraw_requested.load())
157- // , _Elapsed_draw_time(move(other._Elapsed_draw_time))
158- // , _Native_surface(move(other._Native_surface))
159- // , _Native_context(move(other._Native_context)) {
160- // other._Draw_fn = nullptr;
161- // other._Size_change_fn = nullptr;
162- // other._Wndw = None;
163- // }
164- //
165- // display_surface& display_surface::operator=(display_surface&& other) noexcept {
166- // if (this != &other) {
167- // surface::operator=(move(other));
168- // _Default_brush = move(other._Default_brush);
169- // _Display_width = move(other._Display_width);
170- // _Display_height = move(other._Display_height);
171- // _Scaling = move(other._Scaling);
172- // _Width = move(other._Width);
173- // _Height = move(other._Height);
174- // _Draw_fn = move(other._Draw_fn);
175- // _Size_change_fn = move(other._Size_change_fn);
176- // _User_scaling_fn = move(other._User_scaling_fn);
177- // _Letterbox_brush = move(other._Letterbox_brush);
178- // _Auto_clear = move(other._Auto_clear);
179- // _Wndw = move(other._Wndw);
180- // _Can_draw = move(other._Can_draw);
181- // _Refresh_rate = move(other._Refresh_rate);
182- // _Desired_frame_rate = move(other._Desired_frame_rate);
183- // _Redraw_requested = other._Redraw_requested.load();
184- // _Elapsed_draw_time = move(other._Elapsed_draw_time);
185- // _Native_surface = move(other._Native_surface);
186- // _Native_context = move(other._Native_context);
187- //
188- // other._Wndw = None;
189- // other._Draw_fn = nullptr;
190- // other._Size_change_fn = nullptr;
191- // other._Can_draw = false;
192- // }
193- //
194- // return *this;
195- // }
196- //
197139mutex display_surface::_Display_mutex;
198140unique_ptr<Display, function<void (Display*)>> display_surface::_Display{ nullptr , [](Display*) { return ; } };
199141int display_surface::_Display_ref_count = 0 ;
@@ -236,7 +178,7 @@ display_surface::display_surface(int preferredWidth, int preferredHeight, experi
236178
237179display_surface::display_surface (int preferredWidth, int preferredHeight, experimental::io2d::format preferredFormat, int preferredDisplayWidth, int preferredDisplayHeight, experimental::io2d::scaling scl, experimental::io2d::refresh_rate rr, double fps)
238180 : surface({ nullptr , nullptr }, preferredFormat)
239- , _Default_brush(cairo_pattern_create_rgba( 0.0 , 0.0 , 0.0 , 1.0 ))
181+ , _Default_brush(bgra_color::transparent_black( ))
240182 , _Display_width(preferredDisplayWidth)
241183 , _Display_height(preferredDisplayHeight)
242184 , _Scaling(scl)
@@ -245,7 +187,7 @@ display_surface::display_surface(int preferredWidth, int preferredHeight, experi
245187 , _Draw_fn()
246188 , _Size_change_fn()
247189 , _User_scaling_fn()
248- , _Letterbox_brush(cairo_pattern_create_rgba( 0.0 , 0.0 , 0.0 , 1.0 ) )
190+ , _Letterbox_brush()
249191 , _Auto_clear(false )
250192 , _Wndw(None)
251193 , _Can_draw(false )
@@ -312,7 +254,7 @@ display_surface::~display_surface() {
312254 }
313255}
314256
315- int display_surface::show () {
257+ int display_surface::begin_show () {
316258 bool exit = false ;
317259 XEvent event;
318260
@@ -337,7 +279,7 @@ int display_surface::show() {
337279 if (_Auto_clear) {
338280 clear ();
339281 }
340- _Draw_fn (*this );
282+ (* _Draw_fn) (*this );
341283 }
342284 else {
343285 throw system_error (make_error_code (errc::operation_would_block));
@@ -370,7 +312,7 @@ int display_surface::show() {
370312 if (resized) {
371313 cairo_xlib_surface_set_size (_Native_surface.get (), _Display_width, _Display_height);
372314 if (_Size_change_fn != nullptr ) {
373- _Size_change_fn (*this );
315+ (* _Size_change_fn) (*this );
374316 }
375317 }
376318 } break ;
@@ -406,7 +348,7 @@ int display_surface::show() {
406348 if (_Auto_clear) {
407349 clear ();
408350 }
409- _Draw_fn (*this );
351+ (* _Draw_fn) (*this );
410352 }
411353 else {
412354 throw system_error (make_error_code (errc::operation_would_block));
@@ -498,7 +440,8 @@ int display_surface::show() {
498440 if (_Can_draw) {
499441 bool redraw = true ;
500442 if (_Refresh_rate == experimental::io2d::refresh_rate::as_needed) {
501- redraw = _Redraw_requested.exchange (false , std::memory_order_acquire);
443+ redraw = _Redraw_requested;
444+ _Redraw_requested = false ;
502445 }
503446
504447 auto desiredElapsed = 1'000'000'000.0 / _Desired_frame_rate;
@@ -513,7 +456,7 @@ int display_surface::show() {
513456 if (_Auto_clear) {
514457 clear ();
515458 }
516- _Draw_fn (*this );
459+ (* _Draw_fn) (*this );
517460 }
518461 else {
519462 throw system_error (make_error_code (errc::operation_would_block));
0 commit comments