Merge lp:~unity-team/unity/unity.fix-839476 into lp:unity
- unity.fix-839476
- Merge into trunk
Proposed by
Jay Taoko
Status: | Merged |
---|---|
Approved by: | Mirco Müller |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2231 |
Proposed branch: | lp:~unity-team/unity/unity.fix-839476 |
Merge into: | lp:unity |
Diff against target: |
963 lines (+573/-157) 3 files modified
plugins/unityshell/src/DashStyle.cpp (+34/-0) plugins/unityshell/src/DashStyle.h (+5/-0) plugins/unityshell/src/OverlayRenderer.cpp (+534/-157) |
To merge this branch: | bzr merge lp:~unity-team/unity/unity.fix-839476 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mirco Müller (community) | Approve | ||
Andrea Cimitan (community) | design | Approve | |
Review via email: mp+100982@code.launchpad.net |
Commit message
* Fix: rendering of the Dash corners (top-right, bottom-left, bottom-right).
Description of the change
* Fix: rendering of the Dash corners (top-right, bottom-left, bottom-right).
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 | === added file 'plugins/unityshell/resources/dash_bottom_border_tile_mask.png' |
2 | Binary files plugins/unityshell/resources/dash_bottom_border_tile_mask.png 1970-01-01 00:00:00 +0000 and plugins/unityshell/resources/dash_bottom_border_tile_mask.png 2012-04-05 15:25:21 +0000 differ |
3 | === added file 'plugins/unityshell/resources/dash_bottom_left_corner_mask.png' |
4 | Binary files plugins/unityshell/resources/dash_bottom_left_corner_mask.png 1970-01-01 00:00:00 +0000 and plugins/unityshell/resources/dash_bottom_left_corner_mask.png 2012-04-05 15:25:21 +0000 differ |
5 | === added file 'plugins/unityshell/resources/dash_bottom_right_corner_mask.png' |
6 | Binary files plugins/unityshell/resources/dash_bottom_right_corner_mask.png 1970-01-01 00:00:00 +0000 and plugins/unityshell/resources/dash_bottom_right_corner_mask.png 2012-04-05 15:25:21 +0000 differ |
7 | === added file 'plugins/unityshell/resources/dash_right_border_tile_mask.png' |
8 | Binary files plugins/unityshell/resources/dash_right_border_tile_mask.png 1970-01-01 00:00:00 +0000 and plugins/unityshell/resources/dash_right_border_tile_mask.png 2012-04-05 15:25:21 +0000 differ |
9 | === added file 'plugins/unityshell/resources/dash_top_right_corner_mask.png' |
10 | Binary files plugins/unityshell/resources/dash_top_right_corner_mask.png 1970-01-01 00:00:00 +0000 and plugins/unityshell/resources/dash_top_right_corner_mask.png 2012-04-05 15:25:21 +0000 differ |
11 | === modified file 'plugins/unityshell/src/DashStyle.cpp' |
12 | --- plugins/unityshell/src/DashStyle.cpp 2012-03-27 15:09:26 +0000 |
13 | +++ plugins/unityshell/src/DashStyle.cpp 2012-04-05 15:25:21 +0000 |
14 | @@ -194,13 +194,18 @@ |
15 | int number_of_columns_; |
16 | |
17 | LazyLoadTexture dash_bottom_texture_; |
18 | + LazyLoadTexture dash_bottom_texture_mask_; |
19 | LazyLoadTexture dash_right_texture_; |
20 | + LazyLoadTexture dash_right_texture_mask_; |
21 | LazyLoadTexture dash_corner_texture_; |
22 | + LazyLoadTexture dash_corner_texture_mask_; |
23 | LazyLoadTexture dash_fullscreen_icon_; |
24 | LazyLoadTexture dash_left_edge_; |
25 | LazyLoadTexture dash_left_corner_; |
26 | + LazyLoadTexture dash_left_corner_mask_; |
27 | LazyLoadTexture dash_left_tile_; |
28 | LazyLoadTexture dash_top_corner_; |
29 | + LazyLoadTexture dash_top_corner_mask_; |
30 | LazyLoadTexture dash_top_tile_; |
31 | |
32 | LazyLoadTexture dash_shine_; |
33 | @@ -232,13 +237,18 @@ |
34 | , text_height_(0) |
35 | , number_of_columns_(6) |
36 | , dash_bottom_texture_("/dash_bottom_border_tile.png") |
37 | + , dash_bottom_texture_mask_("/dash_bottom_border_tile_mask.png") |
38 | , dash_right_texture_("/dash_right_border_tile.png") |
39 | + , dash_right_texture_mask_("/dash_right_border_tile_mask.png") |
40 | , dash_corner_texture_("/dash_bottom_right_corner.png") |
41 | + , dash_corner_texture_mask_("/dash_bottom_right_corner_mask.png") |
42 | , dash_fullscreen_icon_("/dash_fullscreen_icon.png") |
43 | , dash_left_edge_("/dash_left_edge.png") |
44 | , dash_left_corner_("/dash_bottom_left_corner.png") |
45 | + , dash_left_corner_mask_("/dash_bottom_left_corner_mask.png") |
46 | , dash_left_tile_("/dash_left_tile.png") |
47 | , dash_top_corner_("/dash_top_right_corner.png") |
48 | + , dash_top_corner_mask_("/dash_top_right_corner_mask.png") |
49 | , dash_top_tile_("/dash_top_tile.png") |
50 | , dash_shine_("/dash_sheen.png") |
51 | , search_magnify_texture_("/search_magnify.png") |
52 | @@ -2060,16 +2070,30 @@ |
53 | return pimpl->dash_bottom_texture_.texture(); |
54 | } |
55 | |
56 | +nux::BaseTexture* Style::GetDashBottomTileMask() |
57 | +{ |
58 | + return pimpl->dash_bottom_texture_mask_.texture(); |
59 | +} |
60 | + |
61 | nux::BaseTexture* Style::GetDashRightTile() |
62 | { |
63 | return pimpl->dash_right_texture_.texture(); |
64 | } |
65 | |
66 | +nux::BaseTexture* Style::GetDashRightTileMask() |
67 | +{ |
68 | + return pimpl->dash_right_texture_mask_.texture(); |
69 | +} |
70 | + |
71 | nux::BaseTexture* Style::GetDashCorner() |
72 | { |
73 | return pimpl->dash_corner_texture_.texture(); |
74 | } |
75 | |
76 | +nux::BaseTexture* Style::GetDashCornerMask() |
77 | +{ |
78 | + return pimpl->dash_corner_texture_mask_.texture(); |
79 | +} |
80 | |
81 | nux::BaseTexture* Style::GetDashLeftEdge() |
82 | { |
83 | @@ -2081,6 +2105,11 @@ |
84 | return pimpl->dash_left_corner_.texture(); |
85 | } |
86 | |
87 | +nux::BaseTexture* Style::GetDashLeftCornerMask() |
88 | +{ |
89 | + return pimpl->dash_left_corner_mask_.texture(); |
90 | +} |
91 | + |
92 | nux::BaseTexture* Style::GetDashLeftTile() |
93 | { |
94 | return pimpl->dash_left_tile_.texture(); |
95 | @@ -2091,6 +2120,11 @@ |
96 | return pimpl->dash_top_corner_.texture(); |
97 | } |
98 | |
99 | +nux::BaseTexture* Style::GetDashTopCornerMask() |
100 | +{ |
101 | + return pimpl->dash_top_corner_mask_.texture(); |
102 | +} |
103 | + |
104 | nux::BaseTexture* Style::GetDashTopTile() |
105 | { |
106 | return pimpl->dash_top_tile_.texture(); |
107 | |
108 | === modified file 'plugins/unityshell/src/DashStyle.h' |
109 | --- plugins/unityshell/src/DashStyle.h 2012-03-27 15:09:26 +0000 |
110 | +++ plugins/unityshell/src/DashStyle.h 2012-04-05 15:25:21 +0000 |
111 | @@ -166,13 +166,18 @@ |
112 | int GetTextLineHeight() const; |
113 | |
114 | nux::BaseTexture* GetDashBottomTile(); |
115 | + nux::BaseTexture* GetDashBottomTileMask(); |
116 | nux::BaseTexture* GetDashRightTile(); |
117 | + nux::BaseTexture* GetDashRightTileMask(); |
118 | nux::BaseTexture* GetDashCorner(); |
119 | + nux::BaseTexture* GetDashCornerMask(); |
120 | nux::BaseTexture* GetDashFullscreenIcon(); |
121 | nux::BaseTexture* GetDashLeftEdge(); |
122 | nux::BaseTexture* GetDashLeftCorner(); |
123 | + nux::BaseTexture* GetDashLeftCornerMask(); |
124 | nux::BaseTexture* GetDashLeftTile(); |
125 | nux::BaseTexture* GetDashTopCorner(); |
126 | + nux::BaseTexture* GetDashTopCornerMask(); |
127 | nux::BaseTexture* GetDashTopTile(); |
128 | |
129 | nux::BaseTexture* GetDashShine(); |
130 | |
131 | === modified file 'plugins/unityshell/src/OverlayRenderer.cpp' |
132 | --- plugins/unityshell/src/OverlayRenderer.cpp 2012-03-23 15:12:10 +0000 |
133 | +++ plugins/unityshell/src/OverlayRenderer.cpp 2012-04-05 15:25:21 +0000 |
134 | @@ -38,6 +38,7 @@ |
135 | nux::logging::Logger logger("unity.overlayrenderer"); |
136 | |
137 | const int INNER_CORNER_RADIUS = 5; |
138 | +const int EXCESS_BORDER = 10; |
139 | } |
140 | |
141 | // Impl class |
142 | @@ -70,6 +71,18 @@ |
143 | UBusManager ubus_manager_; |
144 | |
145 | OverlayRenderer *parent; |
146 | + |
147 | + void InitASMInverseTextureMaskShader(); |
148 | + void InitSlInverseTextureMaskShader(); |
149 | + |
150 | + nux::ObjectPtr<nux::IOpenGLAsmShaderProgram> inverse_texture_mask_asm_prog_; |
151 | + nux::ObjectPtr<nux::IOpenGLAsmShaderProgram> inverse_texture_rect_mask_asm_prog_; |
152 | + nux::ObjectPtr<nux::IOpenGLShaderProgram> inverse_texture_mask_prog_; |
153 | + |
154 | + void RenderInverseMask_GLSL(nux::GraphicsEngine& gfx_context, int x, int y, int width, int height, nux::ObjectPtr<nux::IOpenGLBaseTexture> DeviceTexture, nux::TexCoordXForm &texxform0, const nux::Color &color0); |
155 | + void RenderInverseMask_ASM(nux::GraphicsEngine& gfx_context, int x, int y, int width, int height, nux::ObjectPtr<nux::IOpenGLBaseTexture> DeviceTexture, nux::TexCoordXForm &texxform0, const nux::Color &color0); |
156 | + void RenderInverseMask(nux::GraphicsEngine& gfx_context, int x, int y, int width, int height, nux::ObjectPtr<nux::IOpenGLBaseTexture> DeviceTexture, nux::TexCoordXForm &texxform0, const nux::Color &color0); |
157 | + |
158 | }; |
159 | |
160 | OverlayRendererImpl::OverlayRendererImpl(OverlayRenderer *parent_) |
161 | @@ -118,22 +131,404 @@ |
162 | parent->need_redraw.emit(); |
163 | } |
164 | |
165 | +void OverlayRendererImpl::InitASMInverseTextureMaskShader() |
166 | +{ |
167 | + nux::NString AsmVtx = |
168 | + "!!ARBvp1.0 \n\ |
169 | + ATTRIB iPos = vertex.position; \n\ |
170 | + ATTRIB iColor = vertex.attrib[3]; \n\ |
171 | + PARAM mvp[4] = {state.matrix.mvp}; \n\ |
172 | + OUTPUT oPos = result.position; \n\ |
173 | + OUTPUT oColor = result.color; \n\ |
174 | + OUTPUT oTexCoord0 = result.texcoord[0]; \n\ |
175 | + # Transform the vertex to clip coordinates. \n\ |
176 | + DP4 oPos.x, mvp[0], iPos; \n\ |
177 | + DP4 oPos.y, mvp[1], iPos; \n\ |
178 | + DP4 oPos.z, mvp[2], iPos; \n\ |
179 | + DP4 oPos.w, mvp[3], iPos; \n\ |
180 | + MOV oColor, iColor; \n\ |
181 | + MOV oTexCoord0, vertex.attrib[8]; \n\ |
182 | + END"; |
183 | + |
184 | + nux::NString AsmFrg = |
185 | + "!!ARBfp1.0 \n\ |
186 | + TEMP tex0; \n\ |
187 | + TEMP temp0; \n\ |
188 | + TEX tex0, fragment.texcoord[0], texture[0], 2D; \n\ |
189 | + MUL temp0, fragment.color, tex0; \n\ |
190 | + SUB result.color, {1.0, 1.0, 1.0, 1.0}, temp0.aaaa;\n\ |
191 | + END"; |
192 | + |
193 | + nux::NString AsmFrgRect = |
194 | + "!!ARBfp1.0 \n\ |
195 | + TEMP tex0; \n\ |
196 | + TEMP temp0; \n\ |
197 | + TEX tex0, fragment.texcoord[0], texture[0], RECT; \n\ |
198 | + MUL temp0, fragment.color, tex0; \n\ |
199 | + SUB result.color, {1.0, 1.0, 1.0, 1.0}, temp0.aaaa; \n\ |
200 | + END"; |
201 | + |
202 | + inverse_texture_mask_asm_prog_ = nux::GetGraphicsDisplay()->GetGpuDevice()->CreateAsmShaderProgram(); |
203 | + inverse_texture_mask_asm_prog_->LoadVertexShader(AsmVtx.GetTCharPtr()); |
204 | + inverse_texture_mask_asm_prog_->LoadPixelShader(AsmFrg.GetTCharPtr()); |
205 | + inverse_texture_mask_asm_prog_->Link(); |
206 | + |
207 | + inverse_texture_rect_mask_asm_prog_ = nux::GetGraphicsDisplay()->GetGpuDevice()->CreateAsmShaderProgram(); |
208 | + inverse_texture_rect_mask_asm_prog_->LoadVertexShader(AsmVtx.GetTCharPtr()); |
209 | + inverse_texture_rect_mask_asm_prog_->LoadPixelShader(AsmFrgRect.GetTCharPtr()); |
210 | + inverse_texture_rect_mask_asm_prog_->Link(); |
211 | +} |
212 | + |
213 | +void OverlayRendererImpl::RenderInverseMask_ASM(nux::GraphicsEngine& gfx_context, int x, int y, int width, int height, nux::ObjectPtr<nux::IOpenGLBaseTexture> device_texture, nux::TexCoordXForm &texxform, const nux::Color &color) |
214 | +{ |
215 | + printf("RenderInverseMask_ASM\n"); |
216 | + if (!inverse_texture_mask_asm_prog_.IsValid() || !inverse_texture_rect_mask_asm_prog_.IsValid()) |
217 | + { |
218 | + InitASMInverseTextureMaskShader(); |
219 | + } |
220 | + |
221 | + QRP_Compute_Texture_Coord(width, height, device_texture, texxform); |
222 | + float fx = x, fy = y; |
223 | + float VtxBuffer[] = |
224 | + { |
225 | + fx, fy, 0.0f, 1.0f, texxform.u0, texxform.v0, 0, 1.0f, color.red, color.green, color.blue, color.alpha, |
226 | + fx, fy + height, 0.0f, 1.0f, texxform.u0, texxform.v1, 0, 1.0f, color.red, color.green, color.blue, color.alpha, |
227 | + fx + width, fy + height, 0.0f, 1.0f, texxform.u1, texxform.v1, 0, 1.0f, color.red, color.green, color.blue, color.alpha, |
228 | + fx + width, fy, 0.0f, 1.0f, texxform.u1, texxform.v0, 0, 1.0f, color.red, color.green, color.blue, color.alpha, |
229 | + }; |
230 | + |
231 | + CHECKGL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0)); |
232 | + CHECKGL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0)); |
233 | + |
234 | + nux::ObjectPtr<nux::IOpenGLAsmShaderProgram> shader_program = inverse_texture_mask_asm_prog_; |
235 | + if (device_texture->Type().IsDerivedFromType(nux::IOpenGLRectangleTexture::StaticObjectType)) |
236 | + { |
237 | + shader_program = inverse_texture_rect_mask_asm_prog_; |
238 | + } |
239 | + shader_program->Begin(); |
240 | + |
241 | + gfx_context.SetTexture(GL_TEXTURE0, device_texture); |
242 | + |
243 | + CHECKGL(glMatrixMode(GL_MODELVIEW)); |
244 | + CHECKGL(glLoadIdentity()); |
245 | + CHECKGL(glLoadMatrixf((FLOAT *) gfx_context.GetOpenGLModelViewMatrix().m)); |
246 | + CHECKGL(glMatrixMode(GL_PROJECTION)); |
247 | + CHECKGL(glLoadIdentity()); |
248 | + CHECKGL(glLoadMatrixf((FLOAT *) gfx_context.GetOpenGLProjectionMatrix().m)); |
249 | + |
250 | + |
251 | + int VertexLocation = nux::VTXATTRIB_POSITION; |
252 | + int TextureCoord0Location = nux::VTXATTRIB_TEXCOORD0; |
253 | + int VertexColorLocation = nux::VTXATTRIB_COLOR; |
254 | + |
255 | + CHECKGL(glEnableVertexAttribArrayARB(VertexLocation)); |
256 | + CHECKGL(glVertexAttribPointerARB((GLuint) VertexLocation, 4, GL_FLOAT, GL_FALSE, 48, VtxBuffer)); |
257 | + |
258 | + if (TextureCoord0Location != -1) |
259 | + { |
260 | + CHECKGL(glEnableVertexAttribArrayARB(TextureCoord0Location)); |
261 | + CHECKGL(glVertexAttribPointerARB((GLuint) TextureCoord0Location, 4, GL_FLOAT, GL_FALSE, 48, VtxBuffer + 4)); |
262 | + } |
263 | + |
264 | + if (VertexColorLocation != -1) |
265 | + { |
266 | + CHECKGL(glEnableVertexAttribArrayARB(VertexColorLocation)); |
267 | + CHECKGL(glVertexAttribPointerARB((GLuint) VertexColorLocation, 4, GL_FLOAT, GL_FALSE, 48, VtxBuffer + 8)); |
268 | + } |
269 | + |
270 | + CHECKGL(glDrawArrays(GL_TRIANGLE_FAN, 0, 4)); |
271 | + |
272 | + CHECKGL(glDisableVertexAttribArrayARB(VertexLocation)); |
273 | + |
274 | + if (TextureCoord0Location != -1) |
275 | + CHECKGL(glDisableVertexAttribArrayARB(TextureCoord0Location)); |
276 | + |
277 | + if (VertexColorLocation != -1) |
278 | + CHECKGL(glDisableVertexAttribArrayARB(VertexColorLocation)); |
279 | + |
280 | + shader_program->End(); |
281 | +} |
282 | + |
283 | +void OverlayRendererImpl::InitSlInverseTextureMaskShader() |
284 | +{ |
285 | + nux::ObjectPtr<nux::IOpenGLVertexShader> VS = nux::GetGraphicsDisplay()->GetGpuDevice()->CreateVertexShader(); |
286 | + nux::ObjectPtr<nux::IOpenGLPixelShader> PS = nux::GetGraphicsDisplay()->GetGpuDevice()->CreatePixelShader(); |
287 | + nux::NString VSString; |
288 | + nux::NString PSString; |
289 | + |
290 | + VSString = |
291 | + NUX_VERTEX_SHADER_HEADER |
292 | + "attribute vec4 AVertex; \n\ |
293 | + attribute vec4 MyTextureCoord0; \n\ |
294 | + attribute vec4 VertexColor; \n\ |
295 | + uniform mat4 ViewProjectionMatrix; \n\ |
296 | + varying vec4 varyTexCoord0; \n\ |
297 | + varying vec4 varyVertexColor; \n\ |
298 | + void main() \n\ |
299 | + { \n\ |
300 | + gl_Position = ViewProjectionMatrix * (AVertex); \n\ |
301 | + varyTexCoord0 = MyTextureCoord0; \n\ |
302 | + varyVertexColor = VertexColor; \n\ |
303 | + }"; |
304 | + |
305 | + PSString = |
306 | + NUX_FRAGMENT_SHADER_HEADER |
307 | + "varying vec4 varyTexCoord0; \n\ |
308 | + varying vec4 varyVertexColor; \n\ |
309 | + uniform sampler2D TextureObject0; \n\ |
310 | + void main() \n\ |
311 | + { \n\ |
312 | + vec4 v = varyVertexColor*texture2D(TextureObject0, varyTexCoord0.xy); \n\ |
313 | + gl_FragColor = vec4(1.0-v.a); \n\ |
314 | + }"; |
315 | + |
316 | + // Textured 2D Primitive Shader |
317 | + inverse_texture_mask_prog_ = nux::GetGraphicsDisplay()->GetGpuDevice()->CreateShaderProgram(); |
318 | + VS->SetShaderCode(TCHAR_TO_ANSI(*VSString)); |
319 | + PS->SetShaderCode(TCHAR_TO_ANSI(*PSString), "#define SAMPLERTEX2D"); |
320 | + |
321 | + inverse_texture_mask_prog_->ClearShaderObjects(); |
322 | + inverse_texture_mask_prog_->AddShaderObject(VS); |
323 | + inverse_texture_mask_prog_->AddShaderObject(PS); |
324 | + CHECKGL(glBindAttribLocation(inverse_texture_mask_prog_->GetOpenGLID(), 0, "AVertex")); |
325 | + inverse_texture_mask_prog_->Link(); |
326 | +} |
327 | + |
328 | +void OverlayRendererImpl::RenderInverseMask_GLSL(nux::GraphicsEngine& gfx_context, int x, int y, int width, int height, nux::ObjectPtr<nux::IOpenGLBaseTexture> DeviceTexture, nux::TexCoordXForm &texxform0, const nux::Color &color0) |
329 | +{ |
330 | + if (!inverse_texture_mask_prog_.IsValid()) |
331 | + InitSlInverseTextureMaskShader(); |
332 | + |
333 | + QRP_Compute_Texture_Coord(width, height, DeviceTexture, texxform0); |
334 | + float fx = x, fy = y; |
335 | + float VtxBuffer[] = |
336 | + { |
337 | + fx, fy, 0.0f, 1.0f, texxform0.u0, texxform0.v0, 0, 0, color0.red, color0.green, color0.blue, color0.alpha, |
338 | + fx, fy + height, 0.0f, 1.0f, texxform0.u0, texxform0.v1, 0, 0, color0.red, color0.green, color0.blue, color0.alpha, |
339 | + fx + width, fy + height, 0.0f, 1.0f, texxform0.u1, texxform0.v1, 0, 0, color0.red, color0.green, color0.blue, color0.alpha, |
340 | + fx + width, fy, 0.0f, 1.0f, texxform0.u1, texxform0.v0, 0, 0, color0.red, color0.green, color0.blue, color0.alpha, |
341 | + }; |
342 | + |
343 | + nux::ObjectPtr<nux::IOpenGLShaderProgram> ShaderProg; |
344 | + |
345 | + if (DeviceTexture->Type().IsDerivedFromType(nux::IOpenGLTexture2D::StaticObjectType)) |
346 | + { |
347 | + ShaderProg = inverse_texture_mask_prog_; |
348 | + } |
349 | + |
350 | + CHECKGL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0)); |
351 | + CHECKGL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0)); |
352 | + ShaderProg->Begin(); |
353 | + |
354 | + int TextureObjectLocation = ShaderProg->GetUniformLocationARB("TextureObject0"); |
355 | + int VertexLocation = ShaderProg->GetAttributeLocation("AVertex"); |
356 | + int TextureCoord0Location = ShaderProg->GetAttributeLocation("MyTextureCoord0"); |
357 | + int VertexColorLocation = ShaderProg->GetAttributeLocation("VertexColor"); |
358 | + |
359 | + gfx_context.SetTexture(GL_TEXTURE0, DeviceTexture); |
360 | + CHECKGL(glUniform1iARB(TextureObjectLocation, 0)); |
361 | + |
362 | + int VPMatrixLocation = ShaderProg->GetUniformLocationARB("ViewProjectionMatrix"); |
363 | + nux::Matrix4 MVPMatrix = gfx_context.GetOpenGLModelViewProjectionMatrix(); |
364 | + ShaderProg->SetUniformLocMatrix4fv((GLint) VPMatrixLocation, 1, false, (GLfloat *) & (MVPMatrix.m)); |
365 | + |
366 | + CHECKGL(glEnableVertexAttribArrayARB(VertexLocation)); |
367 | + CHECKGL(glVertexAttribPointerARB((GLuint) VertexLocation, 4, GL_FLOAT, GL_FALSE, 48, VtxBuffer)); |
368 | + |
369 | + if (TextureCoord0Location != -1) |
370 | + { |
371 | + CHECKGL(glEnableVertexAttribArrayARB(TextureCoord0Location)); |
372 | + CHECKGL(glVertexAttribPointerARB((GLuint) TextureCoord0Location, 4, GL_FLOAT, GL_FALSE, 48, VtxBuffer + 4)); |
373 | + } |
374 | + |
375 | + if (VertexColorLocation != -1) |
376 | + { |
377 | + CHECKGL(glEnableVertexAttribArrayARB(VertexColorLocation)); |
378 | + CHECKGL(glVertexAttribPointerARB((GLuint) VertexColorLocation, 4, GL_FLOAT, GL_FALSE, 48, VtxBuffer + 8)); |
379 | + } |
380 | + |
381 | + CHECKGL(glDrawArrays(GL_TRIANGLE_FAN, 0, 4)); |
382 | + |
383 | + CHECKGL(glDisableVertexAttribArrayARB(VertexLocation)); |
384 | + |
385 | + if (TextureCoord0Location != -1) |
386 | + CHECKGL(glDisableVertexAttribArrayARB(TextureCoord0Location)); |
387 | + |
388 | + if (VertexColorLocation != -1) |
389 | + CHECKGL(glDisableVertexAttribArrayARB(VertexColorLocation)); |
390 | + |
391 | + ShaderProg->End(); |
392 | +} |
393 | + |
394 | +void OverlayRendererImpl::RenderInverseMask(nux::GraphicsEngine& gfx_context, int x, int y, int width, int height, nux::ObjectPtr<nux::IOpenGLBaseTexture> DeviceTexture, nux::TexCoordXForm &texxform0, const nux::Color &color0) |
395 | +{ |
396 | + if (nux::GetWindowThread()->GetGraphicsEngine().UsingGLSLCodePath()) |
397 | + { |
398 | + RenderInverseMask_GLSL(gfx_context, x, y, width, height, DeviceTexture, texxform0, color0); |
399 | + } |
400 | + else |
401 | + { |
402 | + RenderInverseMask_ASM(gfx_context, x, y, width, height, DeviceTexture, texxform0, color0); |
403 | + } |
404 | +} |
405 | + |
406 | void OverlayRendererImpl::Draw(nux::GraphicsEngine& gfx_context, nux::Geometry content_geo, nux::Geometry absolute_geo, nux::Geometry geometry, bool force_edges) |
407 | { |
408 | bool paint_blur = BackgroundEffectHelper::blur_type != BLUR_NONE; |
409 | nux::Geometry geo(content_geo); |
410 | |
411 | + |
412 | + nux::Geometry larger_content_geo = content_geo; |
413 | + larger_content_geo.OffsetSize(EXCESS_BORDER, EXCESS_BORDER); |
414 | + |
415 | + nux::Geometry larger_geo(larger_content_geo); |
416 | + |
417 | + nux::Geometry larger_absolute_geo = absolute_geo; |
418 | + larger_absolute_geo.OffsetSize(EXCESS_BORDER, EXCESS_BORDER); |
419 | + |
420 | + nux::TexCoordXForm texxform_absolute_bg; |
421 | + texxform_absolute_bg.flip_v_coord = true; |
422 | + texxform_absolute_bg.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
423 | + texxform_absolute_bg.uoffset = ((float) larger_content_geo.x) / larger_absolute_geo.width; |
424 | + texxform_absolute_bg.voffset = ((float) larger_content_geo.y) / larger_absolute_geo.height; |
425 | + texxform_absolute_bg.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP); |
426 | + |
427 | + nux::Geometry blur_geo(larger_absolute_geo.x, larger_absolute_geo.y, larger_content_geo.width, larger_content_geo.height); |
428 | + if (paint_blur) |
429 | + { |
430 | + bg_blur_texture_ = bg_effect_helper_.GetBlurRegion(blur_geo); |
431 | + } |
432 | + else |
433 | + { |
434 | + bg_blur_texture_ = bg_effect_helper_.GetRegion(blur_geo); |
435 | + } |
436 | + |
437 | + if (bg_blur_texture_.IsValid()) |
438 | + { |
439 | + nux::Geometry bg_clip = larger_geo; |
440 | + gfx_context.PushClippingRectangle(bg_clip); |
441 | + |
442 | + gfx_context.GetRenderStates().SetBlend(false); |
443 | +#ifndef NUX_OPENGLES_20 |
444 | + if (gfx_context.UsingGLSLCodePath()) |
445 | + gfx_context.QRP_GLSL_ColorBlendOverTex (larger_content_geo.x, larger_content_geo.y, |
446 | + larger_content_geo.width, larger_content_geo.height, |
447 | + bg_blur_texture_, texxform_absolute_bg, nux::color::White, |
448 | + bg_color_, nux::LAYER_BLEND_MODE_OVERLAY); |
449 | + |
450 | + else |
451 | + gfx_context.QRP_1Tex (larger_content_geo.x, larger_content_geo.y, |
452 | + larger_content_geo.width, larger_content_geo.height, |
453 | + bg_blur_texture_, texxform_absolute_bg, nux::color::White); |
454 | +#else |
455 | + gfx_context.QRP_GLSL_ColorBlendOverTex (larger_content_geo.x, larger_content_geo.y, |
456 | + larger_content_geo.width, larger_content_geo.height, |
457 | + bg_blur_texture_, texxform_absolute_bg, nux::color::White, |
458 | + bg_color_, nux::LAYER_BLEND_MODE_OVERLAY); |
459 | + |
460 | +#endif |
461 | + gPainter.PopBackground(); |
462 | + |
463 | + gfx_context.PopClippingRectangle(); |
464 | + } |
465 | + |
466 | + // Draw the left and top lines |
467 | + dash::Style& style = dash::Style::Instance(); |
468 | + |
469 | + gfx_context.GetRenderStates().SetColorMask(true, true, true, true); |
470 | + gfx_context.GetRenderStates().SetBlend(true); |
471 | + gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
472 | + |
473 | + const double line_opacity = 0.1f; |
474 | + const int gradient_width = 130; |
475 | + const int gradient_height = 50; |
476 | + const int horizontal_padding = 40; |
477 | + const int vertical_padding = 20; |
478 | + |
479 | + // Now that we mask the corners of the dash, |
480 | + // draw longer lines to fill the minimal gaps |
481 | + const int corner_overlap = 3; |
482 | + |
483 | + nux::Color line_color = nux::color::White * line_opacity; |
484 | + |
485 | + // Vertical lancher/dash separator |
486 | + nux::GetPainter().Paint2DQuadColor(gfx_context, |
487 | + nux::Geometry(geometry.x, |
488 | + geometry.y + vertical_padding, |
489 | + style.GetVSeparatorSize(), |
490 | + gradient_height), |
491 | + nux::color::Transparent, |
492 | + line_color * 0.7f, // less opacity |
493 | + line_color * 0.7f, // less opacity |
494 | + nux::color::Transparent); |
495 | + nux::GetPainter().Draw2DLine(gfx_context, |
496 | + geometry.x, |
497 | + geometry.y + vertical_padding + gradient_height, |
498 | + style.GetVSeparatorSize(), |
499 | + geometry.y + content_geo.height + INNER_CORNER_RADIUS + corner_overlap, |
500 | + line_color * 0.7f); // less opacity |
501 | + |
502 | + // Horizontal panel/dash separator |
503 | + nux::GetPainter().Paint2DQuadColor(gfx_context, |
504 | + nux::Geometry(geometry.x + horizontal_padding, |
505 | + geometry.y, |
506 | + gradient_width, |
507 | + style.GetHSeparatorSize()), |
508 | + nux::color::Transparent, |
509 | + nux::color::Transparent, |
510 | + line_color, |
511 | + line_color); |
512 | + nux::GetPainter().Draw2DLine(gfx_context, |
513 | + geometry.x + horizontal_padding + gradient_width, |
514 | + geometry.y, |
515 | + geometry.x + content_geo.width + INNER_CORNER_RADIUS + corner_overlap, |
516 | + style.GetHSeparatorSize(), |
517 | + line_color); |
518 | + |
519 | + // Draw the background |
520 | + bg_darken_layer_->SetGeometry(larger_content_geo); |
521 | + nux::GetPainter().RenderSinglePaintLayer(gfx_context, larger_content_geo, bg_darken_layer_); |
522 | + |
523 | +#ifndef NUX_OPENGLES_20 |
524 | + if (gfx_context.UsingGLSLCodePath() == FALSE) |
525 | + { |
526 | + bg_layer_->SetGeometry(larger_content_geo); |
527 | + nux::GetPainter().RenderSinglePaintLayer(gfx_context, larger_content_geo, bg_layer_); |
528 | + } |
529 | +#endif |
530 | + |
531 | + |
532 | + texxform_absolute_bg.flip_v_coord = false; |
533 | + texxform_absolute_bg.uoffset = (1.0f / bg_shine_texture_->GetWidth()) * parent->x_offset; |
534 | + texxform_absolute_bg.voffset = (1.0f / bg_shine_texture_->GetHeight()) * parent->y_offset; |
535 | + |
536 | + gfx_context.GetRenderStates().SetColorMask(true, true, true, false); |
537 | + gfx_context.GetRenderStates().SetBlend(true, GL_DST_COLOR, GL_ONE); |
538 | + |
539 | + gfx_context.QRP_1Tex (larger_content_geo.x, larger_content_geo.y, |
540 | + larger_content_geo.width, larger_content_geo.height, |
541 | + bg_shine_texture_, texxform_absolute_bg, nux::color::White); |
542 | + |
543 | if (dash::Settings::Instance().GetFormFactor() != dash::FormFactor::NETBOOK || force_edges) |
544 | { |
545 | // Paint the edges |
546 | { |
547 | + gfx_context.GetRenderStates().SetColorMask(true, true, true, true); |
548 | + gfx_context.GetRenderStates().SetBlend(true); |
549 | + gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
550 | + |
551 | dash::Style& style = dash::Style::Instance(); |
552 | nux::BaseTexture* bottom = style.GetDashBottomTile(); |
553 | + nux::BaseTexture* bottom_mask = style.GetDashBottomTileMask(); |
554 | nux::BaseTexture* right = style.GetDashRightTile(); |
555 | + nux::BaseTexture* right_mask = style.GetDashRightTileMask(); |
556 | nux::BaseTexture* corner = style.GetDashCorner(); |
557 | + nux::BaseTexture* corner_mask = style.GetDashCornerMask(); |
558 | nux::BaseTexture* left_corner = style.GetDashLeftCorner(); |
559 | + nux::BaseTexture* left_corner_mask = style.GetDashLeftCornerMask(); |
560 | nux::BaseTexture* left_tile = style.GetDashLeftTile(); |
561 | nux::BaseTexture* top_corner = style.GetDashTopCorner(); |
562 | + nux::BaseTexture* top_corner_mask = style.GetDashTopCornerMask(); |
563 | nux::BaseTexture* top_tile = style.GetDashTopTile(); |
564 | nux::TexCoordXForm texxform; |
565 | |
566 | @@ -147,6 +542,30 @@ |
567 | texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
568 | texxform.SetWrap(nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER); |
569 | |
570 | + // Selectively erase blur region in the curbe |
571 | + gfx_context.QRP_ColorModTexAlpha(geo.x + (geo.width - corner->GetWidth()), |
572 | + geo.y + (geo.height - corner->GetHeight()), |
573 | + corner->GetWidth(), |
574 | + corner->GetHeight(), |
575 | + corner_mask->GetDeviceTexture(), |
576 | + texxform, |
577 | + nux::color::Black); |
578 | + |
579 | + // Write correct alpha |
580 | + gfx_context.GetRenderStates().SetBlend(false); |
581 | + gfx_context.GetRenderStates().SetColorMask(false, false, false, true); |
582 | + RenderInverseMask(gfx_context, geo.x + (geo.width - corner->GetWidth()), |
583 | + geo.y + (geo.height - corner->GetHeight()), |
584 | + corner->GetWidth(), |
585 | + corner->GetHeight(), |
586 | + corner_mask->GetDeviceTexture(), |
587 | + texxform, |
588 | + nux::color::White); |
589 | + |
590 | + gfx_context.GetRenderStates().SetBlend(true); |
591 | + gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
592 | + gfx_context.GetRenderStates().SetColorMask(true, true, true, true); |
593 | + |
594 | gfx_context.QRP_1Tex(geo.x + (geo.width - corner->GetWidth()), |
595 | geo.y + (geo.height - corner->GetHeight()), |
596 | corner->GetWidth(), |
597 | @@ -163,6 +582,30 @@ |
598 | texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
599 | texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT); |
600 | |
601 | + // Selectively erase blur region in the curbe |
602 | + gfx_context.QRP_ColorModTexAlpha(left_corner->GetWidth() - left_corner_offset - offset, |
603 | + geo.y + (geo.height - bottom->GetHeight()), |
604 | + real_width + offset, |
605 | + bottom->GetHeight(), |
606 | + bottom_mask->GetDeviceTexture(), |
607 | + texxform, |
608 | + nux::color::Black); |
609 | + |
610 | + // Write correct alpha |
611 | + gfx_context.GetRenderStates().SetBlend(false); |
612 | + gfx_context.GetRenderStates().SetColorMask(false, false, false, true); |
613 | + RenderInverseMask(gfx_context, left_corner->GetWidth() - left_corner_offset - offset, |
614 | + geo.y + (geo.height - bottom->GetHeight()), |
615 | + real_width + offset, |
616 | + bottom->GetHeight(), |
617 | + bottom_mask->GetDeviceTexture(), |
618 | + texxform, |
619 | + nux::color::White); |
620 | + |
621 | + gfx_context.GetRenderStates().SetBlend(true); |
622 | + gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
623 | + gfx_context.GetRenderStates().SetColorMask(true, true, true, true); |
624 | + |
625 | gfx_context.QRP_1Tex(left_corner->GetWidth() - left_corner_offset - offset, |
626 | geo.y + (geo.height - bottom->GetHeight()), |
627 | real_width + offset, |
628 | @@ -176,6 +619,30 @@ |
629 | texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
630 | texxform.SetWrap(nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER); |
631 | |
632 | + // Selectively erase blur region in the curbe |
633 | + gfx_context.QRP_ColorModTexAlpha(geo.x - left_corner_offset, |
634 | + geo.y + (geo.height - left_corner->GetHeight()), |
635 | + left_corner->GetWidth(), |
636 | + left_corner->GetHeight(), |
637 | + left_corner_mask->GetDeviceTexture(), |
638 | + texxform, |
639 | + nux::color::Black); |
640 | + |
641 | + // Write correct alpha |
642 | + gfx_context.GetRenderStates().SetBlend(false); |
643 | + gfx_context.GetRenderStates().SetColorMask(false, false, false, true); |
644 | + RenderInverseMask(gfx_context, geo.x - left_corner_offset, |
645 | + geo.y + (geo.height - left_corner->GetHeight()), |
646 | + left_corner->GetWidth(), |
647 | + left_corner->GetHeight(), |
648 | + left_corner_mask->GetDeviceTexture(), |
649 | + texxform, |
650 | + nux::color::White); |
651 | + |
652 | + gfx_context.GetRenderStates().SetBlend(true); |
653 | + gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
654 | + gfx_context.GetRenderStates().SetColorMask(true, true, true, true); |
655 | + |
656 | gfx_context.QRP_1Tex(geo.x - left_corner_offset, |
657 | geo.y + (geo.height - left_corner->GetHeight()), |
658 | left_corner->GetWidth(), |
659 | @@ -194,7 +661,7 @@ |
660 | texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT); |
661 | |
662 | gfx_context.QRP_1Tex(geo.x - 10, |
663 | - geo.y + geo.height - offset, |
664 | + geo.y + geo.height, |
665 | left_tile->GetWidth(), |
666 | real_height + offset, |
667 | left_tile->GetDeviceTexture(), |
668 | @@ -206,6 +673,30 @@ |
669 | texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
670 | texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT); |
671 | |
672 | + // Selectively erase blur region in the curbe |
673 | + gfx_context.QRP_ColorModTexAlpha(geo.x + geo.width - right->GetWidth(), |
674 | + geo.y + top_corner->GetHeight() - top_corner_offset, |
675 | + right->GetWidth(), |
676 | + geo.height - corner->GetHeight() - (top_corner->GetHeight() - top_corner_offset), |
677 | + right_mask->GetDeviceTexture(), |
678 | + texxform, |
679 | + nux::color::Black); |
680 | + |
681 | + // Write correct alpha |
682 | + gfx_context.GetRenderStates().SetBlend(false); |
683 | + gfx_context.GetRenderStates().SetColorMask(false, false, false, true); |
684 | + RenderInverseMask(gfx_context, geo.x + geo.width - right->GetWidth(), |
685 | + geo.y + top_corner->GetHeight() - top_corner_offset, |
686 | + right->GetWidth(), |
687 | + geo.height - corner->GetHeight() - (top_corner->GetHeight() - top_corner_offset), |
688 | + right_mask->GetDeviceTexture(), |
689 | + texxform, |
690 | + nux::color::White); |
691 | + |
692 | + gfx_context.GetRenderStates().SetBlend(true); |
693 | + gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
694 | + gfx_context.GetRenderStates().SetColorMask(true, true, true, true); |
695 | + |
696 | gfx_context.QRP_1Tex(geo.x + geo.width - right->GetWidth(), |
697 | geo.y + top_corner->GetHeight() - top_corner_offset, |
698 | right->GetWidth(), |
699 | @@ -219,6 +710,29 @@ |
700 | texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
701 | texxform.SetWrap(nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER); |
702 | |
703 | + // Selectively erase blur region in the curbe |
704 | + gfx_context.QRP_ColorModTexAlpha(geo.x + geo.width - right->GetWidth(), |
705 | + geo.y - top_corner_offset, |
706 | + top_corner->GetWidth(), |
707 | + top_corner->GetHeight(), |
708 | + top_corner_mask->GetDeviceTexture(), |
709 | + texxform, |
710 | + nux::color::Black); |
711 | + |
712 | + // Write correct alpha |
713 | + gfx_context.GetRenderStates().SetBlend(false); |
714 | + gfx_context.GetRenderStates().SetColorMask(false, false, false, true); |
715 | + RenderInverseMask(gfx_context, geo.x + geo.width - right->GetWidth(), |
716 | + geo.y - top_corner_offset, |
717 | + top_corner->GetWidth(), |
718 | + top_corner->GetHeight(), |
719 | + top_corner_mask->GetDeviceTexture(), |
720 | + texxform, |
721 | + nux::color::White); |
722 | + |
723 | + gfx_context.GetRenderStates().SetBlend(true); |
724 | + gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
725 | + gfx_context.GetRenderStates().SetColorMask(true, true, true, true); |
726 | gfx_context.QRP_1Tex(geo.x + geo.width - right->GetWidth(), |
727 | geo.y - top_corner_offset, |
728 | top_corner->GetWidth(), |
729 | @@ -232,6 +746,7 @@ |
730 | texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
731 | texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT); |
732 | |
733 | + gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
734 | gfx_context.QRP_1Tex(geo.x + geo.width, |
735 | geo.y - 10, |
736 | geometry.width - (geo.x + geo.width), |
737 | @@ -240,139 +755,8 @@ |
738 | texxform, |
739 | nux::color::White); |
740 | } |
741 | - } |
742 | - } |
743 | - |
744 | - |
745 | - nux::TexCoordXForm texxform_absolute_bg; |
746 | - texxform_absolute_bg.flip_v_coord = true; |
747 | - texxform_absolute_bg.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
748 | - texxform_absolute_bg.uoffset = ((float) content_geo.x) / absolute_geo.width; |
749 | - texxform_absolute_bg.voffset = ((float) content_geo.y) / absolute_geo.height; |
750 | - texxform_absolute_bg.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP); |
751 | - |
752 | - nux::Geometry blur_geo(absolute_geo.x, absolute_geo.y, content_geo.width, content_geo.height); |
753 | - if (paint_blur) |
754 | - { |
755 | - bg_blur_texture_ = bg_effect_helper_.GetBlurRegion(blur_geo); |
756 | - } |
757 | - else |
758 | - { |
759 | - bg_blur_texture_ = bg_effect_helper_.GetRegion(blur_geo); |
760 | - } |
761 | - |
762 | - if (bg_blur_texture_.IsValid()) |
763 | - { |
764 | - nux::Geometry bg_clip = geo; |
765 | - gfx_context.PushClippingRectangle(bg_clip); |
766 | - |
767 | - gfx_context.GetRenderStates().SetBlend(false); |
768 | -#ifndef NUX_OPENGLES_20 |
769 | - if (gfx_context.UsingGLSLCodePath()) |
770 | - gfx_context.QRP_GLSL_ColorBlendOverTex (content_geo.x, content_geo.y, |
771 | - content_geo.width, content_geo.height, |
772 | - bg_blur_texture_, texxform_absolute_bg, nux::color::White, |
773 | - bg_color_, nux::LAYER_BLEND_MODE_OVERLAY); |
774 | - |
775 | - else |
776 | - gfx_context.QRP_1Tex (content_geo.x, content_geo.y, |
777 | - content_geo.width, content_geo.height, |
778 | - bg_blur_texture_, texxform_absolute_bg, nux::color::White); |
779 | -#else |
780 | - gfx_context.QRP_GLSL_ColorBlendOverTex (content_geo.x, content_geo.y, |
781 | - content_geo.width, content_geo.height, |
782 | - bg_blur_texture_, texxform_absolute_bg, nux::color::White, |
783 | - bg_color_, nux::LAYER_BLEND_MODE_OVERLAY); |
784 | - |
785 | -#endif |
786 | - |
787 | - gfx_context.PopClippingRectangle(); |
788 | - } |
789 | - |
790 | - // Draw the left and top lines |
791 | - dash::Style& style = dash::Style::Instance(); |
792 | - |
793 | - gfx_context.GetRenderStates().SetColorMask(true, true, true, true); |
794 | - gfx_context.GetRenderStates().SetBlend(true); |
795 | - gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
796 | - |
797 | - const double line_opacity = 0.22f; |
798 | - nux::Color line_color = nux::color::White * line_opacity; |
799 | - nux::GetPainter().Paint2DQuadColor(gfx_context, |
800 | - nux::Geometry(geometry.x, |
801 | - geometry.y, |
802 | - style.GetVSeparatorSize(), |
803 | - content_geo.height + INNER_CORNER_RADIUS), |
804 | - nux::color::Transparent, |
805 | - line_color, |
806 | - line_color, |
807 | - nux::color::Transparent); |
808 | - |
809 | - nux::GetPainter().Paint2DQuadColor(gfx_context, |
810 | - nux::Geometry(geometry.x, |
811 | - geometry.y, |
812 | - content_geo.width + INNER_CORNER_RADIUS, |
813 | - style.GetHSeparatorSize()), |
814 | - nux::color::Transparent, |
815 | - nux::color::Transparent, |
816 | - line_color, |
817 | - line_color); |
818 | - |
819 | - // Draw the background |
820 | - bg_darken_layer_->SetGeometry(content_geo); |
821 | - nux::GetPainter().RenderSinglePaintLayer(gfx_context, content_geo, bg_darken_layer_); |
822 | - |
823 | -#ifndef NUX_OPENGLES_20 |
824 | - if (gfx_context.UsingGLSLCodePath() == FALSE) |
825 | - { |
826 | - bg_layer_->SetGeometry(content_geo); |
827 | - nux::GetPainter().RenderSinglePaintLayer(gfx_context, content_geo, bg_layer_); |
828 | - } |
829 | -#endif |
830 | - |
831 | - |
832 | - texxform_absolute_bg.flip_v_coord = false; |
833 | - texxform_absolute_bg.uoffset = (1.0f / bg_shine_texture_->GetWidth()) * parent->x_offset; |
834 | - texxform_absolute_bg.voffset = (1.0f / bg_shine_texture_->GetHeight()) * parent->y_offset; |
835 | - |
836 | - gfx_context.GetRenderStates().SetColorMask(true, true, true, false); |
837 | - gfx_context.GetRenderStates().SetBlend(true, GL_DST_COLOR, GL_ONE); |
838 | - |
839 | - gfx_context.QRP_1Tex (content_geo.x, content_geo.y, |
840 | - content_geo.width, content_geo.height, |
841 | - bg_shine_texture_, texxform_absolute_bg, nux::color::White); |
842 | - |
843 | - if (dash::Settings::Instance().GetFormFactor() != dash::FormFactor::NETBOOK) |
844 | - { |
845 | - // Make bottom-right corner rounded |
846 | - nux::ROPConfig rop; |
847 | - rop.Blend = true; |
848 | - rop.SrcBlend = GL_ZERO; |
849 | - rop.DstBlend = GL_SRC_ALPHA; |
850 | - nux::GetPainter().PaintShapeCornerROP(gfx_context, |
851 | - content_geo, |
852 | - nux::color::White, |
853 | - nux::eSHAPE_CORNER_ROUND4, |
854 | - nux::eCornerBottomRight, |
855 | - true, |
856 | - rop); |
857 | - |
858 | - geo = content_geo; |
859 | - |
860 | - gfx_context.GetRenderStates().SetColorMask(true, true, true, true); |
861 | - gfx_context.GetRenderStates().SetBlend(true); |
862 | - gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
863 | - |
864 | - // Fill in corners (meh) |
865 | - for (int i = 0; i < INNER_CORNER_RADIUS; ++i) |
866 | - { |
867 | - nux::Geometry fill_geo (geo.x + geo.width, geo.y + i, INNER_CORNER_RADIUS - i, 1); |
868 | - nux::GetPainter().Paint2DQuadColor(gfx_context, fill_geo, bg_color_); |
869 | - |
870 | - nux::Color dark = bg_color_ * 0.8f; |
871 | - dark.alpha = bg_color_.alpha; |
872 | - fill_geo = nux::Geometry(geo.x + i, geo.y + geo.height, 1, INNER_CORNER_RADIUS - i); |
873 | - nux::GetPainter().Paint2DQuadColor(gfx_context, fill_geo, dark); |
874 | + |
875 | + gfx_context.GetRenderStates().SetBlend(false); |
876 | } |
877 | } |
878 | } |
879 | @@ -382,7 +766,16 @@ |
880 | nux::Geometry geo = geometry; |
881 | bgs = 0; |
882 | |
883 | - gfx_context.PushClippingRectangle(geo); |
884 | + nux::Geometry larger_content_geo = content_geo; |
885 | + larger_content_geo.OffsetSize(EXCESS_BORDER, EXCESS_BORDER); |
886 | + |
887 | + nux::Geometry larger_geo(larger_content_geo); |
888 | + |
889 | + nux::Geometry larger_absolute_geo = absolute_geo; |
890 | + larger_absolute_geo.OffsetSize(EXCESS_BORDER, EXCESS_BORDER); |
891 | + |
892 | + |
893 | + gfx_context.PushClippingRectangle(larger_geo); |
894 | |
895 | gfx_context.GetRenderStates().SetBlend(true); |
896 | gfx_context.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
897 | @@ -390,8 +783,8 @@ |
898 | nux::TexCoordXForm texxform_absolute_bg; |
899 | texxform_absolute_bg.flip_v_coord = true; |
900 | texxform_absolute_bg.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
901 | - texxform_absolute_bg.uoffset = ((float) content_geo.x) / absolute_geo.width; |
902 | - texxform_absolute_bg.voffset = ((float) content_geo.y) / absolute_geo.height; |
903 | + texxform_absolute_bg.uoffset = ((float) larger_content_geo.x) / absolute_geo.width; |
904 | + texxform_absolute_bg.voffset = ((float) larger_content_geo.y) / absolute_geo.height; |
905 | texxform_absolute_bg.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP); |
906 | |
907 | nux::ROPConfig rop; |
908 | @@ -403,21 +796,21 @@ |
909 | { |
910 | #ifndef NUX_OPENGLES_20 |
911 | if (gfx_context.UsingGLSLCodePath()) |
912 | - gPainter.PushCompositionLayer(gfx_context, content_geo, |
913 | + gPainter.PushCompositionLayer(gfx_context, larger_content_geo, |
914 | bg_blur_texture_, |
915 | texxform_absolute_bg, |
916 | nux::color::White, |
917 | bg_color_, nux::LAYER_BLEND_MODE_OVERLAY, |
918 | true, rop); |
919 | else |
920 | - gPainter.PushTextureLayer(gfx_context, content_geo, |
921 | + gPainter.PushTextureLayer(gfx_context, larger_content_geo, |
922 | bg_blur_texture_, |
923 | texxform_absolute_bg, |
924 | nux::color::White, |
925 | true, // write alpha? |
926 | rop); |
927 | #else |
928 | - gPainter.PushCompositionLayer(gfx_context, content_geo, |
929 | + gPainter.PushCompositionLayer(gfx_context, larger_content_geo, |
930 | bg_blur_texture_, |
931 | texxform_absolute_bg, |
932 | nux::color::White, |
933 | @@ -447,7 +840,7 @@ |
934 | texxform_absolute_bg.uoffset = (1.0f / bg_shine_texture_->GetWidth()) * parent->x_offset; |
935 | texxform_absolute_bg.voffset = (1.0f / bg_shine_texture_->GetHeight()) * parent->y_offset; |
936 | |
937 | - nux::GetPainter().PushTextureLayer(gfx_context, content_geo, |
938 | + nux::GetPainter().PushTextureLayer(gfx_context, larger_content_geo, |
939 | bg_shine_texture_, |
940 | texxform_absolute_bg, |
941 | nux::color::White, |
942 | @@ -463,22 +856,6 @@ |
943 | gfx_context.GetRenderStates().SetBlend(false); |
944 | gfx_context.PopClippingRectangle(); |
945 | |
946 | - if (dash::Settings::Instance().GetFormFactor() != dash::FormFactor::NETBOOK) |
947 | - { |
948 | - // Make bottom-right corner rounded |
949 | - nux::ROPConfig rop; |
950 | - rop.Blend = true; |
951 | - rop.SrcBlend = GL_ZERO; |
952 | - rop.DstBlend = GL_SRC_ALPHA; |
953 | - nux::GetPainter().PaintShapeCornerROP(gfx_context, |
954 | - content_geo, |
955 | - nux::color::White, |
956 | - nux::eSHAPE_CORNER_ROUND4, |
957 | - nux::eCornerBottomRight, |
958 | - true, |
959 | - rop); |
960 | - } |
961 | - |
962 | bgs = 0; |
963 | } |
964 |
Amazing work guys.