Mir

Merge lp:~vanvugt/mir/shape into lp:mir

Proposed by Daniel van Vugt
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 1113
Proposed branch: lp:~vanvugt/mir/shape
Merge into: lp:mir
Diff against target: 493 lines (+149/-32)
15 files modified
examples/eglapp.c (+43/-2)
examples/eglapp.h (+2/-0)
examples/eglflash.c (+11/-11)
examples/egltriangle.c (+1/-1)
include/server/mir/compositor/compositing_criteria.h (+1/-0)
include/shared/mir/geometry/pixel_format.h (+6/-0)
include/test/mir_test_doubles/mock_compositing_criteria.h (+1/-0)
include/test/mir_test_doubles/mock_surface_state.h (+1/-0)
include/test/mir_test_doubles/stub_compositing_criteria.h (+10/-2)
src/server/compositor/bypass.cpp (+1/-1)
src/server/surfaces/surface_allocator.cpp (+4/-1)
src/server/surfaces/surface_data.cpp (+7/-1)
src/server/surfaces/surface_data.h (+4/-1)
tests/unit-tests/compositor/test_bypass.cpp (+43/-0)
tests/unit-tests/surfaces/test_surface_data.cpp (+14/-12)
To merge this branch: bzr merge lp:~vanvugt/mir/shape
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Kevin DuBois (community) Approve
Alan Griffiths Approve
Review via email: mp+189557@code.launchpad.net

Commit message

Ensure nonrectangular surfaces are never bypassed, even if they are
fullscreen and on top (e.g. Unity8 shell at present).
(LP: #1236264)

Description of the change

More importantly, the shape() method is required to fix bug 1227739 on the phone, soon.

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

145 + virtual bool shaped() const = 0; // meaning the pixel format has alpha

When comments and code disagree: trust neither!

Surely we can come up with clearer terminology?

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

I think there's some conflation of shaped/alpha/opacity but otherwise seems to work as advertised.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

To me 'nonrectangular' doesn't immediately mean to me 'surface has alpha channel', (alpha_masked(), perhaps)? but its ok.

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I agree the terminology is confusing. Present terminology:
Mir alpha() == Compiz opacity()
Mir shaped() == Compiz alpha()

Since they're distinctly different things, and both related to alpha blending, I suggest not mentioning "alpha" at all. Hence bug 1236224.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

The failure is a bug which seems to already exist on the target branch. I just reproduced it using development-branch.

It has nothing to do with this proposal. Retry...

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

The failure is now logged as bug 1236698.

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'examples/eglapp.c'
--- examples/eglapp.c 2013-09-19 13:24:22 +0000
+++ examples/eglapp.c 2013-10-07 10:02:32 +0000
@@ -26,6 +26,8 @@
2626
27#include <xkbcommon/xkbcommon-keysyms.h>27#include <xkbcommon/xkbcommon-keysyms.h>
2828
29float mir_eglapp_background_opacity = 1.0f;
30
29static const char appname[] = "egldemo";31static const char appname[] = "egldemo";
3032
31static MirConnection *connection;33static MirConnection *connection;
@@ -182,6 +184,26 @@
182 {184 {
183 switch (arg[1])185 switch (arg[1])
184 {186 {
187 case 'b':
188 {
189 float alpha = 1.0f;
190 arg += 2;
191 if (!arg[0] && i < argc-1)
192 {
193 i++;
194 arg = argv[i];
195 }
196 if (sscanf(arg, "%f", &alpha) == 1)
197 {
198 mir_eglapp_background_opacity = alpha;
199 }
200 else
201 {
202 printf("Invalid opacity value: %s\n", arg);
203 help = 1;
204 }
205 }
206 break;
185 case 'n':207 case 'n':
186 swapinterval = 0;208 swapinterval = 0;
187 break;209 break;
@@ -247,6 +269,7 @@
247 if (help)269 if (help)
248 {270 {
249 printf("Usage: %s [<options>]\n"271 printf("Usage: %s [<options>]\n"
272 " -b Background opacity (0.0 - 1.0)\n"
250 " -h Show this help text\n"273 " -h Show this help text\n"
251 " -f Force full screen\n"274 " -f Force full screen\n"
252 " -o ID Force placement on output monitor ID\n"275 " -o ID Force placement on output monitor ID\n"
@@ -277,9 +300,27 @@
277300
278 const MirDisplayMode *mode = &output->modes[output->current_mode];301 const MirDisplayMode *mode = &output->modes[output->current_mode];
279302
280 unsigned int valid_formats;303 const unsigned int max_formats = 10;
304 unsigned int format[max_formats];
305 unsigned int nformats;
306
281 mir_connection_get_available_surface_formats(connection,307 mir_connection_get_available_surface_formats(connection,
282 &surfaceparm.pixel_format, 1, &valid_formats);308 format, max_formats, &nformats);
309
310 surfaceparm.pixel_format = format[0];
311 for (unsigned int f = 0; f < nformats; f++)
312 {
313 const int opaque = (format[f] == mir_pixel_format_xbgr_8888 ||
314 format[f] == mir_pixel_format_xrgb_8888 ||
315 format[f] == mir_pixel_format_bgr_888);
316
317 if ((mir_eglapp_background_opacity == 1.0f && opaque) ||
318 (mir_eglapp_background_opacity < 1.0f && !opaque))
319 {
320 surfaceparm.pixel_format = format[f];
321 break;
322 }
323 }
283324
284 printf("Connected to display: resolution (%dx%d), position(%dx%d), "325 printf("Connected to display: resolution (%dx%d), position(%dx%d), "
285 "supports %d pixel formats\n",326 "supports %d pixel formats\n",
286327
=== modified file 'examples/eglapp.h'
--- examples/eglapp.h 2013-09-19 13:24:22 +0000
+++ examples/eglapp.h 2013-10-07 10:02:32 +0000
@@ -27,6 +27,8 @@
27struct MirConnection;27struct MirConnection;
28struct MirSurface;28struct MirSurface;
2929
30extern float mir_eglapp_background_opacity;
31
30mir_eglapp_bool mir_eglapp_init(int argc, char *argv[],32mir_eglapp_bool mir_eglapp_init(int argc, char *argv[],
31 unsigned int *width, unsigned int *height);33 unsigned int *width, unsigned int *height);
32void mir_eglapp_swap_buffers(void);34void mir_eglapp_swap_buffers(void);
3335
=== modified file 'examples/eglflash.c'
--- examples/eglflash.c 2013-09-19 13:24:22 +0000
+++ examples/eglflash.c 2013-10-07 10:02:32 +0000
@@ -33,17 +33,17 @@
33 /* This is probably the simplest GL you can do */33 /* This is probably the simplest GL you can do */
34 while (mir_eglapp_running())34 while (mir_eglapp_running())
35 {35 {
36 glClearColor(1.0f, 0.0f, 0.0f, 1.0f);36 glClearColor(1.0f, 0.0f, 0.0f, mir_eglapp_background_opacity);
37 glClear(GL_COLOR_BUFFER_BIT);37 glClear(GL_COLOR_BUFFER_BIT);
38 mir_eglapp_swap_buffers();38 mir_eglapp_swap_buffers();
39 sleep(1);39 sleep(1);
4040
41 glClearColor(0.0f, 1.0f, 0.0f, 1.0f);41 glClearColor(0.0f, 1.0f, 0.0f, mir_eglapp_background_opacity);
42 glClear(GL_COLOR_BUFFER_BIT);42 glClear(GL_COLOR_BUFFER_BIT);
43 mir_eglapp_swap_buffers();43 mir_eglapp_swap_buffers();
44 sleep(1);44 sleep(1);
4545
46 glClearColor(0.0f, 0.0f, 1.0f, 1.0f);46 glClearColor(0.0f, 0.0f, 1.0f, mir_eglapp_background_opacity);
47 glClear(GL_COLOR_BUFFER_BIT);47 glClear(GL_COLOR_BUFFER_BIT);
48 mir_eglapp_swap_buffers();48 mir_eglapp_swap_buffers();
49 sleep(1);49 sleep(1);
5050
=== modified file 'examples/egltriangle.c'
--- examples/egltriangle.c 2013-09-19 13:24:22 +0000
+++ examples/egltriangle.c 2013-10-07 10:02:32 +0000
@@ -105,7 +105,7 @@
105 return 2;105 return 2;
106 }106 }
107107
108 glClearColor(MID_AUBERGINE, 1.0);108 glClearColor(MID_AUBERGINE, mir_eglapp_background_opacity);
109 glViewport(0, 0, width, height);109 glViewport(0, 0, width, height);
110110
111 glUseProgram(prog);111 glUseProgram(prog);
112112
=== modified file 'include/server/mir/compositor/compositing_criteria.h'
--- include/server/mir/compositor/compositing_criteria.h 2013-08-28 03:41:48 +0000
+++ include/server/mir/compositor/compositing_criteria.h 2013-10-07 10:02:32 +0000
@@ -36,6 +36,7 @@
36 virtual float alpha() const = 0;36 virtual float alpha() const = 0;
37 virtual glm::mat4 const& transformation() const = 0;37 virtual glm::mat4 const& transformation() const = 0;
38 virtual bool should_be_rendered_in(geometry::Rectangle const& rect) const = 0;38 virtual bool should_be_rendered_in(geometry::Rectangle const& rect) const = 0;
39 virtual bool shaped() const = 0; // meaning the pixel format has alpha
3940
40 virtual ~CompositingCriteria() = default;41 virtual ~CompositingCriteria() = default;
4142
4243
=== modified file 'include/shared/mir/geometry/pixel_format.h'
--- include/shared/mir/geometry/pixel_format.h 2013-06-12 09:36:20 +0000
+++ include/shared/mir/geometry/pixel_format.h 2013-10-07 10:02:32 +0000
@@ -42,6 +42,12 @@
42 return (fmt == PixelFormat::bgr_888) ? 3 : 4;42 return (fmt == PixelFormat::bgr_888) ? 3 : 4;
43}43}
4444
45static inline bool has_alpha(PixelFormat fmt)
46{
47 return (fmt == PixelFormat::abgr_8888) ||
48 (fmt == PixelFormat::argb_8888);
49}
50
45}51}
46}52}
4753
4854
=== modified file 'include/test/mir_test_doubles/mock_compositing_criteria.h'
--- include/test/mir_test_doubles/mock_compositing_criteria.h 2013-08-28 03:41:48 +0000
+++ include/test/mir_test_doubles/mock_compositing_criteria.h 2013-10-07 10:02:32 +0000
@@ -36,6 +36,7 @@
36 MOCK_CONST_METHOD0(alpha, float());36 MOCK_CONST_METHOD0(alpha, float());
37 MOCK_CONST_METHOD0(transformation, glm::mat4 const&());37 MOCK_CONST_METHOD0(transformation, glm::mat4 const&());
38 MOCK_CONST_METHOD1(should_be_rendered_in, bool(geometry::Rectangle const&));38 MOCK_CONST_METHOD1(should_be_rendered_in, bool(geometry::Rectangle const&));
39 MOCK_CONST_METHOD0(shaped, bool());
39};40};
4041
41}42}
4243
=== modified file 'include/test/mir_test_doubles/mock_surface_state.h'
--- include/test/mir_test_doubles/mock_surface_state.h 2013-10-03 06:01:11 +0000
+++ include/test/mir_test_doubles/mock_surface_state.h 2013-10-07 10:02:32 +0000
@@ -60,6 +60,7 @@
60 MOCK_METHOD0(frame_posted, void());60 MOCK_METHOD0(frame_posted, void());
61 MOCK_METHOD1(set_hidden, void(bool));61 MOCK_METHOD1(set_hidden, void(bool));
62 MOCK_CONST_METHOD1(should_be_rendered_in, bool(geometry::Rectangle const&));62 MOCK_CONST_METHOD1(should_be_rendered_in, bool(geometry::Rectangle const&));
63 MOCK_CONST_METHOD0(shaped, bool());
63};64};
6465
65typedef ::testing::NiceMock<MockSurfaceState> StubSurfaceState;66typedef ::testing::NiceMock<MockSurfaceState> StubSurfaceState;
6667
=== modified file 'include/test/mir_test_doubles/stub_compositing_criteria.h'
--- include/test/mir_test_doubles/stub_compositing_criteria.h 2013-08-13 07:07:12 +0000
+++ include/test/mir_test_doubles/stub_compositing_criteria.h 2013-10-07 10:02:32 +0000
@@ -34,9 +34,11 @@
34{34{
35public:35public:
36 StubCompositingCriteria(int x, int y, int width, int height,36 StubCompositingCriteria(int x, int y, int width, int height,
37 float opacity=1.0f)37 float opacity=1.0f,
38 bool rectangular=true)
38 : rect{{x, y}, {width, height}},39 : rect{{x, y}, {width, height}},
39 opacity(opacity)40 opacity(opacity),
41 rectangular(rectangular)
40 {42 {
41 const glm::mat4 ident;43 const glm::mat4 ident;
42 glm::vec3 size(width, height, 0.0f);44 glm::vec3 size(width, height, 0.0f);
@@ -59,10 +61,16 @@
59 return rect.overlaps(r);61 return rect.overlaps(r);
60 }62 }
6163
64 bool shaped() const override
65 {
66 return !rectangular;
67 }
68
62private:69private:
63 mir::geometry::Rectangle rect;70 mir::geometry::Rectangle rect;
64 glm::mat4 trans;71 glm::mat4 trans;
65 float opacity;72 float opacity;
73 bool rectangular;
66};74};
6775
68} // namespace doubles76} // namespace doubles
6977
=== modified file 'src/server/compositor/bypass.cpp'
--- src/server/compositor/bypass.cpp 2013-08-13 07:14:11 +0000
+++ src/server/compositor/bypass.cpp 2013-10-07 10:02:32 +0000
@@ -57,7 +57,7 @@
5757
58bool BypassFilter::operator()(const CompositingCriteria &criteria)58bool BypassFilter::operator()(const CompositingCriteria &criteria)
59{59{
60 if (criteria.alpha() != 1.0f)60 if (criteria.alpha() != 1.0f || criteria.shaped())
61 return false;61 return false;
6262
63 if (!all_orthogonal)63 if (!all_orthogonal)
6464
=== modified file 'src/server/surfaces/surface_allocator.cpp'
--- src/server/surfaces/surface_allocator.cpp 2013-10-03 03:44:08 +0000
+++ src/server/surfaces/surface_allocator.cpp 2013-10-07 10:02:32 +0000
@@ -46,9 +46,12 @@
46 params.buffer_usage};46 params.buffer_usage};
47 auto buffer_stream = buffer_stream_factory->create_buffer_stream(buffer_properties);47 auto buffer_stream = buffer_stream_factory->create_buffer_stream(buffer_properties);
48 auto actual_size = geom::Rectangle{params.top_left, buffer_stream->stream_size()};48 auto actual_size = geom::Rectangle{params.top_left, buffer_stream->stream_size()};
49
50 bool nonrectangular = has_alpha(params.pixel_format);
49 auto state = std::make_shared<ms::SurfaceData>(params.name,51 auto state = std::make_shared<ms::SurfaceData>(params.name,
50 actual_size,52 actual_size,
51 change_callback);53 change_callback,
54 nonrectangular);
52 auto input_channel = input_factory->make_input_channel();55 auto input_channel = input_factory->make_input_channel();
53 return std::make_shared<ms::Surface>(state, buffer_stream, input_channel);56 return std::make_shared<ms::Surface>(state, buffer_stream, input_channel);
54}57}
5558
=== modified file 'src/server/surfaces/surface_data.cpp'
--- src/server/surfaces/surface_data.cpp 2013-10-03 03:44:08 +0000
+++ src/server/surfaces/surface_data.cpp 2013-10-07 10:02:32 +0000
@@ -22,7 +22,7 @@
22namespace geom=mir::geometry;22namespace geom=mir::geometry;
23namespace ms = mir::surfaces;23namespace ms = mir::surfaces;
2424
25ms::SurfaceData::SurfaceData(std::string const& name, geom::Rectangle rect, std::function<void()> change_cb)25ms::SurfaceData::SurfaceData(std::string const& name, geom::Rectangle rect, std::function<void()> change_cb, bool nonrectangular)
26 : notify_change(change_cb),26 : notify_change(change_cb),
27 surface_name(name),27 surface_name(name),
28 surface_rect(rect),28 surface_rect(rect),
@@ -30,6 +30,7 @@
30 surface_alpha(1.0f),30 surface_alpha(1.0f),
31 first_frame_posted(false),31 first_frame_posted(false),
32 hidden(false),32 hidden(false),
33 nonrectangular(nonrectangular),
33 input_rectangles{surface_rect}34 input_rectangles{surface_rect}
34{35{
35}36}
@@ -91,6 +92,11 @@
91 return rect.overlaps(surface_rect);92 return rect.overlaps(surface_rect);
92}93}
9394
95bool ms::SurfaceData::shaped() const
96{
97 return nonrectangular;
98}
99
94void ms::SurfaceData::apply_alpha(float alpha)100void ms::SurfaceData::apply_alpha(float alpha)
95{101{
96 {102 {
97103
=== modified file 'src/server/surfaces/surface_data.h'
--- src/server/surfaces/surface_data.h 2013-10-03 08:42:27 +0000
+++ src/server/surfaces/surface_data.h 2013-10-07 10:02:32 +0000
@@ -34,12 +34,14 @@
34{34{
35public:35public:
36 SurfaceData(std::string const& name, geometry::Rectangle rect,36 SurfaceData(std::string const& name, geometry::Rectangle rect,
37 std::function<void()> change_cb);37 std::function<void()> change_cb,
38 bool nonrectangular);
3839
39 //mc::CompositingCriteria40 //mc::CompositingCriteria
40 glm::mat4 const& transformation() const;41 glm::mat4 const& transformation() const;
41 float alpha() const;42 float alpha() const;
42 bool should_be_rendered_in(geometry::Rectangle const& rect) const;43 bool should_be_rendered_in(geometry::Rectangle const& rect) const;
44 bool shaped() const override;
4345
44 //mi::Surface46 //mi::Surface
45 std::string const& name() const;47 std::string const& name() const;
@@ -67,6 +69,7 @@
67 float surface_alpha;69 float surface_alpha;
68 bool first_frame_posted;70 bool first_frame_posted;
69 bool hidden;71 bool hidden;
72 const bool nonrectangular;
70 std::vector<geometry::Rectangle> input_rectangles;73 std::vector<geometry::Rectangle> input_rectangles;
71};74};
7275
7376
=== modified file 'tests/unit-tests/compositor/test_bypass.cpp'
--- tests/unit-tests/compositor/test_bypass.cpp 2013-08-13 07:18:22 +0000
+++ tests/unit-tests/compositor/test_bypass.cpp 2013-10-07 10:02:32 +0000
@@ -88,6 +88,16 @@
88 EXPECT_FALSE(filter.fullscreen_on_top());88 EXPECT_FALSE(filter.fullscreen_on_top());
89}89}
9090
91TEST_F(BypassFilterTest, shaped_fullscreen_window_not_bypassed)
92{
93 BypassFilter filter(display_buffer[0]);
94
95 StubCompositingCriteria win(0, 0, 1920, 1200, 1.0f, false);
96
97 EXPECT_FALSE(filter(win));
98 EXPECT_FALSE(filter.fullscreen_on_top());
99}
100
91TEST_F(BypassFilterTest, offset_fullscreen_window_not_bypassed)101TEST_F(BypassFilterTest, offset_fullscreen_window_not_bypassed)
92{102{
93 BypassFilter filter(display_buffer[0]);103 BypassFilter filter(display_buffer[0]);
@@ -167,6 +177,39 @@
167 EXPECT_TRUE(filter.fullscreen_on_top());177 EXPECT_TRUE(filter.fullscreen_on_top());
168}178}
169179
180TEST_F(BypassFilterTest, many_fullscreen_windows_only_bypass_top_rectangular)
181{
182 BypassFilter filter(display_buffer[0]);
183
184 StubCompositingCriteria a(0, 0, 1920, 1200, 1.0f, false);
185 EXPECT_FALSE(filter(a));
186 EXPECT_FALSE(filter.fullscreen_on_top());
187
188 StubCompositingCriteria b(1, 2, 3, 4);
189 EXPECT_FALSE(filter(b));
190 EXPECT_FALSE(filter.fullscreen_on_top());
191
192 StubCompositingCriteria c(0, 0, 1920, 1200);
193 EXPECT_TRUE(filter(c));
194 EXPECT_TRUE(filter.fullscreen_on_top());
195
196 StubCompositingCriteria d(5, 6, 7, 8);
197 EXPECT_FALSE(filter(d));
198 EXPECT_FALSE(filter.fullscreen_on_top());
199
200 StubCompositingCriteria e(0, 0, 1920, 1200, 1.0f, true);
201 EXPECT_TRUE(filter(e));
202 EXPECT_TRUE(filter.fullscreen_on_top());
203
204 StubCompositingCriteria f(9, 10, 11, 12);
205 EXPECT_FALSE(filter(f));
206 EXPECT_FALSE(filter.fullscreen_on_top());
207
208 StubCompositingCriteria g(0, 0, 1920, 1200, 0.5f, false);
209 EXPECT_FALSE(filter(g));
210 EXPECT_FALSE(filter.fullscreen_on_top());
211}
212
170TEST_F(BypassFilterTest, multimonitor_one_bypassed)213TEST_F(BypassFilterTest, multimonitor_one_bypassed)
171{214{
172 BypassFilter left(display_buffer[0]);215 BypassFilter left(display_buffer[0]);
173216
=== modified file 'tests/unit-tests/surfaces/test_surface_data.cpp'
--- tests/unit-tests/surfaces/test_surface_data.cpp 2013-10-03 03:44:08 +0000
+++ tests/unit-tests/surfaces/test_surface_data.cpp 2013-10-07 10:02:32 +0000
@@ -67,10 +67,11 @@
6767
68TEST_F(SurfaceDataTest, basics)68TEST_F(SurfaceDataTest, basics)
69{ 69{
70 ms::SurfaceData data{name, rect, null_change_cb};70 ms::SurfaceData data{name, rect, null_change_cb, false};
71 EXPECT_EQ(name, data.name());71 EXPECT_EQ(name, data.name());
72 EXPECT_EQ(rect.size, data.size());72 EXPECT_EQ(rect.size, data.size());
73 EXPECT_EQ(rect.top_left, data.position());73 EXPECT_EQ(rect.top_left, data.position());
74 EXPECT_FALSE(data.shaped());
74}75}
7576
76TEST_F(SurfaceDataTest, update_position)77TEST_F(SurfaceDataTest, update_position)
@@ -78,7 +79,7 @@
78 EXPECT_CALL(mock_callback, call())79 EXPECT_CALL(mock_callback, call())
79 .Times(1);80 .Times(1);
8081
81 ms::SurfaceData storage{name, rect, mock_change_cb};82 ms::SurfaceData storage{name, rect, mock_change_cb, false};
82 EXPECT_EQ(rect.top_left, storage.position());83 EXPECT_EQ(rect.top_left, storage.position());
8384
84 auto new_top_left = geom::Point{geom::X{6}, geom::Y{10}};85 auto new_top_left = geom::Point{geom::X{6}, geom::Y{10}};
@@ -91,7 +92,7 @@
91 EXPECT_CALL(mock_callback, call())92 EXPECT_CALL(mock_callback, call())
92 .Times(1);93 .Times(1);
9394
94 ms::SurfaceData storage{name, rect, mock_change_cb};95 ms::SurfaceData storage{name, rect, mock_change_cb, false};
95 auto original_transformation = storage.transformation();96 auto original_transformation = storage.transformation();
9697
97 storage.apply_rotation(60.0f, glm::vec3{0.0f, 0.0f, 1.0f});98 storage.apply_rotation(60.0f, glm::vec3{0.0f, 0.0f, 1.0f});
@@ -106,7 +107,7 @@
106 const geom::Size sz{geom::Width{85}, geom::Height{43}};107 const geom::Size sz{geom::Width{85}, geom::Height{43}};
107 const geom::Rectangle origin{geom::Point{geom::X{77}, geom::Y{88}}, sz};108 const geom::Rectangle origin{geom::Point{geom::X{77}, geom::Y{88}}, sz};
108 const geom::Rectangle moved_pt{geom::Point{geom::X{55}, geom::Y{66}}, sz};109 const geom::Rectangle moved_pt{geom::Point{geom::X{55}, geom::Y{66}}, sz};
109 ms::SurfaceData storage{name, origin, null_change_cb};110 ms::SurfaceData storage{name, origin, null_change_cb, false};
110111
111 glm::mat4 t0 = storage.transformation();112 glm::mat4 t0 = storage.transformation();
112 storage.move_to(moved_pt.top_left);113 storage.move_to(moved_pt.top_left);
@@ -125,7 +126,7 @@
125 EXPECT_CALL(mock_callback, call())126 EXPECT_CALL(mock_callback, call())
126 .Times(1);127 .Times(1);
127128
128 ms::SurfaceData surface_state{name, rect, mock_change_cb};129 ms::SurfaceData surface_state{name, rect, mock_change_cb, false};
129130
130 float alpha = 0.5f;131 float alpha = 0.5f;
131 surface_state.apply_alpha(0.5f);132 surface_state.apply_alpha(0.5f);
@@ -135,8 +136,9 @@
135TEST_F(SurfaceDataTest, test_surface_is_opaque_by_default)136TEST_F(SurfaceDataTest, test_surface_is_opaque_by_default)
136{137{
137 using namespace testing;138 using namespace testing;
138 ms::SurfaceData surface_state{name, rect, null_change_cb};139 ms::SurfaceData surface_state{name, rect, null_change_cb, false};
139 EXPECT_THAT(1.0f, FloatEq(surface_state.alpha()));140 EXPECT_THAT(1.0f, FloatEq(surface_state.alpha()));
141 EXPECT_FALSE(surface_state.shaped());
140}142}
141143
142TEST_F(SurfaceDataTest, test_surface_apply_rotation)144TEST_F(SurfaceDataTest, test_surface_apply_rotation)
@@ -144,13 +146,13 @@
144 EXPECT_CALL(mock_callback, call())146 EXPECT_CALL(mock_callback, call())
145 .Times(1);147 .Times(1);
146148
147 ms::SurfaceData surface_state{name, rect, mock_change_cb};149 ms::SurfaceData surface_state{name, rect, mock_change_cb, false};
148 surface_state.apply_rotation(60.0f, glm::vec3{0.0f, 0.0f, 1.0f});150 surface_state.apply_rotation(60.0f, glm::vec3{0.0f, 0.0f, 1.0f});
149}151}
150152
151TEST_F(SurfaceDataTest, test_surface_should_be_rendered_in)153TEST_F(SurfaceDataTest, test_surface_should_be_rendered_in)
152{154{
153 ms::SurfaceData surface_state{name, rect, mock_change_cb};155 ms::SurfaceData surface_state{name, rect, mock_change_cb, false};
154 geom::Rectangle output_rect{geom::Point{0,0}, geom::Size{100, 100}};156 geom::Rectangle output_rect{geom::Point{0,0}, geom::Size{100, 100}};
155157
156 //not renderable by default158 //not renderable by default
@@ -179,7 +181,7 @@
179 EXPECT_CALL(mock_callback, call())181 EXPECT_CALL(mock_callback, call())
180 .Times(1);182 .Times(1);
181183
182 ms::SurfaceData surface_state{name, rect, mock_change_cb};184 ms::SurfaceData surface_state{name, rect, mock_change_cb, false};
183 surface_state.set_hidden(true);185 surface_state.set_hidden(true);
184}186}
185187
@@ -189,7 +191,7 @@
189 EXPECT_CALL(mock_callback, call())191 EXPECT_CALL(mock_callback, call())
190 .Times(1);192 .Times(1);
191193
192 ms::SurfaceData surface_state{name, rect, mock_change_cb};194 ms::SurfaceData surface_state{name, rect, mock_change_cb, false};
193 surface_state.frame_posted();195 surface_state.frame_posted();
194}196}
195197
@@ -198,7 +200,7 @@
198{200{
199 geom::Point pt(1,1);201 geom::Point pt(1,1);
200 geom::Size one_by_one{geom::Width{1}, geom::Height{1}};202 geom::Size one_by_one{geom::Width{1}, geom::Height{1}};
201 ms::SurfaceData surface_state{name, geom::Rectangle{pt, one_by_one}, mock_change_cb};203 ms::SurfaceData surface_state{name, geom::Rectangle{pt, one_by_one}, mock_change_cb, false};
202204
203 std::vector<geom::Point> contained_pt205 std::vector<geom::Point> contained_pt
204 {206 {
@@ -230,7 +232,7 @@
230 {{geom::X{1}, geom::Y{1}}, {geom::Width{1}, geom::Height{1}}} //region1232 {{geom::X{1}, geom::Y{1}}, {geom::Width{1}, geom::Height{1}}} //region1
231 };233 };
232234
233 ms::SurfaceData surface_state{name, rect, mock_change_cb};235 ms::SurfaceData surface_state{name, rect, mock_change_cb, false};
234 surface_state.set_input_region(rectangles);236 surface_state.set_input_region(rectangles);
235237
236 std::vector<geom::Point> contained_pt238 std::vector<geom::Point> contained_pt

Subscribers

People subscribed via source and target branches