Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the desktop no longer show through when alpha blending is involved for borderless windows on the Mac. #237

Merged
merged 1 commit into from Mar 16, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Make the desktop no longer show through when alpha blending is involved

for borderless windows on the Mac.

This was because the blend function was
`GL_SRC_ALPHA`/`GL_ONE_MINUS_SRC_ALPHA` for both RGB and alpha, and that
was incorrect for alpha, since a destination alpha of 1.0 and a source
alpha < 1.0 should result in an alpha of 1.0.
  • Loading branch information
pcwalton committed Mar 12, 2016
commit 8d191d1d04e42ff88340705074ffd5b0cea062a4
@@ -168,7 +168,8 @@ impl DebugRenderer {
gl::disable(gl::DEPTH_TEST);
gl::enable(gl::BLEND);
gl::blend_equation(gl::FUNC_ADD);
gl::blend_func(gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA);
gl::blend_func_separate(gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA,
gl::ONE, gl::ONE);

let projection = Matrix4::ortho(0.0,
viewport_size.width as f32,
@@ -1204,7 +1204,8 @@ impl Renderer {
gl::disable(gl::BLEND);
} else {
gl::enable(gl::BLEND);
gl::blend_func(gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA);
gl::blend_func_separate(gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA,
gl::ONE, gl::ONE);
gl::blend_equation(gl::FUNC_ADD);
}

@@ -1417,8 +1418,8 @@ impl Renderer {
program = self.blit_program_id;
}
CompositionOp::Filter(LowLevelFilterOp::Opacity(amount)) => {
gl::blend_func(gl::SRC_ALPHA,
gl::ONE_MINUS_SRC_ALPHA);
gl::blend_func_separate(gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA,
gl::ONE, gl::ONE);
gl::blend_equation(gl::FUNC_ADD);
alpha = amount.to_f32_px();
program = self.blit_program_id;
@@ -1430,15 +1431,21 @@ impl Renderer {
let (opcode, amount, param0, param1) = match filter_op {
LowLevelFilterOp::Blur(radius,
AxisDirection::Horizontal) => {
gl::blend_func(gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA);
gl::blend_func_separate(gl::SRC_ALPHA,
gl::ONE_MINUS_SRC_ALPHA,
gl::ONE,
gl::ONE);
(0.0,
radius.to_f32_px() * self.device_pixel_ratio,
1.0,
0.0)
}
LowLevelFilterOp::Blur(radius,
AxisDirection::Vertical) => {
gl::blend_func(gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA);
gl::blend_func_separate(gl::SRC_ALPHA,
gl::ONE_MINUS_SRC_ALPHA,
gl::ONE,
gl::ONE);
(0.0,
radius.to_f32_px() * self.device_pixel_ratio,
0.0,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.