fixed 卡顿

This commit is contained in:
sin365 2025-01-21 14:56:12 +08:00
parent 0192ae4f1b
commit e7262578a3

View File

@ -1,4 +1,8 @@
using System; using MAME.Core;
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using UnityEngine.UIElements;
namespace MAME.Core namespace MAME.Core
{ {
@ -154,29 +158,29 @@ namespace MAME.Core
else else
{ {
for (y = startY; y < endY; y++)
{
int stepIndex = y * Video.fullwidth;
for (x = startX; x < endX; x++, target_i++)
{
i = stepIndex + x;
bitmapcolorRect[target_i] = (int)entry_color[curbitmap[i]];
}
}
//for (y = startY; y < endY; y++) //for (y = startY; y < endY; y++)
//{ //{
// int stepIndex = y * Video.fullwidth; // int stepIndex = y * Video.fullwidth;
// for (x = startX; x < endX; x++, target_i++) // for (x = startX; x < endX; x++, target_i++)
// { // {
// i = stepIndex + x; // i = stepIndex + x;
// bitmapcolorRect[target_i] = (int)entry_color[curbitmap[i]]; // bitmapcolorRect[target_i] = (int)entry_color[curbitmap[i]];
// } // }
//}
for (y = startY; y < endY; y++) // // 使用Marshal.Copy进行内存拷贝
{ // Marshal.Copy(Palette.entry_color_Ptr,, Video.bitmapcolorRect_Ptr, endX - startX);
int stepIndex = y * Video.fullwidth;
//for (x = startX; x < endX; x++, target_i++)
//{
// i = stepIndex + x;
// //bitmapcolorRect[target_i] = (int)entry_color[curbitmap[i]];
//} //}
int stepStartIdx = stepIndex + startX;
int linelenght = endX - startX;
Array.Copy(Palette.entry_color, stepStartIdx, Video.bitmapcolorRect, 0, linelenght);
target_i += linelenght;
}
} }
} }
} }