yuzu-emu
/
yuzu
Archived
1
0
Fork 0

bootmanager: Encapsulate all QCamera code

This commit is contained in:
german77 2022-12-17 23:54:47 -06:00
parent dffeca66fa
commit c489cbee29
2 changed files with 7 additions and 5 deletions

View File

@ -820,6 +820,7 @@ void GRenderWindow::RequestCameraCapture() {
} }
void GRenderWindow::OnCameraCapture(int requestId, const QImage& img) { void GRenderWindow::OnCameraCapture(int requestId, const QImage& img) {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA
// TODO: Capture directly in the format and resolution needed // TODO: Capture directly in the format and resolution needed
const auto converted = const auto converted =
img.scaled(CAMERA_WIDTH, CAMERA_HEIGHT, Qt::AspectRatioMode::IgnoreAspectRatio, img.scaled(CAMERA_WIDTH, CAMERA_HEIGHT, Qt::AspectRatioMode::IgnoreAspectRatio,
@ -828,6 +829,7 @@ void GRenderWindow::OnCameraCapture(int requestId, const QImage& img) {
std::memcpy(camera_data.data(), converted.bits(), CAMERA_WIDTH * CAMERA_HEIGHT * sizeof(u32)); std::memcpy(camera_data.data(), converted.bits(), CAMERA_WIDTH * CAMERA_HEIGHT * sizeof(u32));
input_subsystem->GetCamera()->SetCameraData(CAMERA_WIDTH, CAMERA_HEIGHT, camera_data); input_subsystem->GetCamera()->SetCameraData(CAMERA_WIDTH, CAMERA_HEIGHT, camera_data);
pending_camera_snapshots = 0; pending_camera_snapshots = 0;
#endif
} }
bool GRenderWindow::event(QEvent* event) { bool GRenderWindow::event(QEvent* event) {

View File

@ -242,16 +242,16 @@ private:
bool first_frame = false; bool first_frame = false;
InputCommon::TasInput::TasState last_tas_state; InputCommon::TasInput::TasState last_tas_state;
bool is_virtual_camera;
int pending_camera_snapshots;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA
std::unique_ptr<QCamera> camera;
std::unique_ptr<QCameraImageCapture> camera_capture;
static constexpr std::size_t CAMERA_WIDTH = 320; static constexpr std::size_t CAMERA_WIDTH = 320;
static constexpr std::size_t CAMERA_HEIGHT = 240; static constexpr std::size_t CAMERA_HEIGHT = 240;
bool is_virtual_camera;
int pending_camera_snapshots;
std::vector<u32> camera_data; std::vector<u32> camera_data;
#endif std::unique_ptr<QCamera> camera;
std::unique_ptr<QCameraImageCapture> camera_capture;
std::unique_ptr<QTimer> camera_timer; std::unique_ptr<QTimer> camera_timer;
#endif
Core::System& system; Core::System& system;