This commit is contained in:
2025-03-17 11:34:58 +01:00
committed by GitHub
2 changed files with 4 additions and 3 deletions

View File

@@ -275,7 +275,8 @@ namespace mlx
default: break; default: break;
} }
m_binding_hook(&event); if(m_binding_hook)
m_binding_hook(&event);
} }
} }

View File

@@ -243,9 +243,9 @@ namespace mlx
if(moving_x >= static_cast<std::uint32_t>(x + w) || moving_x >= m_width) if(moving_x >= static_cast<std::uint32_t>(x + w) || moving_x >= m_width)
{ {
moving_x = x; moving_x = x;
moving_y++;
if(moving_y >= static_cast<std::uint32_t>(y + h) || moving_y >= m_height) if(moving_y >= static_cast<std::uint32_t>(y + h) || moving_y >= m_height)
break; break;
moving_y++;
} }
if constexpr(std::endian::native == std::endian::little) if constexpr(std::endian::native == std::endian::little)
m_staging_buffer->GetMap<mlx_color*>()[(moving_y * m_width) + moving_x] = ReverseColor(pixels[i]); m_staging_buffer->GetMap<mlx_color*>()[(moving_y * m_width) + moving_x] = ReverseColor(pixels[i]);
@@ -304,9 +304,9 @@ namespace mlx
if(moving_x >= static_cast<std::uint32_t>(x + w) || moving_x >= m_width) if(moving_x >= static_cast<std::uint32_t>(x + w) || moving_x >= m_width)
{ {
moving_x = x; moving_x = x;
moving_y++;
if(moving_y >= static_cast<std::uint32_t>(y + h) || moving_y >= m_height) if(moving_y >= static_cast<std::uint32_t>(y + h) || moving_y >= m_height)
break; break;
moving_y++;
} }
if constexpr(std::endian::native == std::endian::little) if constexpr(std::endian::native == std::endian::little)
dst[i] = ReverseColor(m_staging_buffer->GetMap<mlx_color*>()[(moving_y * m_width) + moving_x]); dst[i] = ReverseColor(m_staging_buffer->GetMap<mlx_color*>()[(moving_y * m_width) + moving_x]);