Brought in Amit's latest and will now merge in my fixing from last night into his to get them synced up.

This commit is contained in:
Zed A. Shaw 2025-01-17 11:00:49 -05:00
parent adfb6367d7
commit c91e8fc543
8 changed files with 116 additions and 68 deletions

View file

@ -62,8 +62,20 @@ namespace amt {
constexpr RGBA() noexcept = default;
constexpr RGBA(RGBA const&) noexcept = default;
constexpr RGBA(RGBA &&) noexcept = default;
constexpr RGBA& operator=(RGBA const&) noexcept = default;
constexpr RGBA& operator=(RGBA &&) noexcept = default;
RGBA& operator=(RGBA const& other) noexcept {
// HACK: clang was unable to optimize the copy using a single move instruction.
auto& self = *reinterpret_cast<std::uint32_t*>(this);
auto color = *reinterpret_cast<std::uint32_t const*>(&other);
self = color;
return *this;
}
RGBA& operator=(RGBA && other) noexcept {
// HACK: clang was unable to optimize the copy using a single move instruction
auto& self = *reinterpret_cast<std::uint32_t*>(this);
auto color = *reinterpret_cast<std::uint32_t const*>(&other);
self = color;
return *this;
}
constexpr ~RGBA() noexcept = default;
constexpr RGBA(pixel_t r, pixel_t g, pixel_t b, pixel_t a = 0xff) noexcept
@ -452,6 +464,7 @@ namespace amt {
}
}
PixelBuf() noexcept = default;
PixelBuf(PixelBuf const&) = default;
PixelBuf(PixelBuf &&) noexcept = default;
PixelBuf& operator=(PixelBuf const&) = default;
@ -476,8 +489,8 @@ namespace amt {
constexpr auto rbegin() const noexcept -> const_reverse_iterator { return m_data.rbegin(); }
constexpr auto rend() const noexcept -> const_reverse_iterator { return m_data.rend(); }
constexpr auto operator[](size_type r) noexcept { return m_data[r]; }
constexpr auto operator[](size_type r) const noexcept { return m_data[r]; }
constexpr decltype(auto) operator[](size_type r) noexcept { return m_data[r]; }
constexpr decltype(auto) operator[](size_type r) const noexcept { return m_data[r]; }
constexpr auto operator()(size_type r, size_type c) noexcept -> reference { return m_data(r, c); }
constexpr auto operator()(size_type r, size_type c) const noexcept -> const_reference { return m_data(r, c); }
@ -579,4 +592,4 @@ namespace std {
};
} // namespace std
#endif // AMT_PIXEL_HPP
#endif // AMT_PIXEL_HPP