add stride_align for onRgba (#6)
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
1c79d8dd88
commit
044bb260d9
9 changed files with 89 additions and 40 deletions
|
|
@ -1,9 +1,9 @@
|
|||
import 'dart:ffi';
|
||||
|
||||
typedef F1 = Void Function(
|
||||
Pointer<Void> ptr, Pointer<Uint8> buffer, Int32 width, Int32 height);
|
||||
typedef F1Dart = void Function(
|
||||
Pointer<Void> ptr, Pointer<Uint8> buffer, int width, int height);
|
||||
typedef F1 = Void Function(Pointer<Void> ptr, Pointer<Uint8> buffer,
|
||||
Int32 width, Int32 height, Int stride_align);
|
||||
typedef F1Dart = void Function(Pointer<Void> ptr, Pointer<Uint8> buffer,
|
||||
int width, int height, int stride_align);
|
||||
|
||||
class Native {
|
||||
Native._();
|
||||
|
|
@ -17,4 +17,4 @@ class Native {
|
|||
final lib = DynamicLibrary.process();
|
||||
onRgba = lib.lookupFunction<F1, F1Dart>("FlutterRgbaRendererPluginOnRgba");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,9 +23,10 @@ class TextureRgbaRenderer {
|
|||
}
|
||||
|
||||
/// Provide the rgba data to the texture.
|
||||
Future<bool> onRgba(int key, Uint8List data, int height, int width) {
|
||||
Future<bool> onRgba(
|
||||
int key, Uint8List data, int height, int width, int stride_align) {
|
||||
return TextureRgbaRendererPlatform.instance
|
||||
.onRgba(key, data, height, width);
|
||||
.onRgba(key, data, height, width, stride_align);
|
||||
}
|
||||
|
||||
Future<int> getTexturePtr(int key) {
|
||||
|
|
|
|||
|
|
@ -37,9 +37,15 @@ class MethodChannelTextureRgbaRenderer extends TextureRgbaRendererPlatform {
|
|||
}
|
||||
|
||||
@override
|
||||
Future<bool> onRgba(int key, Uint8List data, int height, int width) async {
|
||||
return await methodChannel.invokeMethod<bool>('onRgba',
|
||||
{"data": data, "height": height, "width": width, "key": key}) ??
|
||||
Future<bool> onRgba(
|
||||
int key, Uint8List data, int height, int width, int stride_align) async {
|
||||
return await methodChannel.invokeMethod<bool>('onRgba', {
|
||||
"data": data,
|
||||
"height": height,
|
||||
"width": width,
|
||||
"key": key,
|
||||
"stride_align": stride_align,
|
||||
}) ??
|
||||
false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@ abstract class TextureRgbaRendererPlatform extends PlatformInterface {
|
|||
throw UnimplementedError('closeTexture() has not been implemented.');
|
||||
}
|
||||
|
||||
Future<bool> onRgba(int key, Uint8List data, int height, int width) {
|
||||
Future<bool> onRgba(
|
||||
int key, Uint8List data, int height, int width, int stride_align) {
|
||||
throw UnimplementedError('onRgba() has not been implemented.');
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue