gpui: Update dependencies (second attempt) (#9836)

Updated version of #9741 with fixes for the problems raised in #9774. I
only verified that the images no longer look blueish on Linux, because I
don't have a Mac.

cc @osiewicz

Release Notes:

- N/A

---------

Signed-off-by: Niklas Wimmer <mail@nwimmer.me>
This commit is contained in:
Niklas Wimmer
2024-03-28 10:22:31 -07:00
committed by GitHub
parent 94c51c6ac9
commit e2d6b0deba
13 changed files with 743 additions and 613 deletions
@@ -159,7 +159,7 @@ impl BladeAtlasState {
usage = gpu::TextureUsage::COPY | gpu::TextureUsage::RESOURCE;
}
AtlasTextureKind::Polychrome => {
format = gpu::TextureFormat::Bgra8Unorm;
format = gpu::TextureFormat::Rgba8Unorm;
usage = gpu::TextureUsage::COPY | gpu::TextureUsage::RESOURCE;
}
AtlasTextureKind::Path => {
@@ -286,6 +286,7 @@ impl LinuxTextSystemState {
params.glyph_id.0 as u16,
(params.font_size * params.scale_factor).into(),
(0.0, 0.0),
cosmic_text::CacheKeyFlags::empty(),
)
.0,
)
@@ -319,6 +320,7 @@ impl LinuxTextSystemState {
params.glyph_id.0 as u16,
(params.font_size * params.scale_factor).into(),
(0.0, 0.0),
cosmic_text::CacheKeyFlags::empty(),
)
.0,
)
@@ -381,6 +383,7 @@ impl LinuxTextSystemState {
font_size.0,
f32::MAX, // We do our own wrapping
cosmic_text::Wrap::None,
None,
);
let mut runs = Vec::new();
+1 -1
View File
@@ -115,7 +115,7 @@ impl MetalAtlasState {
usage = metal::MTLTextureUsage::ShaderRead;
}
AtlasTextureKind::Polychrome => {
pixel_format = metal::MTLPixelFormat::BGRA8Unorm;
pixel_format = metal::MTLPixelFormat::RGBA8Unorm;
usage = metal::MTLTextureUsage::ShaderRead;
}
AtlasTextureKind::Path => {
@@ -72,7 +72,7 @@ impl MetalRenderer {
let layer = metal::MetalLayer::new();
layer.set_device(&device);
layer.set_pixel_format(MTLPixelFormat::BGRA8Unorm);
layer.set_pixel_format(MTLPixelFormat::RGBA8Unorm);
layer.set_opaque(true);
layer.set_maximum_drawable_count(3);
unsafe {
@@ -128,7 +128,7 @@ impl MetalRenderer {
"path_sprites",
"path_sprite_vertex",
"path_sprite_fragment",
MTLPixelFormat::BGRA8Unorm,
MTLPixelFormat::RGBA8Unorm,
);
let shadows_pipeline_state = build_pipeline_state(
&device,
@@ -136,7 +136,7 @@ impl MetalRenderer {
"shadows",
"shadow_vertex",
"shadow_fragment",
MTLPixelFormat::BGRA8Unorm,
MTLPixelFormat::RGBA8Unorm,
);
let quads_pipeline_state = build_pipeline_state(
&device,
@@ -144,7 +144,7 @@ impl MetalRenderer {
"quads",
"quad_vertex",
"quad_fragment",
MTLPixelFormat::BGRA8Unorm,
MTLPixelFormat::RGBA8Unorm,
);
let underlines_pipeline_state = build_pipeline_state(
&device,
@@ -152,7 +152,7 @@ impl MetalRenderer {
"underlines",
"underline_vertex",
"underline_fragment",
MTLPixelFormat::BGRA8Unorm,
MTLPixelFormat::RGBA8Unorm,
);
let monochrome_sprites_pipeline_state = build_pipeline_state(
&device,
@@ -160,7 +160,7 @@ impl MetalRenderer {
"monochrome_sprites",
"monochrome_sprite_vertex",
"monochrome_sprite_fragment",
MTLPixelFormat::BGRA8Unorm,
MTLPixelFormat::RGBA8Unorm,
);
let polychrome_sprites_pipeline_state = build_pipeline_state(
&device,
@@ -168,7 +168,7 @@ impl MetalRenderer {
"polychrome_sprites",
"polychrome_sprite_vertex",
"polychrome_sprite_fragment",
MTLPixelFormat::BGRA8Unorm,
MTLPixelFormat::RGBA8Unorm,
);
let surfaces_pipeline_state = build_pipeline_state(
&device,
@@ -176,7 +176,7 @@ impl MetalRenderer {
"surfaces",
"surface_vertex",
"surface_fragment",
MTLPixelFormat::BGRA8Unorm,
MTLPixelFormat::RGBA8Unorm,
);
let command_queue = device.new_command_queue();
+1 -2
View File
@@ -425,9 +425,8 @@ impl MacTextSystemState {
);
if params.is_emoji {
// Convert from RGBA with premultiplied alpha to BGRA with straight alpha.
// Convert from RGBA with premultiplied alpha to RGBA with straight alpha.
for pixel in bytes.chunks_exact_mut(4) {
pixel.swap(0, 2);
let a = pixel[3] as f32 / 255.;
pixel[0] = (pixel[0] as f32 / a) as u8;
pixel[1] = (pixel[1] as f32 / a) as u8;
@@ -213,11 +213,19 @@ impl WindowsTextSystemState {
_features: FontFeatures,
) -> Result<SmallVec<[FontId; 4]>> {
let mut font_ids = SmallVec::new();
let family = self
let families = self
.font_system
.get_font_matches(Attrs::new().family(cosmic_text::Family::Name(name)));
for font in family.as_ref() {
let font = self.font_system.get_font(*font).unwrap();
.db()
.faces()
.filter(|face| face.families.iter().any(|family| *name == family.0))
.map(|face| (face.id, face.post_script_name.clone()))
.collect::<SmallVec<[_; 4]>>();
for (font_id, postscript_name) in families {
let font = self
.font_system
.get_font(font_id)
.ok_or_else(|| anyhow!("Could not load font"))?;
// TODO: figure out why this is causing fluent icons from loading
// if font.as_swash().charmap().map('m') == 0 {
// self.font_system.db_mut().remove_face(font.id());
@@ -227,6 +235,8 @@ impl WindowsTextSystemState {
let font_id = FontId(self.fonts.len());
font_ids.push(font_id);
self.fonts.push(font);
self.postscript_names_by_font_id
.insert(font_id, postscript_name);
}
Ok(font_ids)
}
@@ -274,6 +284,7 @@ impl WindowsTextSystemState {
params.glyph_id.0 as u16,
(params.font_size * params.scale_factor).into(),
(0.0, 0.0),
cosmic_text::CacheKeyFlags::empty(),
)
.0,
)
@@ -307,6 +318,7 @@ impl WindowsTextSystemState {
params.glyph_id.0 as u16,
(params.font_size * params.scale_factor).into(),
(0.0, 0.0),
cosmic_text::CacheKeyFlags::empty(),
)
.0,
)
@@ -342,6 +354,7 @@ impl WindowsTextSystemState {
font_size.0,
f32::MAX, // todo(windows) we don't have a width cause this should technically not be wrapped I believe
cosmic_text::Wrap::None,
None,
);
let mut runs = Vec::new();
// todo(windows) what I think can happen is layout returns possibly multiple lines which means we should be probably working with it higher up in the text rendering