fix(gpui_macos): silence const-in-pattern warnings in surface format check

Compare the pixel format with == instead of match patterns to avoid
non_upper_case_globals warnings from the CoreVideo constants.
This commit is contained in:
2026-08-09 06:33:31 +08:00
parent 098d422628
commit 816d6db93e
2 changed files with 9 additions and 7 deletions
Generated
+1
View File
@@ -2762,6 +2762,7 @@ name = "gpui_widgets"
version = "0.1.0"
dependencies = [
"anyhow",
"core-video",
"gpui",
"gpui_elements",
"gpui_platform",
+8 -7
View File
@@ -1840,13 +1840,14 @@ impl MetalRenderer {
DevicePixels::from(surface.image_buffer.get_height() as i32),
);
let is_bgra = match surface.image_buffer.get_pixel_format() {
kCVPixelFormatType_420YpCbCr8BiPlanarFullRange => false,
kCVPixelFormatType_32BGRA => true,
other => {
log::error!("unsupported surface pixel format: {other}");
return false;
}
let pixel_format = surface.image_buffer.get_pixel_format();
let is_bgra = if pixel_format == kCVPixelFormatType_420YpCbCr8BiPlanarFullRange {
false
} else if pixel_format == kCVPixelFormatType_32BGRA {
true
} else {
log::error!("unsupported surface pixel format: {pixel_format}");
return false;
};
// Y (or the whole BGRA image) texture from plane 0.