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
1=== modified file 'examples/multiwin.c'
2--- examples/multiwin.c 2014-03-06 06:05:17 +0000
3+++ examples/multiwin.c 2014-07-10 08:44:33 +0000
4@@ -44,6 +44,13 @@
5 }
6 }
7
8+static void premultiply_alpha(Color *c)
9+{
10+ c->r = (unsigned)c->r * c->a / 255U;
11+ c->g = (unsigned)c->g * c->a / 255U;
12+ c->b = (unsigned)c->b * c->a / 255U;
13+}
14+
15 static void put_pixels(void *where, int count, MirPixelFormat format,
16 const Color *color)
17 {
18@@ -187,6 +194,7 @@
19 win[0].fill.g = 0x00;
20 win[0].fill.b = 0x00;
21 win[0].fill.a = 0x50;
22+ premultiply_alpha(&win[0].fill);
23
24 parm.name = "green";
25 parm.width = 300;
26@@ -196,6 +204,7 @@
27 win[1].fill.g = 0xff;
28 win[1].fill.b = 0x00;
29 win[1].fill.a = 0x50;
30+ premultiply_alpha(&win[1].fill);
31
32 parm.name = "blue";
33 parm.width = 150;
34@@ -205,6 +214,7 @@
35 win[2].fill.g = 0x00;
36 win[2].fill.b = 0xff;
37 win[2].fill.a = 0x50;
38+ premultiply_alpha(&win[2].fill);
39
40 signal(SIGINT, shutdown);
41 signal(SIGTERM, shutdown);

Subscribers

People subscribed via source and target branches