Refact/stride align (#8)

* rename row_align_bytes  to stride_align

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* trivail changes

Signed-off-by: fufesou <shuanglongchen@yeah.net>

---------

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-03-03 09:46:33 +08:00 • committed by GitHub
parent 873919902e
commit 8d66a7c55e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 26 additions and 26 deletions

View file

@ -34,7 +34,7 @@ class _MyAppState extends State<MyApp> {
Timer? _timer;
int time = 0;
int method = 0;
final rowAlignBytes = Platform.isMacOS ? 64 : 1;
final strideAlign = Platform.isMacOS ? 64 : 1;
@override
void initState() {
@ -60,7 +60,7 @@ class _MyAppState extends State<MyApp> {
void start(int methodId) {
debugPrint("start mockPic");
method = methodId;
final rowBytes = (width * 4 + rowAlignBytes - 1) & (~(rowAlignBytes - 1));
final rowBytes = (width * 4 + strideAlign - 1) & (~(strideAlign - 1));
final picDataLength = rowBytes * height;
_timer?.cancel();
// 60 fps
@ -71,7 +71,7 @@ class _MyAppState extends State<MyApp> {
data = mockPicture(width, height, rowBytes, picDataLength);
final t1 = DateTime.now().microsecondsSinceEpoch;
final res = await _textureRgbaRendererPlugin.onRgba(
key, data!, height, width, rowAlignBytes);
key, data!, height, width, strideAlign);
final t2 = DateTime.now().microsecondsSinceEpoch;
setState(() {
time = t2 - t1;
@ -84,7 +84,7 @@ class _MyAppState extends State<MyApp> {
// Method.2: with native ffi
final t1 = DateTime.now().microsecondsSinceEpoch;
Native.instance.onRgba(Pointer.fromAddress(texturePtr).cast<Void>(),
dataPtr, picDataLength, width, height, rowAlignBytes);
dataPtr, picDataLength, width, height, strideAlign);
final t2 = DateTime.now().microsecondsSinceEpoch;
setState(() {
time = t2 - t1;