Skip to content

Commit 3007162

Browse files
Revert 047cb01 and clarify documentation
1 parent f1d90be commit 3007162

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,12 +784,12 @@ pub trait Surface {
784784
fn clear(&mut self, rect: Option<&Rect>, color: Option<(f32, f32, f32, f32)>, color_srgb: bool,
785785
depth: Option<f32>, stencil: Option<i32>);
786786

787-
/// Clears the color attachment of the target.
787+
/// Clears the color attachment of the target. The color is converted to sRGB when the target has sRGB format.
788788
fn clear_color(&mut self, red: f32, green: f32, blue: f32, alpha: f32) {
789789
self.clear(None, Some((red, green, blue, alpha)), false, None, None);
790790
}
791791

792-
/// Clears the color attachment of the target. The color is in sRGB format.
792+
/// Clears the color attachment of the target. The color is in sRGB format and is not converted in the target.
793793
fn clear_color_srgb(&mut self, red: f32, green: f32, blue: f32, alpha: f32) {
794794
self.clear(None, Some((red, green, blue, alpha)), true, None, None);
795795
}

src/ops/clear.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ pub fn clear(context: &Context, framebuffer: Option<&ValidatedAttachments<'_>>,
3535
if ctxt.version >= &Version(Api::Gl, 3, 0) || ctxt.extensions.gl_arb_framebuffer_srgb ||
3636
ctxt.extensions.gl_ext_framebuffer_srgb || ctxt.extensions.gl_ext_srgb_write_control
3737
{
38-
if color_srgb && !ctxt.state.enabled_framebuffer_srgb {
38+
if !color_srgb && !ctxt.state.enabled_framebuffer_srgb {
3939
ctxt.gl.Enable(gl::FRAMEBUFFER_SRGB);
4040
ctxt.state.enabled_framebuffer_srgb = true;
4141

42-
} else if !color_srgb && ctxt.state.enabled_framebuffer_srgb {
42+
} else if color_srgb && ctxt.state.enabled_framebuffer_srgb {
4343
ctxt.gl.Disable(gl::FRAMEBUFFER_SRGB);
4444
ctxt.state.enabled_framebuffer_srgb = false;
4545
}

0 commit comments

Comments
 (0)