Merge lp:~3v1n0/unity/scale-window-glow into lp:unity
- scale-window-glow
- Merge into trunk
Proposed by
Marco Trevisan (Treviño)
Status: | Merged |
---|---|
Approved by: | Marco Trevisan (Treviño) |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2776 |
Proposed branch: | lp:~3v1n0/unity/scale-window-glow |
Merge into: | lp:unity |
Diff against target: |
836 lines (+722/-12) 5 files modified
plugins/unityshell/src/glow_texture.h (+204/-0) plugins/unityshell/src/unityshell.cpp (+33/-11) plugins/unityshell/src/unityshell.h (+8/-1) plugins/unityshell/src/unityshell_glow.cpp (+406/-0) plugins/unityshell/src/unityshell_glow.h (+71/-0) |
To merge this branch: | bzr merge lp:~3v1n0/unity/scale-window-glow |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
John Lea (community) | design | Approve | |
Andrea Azzarone (community) | Approve | ||
Review via email: mp+126675@code.launchpad.net |
Commit message
UnityWindow: add glow drawing support and draw it around the scale selected window
Description of the change
Add glow border to the selected window in scale, as the spread design doc shows: http://
To get that I've added the glow texture and painting facilities coming from the compiz group plugin.
Screenshot: http://
To post a comment you must log in.
Revision history for this message
John Lea (johnlea) : | # |
review:
Approve
(design)
Revision history for this message
Unity Merger (unity-merger) wrote : | # |
The Jenkins job https:/
Not merging it.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'plugins/unityshell/src/glow_texture.h' |
2 | --- plugins/unityshell/src/glow_texture.h 1970-01-01 00:00:00 +0000 |
3 | +++ plugins/unityshell/src/glow_texture.h 2012-09-28 09:43:23 +0000 |
4 | @@ -0,0 +1,204 @@ |
5 | +/** |
6 | + * |
7 | + * |
8 | + * Copyright : (C) 2006-2010 by Patrick Niklaus, Roi Cohen, |
9 | + * Danny Baumann, Sam Spilsbury |
10 | + * Authors: Patrick Niklaus <patrick.niklaus@googlemail.com> |
11 | + * Roi Cohen <roico.beryl@gmail.com> |
12 | + * Danny Baumann <maniac@opencompositing.org> |
13 | + * Sam Spilsbury <smspillaz@gmail.com> |
14 | + * |
15 | + * |
16 | + * This program is free software; you can redistribute it and/or |
17 | + * modify it under the terms of the GNU General Public License |
18 | + * as published by the Free Software Foundation; either version 2 |
19 | + * of the License, or (at your option) any later version. |
20 | + * |
21 | + * This program is distributed in the hope that it will be useful, |
22 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
24 | + * GNU General Public License for more details. |
25 | + * |
26 | + **/ |
27 | + |
28 | +#ifndef UNITY_TEXTURE_GLOW_H |
29 | +#define UNITY_TEXTURE_GLOW_H |
30 | + |
31 | +namespace unity |
32 | +{ |
33 | +namespace texture |
34 | +{ |
35 | + |
36 | +/* |
37 | + * glowTex |
38 | + */ |
39 | + |
40 | +const unsigned GLOW_SIZE = 32; |
41 | +const int GLOW_OFFSET = 21; |
42 | +const char GLOW[4097] = { |
43 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
44 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
45 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377" |
46 | + "\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377" |
47 | + "\377\6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
48 | + "\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\6\377\377\377\6\377\377" |
49 | + "\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377" |
50 | + "\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6" |
51 | + "\377\377\377\14\377\377\377\14\377\377\377\14\377\377\377\14\377\377\377" |
52 | + "\14\377\377\377\14\377\377\377\14\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
53 | + "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\14" |
54 | + "\377\377\377\14\377\377\377\22\377\377\377\22\377\377\377\22\377\377\377" |
55 | + "\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377" |
56 | + "\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377" |
57 | + "\35\377\377\377\35\377\377\377\35\377\377\377\35\377\377\377\35\377\377\377" |
58 | + "\35\377\377\377\35\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377" |
59 | + "\377\6\377\377\377\6\377\377\377\14\377\377\377\22\377\377\377\27\377\377" |
60 | + "\377\27\377\377\377\35\377\377\377#\377\377\377'\377\377\377'\377\377\377" |
61 | + "+\377\377\377+\377\377\377+\377\377\377+\377\377\377+\377\377\377+\377\377" |
62 | + "\377+\377\377\377+\377\377\377+\377\377\3771\377\377\3771\377\377\3771\377" |
63 | + "\377\3771\377\377\3771\377\377\3771\377\377\3771\0\0\0\0\0\0\0\0\0\0\0\0" |
64 | + "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\22\377\377\377" |
65 | + "\27\377\377\377\35\377\377\377#\377\377\377+\377\377\3771\377\377\3776\377" |
66 | + "\377\377<\377\377\377>\377\377\377C\377\377\377I\377\377\377I\377\377\377" |
67 | + "I\377\377\377I\377\377\377I\377\377\377I\377\377\377I\377\377\377I\377\377" |
68 | + "\377L\377\377\377L\377\377\377L\377\377\377L\377\377\377L\377\377\377L\377" |
69 | + "\377\377L\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377" |
70 | + "\377\377\22\377\377\377\27\377\377\377#\377\377\377+\377\377\3776\377\377" |
71 | + "\377C\377\377\377L\377\377\377U\377\377\377]\377\377\377`\377\377\377d\377" |
72 | + "\377\377h\377\377\377k\377\377\377k\377\377\377k\377\377\377k\377\377\377" |
73 | + "k\377\377\377k\377\377\377k\377\377\377p\377\377\377p\377\377\377p\377\377" |
74 | + "\377p\377\377\377p\377\377\377p\377\377\377p\0\0\0\0\0\0\0\0\0\0\0\0\377" |
75 | + "\377\377\6\377\377\377\14\377\377\377\22\314\314\314\35\377\377\377'\377" |
76 | + "\377\3771\377\377\377>\357\357\357P\377\377\377]\363\363\363k\365\365\365" |
77 | + "v\365\365\365|\377\377\377\202\367\367\367\210\367\367\367\214\367\367\367" |
78 | + "\216\367\367\367\221\367\367\367\221\367\367\367\221\367\367\367\221\367" |
79 | + "\367\367\221\367\367\367\221\367\367\367\224\367\367\367\224\367\367\367" |
80 | + "\224\367\367\367\224\367\367\367\224\367\367\367\224\367\367\367\224\0\0" |
81 | + "\0\0\0\0\0\0\377\377\377\6\377\377\377\6\377\377\377\22\377\377\377\27\377" |
82 | + "\377\377'\377\377\3776\377\377\377I\377\377\377Y\377\377\377k\376\376\376" |
83 | + "y\377\377\377\210\377\377\377\224\377\377\377\235\377\377\377\245\377\377" |
84 | + "\377\253\377\377\377\255\377\377\377\262\377\377\377\262\377\377\377\263" |
85 | + "\377\377\377\263\377\377\377\263\377\377\377\263\377\377\377\263\377\377" |
86 | + "\377\266\377\377\377\266\377\377\377\266\377\377\377\266\377\377\377\266" |
87 | + "\377\377\377\266\377\377\377\266\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377" |
88 | + "\14\377\377\377\27\377\377\377#\377\377\3771\377\377\377I\377\377\377]\377" |
89 | + "\377\377r\377\377\377\205\377\377\377\231\377\377\377\247\377\377\377\263" |
90 | + "\377\377\377\275\377\377\377\304\377\377\377\310\377\377\377\313\377\377" |
91 | + "\377\316\377\377\377\320\377\377\377\320\377\377\377\320\377\377\377\320" |
92 | + "\377\377\377\320\377\377\377\320\377\377\377\322\377\377\377\322\377\377" |
93 | + "\377\322\377\377\377\322\377\377\377\322\377\377\377\322\377\377\377\322" |
94 | + "\0\0\0\0\377\377\377\6\377\377\377\6\377\377\377\22\377\377\377\35\377\377" |
95 | + "\377+\377\377\377>\377\377\377Y\377\377\377r\377\377\377\210\376\376\376" |
96 | + "\237\377\377\377\262\377\377\377\302\377\377\377\313\377\377\377\324\377" |
97 | + "\377\377\332\376\376\376\336\377\377\377\341\377\377\377\342\377\377\377" |
98 | + "\344\377\377\377\344\377\377\377\344\377\377\377\344\377\377\377\344\377" |
99 | + "\377\377\344\377\377\377\345\377\377\377\345\377\377\377\345\377\377\377" |
100 | + "\345\377\377\377\345\377\377\377\345\377\377\377\345\0\0\0\0\377\377\377" |
101 | + "\6\377\377\377\14\377\377\377\27\377\377\377#\377\377\3776\377\377\377P\377" |
102 | + "\377\377k\377\377\377\205\376\376\376\237\372\372\372\266\377\377\377\307" |
103 | + "\373\373\373\325\373\373\373\337\374\374\374\345\374\374\374\352\374\374" |
104 | + "\374\355\374\374\374\357\374\374\374\360\374\374\374\361\374\374\374\361" |
105 | + "\374\374\374\362\374\374\374\362\374\374\374\362\374\374\374\362\374\374" |
106 | + "\374\362\374\374\374\362\374\374\374\362\374\374\374\362\374\374\374\362" |
107 | + "\374\374\374\362\374\374\374\362\0\0\0\0\377\377\377\6\377\377\377\14\377" |
108 | + "\377\377\35\377\377\377+\377\377\377C\377\377\377]\377\377\377|\377\377\377" |
109 | + "\231\377\377\377\263\377\377\377\307\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
110 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
111 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377" |
112 | + "\377\377\6\377\377\377\22\324\324\324#\377\377\3771\377\377\377L\363\363" |
113 | + "\363k\377\377\377\210\377\377\377\247\377\377\377\302\377\377\377\325\0\0" |
114 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
115 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
116 | + "\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\22\377\377" |
117 | + "\377#\377\377\377<\377\377\377U\377\377\377v\377\377\377\226\377\377\377" |
118 | + "\263\377\377\377\315\377\377\377\337\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
119 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
120 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377" |
121 | + "\6\377\377\377\14\377\377\377\27\377\377\377'\377\377\377>\377\377\377]\377" |
122 | + "\377\377|\370\370\370\237\377\377\377\275\373\373\373\325\377\377\377\345" |
123 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
124 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
125 | + "\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\27\377" |
126 | + "\377\377+\377\377\377C\377\377\377`\377\377\377\202\377\377\377\247\377\377" |
127 | + "\377\304\377\377\377\332\377\377\377\352\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
128 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
129 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377" |
130 | + "\377\6\377\377\377\14\377\377\377\27\377\377\377+\377\377\377C\377\377\377" |
131 | + "d\377\377\377\210\377\377\377\253\377\377\377\310\376\376\376\336\374\374" |
132 | + "\374\355\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
133 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
134 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377" |
135 | + "\35\377\377\377+\377\377\377I\377\377\377h\377\377\377\214\377\377\377\260" |
136 | + "\377\377\377\313\374\374\374\342\374\374\374\357\0\0\0\0\0\0\0\0\0\0\0\0" |
137 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
138 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
139 | + "\377\377\377\6\377\377\377\14\377\377\377\35\342\342\3421\377\377\377I\377" |
140 | + "\377\377k\377\377\377\216\377\377\377\262\377\377\377\316\374\374\374\344" |
141 | + "\377\377\377\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
142 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
143 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377" |
144 | + "\377\377\35\377\377\3771\377\377\377L\377\377\377k\377\377\377\221\377\377" |
145 | + "\377\263\377\377\377\320\377\377\377\344\377\377\377\361\0\0\0\0\0\0\0\0" |
146 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
147 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
148 | + "\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377" |
149 | + "\377L\377\377\377k\377\377\377\221\377\377\377\263\377\377\377\320\377\377" |
150 | + "\377\344\374\374\374\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
151 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
152 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377" |
153 | + "\14\377\377\377\35\377\377\3771\377\377\377L\364\364\364p\377\377\377\221" |
154 | + "\372\372\372\266\377\377\377\320\374\374\374\345\377\377\377\362\0\0\0\0" |
155 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
156 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
157 | + "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\377" |
158 | + "1\377\377\377L\377\377\377p\377\377\377\221\377\377\377\266\373\373\373\322" |
159 | + "\377\377\377\345\377\377\377\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
160 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
161 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377" |
162 | + "\377\377\14\377\377\377\35\377\377\3771\377\377\377L\377\377\377p\377\377" |
163 | + "\377\221\377\377\377\266\373\373\373\322\377\377\377\345\377\377\377\362" |
164 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
165 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
166 | + "\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377" |
167 | + "\377\3771\377\377\377L\377\377\377p\377\377\377\221\377\377\377\266\373\373" |
168 | + "\373\322\377\377\377\345\377\377\377\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
169 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
170 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377" |
171 | + "\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377\377L\377\377\377" |
172 | + "p\367\367\367\224\377\377\377\266\377\377\377\322\377\377\377\345\374\374" |
173 | + "\374\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
174 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
175 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377" |
176 | + "\35\377\377\3771\377\377\377L\377\377\377p\367\367\367\224\377\377\377\266" |
177 | + "\377\377\377\322\377\377\377\345\374\374\374\362\0\0\0\0\0\0\0\0\0\0\0\0" |
178 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
179 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
180 | + "\377\377\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377\377L\377" |
181 | + "\377\377p\367\367\367\224\377\377\377\266\377\377\377\322\377\377\377\345" |
182 | + "\374\374\374\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
183 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
184 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377" |
185 | + "\377\377\35\377\377\3771\377\377\377L\377\377\377p\367\367\367\224\377\377" |
186 | + "\377\266\377\377\377\322\377\377\377\345\374\374\374\362\0\0\0\0\0\0\0\0" |
187 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
188 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
189 | + "\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377" |
190 | + "\377L\377\377\377p\367\367\367\224\377\377\377\266\377\377\377\322\377\377" |
191 | + "\377\345\374\374\374\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
192 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
193 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377" |
194 | + "\14\377\377\377\35\377\377\3771\377\377\377L\377\377\377p\367\367\367\224" |
195 | + "\377\377\377\266\377\377\377\322\377\377\377\345\374\374\374\362\0\0\0\0" |
196 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
197 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
198 | + "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\377" |
199 | + "1\377\377\377L\377\377\377p\367\367\367\224\377\377\377\266\377\377\377\322" |
200 | + "\377\377\377\345\374\374\374\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
201 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
202 | + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", |
203 | +}; |
204 | + |
205 | +} // Namespace texture |
206 | +} // Namespace unity |
207 | + |
208 | +#endif |
209 | |
210 | === modified file 'plugins/unityshell/src/unityshell.cpp' |
211 | --- plugins/unityshell/src/unityshell.cpp 2012-09-27 08:37:12 +0000 |
212 | +++ plugins/unityshell/src/unityshell.cpp 2012-09-28 09:43:23 +0000 |
213 | @@ -38,6 +38,7 @@ |
214 | #include "StartupNotifyService.h" |
215 | #include "Timer.h" |
216 | #include "KeyboardUtil.h" |
217 | +#include "glow_texture.h" |
218 | #include "unityshell.h" |
219 | #include "BackgroundEffectHelper.h" |
220 | #include "UnityGestureBroker.h" |
221 | @@ -105,6 +106,19 @@ |
222 | |
223 | const std::string RELAYOUT_TIMEOUT = "relayout-timeout"; |
224 | } // namespace local |
225 | + |
226 | +namespace scale |
227 | +{ |
228 | +namespace decoration |
229 | +{ |
230 | +const unsigned CLOSE_SIZE = 19; |
231 | +const unsigned ITEMS_PADDING = 5; |
232 | +const unsigned RADIUS = 8; |
233 | +const unsigned GLOW = 20; |
234 | +const nux::Color GLOW_COLOR(221, 72, 20); |
235 | +} // decoration namespace |
236 | +} // scale namespace |
237 | + |
238 | } // anon namespace |
239 | |
240 | UnityScreen::UnityScreen(CompScreen* screen) |
241 | @@ -2477,6 +2491,15 @@ |
242 | uScreen->paintPanelShadow(region); |
243 | } |
244 | |
245 | + if (WindowManager::Default()->IsScaleActive() && ScaleScreen::get(screen)->getSelectedWindow() == window->id()) |
246 | + { |
247 | + if (!region.isEmpty()) |
248 | + { |
249 | + double scale = ScaleWindow::get(window)->getCurrentPosition().scale; |
250 | + glow::Quads const& quads = computeGlowQuads(glow_texture_, scale::decoration::GLOW, scale); |
251 | + paintGlow(matrix, attrib, region, quads, glow_texture_, scale::decoration::GLOW_COLOR, mask); |
252 | + } |
253 | + } |
254 | |
255 | return ret; |
256 | } |
257 | @@ -3386,16 +3409,7 @@ |
258 | GLTexture::List UnityWindow::close_normal_tex_; |
259 | GLTexture::List UnityWindow::close_prelight_tex_; |
260 | GLTexture::List UnityWindow::close_pressed_tex_; |
261 | - |
262 | -namespace scale |
263 | -{ |
264 | -namespace decoration |
265 | -{ |
266 | -const unsigned CLOSE_SIZE = 19; |
267 | -const unsigned ITEMS_PADDING = 5; |
268 | -const unsigned RADIUS = 8; |
269 | -} |
270 | -} |
271 | +GLTexture::List UnityWindow::glow_texture_; |
272 | |
273 | struct UnityWindow::CairoContext |
274 | { |
275 | @@ -3674,10 +3688,10 @@ |
276 | if (!texture.empty()) |
277 | return; |
278 | |
279 | + CompString plugin("unityshell"); |
280 | auto& style = panel::Style::Instance(); |
281 | auto const& files = style.GetWindowButtonFileNames(panel::WindowButtonType::CLOSE, state); |
282 | |
283 | - CompString plugin("unityshell"); |
284 | for (std::string const& file : files) |
285 | { |
286 | CompString file_name = file; |
287 | @@ -3706,6 +3720,12 @@ |
288 | LoadCloseIcon(panel::WindowState::NORMAL, close_normal_tex_); |
289 | LoadCloseIcon(panel::WindowState::PRELIGHT, close_prelight_tex_); |
290 | LoadCloseIcon(panel::WindowState::PRESSED, close_pressed_tex_); |
291 | + |
292 | + if (glow_texture_.empty()) |
293 | + { |
294 | + CompSize size(texture::GLOW_SIZE, texture::GLOW_SIZE); |
295 | + glow_texture_ = GLTexture::imageDataToTexture(texture::GLOW, size, GL_RGBA, GL_UNSIGNED_BYTE); |
296 | + } |
297 | } |
298 | |
299 | void UnityWindow::CleanupSharedTextures() |
300 | @@ -3713,6 +3733,7 @@ |
301 | close_normal_tex_.clear(); |
302 | close_prelight_tex_.clear(); |
303 | close_pressed_tex_.clear(); |
304 | + glow_texture_.clear(); |
305 | } |
306 | |
307 | void UnityWindow::CleanupCachedTextures() |
308 | @@ -3874,6 +3895,7 @@ |
309 | PluginAdapter::Default ()->OnWindowClosed(window); |
310 | } |
311 | |
312 | + |
313 | /* vtable init */ |
314 | bool UnityPluginVTable::init() |
315 | { |
316 | |
317 | === modified file 'plugins/unityshell/src/unityshell.h' |
318 | --- plugins/unityshell/src/unityshell.h 2012-09-24 18:30:57 +0000 |
319 | +++ plugins/unityshell/src/unityshell.h 2012-09-28 09:43:23 +0000 |
320 | @@ -64,6 +64,8 @@ |
321 | #include "HudController.h" |
322 | #include "WindowMinimizeSpeedController.h" |
323 | |
324 | +#include "unityshell_glow.h" |
325 | + |
326 | namespace unity |
327 | { |
328 | |
329 | @@ -442,7 +444,11 @@ |
330 | void RenderDecoration(CairoContext const&, double aspect = 1.0f); |
331 | void RenderText(CairoContext const&, int x, int y, int width, int height); |
332 | void DrawTexture(GLTexture::List const& textures, GLWindowPaintAttrib const&, |
333 | - GLMatrix const&, unsigned mask, int x, int y, double scale = 1.0f); |
334 | + GLMatrix const&, unsigned mask, int x, int y, double aspect = 1.0f); |
335 | + |
336 | + glow::Quads computeGlowQuads(GLTexture::List const& texture, int glow_size, double window_aspect = 1.0f); |
337 | + void paintGlow(GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, |
338 | + glow::Quads const&, GLTexture::List const&, nux::Color const&, unsigned mask); |
339 | |
340 | void BuildDecorationTexture(); |
341 | void CleanupCachedTextures(); |
342 | @@ -458,6 +464,7 @@ |
343 | static GLTexture::List close_normal_tex_; |
344 | static GLTexture::List close_prelight_tex_; |
345 | static GLTexture::List close_pressed_tex_; |
346 | + static GLTexture::List glow_texture_; |
347 | GLTexture::List decoration_tex_; |
348 | GLTexture::List decoration_selected_tex_; |
349 | std::string decoration_title_; |
350 | |
351 | === added file 'plugins/unityshell/src/unityshell_glow.cpp' |
352 | --- plugins/unityshell/src/unityshell_glow.cpp 1970-01-01 00:00:00 +0000 |
353 | +++ plugins/unityshell/src/unityshell_glow.cpp 2012-09-28 09:43:23 +0000 |
354 | @@ -0,0 +1,406 @@ |
355 | +/** |
356 | + * Copyright : (C) 2006-2012 by Patrick Niklaus, Roi Cohen, |
357 | + * Danny Baumann, Sam Spilsbury |
358 | + * Authors: Patrick Niklaus <patrick.niklaus@googlemail.com> |
359 | + * Roi Cohen <roico.beryl@gmail.com> |
360 | + * Danny Baumann <maniac@opencompositing.org> |
361 | + * Sam Spilsbury <smspillaz@gmail.com> |
362 | + * Marco Trevisan <marco.trevisan@canonical.com> |
363 | + * |
364 | + * |
365 | + * This program is free software; you can redistribute it and/or |
366 | + * modify it under the terms of the GNU General Public License |
367 | + * as published by the Free Software Foundation; either version 2 |
368 | + * of the License, or (at your option) any later version. |
369 | + * |
370 | + * This program is distributed in the hope that it will be useful, |
371 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
372 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
373 | + * GNU General Public License for more details. |
374 | + * |
375 | + **/ |
376 | + |
377 | +#include <Nux/Nux.h> |
378 | +#include "unityshell.h" |
379 | +#include "glow_texture.h" |
380 | +#include "unityshell_glow.h" |
381 | + |
382 | +namespace unity |
383 | +{ |
384 | + |
385 | +/* |
386 | + * UnityWindow::paintGlow |
387 | + * |
388 | + * Takes our glow texture, stretches the appropriate positions in the glow texture, |
389 | + * adds those geometries (so plugins like wobby and deform this texture correctly) |
390 | + * and then draws the glow texture with this geometry (plugins like wobbly and friends |
391 | + * will automatically deform the texture based on our set geometry) |
392 | + */ |
393 | + |
394 | +void |
395 | +UnityWindow::paintGlow(GLMatrix const& transform, GLWindowPaintAttrib const& attrib, |
396 | + CompRegion const& paintRegion, glow::Quads const& glow_quads, |
397 | + GLTexture::List const& outline_texture, nux::Color const& color, |
398 | + unsigned mask) |
399 | +{ |
400 | + GLushort colorData[4]; |
401 | + colorData[0] = color.red * 0xffff; |
402 | + colorData[1] = color.green * 0xffff; |
403 | + colorData[2] = color.blue * 0xffff; |
404 | + colorData[3] = color.alpha * 0xffff; |
405 | + |
406 | + gWindow->vertexBuffer()->begin (); |
407 | + |
408 | + /* There are 8 glow parts of the glow texture which we wish to paint |
409 | + * separately with different transformations |
410 | + */ |
411 | + for (unsigned i = 0; i < unsigned(glow::QuadPos::LAST); ++i) |
412 | + { |
413 | + /* Using precalculated quads here */ |
414 | + glow::Quads::Quad const& quad = glow_quads[static_cast<glow::QuadPos>(i)]; |
415 | + CompRegion reg(quad.box); |
416 | + |
417 | + if (reg.boundingRect().x1() < reg.boundingRect().x2() && |
418 | + reg.boundingRect().y1() < reg.boundingRect().y2()) |
419 | + { |
420 | + GLTexture::MatrixList matl; |
421 | + reg = CompRegion(reg.boundingRect().x1(), reg.boundingRect().y1(), |
422 | + reg.boundingRect().width(), reg.boundingRect().height()); |
423 | + |
424 | + matl.push_back(quad.matrix); |
425 | + |
426 | + /* Add color data for all 6 vertices of the quad */ |
427 | + for (int n = 0; n < 6; n++) |
428 | + gWindow->vertexBuffer()->addColors(1, colorData); |
429 | + |
430 | + gWindow->glAddGeometry(matl, reg, reg); |
431 | + } |
432 | + } |
433 | + |
434 | + if (gWindow->vertexBuffer()->end()) |
435 | + { |
436 | + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
437 | + |
438 | + /* we use PAINT_WINDOW_TRANSFORMED_MASK here to force |
439 | + the usage of a good texture filter */ |
440 | + for (GLTexture *tex : outline_texture) |
441 | + { |
442 | + mask |= PAINT_WINDOW_BLEND_MASK | PAINT_WINDOW_TRANSLUCENT_MASK | PAINT_WINDOW_TRANSFORMED_MASK; |
443 | + gWindow->glDrawTexture(tex, transform, attrib, mask); |
444 | + } |
445 | + |
446 | + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
447 | + GLScreen::get(screen)->setTexEnvMode (GL_REPLACE); |
448 | + } |
449 | +} |
450 | + |
451 | +/* |
452 | + * UnityWindow::computeGlowQuads |
453 | + * |
454 | + * This function computures the matrix transformation required for each |
455 | + * part of the glow texture which we wish to stretch to some rectangular |
456 | + * dimentions |
457 | + * |
458 | + * There are eight quads different parts of the texture which we wish to |
459 | + * paint here, the 4 sides and four corners, eg: |
460 | + * |
461 | + * ------------------ |
462 | + * | 1 | 4 | 6 | |
463 | + * ------------- ------------------ |
464 | + * | 1 | 4 | 6 | | | | | |
465 | + * ------------- | | | | |
466 | + * | 2 | n | 7 | -> | 2 | n | 7 | |
467 | + * ------------- | | | | |
468 | + * | 3 | 5 | 8 | | | | | |
469 | + * ------------- ------------------ |
470 | + * | 3 | 5 | 8 | |
471 | + * ------------------ |
472 | + * |
473 | + * In this example here, 2, 4, 5 and 7 are stretched, and the matrices for |
474 | + * each quad rect adjusted accordingly for it's size compared to the original |
475 | + * texture size. |
476 | + * |
477 | + * When we are adjusting the matrices here, the initial size of each corner has |
478 | + * a size of of "1.0f", so according to 2x2 matrix rules, |
479 | + * while you will see here that matrix->xx is (1 / glowSize) |
480 | + * where glowSize is the size the user specifies they want their glow to extend. |
481 | + * (likewise, matrix->yy is adjusted similarly for corners and for top/bottom) |
482 | + * |
483 | + * matrix->x0 and matrix->y0 here are set to be the top left edge of the rect |
484 | + * adjusted by the matrix scale factor (matrix->xx and matrix->yy) |
485 | + * |
486 | + */ |
487 | +glow::Quads UnityWindow::computeGlowQuads(GLTexture::List const& texture, int glow_size, double window_aspect) |
488 | +{ |
489 | + glow::Quads glow_quads; |
490 | + |
491 | + if (texture.empty()) |
492 | + return glow_quads; |
493 | + |
494 | + int x1, x2, y1, y2; |
495 | + int glow_offset; |
496 | + CompRect const& border_rect = window->borderRect(); |
497 | + GLTexture::Matrix const& matrix = texture.front()->matrix(); |
498 | + |
499 | + CompRect *box; |
500 | + GLTexture::Matrix *quadMatrix; |
501 | + |
502 | + glow_size /= window_aspect; |
503 | + glow_offset = (glow_size * texture::GLOW_OFFSET / texture::GLOW_SIZE) + 1; |
504 | + |
505 | + /* Top left corner */ |
506 | + box = &glow_quads[glow::QuadPos::TOPLEFT].box; |
507 | + glow_quads[glow::QuadPos::TOPLEFT].matrix = matrix; |
508 | + quadMatrix = &glow_quads[glow::QuadPos::TOPLEFT].matrix; |
509 | + |
510 | + /* Set the desired rect dimentions |
511 | + * for the part of the glow we are painting */ |
512 | + |
513 | + x1 = border_rect.x() - glow_size + glow_offset; |
514 | + y1 = border_rect.y() - glow_size + glow_offset; |
515 | + |
516 | + /* 2x2 Matrix here, adjust both x and y scale factors |
517 | + * and the x and y position |
518 | + * |
519 | + * Scaling both parts of the texture in a positive direction |
520 | + * here (left to right top to bottom) |
521 | + * |
522 | + * The base position (x0 and y0) here requires us to move backwards |
523 | + * on the x and y dimentions by the calculated rect dimentions |
524 | + * multiplied by the scale factors |
525 | + */ |
526 | + |
527 | + quadMatrix->xx = 1.0f / glow_size; |
528 | + quadMatrix->yy = 1.0f / glow_size; |
529 | + quadMatrix->x0 = -(x1 * quadMatrix->xx); |
530 | + quadMatrix->y0 = -(y1 * quadMatrix->yy); |
531 | + |
532 | + x2 = std::min<int>(border_rect.x() + glow_offset, |
533 | + border_rect.x() + (border_rect.width() / 2)); |
534 | + y2 = std::min<int>(border_rect.y() + glow_offset, |
535 | + border_rect.y() + (border_rect.height() / 2)); |
536 | + |
537 | + box->setGeometry(x1, y1, x2 - x1, y2 - y1); |
538 | + |
539 | + /* Top right corner */ |
540 | + box = &glow_quads[glow::QuadPos::TOPRIGHT].box; |
541 | + glow_quads[glow::QuadPos::TOPRIGHT].matrix = matrix; |
542 | + quadMatrix = &glow_quads[glow::QuadPos::TOPRIGHT].matrix; |
543 | + |
544 | + /* Set the desired rect dimentions |
545 | + * for the part of the glow we are painting */ |
546 | + |
547 | + x1 = border_rect.x() + border_rect.width() - glow_offset; |
548 | + y1 = border_rect.y() - glow_size + glow_offset; |
549 | + x2 = border_rect.x() + border_rect.width() + glow_size - glow_offset; |
550 | + |
551 | + /* |
552 | + * 2x2 Matrix here, adjust both x and y scale factors |
553 | + * and the x and y position |
554 | + * |
555 | + * Scaling the y part of the texture in a positive direction |
556 | + * and the x part in a negative direction here |
557 | + * (right to left top to bottom) |
558 | + * |
559 | + * The base position (x0 and y0) here requires us to move backwards |
560 | + * on the y dimention and forwards on x by the calculated rect dimentions |
561 | + * multiplied by the scale factors (since we are moving forward on x we |
562 | + * need the inverse of that which is 1 - x1 * xx |
563 | + */ |
564 | + |
565 | + quadMatrix->xx = -1.0f / glow_size; |
566 | + quadMatrix->yy = 1.0f / glow_size; |
567 | + quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx); |
568 | + quadMatrix->y0 = -(y1 * quadMatrix->yy); |
569 | + |
570 | + x1 = std::max<int>(border_rect.x() + border_rect.width() - glow_offset, |
571 | + border_rect.x() + (border_rect.width() / 2)); |
572 | + y2 = std::min<int>(border_rect.y() + glow_offset, |
573 | + border_rect.y() + (border_rect.height() / 2)); |
574 | + |
575 | + box->setGeometry(x1, y1, x2 - x1, y2 - y1); |
576 | + |
577 | + /* Bottom left corner */ |
578 | + box = &glow_quads[glow::QuadPos::BOTTOMLEFT].box; |
579 | + glow_quads[glow::QuadPos::BOTTOMLEFT].matrix = matrix; |
580 | + quadMatrix = &glow_quads[glow::QuadPos::BOTTOMLEFT].matrix; |
581 | + |
582 | + x1 = border_rect.x() - glow_size + glow_offset; |
583 | + y1 = border_rect.y() + border_rect.height() - glow_offset; |
584 | + x2 = border_rect.x() + glow_offset; |
585 | + y2 = border_rect.y() + border_rect.height() + glow_size - glow_offset; |
586 | + |
587 | + /* 2x2 Matrix here, adjust both x and y scale factors |
588 | + * and the x and y position |
589 | + * |
590 | + * Scaling the x part of the texture in a positive direction |
591 | + * and the y part in a negative direction here |
592 | + * (left to right bottom to top) |
593 | + * |
594 | + * The base position (x0 and y0) here requires us to move backwards |
595 | + * on the x dimention and forwards on y by the calculated rect dimentions |
596 | + * multiplied by the scale factors (since we are moving forward on x we |
597 | + * need the inverse of that which is 1 - y1 * yy |
598 | + */ |
599 | + |
600 | + quadMatrix->xx = 1.0f / glow_size; |
601 | + quadMatrix->yy = -1.0f / glow_size; |
602 | + quadMatrix->x0 = -(x1 * quadMatrix->xx); |
603 | + quadMatrix->y0 = 1.0f - (y1 * quadMatrix->yy); |
604 | + |
605 | + y1 = std::max<int>(border_rect.y() + border_rect.height() - glow_offset, |
606 | + border_rect.y() + (border_rect.height() / 2)); |
607 | + x2 = std::min<int>(border_rect.x() + glow_offset, |
608 | + border_rect.x() + (border_rect.width() / 2)); |
609 | + |
610 | + box->setGeometry(x1, y1, x2 - x1, y2 - y1); |
611 | + |
612 | + /* Bottom right corner */ |
613 | + box = &glow_quads[glow::QuadPos::BOTTOMRIGHT].box; |
614 | + glow_quads[glow::QuadPos::BOTTOMRIGHT].matrix = matrix; |
615 | + quadMatrix = &glow_quads[glow::QuadPos::BOTTOMRIGHT].matrix; |
616 | + |
617 | + x1 = border_rect.x() + border_rect.width() - glow_offset; |
618 | + y1 = border_rect.y() + border_rect.height() - glow_offset; |
619 | + x2 = border_rect.x() + border_rect.width() + glow_size - glow_offset; |
620 | + y2 = border_rect.y() + border_rect.height() + glow_size - glow_offset; |
621 | + |
622 | + /* 2x2 Matrix here, adjust both x and y scale factors |
623 | + * and the x and y position |
624 | + * |
625 | + * Scaling the both parts of the texture in a negative direction |
626 | + * (right to left bottom to top) |
627 | + * |
628 | + * The base position (x0 and y0) here requires us to move forwards |
629 | + * on both dimentions by the calculated rect dimentions |
630 | + * multiplied by the scale factors |
631 | + */ |
632 | + |
633 | + quadMatrix->xx = -1.0f / glow_size; |
634 | + quadMatrix->yy = -1.0f / glow_size; |
635 | + quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx); |
636 | + quadMatrix->y0 = 1.0 - (y1 * quadMatrix->yy); |
637 | + |
638 | + x1 = std::max<int>(border_rect.x() + border_rect.width() - glow_offset, |
639 | + border_rect.x() + (border_rect.width() / 2)); |
640 | + y1 = std::max<int>(border_rect.y() + border_rect.height() - glow_offset, |
641 | + border_rect.y() + (border_rect.height() / 2)); |
642 | + |
643 | + box->setGeometry(x1, y1, x2 - x1, y2 - y1); |
644 | + |
645 | + /* Top edge */ |
646 | + box = &glow_quads[glow::QuadPos::TOP].box; |
647 | + glow_quads[glow::QuadPos::TOP].matrix = matrix; |
648 | + quadMatrix = &glow_quads[glow::QuadPos::TOP].matrix; |
649 | + |
650 | + x1 = border_rect.x() + glow_offset; |
651 | + y1 = border_rect.y() - glow_size + glow_offset; |
652 | + x2 = border_rect.x() + border_rect.width() - glow_offset; |
653 | + y2 = border_rect.y() + glow_offset; |
654 | + |
655 | + /* 2x2 Matrix here, adjust both x and y scale factors |
656 | + * and the x and y position |
657 | + * |
658 | + * No need to scale the x part of the texture here, but we |
659 | + * are scaling on the y part in a positive direciton |
660 | + * |
661 | + * The base position (y0) here requires us to move backwards |
662 | + * on the x dimention and forwards on y by the calculated rect dimentions |
663 | + * multiplied by the scale factors |
664 | + */ |
665 | + |
666 | + quadMatrix->xx = 0.0f; |
667 | + quadMatrix->yy = 1.0f / glow_size; |
668 | + quadMatrix->x0 = 1.0; |
669 | + quadMatrix->y0 = -(y1 * quadMatrix->yy); |
670 | + |
671 | + box->setGeometry(x1, y1, x2 - x1, y2 - y1); |
672 | + |
673 | + /* Bottom edge */ |
674 | + box = &glow_quads[glow::QuadPos::BOTTOM].box; |
675 | + glow_quads[glow::QuadPos::BOTTOM].matrix = matrix; |
676 | + quadMatrix = &glow_quads[glow::QuadPos::BOTTOM].matrix; |
677 | + |
678 | + x1 = border_rect.x() + glow_offset; |
679 | + y1 = border_rect.y() + border_rect.height() - glow_offset; |
680 | + x2 = border_rect.x() + border_rect.width() - glow_offset; |
681 | + y2 = border_rect.y() + border_rect.height() + glow_size - glow_offset; |
682 | + |
683 | + /* 2x2 Matrix here, adjust both x and y scale factors |
684 | + * and the x and y position |
685 | + * |
686 | + * No need to scale the x part of the texture here, but we |
687 | + * are scaling on the y part in a negative direciton |
688 | + * |
689 | + * The base position (y0) here requires us to move forwards |
690 | + * on y by the calculated rect dimentions |
691 | + * multiplied by the scale factors |
692 | + */ |
693 | + |
694 | + quadMatrix->xx = 0.0f; |
695 | + quadMatrix->yy = -1.0f / glow_size; |
696 | + quadMatrix->x0 = 1.0; |
697 | + quadMatrix->y0 = 1.0 - (y1 * quadMatrix->yy); |
698 | + |
699 | + box->setGeometry(x1, y1, x2 - x1, y2 - y1); |
700 | + |
701 | + /* Left edge */ |
702 | + box = &glow_quads[glow::QuadPos::LEFT].box; |
703 | + glow_quads[glow::QuadPos::LEFT].matrix = matrix; |
704 | + quadMatrix = &glow_quads[glow::QuadPos::LEFT].matrix; |
705 | + |
706 | + x1 = border_rect.x() - glow_size + glow_offset; |
707 | + y1 = border_rect.y() + glow_offset; |
708 | + x2 = border_rect.x() + glow_offset; |
709 | + y2 = border_rect.y() + border_rect.height() - glow_offset; |
710 | + |
711 | + /* 2x2 Matrix here, adjust both x and y scale factors |
712 | + * and the x and y position |
713 | + * |
714 | + * No need to scale the y part of the texture here, but we |
715 | + * are scaling on the x part in a positive direciton |
716 | + * |
717 | + * The base position (x0) here requires us to move backwards |
718 | + * on x by the calculated rect dimentions |
719 | + * multiplied by the scale factors |
720 | + */ |
721 | + |
722 | + quadMatrix->xx = 1.0f / glow_size; |
723 | + quadMatrix->yy = 0.0f; |
724 | + quadMatrix->x0 = -(x1 * quadMatrix->xx); |
725 | + quadMatrix->y0 = 1.0; |
726 | + |
727 | + box->setGeometry(x1, y1, x2 - x1, y2 - y1); |
728 | + |
729 | + /* Right edge */ |
730 | + box = &glow_quads[glow::QuadPos::RIGHT].box; |
731 | + glow_quads[glow::QuadPos::RIGHT].matrix = matrix; |
732 | + quadMatrix = &glow_quads[glow::QuadPos::RIGHT].matrix; |
733 | + |
734 | + x1 = border_rect.x() + border_rect.width() - glow_offset; |
735 | + y1 = border_rect.y() + glow_offset; |
736 | + x2 = border_rect.x() + border_rect.width() + glow_size - glow_offset; |
737 | + y2 = border_rect.y() + border_rect.height() - glow_offset; |
738 | + |
739 | + /* 2x2 Matrix here, adjust both x and y scale factors |
740 | + * and the x and y position |
741 | + * |
742 | + * No need to scale the y part of the texture here, but we |
743 | + * are scaling on the x part in a negative direciton |
744 | + * |
745 | + * The base position (x0) here requires us to move forwards |
746 | + * on x by the calculated rect dimentions |
747 | + * multiplied by the scale factors |
748 | + */ |
749 | + |
750 | + quadMatrix->xx = -1.0f / glow_size; |
751 | + quadMatrix->yy = 0.0f; |
752 | + quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx); |
753 | + quadMatrix->y0 = 1.0; |
754 | + |
755 | + box->setGeometry(x1, y1, x2 - x1, y2 - y1); |
756 | + |
757 | + return glow_quads; |
758 | +} |
759 | + |
760 | +} // Unity namespace |
761 | |
762 | === added file 'plugins/unityshell/src/unityshell_glow.h' |
763 | --- plugins/unityshell/src/unityshell_glow.h 1970-01-01 00:00:00 +0000 |
764 | +++ plugins/unityshell/src/unityshell_glow.h 2012-09-28 09:43:23 +0000 |
765 | @@ -0,0 +1,71 @@ |
766 | +/** |
767 | + * Copyright : (C) 2006-2012 by Patrick Niklaus, Roi Cohen, |
768 | + * Danny Baumann, Sam Spilsbury |
769 | + * Authors: Patrick Niklaus <patrick.niklaus@googlemail.com> |
770 | + * Roi Cohen <roico.beryl@gmail.com> |
771 | + * Danny Baumann <maniac@opencompositing.org> |
772 | + * Sam Spilsbury <smspillaz@gmail.com> |
773 | + * Marco Trevisan <marco.trevisan@canonical.com> |
774 | + * |
775 | + * |
776 | + * This program is free software; you can redistribute it and/or |
777 | + * modify it under the terms of the GNU General Public License |
778 | + * as published by the Free Software Foundation; either version 2 |
779 | + * of the License, or (at your option) any later version. |
780 | + * |
781 | + * This program is distributed in the hope that it will be useful, |
782 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
783 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
784 | + * GNU General Public License for more details. |
785 | + * |
786 | + **/ |
787 | + |
788 | +#ifndef _UNITYSHELL_GLOW_H |
789 | +#define _UNITYSHELL_GLOW_H |
790 | + |
791 | +#include <core/core.h> |
792 | +#include <opengl/opengl.h> |
793 | + |
794 | +namespace unity |
795 | +{ |
796 | +namespace glow |
797 | +{ |
798 | + |
799 | +enum class QuadPos |
800 | +{ |
801 | + TOPLEFT = 0, |
802 | + TOPRIGHT, |
803 | + BOTTOMLEFT, |
804 | + BOTTOMRIGHT, |
805 | + TOP, |
806 | + BOTTOM, |
807 | + LEFT, |
808 | + RIGHT, |
809 | + LAST |
810 | +}; |
811 | + |
812 | +struct Quads |
813 | +{ |
814 | +/* Each glow quad contains a 2x2 scale + positional matrix |
815 | + * (the 3rd column is not used since that is for matrix skew |
816 | + * operations which we do not care about) |
817 | + * and also a CompRect which describes the size and position of |
818 | + * the quad on the glow |
819 | + */ |
820 | + struct Quad |
821 | + { |
822 | + CompRect box; |
823 | + GLTexture::Matrix matrix; |
824 | + }; |
825 | + |
826 | + Quad& operator[](QuadPos position) { return inner_vector_[unsigned(position)]; } |
827 | + Quad const& operator[](QuadPos position) const { return inner_vector_[unsigned(position)]; } |
828 | + |
829 | +private: |
830 | + Quad inner_vector_[unsigned(QuadPos::LAST)]; |
831 | +}; |
832 | + |
833 | +} // namespace glow |
834 | +} // namepsace unity |
835 | + |
836 | +#endif |
LGTM.