Files
Renderive/Core/flow/Present_Surface_Lease.cpp
T
2026-08-02 14:20:27 +08:00

48 lines
1.3 KiB
C++

#include "Present_Surface_Lease.h"
namespace renderive {
Present_Surface_Lease::Present_Surface_Lease() = default;
Present_Surface_Lease::Present_Surface_Lease(Present_Surface_Lease&&) noexcept = default;
Present_Surface_Lease& Present_Surface_Lease::operator=(Present_Surface_Lease&&) noexcept = default;
Present_Surface_Lease::~Present_Surface_Lease() = default;
Present_Surface_Lease::operator bool() const {
return output() != nullptr;
}
bool Present_Surface_Lease::new_frame() const {
return is_new_frame;
}
bool Present_Surface_Lease::request_was_pending() const {
return update_was_pending;
}
Image_View Present_Surface_Lease::image() const {
Render_Output* current = output();
if (!current)
return {};
return current->image.view();
}
Present_Surface_Lease Present_Surface_Lease::from_handle(std::unique_ptr<Present_Surface_Handle> handle, bool is_new_frame, bool update_was_pending) {
Present_Surface_Lease lease;
lease.handle_ = std::move(handle);
lease.is_new_frame = is_new_frame;
lease.update_was_pending = update_was_pending;
return lease;
}
Render_Output* Present_Surface_Lease::output() const {
return handle_ ? handle_->output() : nullptr;
}
void Present_Surface_Lease::reset() {
handle_.reset();
is_new_frame = false;
update_was_pending = false;
}
} // namespace renderive