This reverts commit c8b14ee2cb.
This commit is contained in:
@@ -115,7 +115,7 @@ impl MetalAtlasState {
|
||||
usage = metal::MTLTextureUsage::ShaderRead;
|
||||
}
|
||||
AtlasTextureKind::Polychrome => {
|
||||
pixel_format = metal::MTLPixelFormat::RGBA8Unorm;
|
||||
pixel_format = metal::MTLPixelFormat::BGRA8Unorm;
|
||||
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::RGBA8Unorm);
|
||||
layer.set_pixel_format(MTLPixelFormat::BGRA8Unorm);
|
||||
layer.set_opaque(false);
|
||||
layer.set_maximum_drawable_count(3);
|
||||
unsafe {
|
||||
@@ -128,7 +128,7 @@ impl MetalRenderer {
|
||||
"path_sprites",
|
||||
"path_sprite_vertex",
|
||||
"path_sprite_fragment",
|
||||
MTLPixelFormat::RGBA8Unorm,
|
||||
MTLPixelFormat::BGRA8Unorm,
|
||||
);
|
||||
let shadows_pipeline_state = build_pipeline_state(
|
||||
&device,
|
||||
@@ -136,7 +136,7 @@ impl MetalRenderer {
|
||||
"shadows",
|
||||
"shadow_vertex",
|
||||
"shadow_fragment",
|
||||
MTLPixelFormat::RGBA8Unorm,
|
||||
MTLPixelFormat::BGRA8Unorm,
|
||||
);
|
||||
let quads_pipeline_state = build_pipeline_state(
|
||||
&device,
|
||||
@@ -144,7 +144,7 @@ impl MetalRenderer {
|
||||
"quads",
|
||||
"quad_vertex",
|
||||
"quad_fragment",
|
||||
MTLPixelFormat::RGBA8Unorm,
|
||||
MTLPixelFormat::BGRA8Unorm,
|
||||
);
|
||||
let underlines_pipeline_state = build_pipeline_state(
|
||||
&device,
|
||||
@@ -152,7 +152,7 @@ impl MetalRenderer {
|
||||
"underlines",
|
||||
"underline_vertex",
|
||||
"underline_fragment",
|
||||
MTLPixelFormat::RGBA8Unorm,
|
||||
MTLPixelFormat::BGRA8Unorm,
|
||||
);
|
||||
let monochrome_sprites_pipeline_state = build_pipeline_state(
|
||||
&device,
|
||||
@@ -160,7 +160,7 @@ impl MetalRenderer {
|
||||
"monochrome_sprites",
|
||||
"monochrome_sprite_vertex",
|
||||
"monochrome_sprite_fragment",
|
||||
MTLPixelFormat::RGBA8Unorm,
|
||||
MTLPixelFormat::BGRA8Unorm,
|
||||
);
|
||||
let polychrome_sprites_pipeline_state = build_pipeline_state(
|
||||
&device,
|
||||
@@ -168,7 +168,7 @@ impl MetalRenderer {
|
||||
"polychrome_sprites",
|
||||
"polychrome_sprite_vertex",
|
||||
"polychrome_sprite_fragment",
|
||||
MTLPixelFormat::RGBA8Unorm,
|
||||
MTLPixelFormat::BGRA8Unorm,
|
||||
);
|
||||
let surfaces_pipeline_state = build_pipeline_state(
|
||||
&device,
|
||||
@@ -176,7 +176,7 @@ impl MetalRenderer {
|
||||
"surfaces",
|
||||
"surface_vertex",
|
||||
"surface_fragment",
|
||||
MTLPixelFormat::RGBA8Unorm,
|
||||
MTLPixelFormat::BGRA8Unorm,
|
||||
);
|
||||
|
||||
let command_queue = device.new_command_queue();
|
||||
|
||||
@@ -425,8 +425,9 @@ impl MacTextSystemState {
|
||||
);
|
||||
|
||||
if params.is_emoji {
|
||||
// Convert from RGBA with premultiplied alpha to RGBA with straight alpha.
|
||||
// Convert from RGBA with premultiplied alpha to BGRA 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;
|
||||
|
||||
Reference in New Issue
Block a user