mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-12 23:23:34 +00:00
fixing image set pixel
This commit is contained in:
@@ -218,7 +218,7 @@ namespace mlx
|
|||||||
void Texture::SetPixel(int x, int y, mlx_color color) noexcept
|
void Texture::SetPixel(int x, int y, mlx_color color) noexcept
|
||||||
{
|
{
|
||||||
MLX_PROFILE_FUNCTION();
|
MLX_PROFILE_FUNCTION();
|
||||||
if(x < 0 || y < 0 || static_cast<std::uint32_t>(x) > m_width || static_cast<std::uint32_t>(y) > m_height)
|
if(x < 0 || y < 0 || static_cast<std::uint32_t>(x) >= m_width || static_cast<std::uint32_t>(y) >= m_height)
|
||||||
return;
|
return;
|
||||||
if(!m_staging_buffer.has_value())
|
if(!m_staging_buffer.has_value())
|
||||||
OpenCPUBuffer();
|
OpenCPUBuffer();
|
||||||
@@ -232,7 +232,7 @@ namespace mlx
|
|||||||
void Texture::SetRegion(int x, int y, int w, int h, mlx_color* pixels) noexcept
|
void Texture::SetRegion(int x, int y, int w, int h, mlx_color* pixels) noexcept
|
||||||
{
|
{
|
||||||
MLX_PROFILE_FUNCTION();
|
MLX_PROFILE_FUNCTION();
|
||||||
if(x < 0 || y < 0 || static_cast<std::uint32_t>(x) > m_width || static_cast<std::uint32_t>(y) > m_height)
|
if(x < 0 || y < 0 || static_cast<std::uint32_t>(x) >= m_width || static_cast<std::uint32_t>(y) >= m_height)
|
||||||
return;
|
return;
|
||||||
if(w < 0 || h < 0)
|
if(w < 0 || h < 0)
|
||||||
return;
|
return;
|
||||||
@@ -258,7 +258,7 @@ namespace mlx
|
|||||||
void Texture::SetLinearRegion(int x, int y, std::size_t len, mlx_color* pixels) noexcept
|
void Texture::SetLinearRegion(int x, int y, std::size_t len, mlx_color* pixels) noexcept
|
||||||
{
|
{
|
||||||
MLX_PROFILE_FUNCTION();
|
MLX_PROFILE_FUNCTION();
|
||||||
if(x < 0 || y < 0 || static_cast<std::uint32_t>(x) > m_width || static_cast<std::uint32_t>(y) > m_height)
|
if(x < 0 || y < 0 || static_cast<std::uint32_t>(x) >= m_width || static_cast<std::uint32_t>(y) >= m_height)
|
||||||
return;
|
return;
|
||||||
if(!m_staging_buffer.has_value())
|
if(!m_staging_buffer.has_value())
|
||||||
OpenCPUBuffer();
|
OpenCPUBuffer();
|
||||||
@@ -282,7 +282,7 @@ namespace mlx
|
|||||||
mlx_color Texture::GetPixel(int x, int y) noexcept
|
mlx_color Texture::GetPixel(int x, int y) noexcept
|
||||||
{
|
{
|
||||||
MLX_PROFILE_FUNCTION();
|
MLX_PROFILE_FUNCTION();
|
||||||
if(x < 0 || y < 0 || static_cast<std::uint32_t>(x) > m_width || static_cast<std::uint32_t>(y) > m_height)
|
if(x < 0 || y < 0 || static_cast<std::uint32_t>(x) >= m_width || static_cast<std::uint32_t>(y) >= m_height)
|
||||||
return { .rgba = 0x00000000 };
|
return { .rgba = 0x00000000 };
|
||||||
if(!m_staging_buffer.has_value())
|
if(!m_staging_buffer.has_value())
|
||||||
OpenCPUBuffer();
|
OpenCPUBuffer();
|
||||||
@@ -295,7 +295,7 @@ namespace mlx
|
|||||||
void Texture::GetRegion(int x, int y, int w, int h, mlx_color* dst) noexcept
|
void Texture::GetRegion(int x, int y, int w, int h, mlx_color* dst) noexcept
|
||||||
{
|
{
|
||||||
MLX_PROFILE_FUNCTION();
|
MLX_PROFILE_FUNCTION();
|
||||||
if(x < 0 || y < 0 || static_cast<std::uint32_t>(x) > m_width || static_cast<std::uint32_t>(y) > m_height)
|
if(x < 0 || y < 0 || static_cast<std::uint32_t>(x) >= m_width || static_cast<std::uint32_t>(y) >= m_height)
|
||||||
return;
|
return;
|
||||||
if(!m_staging_buffer.has_value())
|
if(!m_staging_buffer.has_value())
|
||||||
OpenCPUBuffer();
|
OpenCPUBuffer();
|
||||||
|
|||||||
Reference in New Issue
Block a user