[nostalgia/core/studio] Fix crash that occurs when a non-leaf node subsheet is selected
All checks were successful
Build / build (push) Successful in 3m11s
All checks were successful
Build / build (push) Successful in 3m11s
This commit is contained in:
parent
c44d8678cb
commit
418d6e3f22
@ -80,6 +80,11 @@ void TileSheetGrid::setBufferObject(
|
||||
}
|
||||
|
||||
void TileSheetGrid::setBufferObjects(ox::Vec2 const&paneSize, TileSheet::SubSheet const&subsheet) noexcept {
|
||||
if (subsheet.columns < 1 || subsheet.rows < 1) {
|
||||
m_bufferSet.elements.clear();
|
||||
m_bufferSet.vertices.clear();
|
||||
return;
|
||||
}
|
||||
auto const pixSize = pixelSize(paneSize);
|
||||
auto const set = [&](std::size_t i, ox::Point pt1, ox::Point pt2, Color32 c) {
|
||||
auto const vbo = &m_bufferSet.vertices[i * VertexVboLength];
|
||||
|
@ -51,7 +51,7 @@ ox::Error TileSheetPixels::buildShader() noexcept {
|
||||
return glutils::buildShaderProgram(s_programSrc).moveTo(m_shader);
|
||||
}
|
||||
|
||||
void TileSheetPixels::draw(bool update, ox::Vec2 const&scroll) noexcept {
|
||||
void TileSheetPixels::draw(bool const update, ox::Vec2 const&scroll) noexcept {
|
||||
glUseProgram(m_shader);
|
||||
glBindVertexArray(m_bufferSet.vao);
|
||||
if (update) {
|
||||
@ -117,6 +117,11 @@ void TileSheetPixels::setPixelBufferObject(
|
||||
void TileSheetPixels::setBufferObjects(ox::Vec2 const&paneSize) noexcept {
|
||||
// set buffer lengths
|
||||
auto const&subSheet = m_model.activeSubSheet();
|
||||
if (subSheet.columns < 1 || subSheet.rows < 1) {
|
||||
m_bufferSet.vertices.clear();
|
||||
m_bufferSet.elements.clear();
|
||||
return;
|
||||
}
|
||||
auto const&pal = m_model.pal();
|
||||
auto const width = subSheet.columns * TileWidth;
|
||||
auto const height = subSheet.rows * TileHeight;
|
||||
|
Loading…
Reference in New Issue
Block a user