debug macos

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-02-01 22:12:28 +08:00
parent 8dba394205
commit 8881462f74

View File

@ -747,7 +747,7 @@ class CanvasModel with ChangeNotifier {
class CursorData { class CursorData {
final String peerId; final String peerId;
final int id; final int id;
final img2.Image? image; final img2.Image image;
double scale; double scale;
Uint8List? data; Uint8List? data;
final double hotxOrigin; final double hotxOrigin;
@ -788,14 +788,27 @@ class CursorData {
} }
if (_doubleToInt(oldScale) != _doubleToInt(scale)) { if (_doubleToInt(oldScale) != _doubleToInt(scale)) {
data = img2 if (Platform.isWindows) {
.copyResize( data = img2
image!, .copyResize(
width: (width * scale).toInt(), image,
height: (height * scale).toInt(), width: (width * scale).toInt(),
interpolation: img2.Interpolation.average, height: (height * scale).toInt(),
) interpolation: img2.Interpolation.average,
.getBytes(format: img2.Format.bgra); )
.getBytes(format: img2.Format.bgra);
} else {
data = Uint8List.fromList(
img2.encodePng(
img2.copyResize(
image,
width: (width * scale).toInt(),
height: (height * scale).toInt(),
interpolation: img2.Interpolation.average,
),
),
);
}
} }
this.scale = scale; this.scale = scale;
@ -863,7 +876,7 @@ class PredefinedCursor {
_cache = CursorData( _cache = CursorData(
peerId: '', peerId: '',
id: id, id: id,
image: _image2?.clone(), image: _image2!.clone(),
scale: scale, scale: scale,
data: data, data: data,
hotxOrigin: hotxOrigin:
@ -1063,9 +1076,9 @@ class CursorModel with ChangeNotifier {
Future<bool> _updateCache( Future<bool> _updateCache(
Uint8List rgba, ui.Image image, int id, int w, int h) async { Uint8List rgba, ui.Image image, int id, int w, int h) async {
Uint8List? data; Uint8List? data;
img2.Image? imgOrigin; img2.Image imgOrigin =
img2.Image.fromBytes(w, h, rgba, format: img2.Format.rgba);
if (Platform.isWindows) { if (Platform.isWindows) {
imgOrigin = img2.Image.fromBytes(w, h, rgba, format: img2.Format.rgba);
data = imgOrigin.getBytes(format: img2.Format.bgra); data = imgOrigin.getBytes(format: img2.Format.bgra);
} else { } else {
ByteData? imgBytes = ByteData? imgBytes =