Mir

Merge lp:~vanvugt/mir/fix-1339471-demoonly into lp:mir

Proposed by Daniel van Vugt
Status: Merged
Approved by: Alexandros Frantzis
Approved revision: no longer in the source branch.
Merged at revision: 1761
Proposed branch: lp:~vanvugt/mir/fix-1339471-demoonly
Merge into: lp:mir
Diff against target: 41 lines (+10/-0)
1 file modified
examples/multiwin.c (+10/-0)
To merge this branch: bzr merge lp:~vanvugt/mir/fix-1339471-demoonly
Reviewer Review Type Date Requested Status
Alexandros Frantzis (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+226259@code.launchpad.net

Commit message

mir_demo_client_multiwin: Premultiply by alpha to produce correctly
composited colours following changes to the blending equation in r1687.
(LP: #1339471)

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'examples/multiwin.c'
--- examples/multiwin.c 2014-03-06 06:05:17 +0000
+++ examples/multiwin.c 2014-07-10 08:44:33 +0000
@@ -44,6 +44,13 @@
44 }44 }
45}45}
4646
47static void premultiply_alpha(Color *c)
48{
49 c->r = (unsigned)c->r * c->a / 255U;
50 c->g = (unsigned)c->g * c->a / 255U;
51 c->b = (unsigned)c->b * c->a / 255U;
52}
53
47static void put_pixels(void *where, int count, MirPixelFormat format,54static void put_pixels(void *where, int count, MirPixelFormat format,
48 const Color *color)55 const Color *color)
49{56{
@@ -187,6 +194,7 @@
187 win[0].fill.g = 0x00;194 win[0].fill.g = 0x00;
188 win[0].fill.b = 0x00;195 win[0].fill.b = 0x00;
189 win[0].fill.a = 0x50;196 win[0].fill.a = 0x50;
197 premultiply_alpha(&win[0].fill);
190198
191 parm.name = "green";199 parm.name = "green";
192 parm.width = 300;200 parm.width = 300;
@@ -196,6 +204,7 @@
196 win[1].fill.g = 0xff;204 win[1].fill.g = 0xff;
197 win[1].fill.b = 0x00;205 win[1].fill.b = 0x00;
198 win[1].fill.a = 0x50;206 win[1].fill.a = 0x50;
207 premultiply_alpha(&win[1].fill);
199208
200 parm.name = "blue";209 parm.name = "blue";
201 parm.width = 150;210 parm.width = 150;
@@ -205,6 +214,7 @@
205 win[2].fill.g = 0x00;214 win[2].fill.g = 0x00;
206 win[2].fill.b = 0xff;215 win[2].fill.b = 0xff;
207 win[2].fill.a = 0x50;216 win[2].fill.a = 0x50;
217 premultiply_alpha(&win[2].fill);
208218
209 signal(SIGINT, shutdown);219 signal(SIGINT, shutdown);
210 signal(SIGTERM, shutdown);220 signal(SIGTERM, shutdown);

Subscribers

People subscribed via source and target branches