Merge lp:~njpatel/unity/low-graphics-mode-6.0 into lp:unity/6.0
- low-graphics-mode-6.0
- Merge into 6.0
Proposed by
Neil J. Patel
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Nicolas d'Offay | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 2748 | ||||
Proposed branch: | lp:~njpatel/unity/low-graphics-mode-6.0 | ||||
Merge into: | lp:unity/6.0 | ||||
Diff against target: |
920 lines (+283/-175) 16 files modified
launcher/CMakeLists.txt (+1/-0) launcher/CairoBaseWindow.cpp (+11/-14) launcher/CairoBaseWindow.h (+1/-0) launcher/Launcher.cpp (+96/-81) launcher/Launcher.h (+0/-1) launcher/QuicklistView.cpp (+14/-5) launcher/Tooltip.cpp (+14/-3) panel/PanelView.cpp (+38/-17) plugins/unityshell/src/unityshell.cpp (+12/-0) tests/CMakeLists.txt (+5/-5) unity-shared/BackgroundEffectHelper.cpp (+6/-0) unity-shared/DashStyle.h (+2/-0) unity-shared/OverlayRenderer.cpp (+68/-47) unity-shared/OverlayRenderer.h (+0/-1) unity-shared/UnitySettings.cpp (+13/-1) unity-shared/UnitySettings.h (+2/-0) |
||||
To merge this branch: | bzr merge lp:~njpatel/unity/low-graphics-mode-6.0 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Nicolas d'Offay (community) | Approve | ||
Review via email: mp+127304@code.launchpad.net |
Commit message
Low Graphics Mode
Description of the change
Low Graphics Mode
You can test with UNITY_LOW_
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'launcher/CMakeLists.txt' |
2 | --- launcher/CMakeLists.txt 2012-09-07 15:01:14 +0000 |
3 | +++ launcher/CMakeLists.txt 2012-10-01 15:14:28 +0000 |
4 | @@ -80,6 +80,7 @@ |
5 | |
6 | add_library (launcher-lib STATIC ${LAUNCHER_SOURCES}) |
7 | add_dependencies (launcher-lib unity-core-${UNITY_API_VERSION} unity-shared) |
8 | +target_link_libraries (launcher-lib unity-shared) |
9 | |
10 | set (SWITCHER_SOURCES |
11 | SwitcherController.cpp |
12 | |
13 | === modified file 'launcher/CairoBaseWindow.cpp' |
14 | --- launcher/CairoBaseWindow.cpp 2012-09-19 06:20:57 +0000 |
15 | +++ launcher/CairoBaseWindow.cpp 2012-10-01 15:14:28 +0000 |
16 | @@ -22,6 +22,7 @@ |
17 | #include <Nux/WindowCompositor.h> |
18 | |
19 | #include "unity-shared/CairoTexture.h" |
20 | +#include "unity-shared/UnitySettings.h" |
21 | #include "CairoBaseWindow.h" |
22 | |
23 | namespace unity |
24 | @@ -40,8 +41,9 @@ |
25 | NUX_IMPLEMENT_OBJECT_TYPE(CairoBaseWindow); |
26 | |
27 | CairoBaseWindow::CairoBaseWindow() : |
28 | - _use_blurred_background(false), |
29 | - _compute_blur_bkg(false) |
30 | + use_blur_(!Settings::Instance().GetLowGfxMode()), |
31 | + _use_blurred_background(use_blur_), |
32 | + _compute_blur_bkg(use_blur_) |
33 | { |
34 | SetWindowSizeMatchLayout(true); |
35 | } |
36 | @@ -91,13 +93,14 @@ |
37 | |
38 | gfxContext.PushClippingRectangle(base); |
39 | |
40 | - /* "Clear" out the background */ |
41 | + /*"Clear" out the background. Blending is disabled if blur is disabled. This might need to change, but for the moment both classes |
42 | + * which are children of CairoBaseWindow don't have any alpha blending when not using the blurred texture.*/ |
43 | nux::ROPConfig rop; |
44 | - rop.Blend = true; |
45 | + rop.Blend = use_blur_; |
46 | rop.SrcBlend = GL_ONE; |
47 | rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA; |
48 | |
49 | - nux::ColorLayer layer(nux::Color(0x00000000), true, rop); |
50 | + nux::ColorLayer layer(nux::Color(0x00000000), use_blur_, rop); |
51 | nux::GetPainter().PushDrawLayer(gfxContext, base, &layer); |
52 | |
53 | nux::TexCoordXForm texxform_bg; |
54 | @@ -107,14 +110,14 @@ |
55 | nux::TexCoordXForm texxform_mask; |
56 | texxform_mask.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP); |
57 | texxform_mask.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
58 | + |
59 | + nux::GetWindowThread()->GetGraphicsEngine().GetRenderStates().SetBlend(true); |
60 | + nux::GetWindowThread()->GetGraphicsEngine().GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
61 | |
62 | if (bg_blur_texture_.IsValid() && texture_mask_.IsValid()) |
63 | { |
64 | nux::TexCoordXForm texxform_blur_bkg; |
65 | |
66 | - nux::GetWindowThread()->GetGraphicsEngine().GetRenderStates().SetBlend(true); |
67 | - nux::GetWindowThread()->GetGraphicsEngine().GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
68 | - |
69 | gfxContext.QRP_2TexMod( |
70 | base.x, |
71 | base.y, |
72 | @@ -130,9 +133,6 @@ |
73 | |
74 | if (texture_bg_.IsValid() && texture_mask_.IsValid()) |
75 | { |
76 | - nux::GetWindowThread()->GetGraphicsEngine().GetRenderStates().SetBlend(true); |
77 | - nux::GetWindowThread()->GetGraphicsEngine().GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
78 | - |
79 | gfxContext.QRP_2TexMod(base.x, |
80 | base.y, |
81 | base.width, |
82 | @@ -150,9 +150,6 @@ |
83 | nux::TexCoordXForm texxform; |
84 | texxform.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP); |
85 | texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
86 | - |
87 | - nux::GetWindowThread()->GetGraphicsDisplay().GetGraphicsEngine()->GetRenderStates().SetBlend(true); |
88 | - nux::GetWindowThread()->GetGraphicsDisplay().GetGraphicsEngine()->GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
89 | |
90 | gfxContext.QRP_1Tex(base.x, |
91 | base.y, |
92 | |
93 | === modified file 'launcher/CairoBaseWindow.h' |
94 | --- launcher/CairoBaseWindow.h 2012-05-07 19:52:54 +0000 |
95 | +++ launcher/CairoBaseWindow.h 2012-10-01 15:14:28 +0000 |
96 | @@ -39,6 +39,7 @@ |
97 | nux::ObjectPtr<nux::BaseTexture> texture_mask_; |
98 | nux::ObjectPtr<nux::BaseTexture> texture_outline_; |
99 | |
100 | + bool use_blur_; |
101 | bool _use_blurred_background; |
102 | bool _compute_blur_bkg; |
103 | |
104 | |
105 | === modified file 'launcher/Launcher.cpp' |
106 | --- launcher/Launcher.cpp 2012-09-24 09:43:57 +0000 |
107 | +++ launcher/Launcher.cpp 2012-10-01 15:14:28 +0000 |
108 | @@ -50,6 +50,7 @@ |
109 | #include "unity-shared/WindowManager.h" |
110 | #include "unity-shared/UScreen.h" |
111 | #include "unity-shared/UBusMessages.h" |
112 | +#include "unity-shared/UnitySettings.h" |
113 | |
114 | #include <UnityCore/GLibWrapper.h> |
115 | #include <UnityCore/Variant.h> |
116 | @@ -1758,14 +1759,25 @@ |
117 | _render_drag_window = false; |
118 | ShowDragWindow(); |
119 | } |
120 | + |
121 | + nux::Color clear_colour = nux::Color(0x00000000); |
122 | + |
123 | + if (Settings::Instance().GetLowGfxMode()) |
124 | + { |
125 | + clear_colour = _background_color; |
126 | + clear_colour.alpha = 1.0f; |
127 | + } |
128 | |
129 | // clear region |
130 | GfxContext.PushClippingRectangle(base); |
131 | - gPainter.PushDrawColorLayer(GfxContext, base, nux::Color(0x00000000), true, ROP); |
132 | + gPainter.PushDrawColorLayer(GfxContext, base, clear_colour, true, ROP); |
133 | |
134 | - GfxContext.GetRenderStates().SetBlend(true); |
135 | - GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
136 | - GfxContext.GetRenderStates().SetColorMask(true, true, true, true); |
137 | + if (Settings::Instance().GetLowGfxMode() == false) |
138 | + { |
139 | + GfxContext.GetRenderStates().SetBlend(true); |
140 | + GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
141 | + GfxContext.GetRenderStates().SetColorMask(true, true, true, true); |
142 | + } |
143 | |
144 | int push_count = 1; |
145 | |
146 | @@ -1794,92 +1806,95 @@ |
147 | pressure_color); |
148 | } |
149 | |
150 | - if (IsOverlayOpen()) |
151 | + if (Settings::Instance().GetLowGfxMode() == false) |
152 | { |
153 | - nux::Geometry blur_geo(geo_absolute.x, geo_absolute.y, base.width, base.height); |
154 | - nux::ObjectPtr<nux::IOpenGLBaseTexture> blur_texture; |
155 | - |
156 | - if (BackgroundEffectHelper::blur_type != unity::BLUR_NONE && (bkg_box.x + bkg_box.width > 0)) |
157 | - { |
158 | - blur_texture = bg_effect_helper_.GetBlurRegion(blur_geo); |
159 | - } |
160 | - else |
161 | - { |
162 | - blur_texture = bg_effect_helper_.GetRegion(blur_geo); |
163 | - } |
164 | - |
165 | - if (blur_texture.IsValid()) |
166 | - { |
167 | - nux::TexCoordXForm texxform_blur_bg; |
168 | - texxform_blur_bg.flip_v_coord = true; |
169 | - texxform_blur_bg.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
170 | - texxform_blur_bg.uoffset = ((float) base.x) / geo_absolute.width; |
171 | - texxform_blur_bg.voffset = ((float) base.y) / geo_absolute.height; |
172 | - |
173 | - GfxContext.PushClippingRectangle(bkg_box); |
174 | + if (IsOverlayOpen()) |
175 | + { |
176 | + nux::Geometry blur_geo(geo_absolute.x, geo_absolute.y, base.width, base.height); |
177 | + nux::ObjectPtr<nux::IOpenGLBaseTexture> blur_texture; |
178 | + |
179 | + if (BackgroundEffectHelper::blur_type != unity::BLUR_NONE && (bkg_box.x + bkg_box.width > 0)) |
180 | + { |
181 | + blur_texture = bg_effect_helper_.GetBlurRegion(blur_geo); |
182 | + } |
183 | + else |
184 | + { |
185 | + blur_texture = bg_effect_helper_.GetRegion(blur_geo); |
186 | + } |
187 | + |
188 | + if (blur_texture.IsValid()) |
189 | + { |
190 | + nux::TexCoordXForm texxform_blur_bg; |
191 | + texxform_blur_bg.flip_v_coord = true; |
192 | + texxform_blur_bg.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
193 | + texxform_blur_bg.uoffset = ((float) base.x) / geo_absolute.width; |
194 | + texxform_blur_bg.voffset = ((float) base.y) / geo_absolute.height; |
195 | + |
196 | + GfxContext.PushClippingRectangle(bkg_box); |
197 | |
198 | #ifndef NUX_OPENGLES_20 |
199 | - if (GfxContext.UsingGLSLCodePath()) |
200 | - gPainter.PushDrawCompositionLayer(GfxContext, base, |
201 | - blur_texture, |
202 | - texxform_blur_bg, |
203 | - nux::color::White, |
204 | - _background_color, nux::LAYER_BLEND_MODE_OVERLAY, |
205 | - true, ROP); |
206 | - else |
207 | - gPainter.PushDrawTextureLayer(GfxContext, base, |
208 | - blur_texture, |
209 | - texxform_blur_bg, |
210 | - nux::color::White, |
211 | - true, |
212 | - ROP); |
213 | + if (GfxContext.UsingGLSLCodePath()) |
214 | + gPainter.PushDrawCompositionLayer(GfxContext, base, |
215 | + blur_texture, |
216 | + texxform_blur_bg, |
217 | + nux::color::White, |
218 | + _background_color, nux::LAYER_BLEND_MODE_OVERLAY, |
219 | + true, ROP); |
220 | + else |
221 | + gPainter.PushDrawTextureLayer(GfxContext, base, |
222 | + blur_texture, |
223 | + texxform_blur_bg, |
224 | + nux::color::White, |
225 | + true, |
226 | + ROP); |
227 | #else |
228 | - gPainter.PushDrawCompositionLayer(GfxContext, base, |
229 | - blur_texture, |
230 | - texxform_blur_bg, |
231 | - nux::color::White, |
232 | - _background_color, nux::LAYER_BLEND_MODE_OVERLAY, |
233 | - true, ROP); |
234 | + gPainter.PushDrawCompositionLayer(GfxContext, base, |
235 | + blur_texture, |
236 | + texxform_blur_bg, |
237 | + nux::color::White, |
238 | + _background_color, nux::LAYER_BLEND_MODE_OVERLAY, |
239 | + true, ROP); |
240 | #endif |
241 | - GfxContext.PopClippingRectangle(); |
242 | - |
243 | - push_count++; |
244 | - } |
245 | - |
246 | - unsigned int alpha = 0, src = 0, dest = 0; |
247 | - GfxContext.GetRenderStates().GetBlend(alpha, src, dest); |
248 | - |
249 | - // apply the darkening |
250 | - GfxContext.GetRenderStates().SetBlend(true, GL_ZERO, GL_SRC_COLOR); |
251 | - gPainter.Paint2DQuadColor(GfxContext, bkg_box, nux::Color(0.9f, 0.9f, 0.9f, 1.0f)); |
252 | - GfxContext.GetRenderStates().SetBlend (alpha, src, dest); |
253 | - |
254 | - // apply the bg colour |
255 | + GfxContext.PopClippingRectangle(); |
256 | + |
257 | + push_count++; |
258 | + } |
259 | + |
260 | + unsigned int alpha = 0, src = 0, dest = 0; |
261 | + GfxContext.GetRenderStates().GetBlend(alpha, src, dest); |
262 | + |
263 | + // apply the darkening |
264 | + GfxContext.GetRenderStates().SetBlend(true, GL_ZERO, GL_SRC_COLOR); |
265 | + gPainter.Paint2DQuadColor(GfxContext, bkg_box, nux::Color(0.9f, 0.9f, 0.9f, 1.0f)); |
266 | + GfxContext.GetRenderStates().SetBlend (alpha, src, dest); |
267 | + |
268 | + // apply the bg colour |
269 | #ifndef NUX_OPENGLES_20 |
270 | - if (GfxContext.UsingGLSLCodePath() == false) |
271 | - gPainter.Paint2DQuadColor(GfxContext, bkg_box, _background_color); |
272 | + if (GfxContext.UsingGLSLCodePath() == false) |
273 | + gPainter.Paint2DQuadColor(GfxContext, bkg_box, _background_color); |
274 | #endif |
275 | |
276 | - // apply the shine |
277 | - GfxContext.GetRenderStates().SetBlend(true, GL_DST_COLOR, GL_ONE); |
278 | - nux::TexCoordXForm texxform; |
279 | - texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
280 | - texxform.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP); |
281 | - texxform.uoffset = (1.0f / launcher_sheen_->GetWidth()); // TODO (gord) don't use absolute values here |
282 | - texxform.voffset = (1.0f / launcher_sheen_->GetHeight()) * panel::Style::Instance().panel_height; |
283 | - GfxContext.QRP_1Tex(base.x, base.y, base.width, base.height, |
284 | - launcher_sheen_->GetDeviceTexture(), |
285 | - texxform, |
286 | - nux::color::White); |
287 | + // apply the shine |
288 | + GfxContext.GetRenderStates().SetBlend(true, GL_DST_COLOR, GL_ONE); |
289 | + nux::TexCoordXForm texxform; |
290 | + texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
291 | + texxform.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP); |
292 | + texxform.uoffset = (1.0f / launcher_sheen_->GetWidth()); // TODO (gord) don't use absolute values here |
293 | + texxform.voffset = (1.0f / launcher_sheen_->GetHeight()) * panel::Style::Instance().panel_height; |
294 | + GfxContext.QRP_1Tex(base.x, base.y, base.width, base.height, |
295 | + launcher_sheen_->GetDeviceTexture(), |
296 | + texxform, |
297 | + nux::color::White); |
298 | |
299 | - //reset the blend state |
300 | - GfxContext.GetRenderStates().SetBlend (alpha, src, dest); |
301 | - } |
302 | - else |
303 | - { |
304 | - nux::Color color = _background_color; |
305 | - color.alpha = options()->background_alpha; |
306 | - gPainter.Paint2DQuadColor(GfxContext, bkg_box, color); |
307 | + //reset the blend state |
308 | + GfxContext.GetRenderStates().SetBlend (alpha, src, dest); |
309 | + } |
310 | + else |
311 | + { |
312 | + nux::Color color = _background_color; |
313 | + color.alpha = options()->background_alpha; |
314 | + gPainter.Paint2DQuadColor(GfxContext, bkg_box, color); |
315 | + } |
316 | } |
317 | |
318 | GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
319 | |
320 | === modified file 'launcher/Launcher.h' |
321 | --- launcher/Launcher.h 2012-09-18 18:53:43 +0000 |
322 | +++ launcher/Launcher.h 2012-10-01 15:14:28 +0000 |
323 | @@ -43,7 +43,6 @@ |
324 | #include "unity-shared/UBusWrapper.h" |
325 | #include "SoftwareCenterLauncherIcon.h" |
326 | |
327 | - |
328 | namespace unity |
329 | { |
330 | namespace launcher |
331 | |
332 | === modified file 'launcher/QuicklistView.cpp' |
333 | --- launcher/QuicklistView.cpp 2012-08-15 02:51:33 +0000 |
334 | +++ launcher/QuicklistView.cpp 2012-10-01 15:14:28 +0000 |
335 | @@ -40,9 +40,11 @@ |
336 | #include "QuicklistMenuItemRadio.h" |
337 | |
338 | #include "unity-shared/Introspectable.h" |
339 | +#include "unity-shared/UnitySettings.h" |
340 | |
341 | #include "unity-shared/ubus-server.h" |
342 | #include "unity-shared/UBusMessages.h" |
343 | +#include "unity-shared/DashStyle.h" |
344 | |
345 | namespace unity |
346 | { |
347 | @@ -71,9 +73,6 @@ |
348 | { |
349 | SetGeometry(nux::Geometry(0, 0, 1, 1)); |
350 | |
351 | - _use_blurred_background = true; |
352 | - _compute_blur_bkg = true; |
353 | - |
354 | _left_space = new nux::SpaceLayout(_padding + |
355 | _anchor_width + |
356 | _corner_radius + |
357 | @@ -1222,8 +1221,18 @@ |
358 | float shadow_color[4] = {0.0f, 0.0f, 0.0f, 1.00f}; |
359 | float outline_color[4] = {1.0f, 1.0f, 1.0f, 0.40f}; |
360 | float mask_color[4] = {1.0f, 1.0f, 1.0f, 1.00f}; |
361 | -// float anchor_width = 10; |
362 | -// float anchor_height = 18; |
363 | + |
364 | + if (Settings::Instance().GetLowGfxMode()) |
365 | + { |
366 | + float alpha_value = 1.0f; |
367 | + |
368 | + tint_color[3] = alpha_value; |
369 | + hl_color[3] = 0.2f; |
370 | + dot_color[3] = 0.0f; |
371 | + shadow_color[3] = alpha_value; |
372 | + outline_color[3] = alpha_value; |
373 | + mask_color[3] = alpha_value; |
374 | + } |
375 | |
376 | ql_tint_dot_hl(cr_bg, |
377 | width, |
378 | |
379 | === modified file 'launcher/Tooltip.cpp' |
380 | --- launcher/Tooltip.cpp 2012-05-07 22:28:17 +0000 |
381 | +++ launcher/Tooltip.cpp 2012-10-01 15:14:28 +0000 |
382 | @@ -26,6 +26,7 @@ |
383 | #include "unity-shared/CairoTexture.h" |
384 | #include "unity-shared/ubus-server.h" |
385 | #include "unity-shared/UBusMessages.h" |
386 | +#include <unity-shared/UnitySettings.h> |
387 | |
388 | #include "Tooltip.h" |
389 | |
390 | @@ -49,9 +50,6 @@ |
391 | _labelText(TEXT("Unity")), |
392 | _cairo_text_has_changed(true) |
393 | { |
394 | - _use_blurred_background = true; |
395 | - _compute_blur_bkg = true; |
396 | - |
397 | _hlayout = new nux::HLayout(TEXT(""), NUX_TRACKER_LOCATION); |
398 | _vlayout = new nux::VLayout(TEXT(""), NUX_TRACKER_LOCATION); |
399 | |
400 | @@ -461,6 +459,19 @@ |
401 | float shadow_color[4] = {0.0f, 0.0f, 0.0f, 1.00f}; |
402 | float outline_color[4] = {1.0f, 1.0f, 1.0f, 0.15f}; |
403 | float mask_color[4] = {1.0f, 1.0f, 1.0f, 1.00f}; |
404 | + |
405 | + if (use_blur_ == false) |
406 | + { |
407 | + //If low gfx is detected then disable transparency because we're not bluring using our blur anymore. |
408 | + float alpha_value = 1.0f; |
409 | + |
410 | + tint_color[3] = alpha_value; |
411 | + hl_color[3] = alpha_value; |
412 | + dot_color[3] = alpha_value; |
413 | + shadow_color[3] = alpha_value; |
414 | + outline_color[3] = alpha_value; |
415 | + mask_color[3] = alpha_value; |
416 | + } |
417 | |
418 | tint_dot_hl(cr_bg, |
419 | width, |
420 | |
421 | === modified file 'panel/PanelView.cpp' |
422 | --- panel/PanelView.cpp 2012-09-13 16:12:19 +0000 |
423 | +++ panel/PanelView.cpp 2012-10-01 15:14:28 +0000 |
424 | @@ -71,10 +71,22 @@ |
425 | |
426 | nux::ROPConfig rop; |
427 | rop.Blend = true; |
428 | - rop.SrcBlend = GL_ZERO; |
429 | - rop.DstBlend = GL_SRC_COLOR; |
430 | + nux::Color darken_colour = nux::Color(0.9f, 0.9f, 0.9f, 1.0f); |
431 | + |
432 | + if (Settings::Instance().GetLowGfxMode() == false) |
433 | + { |
434 | + rop.SrcBlend = GL_ZERO; |
435 | + rop.DstBlend = GL_SRC_COLOR; |
436 | + } |
437 | + //If we are in low gfx mode then change our darken_colour to our background colour. |
438 | + else |
439 | + { |
440 | + rop.SrcBlend = GL_ONE; |
441 | + rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA; |
442 | + darken_colour = _bg_color; |
443 | + } |
444 | |
445 | - _bg_darken_layer.reset(new nux::ColorLayer(nux::Color(0.9f, 0.9f, 0.9f, 1.0f), false, rop)); |
446 | + _bg_darken_layer.reset(new nux::ColorLayer(darken_colour, false, rop)); |
447 | |
448 | _layout = new nux::HLayout("", NUX_TRACKER_LOCATION); |
449 | _layout->SetContentDistribution(nux::eStackLeft); |
450 | @@ -386,13 +398,13 @@ |
451 | GfxContext.PopClippingRectangle(); |
452 | } |
453 | |
454 | - if (_overlay_is_open) |
455 | + if (_overlay_is_open && Settings::Instance().GetLowGfxMode() == false) |
456 | { |
457 | nux::GetPainter().RenderSinglePaintLayer(GfxContext, geo, _bg_darken_layer.get()); |
458 | - |
459 | + |
460 | GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
461 | nux::TexCoordXForm refine_texxform; |
462 | - |
463 | + |
464 | int refine_x_pos = geo.x + (_stored_dash_width - refine_gradient_midpoint); |
465 | |
466 | refine_x_pos += _launcher_width; |
467 | @@ -411,8 +423,8 @@ |
468 | _bg_refine_single_column_tex->GetDeviceTexture(), |
469 | refine_texxform, |
470 | nux::color::White); |
471 | + } |
472 | } |
473 | - } |
474 | |
475 | if (!_overlay_is_open || GfxContext.UsingGLSLCodePath() == false) |
476 | nux::GetPainter().RenderSinglePaintLayer(GfxContext, geo, _bg_layer.get()); |
477 | @@ -484,6 +496,12 @@ |
478 | |
479 | if (_overlay_is_open) |
480 | { |
481 | + if (Settings::Instance().GetLowGfxMode()) |
482 | + { |
483 | + rop.Blend = false; |
484 | + _bg_darken_layer.reset(new nux::ColorLayer(_bg_color, false, rop)); |
485 | + } |
486 | + |
487 | nux::GetPainter().PushLayer(GfxContext, geo, _bg_darken_layer.get()); |
488 | bgs++; |
489 | |
490 | @@ -495,22 +513,25 @@ |
491 | refine_geo.x = refine_x_pos; |
492 | refine_geo.width = _bg_refine_tex->GetWidth(); |
493 | refine_geo.height = _bg_refine_tex->GetHeight(); |
494 | - |
495 | - nux::GetPainter().PushLayer(GfxContext, refine_geo, _bg_refine_layer.get()); |
496 | - bgs++; |
497 | - |
498 | - refine_geo.x += refine_geo.width; |
499 | - refine_geo.width = geo.width; |
500 | - refine_geo.height = geo.height; |
501 | - nux::GetPainter().PushLayer(GfxContext, refine_geo, _bg_refine_single_column_layer.get()); |
502 | - bgs++; |
503 | + |
504 | + if (Settings::Instance().GetLowGfxMode() == false) |
505 | + { |
506 | + nux::GetPainter().PushLayer(GfxContext, refine_geo, _bg_refine_layer.get()); |
507 | + bgs++; |
508 | + |
509 | + refine_geo.x += refine_geo.width; |
510 | + refine_geo.width = geo.width; |
511 | + refine_geo.height = geo.height; |
512 | + nux::GetPainter().PushLayer(GfxContext, refine_geo, _bg_refine_single_column_layer.get()); |
513 | + bgs++; |
514 | + } |
515 | } |
516 | } |
517 | |
518 | if (!_overlay_is_open || GfxContext.UsingGLSLCodePath() == false) |
519 | gPainter.PushLayer(GfxContext, geo, _bg_layer.get()); |
520 | |
521 | - if (_overlay_is_open) |
522 | + if (_overlay_is_open && Settings::Instance().GetLowGfxMode() == false) |
523 | { |
524 | // apply the shine |
525 | nux::TexCoordXForm texxform; |
526 | |
527 | === modified file 'plugins/unityshell/src/unityshell.cpp' |
528 | --- plugins/unityshell/src/unityshell.cpp 2012-09-28 22:33:55 +0000 |
529 | +++ plugins/unityshell/src/unityshell.cpp 2012-10-01 15:14:28 +0000 |
530 | @@ -200,6 +200,18 @@ |
531 | failed = true; |
532 | } |
533 | } |
534 | + |
535 | + //In case of software rendering then enable lowgfx mode. |
536 | + std::string renderer = ANSI_TO_TCHAR(NUX_REINTERPRET_CAST(const char *, glGetString(GL_RENDERER))); |
537 | + |
538 | + if (strstr(renderer.c_str(), "Software Rasterizer") || |
539 | + strstr(renderer.c_str(), "Mesa X11") || |
540 | + strstr(renderer.c_str(), "LLVM") || |
541 | + strstr(renderer.c_str(), "on softpipe") || |
542 | + (getenv("UNITY_LOW_GFX_MODE") != NULL && atoi(getenv("UNITY_LOW_GFX_MODE")) == 1)) |
543 | + { |
544 | + Settings::Instance().SetLowGfxMode(true); |
545 | + } |
546 | #endif |
547 | |
548 | if (!failed) |
549 | |
550 | === modified file 'tests/CMakeLists.txt' |
551 | --- tests/CMakeLists.txt 2012-09-20 03:22:01 +0000 |
552 | +++ tests/CMakeLists.txt 2012-10-01 15:14:28 +0000 |
553 | @@ -72,7 +72,7 @@ |
554 | ${CMAKE_CURRENT_BINARY_DIR}/panel-marshal.c |
555 | ${CMAKE_SOURCE_DIR}/unity-shared/ubus-server.cpp |
556 | ) |
557 | -target_link_libraries (test-unit ${LIBS}) |
558 | +target_link_libraries (test-unit unity-shared ${LIBS}) |
559 | add_dependencies (test-unit unity-core-${UNITY_API_VERSION}) |
560 | add_subdirectory (test-input-remover) |
561 | add_subdirectory (test-minimize-window-handler) |
562 | @@ -111,7 +111,7 @@ |
563 | test_service_main.c |
564 | test_service_model.c |
565 | test_service_model.h) |
566 | - target_link_libraries(test-gtest-service ${LIBS}) |
567 | + target_link_libraries(test-gtest-service unity-shared ${LIBS}) |
568 | add_dependencies (test-gtest-service unity-core-${UNITY_API_VERSION} gtest) |
569 | |
570 | |
571 | @@ -176,7 +176,7 @@ |
572 | ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-texture.cpp |
573 | ${CMAKE_SOURCE_DIR}/hud/HudPrivate.cpp |
574 | ) |
575 | - target_link_libraries(test-gtest-xless gtest ${GMOCK_LIB} ${GMOCK_MAIN_LIB} ${LIBS}) |
576 | + target_link_libraries(test-gtest-xless gtest unity-shared ${GMOCK_LIB} ${GMOCK_MAIN_LIB} ${LIBS}) |
577 | add_test(UnityGTestXless test-gtest-xless) |
578 | add_dependencies(test-gtest-xless unity-core-${UNITY_API_VERSION} gtest) |
579 | |
580 | @@ -194,7 +194,7 @@ |
581 | test_ratings_filter.cpp |
582 | test_results.cpp |
583 | ) |
584 | - target_link_libraries(test-gtest-dbus gtest ${LIBS}) |
585 | + target_link_libraries(test-gtest-dbus gtest unity-shared ${LIBS}) |
586 | add_test(UnityGTestDBus test-gtest-dbus) |
587 | add_dependencies(test-gtest-dbus unity-core-${UNITY_API_VERSION} test-gtest-service gtest) |
588 | |
589 | @@ -361,7 +361,7 @@ |
590 | ${CMAKE_SOURCE_DIR}/unity-shared/ubus-server.cpp |
591 | ${CMAKE_SOURCE_DIR}/plugins/unityshell/src/WindowMinimizeSpeedController.cpp |
592 | ) |
593 | - target_link_libraries(test-gtest gtest gmock ${LIBS}) |
594 | + target_link_libraries(test-gtest gtest gmock unity-shared ${LIBS}) |
595 | add_test(UnityGTest test-gtest) |
596 | add_dependencies(test-gtest unity-core-${UNITY_API_VERSION} gtest gmock) |
597 | |
598 | |
599 | === modified file 'unity-shared/BackgroundEffectHelper.cpp' |
600 | --- unity-shared/BackgroundEffectHelper.cpp 2012-05-06 23:48:38 +0000 |
601 | +++ unity-shared/BackgroundEffectHelper.cpp 2012-10-01 15:14:28 +0000 |
602 | @@ -31,6 +31,7 @@ |
603 | |
604 | #include <X11/Xregion.h> |
605 | #include <boost/utility.hpp> |
606 | +#include "UnitySettings.h" |
607 | |
608 | |
609 | using namespace unity; |
610 | @@ -52,6 +53,11 @@ |
611 | cache_dirty = true; |
612 | enabled.changed.connect (sigc::mem_fun(this, &BackgroundEffectHelper::OnEnabledChanged)); |
613 | noise_texture_ = nux::CreateTextureFromFile(PKGDATADIR"/dash_noise.png"); |
614 | + |
615 | + if (Settings::Instance().GetLowGfxMode()) |
616 | + { |
617 | + blur_type(BLUR_NONE); |
618 | + } |
619 | |
620 | Register(this); |
621 | } |
622 | |
623 | === modified file 'unity-shared/DashStyle.h' |
624 | --- unity-shared/DashStyle.h 2012-09-20 12:52:02 +0000 |
625 | +++ unity-shared/DashStyle.h 2012-10-01 15:14:28 +0000 |
626 | @@ -245,6 +245,8 @@ |
627 | int GetCategoryHeaderLeftPadding() const; |
628 | int GetCategorySeparatorLeftPadding() const; |
629 | int GetCategorySeparatorRightPadding() const; |
630 | + |
631 | + bool GetUseBlur() const; |
632 | |
633 | |
634 | sigc::signal<void> changed; |
635 | |
636 | === modified file 'unity-shared/OverlayRenderer.cpp' |
637 | --- unity-shared/OverlayRenderer.cpp 2012-09-17 00:39:31 +0000 |
638 | +++ unity-shared/OverlayRenderer.cpp 2012-10-01 15:14:28 +0000 |
639 | @@ -109,7 +109,7 @@ |
640 | } |
641 | |
642 | void OverlayRendererImpl::Init() |
643 | -{ |
644 | +{ |
645 | nux::ROPConfig rop; |
646 | rop.Blend = true; |
647 | rop.SrcBlend = GL_ONE; |
648 | @@ -140,7 +140,18 @@ |
649 | rop.Blend = true; |
650 | rop.SrcBlend = GL_ZERO; |
651 | rop.DstBlend = GL_SRC_COLOR; |
652 | - bg_darken_layer_ = new nux::ColorLayer(nux::Color(0.9f, 0.9f, 0.9f, 1.0f), false, rop); |
653 | + nux::Color darken_colour = nux::Color(0.9f, 0.9f, 0.9f, 1.0f); |
654 | + |
655 | + //When we are in low gfx mode then our darken layer will act as a background. |
656 | + if (Settings::Instance().GetLowGfxMode()) |
657 | + { |
658 | + rop.Blend = false; |
659 | + rop.SrcBlend = GL_ONE; |
660 | + rop.DstBlend = GL_SRC_COLOR; |
661 | + darken_colour = bg_color_; |
662 | + } |
663 | + |
664 | + bg_darken_layer_ = new nux::ColorLayer(darken_colour, false, rop); |
665 | bg_shine_texture_ = unity::dash::Style::Instance().GetDashShine()->GetDeviceTexture(); |
666 | |
667 | ubus_manager_.SendMessage(UBUS_BACKGROUND_REQUEST_COLOUR_EMIT); |
668 | @@ -435,7 +446,6 @@ |
669 | |
670 | void OverlayRendererImpl::Draw(nux::GraphicsEngine& gfx_context, nux::Geometry content_geo, nux::Geometry absolute_geo, nux::Geometry geometry, bool force_edges) |
671 | { |
672 | - bool paint_blur = BackgroundEffectHelper::blur_type != BLUR_NONE; |
673 | nux::Geometry geo(content_geo); |
674 | |
675 | int excess_border = (Settings::Instance().form_factor() != FormFactor::NETBOOK || force_edges) ? EXCESS_BORDER : 0; |
676 | @@ -456,7 +466,8 @@ |
677 | texxform_absolute_bg.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP); |
678 | |
679 | nux::Geometry blur_geo(larger_absolute_geo.x, larger_absolute_geo.y, larger_content_geo.width, larger_content_geo.height); |
680 | - if (paint_blur) |
681 | + |
682 | + if (BackgroundEffectHelper::blur_type != BLUR_NONE) |
683 | { |
684 | bg_blur_texture_ = bg_effect_helper_.GetBlurRegion(blur_geo); |
685 | } |
686 | @@ -493,14 +504,14 @@ |
687 | |
688 | gfx_context.PopClippingRectangle(); |
689 | } |
690 | - |
691 | - // Draw the left and top lines |
692 | + |
693 | + //Draw the left and top lines. |
694 | dash::Style& style = dash::Style::Instance(); |
695 | - |
696 | + |
697 | gfx_context.GetRenderStates().SetColorMask(true, true, true, true); |
698 | gfx_context.GetRenderStates().SetBlend(true); |
699 | gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
700 | - |
701 | + |
702 | const double line_opacity = 0.1f; |
703 | const int gradient_height = 50; |
704 | const int vertical_padding = 20; |
705 | @@ -514,9 +525,9 @@ |
706 | // Vertical lancher/dash separator |
707 | nux::GetPainter().Paint2DQuadColor(gfx_context, |
708 | nux::Geometry(geometry.x, |
709 | - geometry.y + vertical_padding, |
710 | - style.GetVSeparatorSize(), |
711 | - gradient_height), |
712 | + geometry.y + vertical_padding, |
713 | + style.GetVSeparatorSize(), |
714 | + gradient_height), |
715 | nux::color::Transparent, |
716 | line_color * 0.7f, // less opacity |
717 | line_color * 0.7f, // less opacity |
718 | @@ -528,10 +539,16 @@ |
719 | geometry.y + content_geo.height + INNER_CORNER_RADIUS + corner_overlap, |
720 | line_color * 0.7f); // less opacity |
721 | |
722 | - // Draw the background |
723 | + if (Settings::Instance().GetLowGfxMode()) |
724 | + { |
725 | + bg_darken_layer_->SetColor(bg_color_); |
726 | + } |
727 | + //Draw the background |
728 | bg_darken_layer_->SetGeometry(larger_content_geo); |
729 | nux::GetPainter().RenderSinglePaintLayer(gfx_context, larger_content_geo, bg_darken_layer_); |
730 | |
731 | + if (Settings::Instance().GetLowGfxMode() == false) |
732 | + { |
733 | #ifndef NUX_OPENGLES_20 |
734 | if (gfx_context.UsingGLSLCodePath() == false) |
735 | { |
736 | @@ -547,9 +564,9 @@ |
737 | gfx_context.GetRenderStates().SetColorMask(true, true, true, false); |
738 | gfx_context.GetRenderStates().SetBlend(true, GL_DST_COLOR, GL_ONE); |
739 | |
740 | - gfx_context.QRP_1Tex (larger_content_geo.x, larger_content_geo.y, |
741 | - larger_content_geo.width, larger_content_geo.height, |
742 | - bg_shine_texture_, texxform_absolute_bg, nux::color::White); |
743 | + gfx_context.QRP_1Tex(larger_content_geo.x, larger_content_geo.y, |
744 | + larger_content_geo.width, larger_content_geo.height, |
745 | + bg_shine_texture_, texxform_absolute_bg, nux::color::White); |
746 | |
747 | gfx_context.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
748 | nux::TexCoordXForm refine_texxform; |
749 | @@ -557,26 +574,26 @@ |
750 | if (refine_is_open_) |
751 | { |
752 | gfx_context.QRP_1Tex(larger_content_geo.x + larger_content_geo.width - bg_refine_tex_->GetWidth(), |
753 | - larger_content_geo.y, |
754 | - bg_refine_tex_->GetWidth(), |
755 | - std::min(bg_refine_tex_->GetHeight(), larger_content_geo.height), |
756 | - bg_refine_tex_->GetDeviceTexture(), |
757 | - refine_texxform, |
758 | - nux::color::White |
759 | - ); |
760 | + larger_content_geo.y, |
761 | + bg_refine_tex_->GetWidth(), |
762 | + std::min(bg_refine_tex_->GetHeight(), larger_content_geo.height), |
763 | + bg_refine_tex_->GetDeviceTexture(), |
764 | + refine_texxform, |
765 | + nux::color::White |
766 | + ); |
767 | } |
768 | else |
769 | { |
770 | - gfx_context.QRP_1Tex(larger_content_geo.x + larger_content_geo.width - bg_refine_no_refine_tex_->GetWidth(), |
771 | - larger_content_geo.y, |
772 | - bg_refine_no_refine_tex_->GetWidth(), |
773 | - std::min(bg_refine_no_refine_tex_->GetHeight(), larger_content_geo.height), |
774 | - bg_refine_no_refine_tex_->GetDeviceTexture(), |
775 | - refine_texxform, |
776 | - nux::color::White |
777 | - ); |
778 | + gfx_context.QRP_1Tex(larger_content_geo.x + larger_content_geo.width - bg_refine_no_refine_tex_->GetWidth(), |
779 | + larger_content_geo.y, |
780 | + bg_refine_no_refine_tex_->GetWidth(), |
781 | + std::min(bg_refine_no_refine_tex_->GetHeight(), larger_content_geo.height), |
782 | + bg_refine_no_refine_tex_->GetDeviceTexture(), |
783 | + refine_texxform, |
784 | + nux::color::White |
785 | + ); |
786 | } |
787 | - |
788 | +} |
789 | |
790 | if (Settings::Instance().form_factor() != FormFactor::NETBOOK || force_edges) |
791 | { |
792 | @@ -606,7 +623,7 @@ |
793 | |
794 | geo.width += corner->GetWidth() - 10; |
795 | geo.height += corner->GetHeight() - 10; |
796 | - { |
797 | + { |
798 | // Corner |
799 | texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
800 | texxform.SetWrap(nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER); |
801 | @@ -708,7 +725,7 @@ |
802 | texxform, |
803 | nux::color::White); |
804 | |
805 | - gfx_context.GetRenderStates().SetBlend(true); |
806 | + gfx_context.GetRenderStates().SetBlend(false); |
807 | gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
808 | gfx_context.GetRenderStates().SetColorMask(true, true, true, true); |
809 | |
810 | @@ -903,21 +920,25 @@ |
811 | } |
812 | #endif |
813 | |
814 | - // apply the shine |
815 | - rop.Blend = true; |
816 | - rop.SrcBlend = GL_DST_COLOR; |
817 | - rop.DstBlend = GL_ONE; |
818 | - texxform_absolute_bg.flip_v_coord = false; |
819 | - texxform_absolute_bg.uoffset = (1.0f / bg_shine_texture_->GetWidth()) * parent->x_offset; |
820 | - texxform_absolute_bg.voffset = (1.0f / bg_shine_texture_->GetHeight()) * parent->y_offset; |
821 | + //Only apply shine if we aren't in low gfx mode. |
822 | + if (Settings::Instance().GetLowGfxMode() == false) |
823 | + { |
824 | + rop.Blend = true; |
825 | + rop.SrcBlend = GL_DST_COLOR; |
826 | + rop.DstBlend = GL_ONE; |
827 | + texxform_absolute_bg.flip_v_coord = false; |
828 | + texxform_absolute_bg.uoffset = (1.0f / bg_shine_texture_->GetWidth()) * parent->x_offset; |
829 | + texxform_absolute_bg.voffset = (1.0f / bg_shine_texture_->GetHeight()) * parent->y_offset; |
830 | + nux::Color shine_colour = nux::color::White; |
831 | |
832 | - nux::GetPainter().PushTextureLayer(gfx_context, larger_content_geo, |
833 | - bg_shine_texture_, |
834 | - texxform_absolute_bg, |
835 | - nux::color::White, |
836 | - false, |
837 | - rop); |
838 | - bgs++; |
839 | + nux::GetPainter().PushTextureLayer(gfx_context, larger_content_geo, |
840 | + bg_shine_texture_, |
841 | + texxform_absolute_bg, |
842 | + shine_colour, |
843 | + true, |
844 | + rop); |
845 | + bgs++; |
846 | + } |
847 | |
848 | nux::Geometry refine_geo = larger_content_geo; |
849 | |
850 | |
851 | === modified file 'unity-shared/OverlayRenderer.h' |
852 | --- unity-shared/OverlayRenderer.h 2012-05-06 23:48:38 +0000 |
853 | +++ unity-shared/OverlayRenderer.h 2012-10-01 15:14:28 +0000 |
854 | @@ -86,7 +86,6 @@ |
855 | |
856 | private: |
857 | OverlayRendererImpl *pimpl_; |
858 | - |
859 | }; |
860 | |
861 | } |
862 | |
863 | === modified file 'unity-shared/UnitySettings.cpp' |
864 | --- unity-shared/UnitySettings.cpp 2012-09-17 09:26:59 +0000 |
865 | +++ unity-shared/UnitySettings.cpp 2012-10-01 15:14:28 +0000 |
866 | @@ -48,6 +48,7 @@ |
867 | : parent_(owner) |
868 | , gsettings_(g_settings_new(SETTINGS_NAME.c_str())) |
869 | , cached_form_factor_(FormFactor::DESKTOP) |
870 | + , lowGfx_(false) |
871 | { |
872 | CacheFormFactor(); |
873 | |
874 | @@ -89,6 +90,7 @@ |
875 | Settings* parent_; |
876 | glib::Object<GSettings> gsettings_; |
877 | FormFactor cached_form_factor_; |
878 | + bool lowGfx_; |
879 | |
880 | glib::Signal<void, GSettings*, gchar* > form_factor_changed_; |
881 | }; |
882 | @@ -105,8 +107,9 @@ |
883 | { |
884 | LOG_ERROR(logger) << "More than one unity::Settings created."; |
885 | } |
886 | + |
887 | else |
888 | - { |
889 | + { |
890 | form_factor.SetGetterFunction(sigc::mem_fun(*pimpl, &Impl::GetFormFactor)); |
891 | form_factor.SetSetterFunction(sigc::mem_fun(*pimpl, &Impl::SetFormFactor)); |
892 | |
893 | @@ -130,5 +133,14 @@ |
894 | return *settings_instance; |
895 | } |
896 | |
897 | +bool Settings::GetLowGfxMode() const |
898 | +{ |
899 | + return pimpl->lowGfx_; |
900 | +} |
901 | + |
902 | +void Settings::SetLowGfxMode(const bool low_gfx) |
903 | +{ |
904 | + pimpl->lowGfx_ = low_gfx; |
905 | +} |
906 | |
907 | } // namespace unity |
908 | |
909 | === modified file 'unity-shared/UnitySettings.h' |
910 | --- unity-shared/UnitySettings.h 2012-09-17 09:26:59 +0000 |
911 | +++ unity-shared/UnitySettings.h 2012-10-01 15:14:28 +0000 |
912 | @@ -42,6 +42,8 @@ |
913 | ~Settings(); |
914 | |
915 | static Settings& Instance(); |
916 | + bool GetLowGfxMode() const; |
917 | + void SetLowGfxMode(const bool low_gfx); |
918 | |
919 | nux::RWProperty<FormFactor> form_factor; |
920 | nux::Property<bool> is_standalone; |
Looks good, works perfectly.