refactor: rename ThermionFlutterTexture->PlatformTextureDescriptor

This commit is contained in:
Nick Fisher
2024-12-17 20:23:51 +08:00
parent 342264eba9
commit dc690bb93a
5 changed files with 49 additions and 66 deletions

View File

@@ -12,8 +12,7 @@ class ThermionFlutterOptions {
const ThermionFlutterOptions.empty() : uberarchivePath = null;
}
typedef PlatformTextureDescriptor = (
{int flutterTextureId, int hardwareId, int? windowHandle}) ;
abstract class ThermionFlutterPlatform extends PlatformInterface {
ThermionFlutterPlatform() : super(token: _token);
@@ -40,7 +39,12 @@ abstract class ThermionFlutterPlatform extends PlatformInterface {
/// This is internal; unless you are [thermion_*] package developer, don't
/// call this yourself. May not be supported on all platforms.
///
Future<PlatformTextureDescriptor?> createTexture(int width, int height);
Future<PlatformTextureDescriptor> createTextureDescriptor(int width, int height);
///
/// Destroys a raw rendering surface.
///
Future destroyTextureDescriptor(PlatformTextureDescriptor descriptor);
///
/// Create a rendering surface and binds to the given [View]
@@ -48,23 +52,19 @@ abstract class ThermionFlutterPlatform extends PlatformInterface {
/// This is internal; unless you are [thermion_*] package developer, don't
/// call this yourself. May not be supported on all platforms.
///
Future<ThermionFlutterTexture?> createTextureAndBindToView(
Future<PlatformTextureDescriptor?> createTextureAndBindToView(
t.View view, int width, int height);
///
///
///
///
Future<ThermionFlutterTexture?> resizeTexture(
ThermionFlutterTexture texture, t.View view, int width, int height);
Future<PlatformTextureDescriptor?> resizeTexture(
PlatformTextureDescriptor texture, t.View view, int width, int height);
///
///
///
Future destroyTexture(ThermionFlutterTexture texture);
///
///
///
Future markTextureFrameAvailable(ThermionFlutterTexture texture);
Future markTextureFrameAvailable(PlatformTextureDescriptor texture);
}

View File

@@ -1,13 +1,10 @@
class ThermionFlutterTexture {
class PlatformTextureDescriptor {
final int flutterTextureId;
final int hardwareId;
final int? windowHandle;
final int width;
final int height;
final int flutterId;
final int hardwareId;
final int window;
ThermionFlutterTexture({required this.width, required this.height, required this.flutterId, required this.hardwareId, required this.window});
PlatformTextureDescriptor(this.flutterTextureId, this.hardwareId, this.windowHandle, this.width, this.height);
}