From 33b5f9dc001fc616ff88a9ea654f26266ec436d7 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Sun, 17 Nov 2024 14:41:43 -0800 Subject: [PATCH] iOS: Eliminate unnecessary bridged retain casts (flutter/engine#56662) This replaces a few ARC bridged retain casts to regular bridge casts to CoreFoundation types, which are then CFRetained via `sk_cfp::retain` calls. This eliminates the last remaining unnecessary __bridge_retained casts in the codebase. The remaining casts have been manually vetted and are reasonable. Issue: https://github.com/flutter/flutter/issues/155943 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- .../darwin/graphics/FlutterDarwinExternalTextureMetal.mm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinExternalTextureMetal.mm b/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinExternalTextureMetal.mm index 580443d409..097a16076a 100644 --- a/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinExternalTextureMetal.mm +++ b/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinExternalTextureMetal.mm @@ -277,14 +277,14 @@ FLUTTER_ASSERT_ARC return nullptr; #else // SLIMPELLER GrMtlTextureInfo ySkiaTextureInfo; - ySkiaTextureInfo.fTexture = sk_cfp{(__bridge_retained const void*)yTex}; + ySkiaTextureInfo.fTexture.retain((__bridge GrMTLHandle)yTex); GrBackendTexture skiaBackendTextures[2]; skiaBackendTextures[0] = GrBackendTextures::MakeMtl(width, height, skgpu::Mipmapped::kNo, ySkiaTextureInfo); GrMtlTextureInfo uvSkiaTextureInfo; - uvSkiaTextureInfo.fTexture = sk_cfp{(__bridge_retained const void*)uvTex}; + uvSkiaTextureInfo.fTexture.retain((__bridge GrMTLHandle)uvTex); skiaBackendTextures[1] = GrBackendTextures::MakeMtl(width, height, skgpu::Mipmapped::kNo, uvSkiaTextureInfo); @@ -308,7 +308,7 @@ FLUTTER_ASSERT_ARC #else // SLIMPELLER GrMtlTextureInfo skiaTextureInfo; - skiaTextureInfo.fTexture = sk_cfp{(__bridge_retained const void*)rgbaTex}; + skiaTextureInfo.fTexture.retain((__bridge GrMTLHandle)rgbaTex); GrBackendTexture skiaBackendTexture = GrBackendTextures::MakeMtl(width, height, skgpu::Mipmapped ::kNo, skiaTextureInfo);