bool FlutterWindowWin32::OnBitmapSurfaceUpdated(const void* allocation, size_t row_bytes, size_t height) { HWND hwnd = std::get<HWND>(GetRenderTarget()); HDC dc = ::GetDC(hwnd); BITMAPINFO bmi; memset(&bmi, 0, sizeof(bmi)); bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmi.bmiHeader.biWidth = row_bytes / 4; bmi.bmiHeader.biHeight = -height; bmi.bmiHeader.biPlanes = 1; bmi.bmiHeader.biBitCount = 32; bmi.bmiHeader.biCompression = BI_RGB; bmi.bmiHeader.biSizeImage = 0; int ret = SetDIBitsToDevice(dc, 0, 0, row_bytes / 4, height, 0, 0, 0, height, allocation, &bmi, DIB_RGB_COLORS); ReleaseDC(hwnd, dc);//原来没有调用releaseDC,加上就可以了 return ret != 0; }
直接上代码,重新编译flutter_windows.dll
转载注明出处,from 博客园HemJohn
标签:bmiHeader,bmi,win7,dc,height,卡死,flutter,row From: https://www.cnblogs.com/HemJohn/p/17037405.html