refactor: continual refactor to support multiple render targets

This commit is contained in:
Nick Fisher
2024-09-28 18:28:05 +08:00
parent 767aa88930
commit 22020d8607
51 changed files with 1714 additions and 877 deletions

View File

@@ -9,7 +9,6 @@ class ThermionFlutterOptions {
ThermionFlutterOptions({this.uberarchivePath});
const ThermionFlutterOptions.empty() : uberarchivePath = null;
}
abstract class ThermionFlutterPlatform extends PlatformInterface {
@@ -25,17 +24,23 @@ abstract class ThermionFlutterPlatform extends PlatformInterface {
_instance = instance;
}
Future<ThermionViewer> createViewerWithOptions(
covariant ThermionFlutterOptions options);
///
///
///
Future<ThermionViewer> createViewer(
{covariant ThermionFlutterOptions? options});
@deprecated
Future<ThermionViewer> createViewer({String? uberarchivePath});
///
/// Create a rendering surface.
///
/// This is internal; unless you are [thermion_*] package developer, don't
/// call this yourself. May not be supported on all platforms.
///
Future<ThermionFlutterTexture?> createTexture(int width, int height);
Future<ThermionFlutterTexture?> createTexture(double width, double height,
double offsetLeft, double offsetTop, double pixelRatio);
Future destroyTexture(ThermionFlutterTexture texture);
Future<ThermionFlutterTexture?> resizeTexture(ThermionFlutterTexture texture,
int width, int height, int offsetTop, int offsetRight, double pixelRatio);
///
///
///
Future resizeWindow(
int width, int height, int offsetTop, int offsetRight);
}

View File

@@ -1,13 +1,30 @@
class ThermionFlutterTexture {
final int width;
final int height;
final int? flutterTextureId;
final int? hardwareTextureId;
final int? surfaceAddress;
bool get usesBackingWindow => flutterTextureId == null;
// class ThermionFlutterTextureImpl {
// final int width;
// final int height;
// final int? flutterTextureId;
// final int? hardwareTextureId;
// final int? surfaceAddress;
// bool get usesBackingWindow => flutterTextureId == null;
ThermionFlutterTexture(this.flutterTextureId, this.hardwareTextureId,
this.width, this.height, this.surfaceAddress) {
// ThermionFlutterTexture(this.flutterTextureId, this.hardwareTextureId,
// this.width, this.height, this.surfaceAddress) {
}
// }
// }
abstract class ThermionFlutterTexture {
int get width;
int get height;
int get flutterId;
int get hardwareId;
///
/// Destroy a texture and clean up the texture cache (if applicable).
///
Future destroy();
Future resize(int width, int height, int left, int top);
Future markFrameAvailable();
}