Skip to content

Commit 2f1e230

Browse files
committed
Ensure R6 compliance
Chapter 12.15 to end
1 parent 2e0679e commit 2f1e230

File tree

6 files changed

+142
-137
lines changed

6 files changed

+142
-137
lines changed

N3888_RefImpl/src/display_surface-common.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -304,23 +304,23 @@ void display_surface::size_change_callback(const ::std::function<void(display_su
304304
_Size_change_fn = make_unique<::std::function<void(display_surface& sfc)>>(fn);
305305
}
306306

307-
void display_surface::width(int w) noexcept {
307+
void display_surface::width(int w) {
308308
dimensions(w, _Width);
309309
}
310310

311-
void display_surface::height(int h) noexcept {
311+
void display_surface::height(int h) {
312312
dimensions(_Width, h);
313313
}
314314

315-
void display_surface::display_width(int w) noexcept {
315+
void display_surface::display_width(int w) {
316316
display_dimensions(w, _Display_height);
317317
}
318318

319-
void display_surface::display_height(int h) noexcept {
319+
void display_surface::display_height(int h) {
320320
display_dimensions(_Display_width, h);
321321
}
322322

323-
void display_surface::dimensions(int w, int h) noexcept {
323+
void display_surface::dimensions(int w, int h) {
324324
bool recreate = false;
325325

326326
if (_Width != w) {
@@ -340,7 +340,7 @@ void display_surface::dimensions(int w, int h) noexcept {
340340
}
341341
}
342342

343-
void display_surface::display_dimensions(int dw, int dh) noexcept {
343+
void display_surface::display_dimensions(int dw, int dh) {
344344
_Display_width = dw;
345345
_Display_height = dh;
346346
_Resize_window();
@@ -357,7 +357,7 @@ void display_surface::user_scaling_callback(const function<experimental::io2d::b
357357
_User_scaling_fn = make_unique<function<experimental::io2d::bounding_box(const display_surface&, bool&)>>(fn);
358358
}
359359

360-
void display_surface::letterbox_brush(const optional<brush>& b, const optional<brush_props>& bp) noexcept {
360+
void display_surface::letterbox_brush(const optional<brush>& b, const optional<brush_props> bp) noexcept {
361361
_Letterbox_brush = b;
362362
_Letterbox_brush_props = bp;
363363
}
@@ -441,7 +441,7 @@ ::std::function<::std::experimental::io2d::bounding_box(const display_surface&,
441441
}
442442
}
443443

444-
const optional<brush>& display_surface::letterbox_brush() const noexcept {
444+
optional<brush> display_surface::letterbox_brush() const noexcept {
445445
return _Letterbox_brush;
446446
}
447447

N3888_RefImpl/src/display_surface-win32.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,6 @@ int display_surface::begin_show() {
549549
return static_cast<int>(msg.wParam);
550550
}
551551

552-
void display_surface::end_show() noexcept {
552+
void display_surface::end_show() {
553553
PostQuitMessage(0);
554554
}

N3888_RefImpl/src/image_surface.cpp

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ image_surface::image_surface(experimental::io2d::format fmt, int width, int heig
123123
}
124124

125125
#ifdef _Filesystem_support_test
126-
image_surface::image_surface(experimental::filesystem::path f, experimental::io2d::format fmt, image_file_format idf)
126+
image_surface::image_surface(experimental::filesystem::path f, image_file_format idf, experimental::io2d::format fmt)
127127
#else
128128
image_surface::image_surface(string f, experimental::io2d::format fmt, image_file_format idf)
129129
#endif
@@ -703,6 +703,59 @@ void image_surface::save(string f, image_file_format idf) {
703703
}
704704
}
705705

706+
// make friendship decision
707+
/*
708+
void image_surface::map(const ::std::function<void(mapped_surface&)>& action) {
709+
if (action != nullptr) {
710+
mapped_surface m({ cairo_surface_map_to_image(_Surface.get(), nullptr), nullptr }, { _Surface.get(), nullptr });
711+
action(m);
712+
mark_dirty();
713+
}
714+
}
715+
716+
void image_surface::map(const ::std::function<void(mapped_surface&, error_code&)>& action, error_code& ec) {
717+
if (action != nullptr) {
718+
mapped_surface m({ cairo_surface_map_to_image(_Surface.get(), nullptr), nullptr }, { _Surface.get(), nullptr }, ec);
719+
if (static_cast<bool>(ec)) {
720+
return;
721+
}
722+
action(m, ec);
723+
if (static_cast<bool>(ec)) {
724+
return;
725+
}
726+
mark_dirty();
727+
}
728+
ec.clear();
729+
}
730+
*/
731+
732+
// divergent from paper
733+
/*
734+
void image_surface::map(const ::std::function<void(mapped_surface&)>& action, const bounding_box& extents) {
735+
if (action != nullptr) {
736+
cairo_rectangle_int_t cextents{ _Double_to_int(extents.x()), _Double_to_int(extents.y()), _Double_to_int(extents.width()), _Double_to_int(extents.height()) };
737+
mapped_surface m({ cairo_surface_map_to_image(_Surface.get(), &cextents), nullptr }, { _Surface.get(), nullptr });
738+
action(m);
739+
}
740+
mark_dirty(extents);
741+
}
742+
743+
void image_surface::map(const ::std::function<void(mapped_surface&, error_code&)>& action, const bounding_box& extents, error_code& ec) {
744+
if (action != nullptr) {
745+
cairo_rectangle_int_t cextents{ _Double_to_int(extents.x()), _Double_to_int(extents.y()), _Double_to_int(extents.width()), _Double_to_int(extents.height()) };
746+
mapped_surface m({ cairo_surface_map_to_image(_Surface.get(), &cextents), nullptr }, { _Surface.get(), nullptr }, ec);
747+
if (static_cast<bool>(ec)) {
748+
return;
749+
}
750+
action(m, ec);
751+
if (static_cast<bool>(ec)) {
752+
return;
753+
}
754+
mark_dirty(extents);
755+
}
756+
ec.clear();
757+
}
758+
*/
706759
format image_surface::format() const noexcept {
707760
return _Cairo_format_t_to_format(cairo_image_surface_get_format(_Surface.get()));
708761
}

N3888_RefImpl/src/surface.cpp

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -52,54 +52,6 @@ void surface::mark_dirty(const bounding_box& rect) {
5252
cairo_surface_mark_dirty_rectangle(_Surface.get(), _Double_to_int(rect.x()), _Double_to_int(rect.y()), _Double_to_int(rect.width()), _Double_to_int(rect.height()));
5353
}
5454

55-
void surface::map(const ::std::function<void(mapped_surface&)>& action) {
56-
if (action != nullptr) {
57-
mapped_surface m({ cairo_surface_map_to_image(_Surface.get(), nullptr), nullptr }, { _Surface.get(), nullptr });
58-
action(m);
59-
mark_dirty();
60-
}
61-
}
62-
63-
void surface::map(const ::std::function<void(mapped_surface&, error_code&)>& action, error_code& ec) {
64-
if (action != nullptr) {
65-
mapped_surface m({ cairo_surface_map_to_image(_Surface.get(), nullptr), nullptr }, { _Surface.get(), nullptr }, ec);
66-
if (static_cast<bool>(ec)) {
67-
return;
68-
}
69-
action(m, ec);
70-
if (static_cast<bool>(ec)) {
71-
return;
72-
}
73-
mark_dirty();
74-
}
75-
ec.clear();
76-
}
77-
78-
void surface::map(const ::std::function<void(mapped_surface&)>& action, const bounding_box& extents) {
79-
if (action != nullptr) {
80-
cairo_rectangle_int_t cextents{ _Double_to_int(extents.x()), _Double_to_int(extents.y()), _Double_to_int(extents.width()), _Double_to_int(extents.height()) };
81-
mapped_surface m({ cairo_surface_map_to_image(_Surface.get(), &cextents), nullptr }, { _Surface.get(), nullptr });
82-
action(m);
83-
}
84-
mark_dirty(extents);
85-
}
86-
87-
void surface::map(const ::std::function<void(mapped_surface&, error_code&)>& action, const bounding_box& extents, error_code& ec) {
88-
if (action != nullptr) {
89-
cairo_rectangle_int_t cextents{ _Double_to_int(extents.x()), _Double_to_int(extents.y()), _Double_to_int(extents.width()), _Double_to_int(extents.height()) };
90-
mapped_surface m({ cairo_surface_map_to_image(_Surface.get(), &cextents), nullptr }, { _Surface.get(), nullptr }, ec);
91-
if (static_cast<bool>(ec)) {
92-
return;
93-
}
94-
action(m, ec);
95-
if (static_cast<bool>(ec)) {
96-
return;
97-
}
98-
mark_dirty(extents);
99-
}
100-
ec.clear();
101-
}
102-
10355
void surface::clear() {
10456
cairo_save(_Context.get());
10557
cairo_set_operator(_Context.get(), CAIRO_OPERATOR_CLEAR);
@@ -246,7 +198,7 @@ void surface::stroke(const brush& b, const interpreted_path& pg, const optional<
246198
cairo_stroke(context);
247199
}
248200

249-
void surface::mask(const brush& b, const brush& mb, const interpreted_path& pg, const optional<brush_props>& bp, const optional<mask_props>& mp, const optional<render_props>& rp, const optional<clip_props>& cl) {
201+
/*void surface::mask(const brush& b, const brush& mb, const interpreted_path& pg, const optional<brush_props>& bp, const optional<mask_props>& mp, const optional<render_props>& rp, const optional<clip_props>& cl) {
250202
auto context = _Context.get();
251203
_Set_render_props(context, rp);
252204
_Set_clip_props(context, cl);
@@ -256,4 +208,4 @@ void surface::mask(const brush& b, const brush& mb, const interpreted_path& pg,
256208
cairo_new_path(context);
257209
cairo_append_path(context, pg._Native_handle());
258210
cairo_mask(context, mb.native_handle());
259-
}
211+
}*/

N3888_RefImpl/src/xio2d_impl.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2483,23 +2483,25 @@ namespace std::experimental::io2d {
24832483
return _Matrix;
24842484
}
24852485

2486-
template <class Allocator>
2486+
// divergent from paper
2487+
/* template <class Allocator>
24872488
inline void surface::fill(const brush& b, const path_builder<Allocator>& pf, const optional<brush_props>& bp, const optional<render_props>& rp, const optional<clip_props>& cl) {
24882489
interpreted_path pg(pf);
24892490
fill(b, pg, bp, rp, cl);
2490-
}
2491+
}*/
24912492

24922493
template <class Allocator>
24932494
inline void surface::stroke(const brush& b, const path_builder<Allocator>& pf, const optional<brush_props>& bp, const optional<stroke_props>& sp, const optional<dashes>& d, const optional<render_props>& rp, const optional<clip_props>& cl) {
24942495
interpreted_path pg(pf);
24952496
stroke(b, pg, bp, sp, d, rp, cl);
24962497
}
24972498

2498-
template <class Allocator>
2499+
// divergent from paper
2500+
/* template <class Allocator>
24992501
inline void surface::mask(const brush& b, const brush& mb, const path_builder<Allocator>& pf, const optional<brush_props>& bp, const optional<mask_props>& mp, const optional<render_props>&rp, const optional<clip_props>& cl) {
25002502
interpreted_path pg(pf);
25012503
mask(b, mb, pg, bp, mp, rp, cl);
2502-
}
2504+
}*/
25032505

25042506
inline mapped_surface::mapped_surface(surface::native_handle_type nh, surface::native_handle_type map_of)
25052507
: _Mapped_surface(nh)

0 commit comments

Comments
 (0)