Merge pull request #12415 from lioncash/buffer
GBAWidget: Use std::span with SetVideoBuffer()
This commit is contained in:
commit
b5d8498346
|
@ -106,7 +106,7 @@ void GBAWidget::GameChanged(const HW::GBA::CoreInfo& info)
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBAWidget::SetVideoBuffer(std::vector<u32> video_buffer)
|
void GBAWidget::SetVideoBuffer(std::span<const u32> video_buffer)
|
||||||
{
|
{
|
||||||
m_previous_frame = std::move(m_last_frame);
|
m_previous_frame = std::move(m_last_frame);
|
||||||
if (video_buffer.size() == static_cast<size_t>(m_core_info.width * m_core_info.height))
|
if (video_buffer.size() == static_cast<size_t>(m_core_info.width * m_core_info.height))
|
||||||
|
@ -608,7 +608,7 @@ void GBAWidgetController::GameChanged(const HW::GBA::CoreInfo& info)
|
||||||
m_widget->GameChanged(info);
|
m_widget->GameChanged(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBAWidgetController::FrameEnded(std::vector<u32> video_buffer)
|
void GBAWidgetController::FrameEnded(std::span<const u32> video_buffer)
|
||||||
{
|
{
|
||||||
m_widget->SetVideoBuffer(std::move(video_buffer));
|
m_widget->SetVideoBuffer(video_buffer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <span>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -34,10 +35,10 @@ class GBAWidget : public QWidget
|
||||||
public:
|
public:
|
||||||
explicit GBAWidget(std::weak_ptr<HW::GBA::Core> core, const HW::GBA::CoreInfo& info,
|
explicit GBAWidget(std::weak_ptr<HW::GBA::Core> core, const HW::GBA::CoreInfo& info,
|
||||||
const std::optional<NetPlay::PadDetails>& netplay_pad);
|
const std::optional<NetPlay::PadDetails>& netplay_pad);
|
||||||
~GBAWidget();
|
~GBAWidget() override;
|
||||||
|
|
||||||
void GameChanged(const HW::GBA::CoreInfo& info);
|
void GameChanged(const HW::GBA::CoreInfo& info);
|
||||||
void SetVideoBuffer(std::vector<u32> video_buffer);
|
void SetVideoBuffer(std::span<const u32> video_buffer);
|
||||||
|
|
||||||
void SetVolume(int volume);
|
void SetVolume(int volume);
|
||||||
void VolumeDown();
|
void VolumeDown();
|
||||||
|
@ -102,11 +103,11 @@ class GBAWidgetController : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit GBAWidgetController() = default;
|
explicit GBAWidgetController() = default;
|
||||||
~GBAWidgetController();
|
~GBAWidgetController() override;
|
||||||
|
|
||||||
void Create(std::weak_ptr<HW::GBA::Core> core, const HW::GBA::CoreInfo& info);
|
void Create(std::weak_ptr<HW::GBA::Core> core, const HW::GBA::CoreInfo& info);
|
||||||
void GameChanged(const HW::GBA::CoreInfo& info);
|
void GameChanged(const HW::GBA::CoreInfo& info);
|
||||||
void FrameEnded(std::vector<u32> video_buffer);
|
void FrameEnded(std::span<const u32> video_buffer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GBAWidget* m_widget{};
|
GBAWidget* m_widget{};
|
||||||
|
|
Loading…
Reference in New Issue