make brushes square when imported from ABR

This commit is contained in:
2019-02-11 00:45:53 +01:00
parent 6e41263600
commit 97c3ac0d19
5 changed files with 10 additions and 8 deletions

View File

@@ -120,7 +120,7 @@ Image Image::resize_power2() const
return resize(w, h);
}
Image Image::resize_squared() const
Image Image::resize_squared(const glm::u8vec4& bg) const
{
Image ret;
if (width == height)
@@ -146,7 +146,7 @@ Image Image::resize_squared() const
ret.create(size, size);
auto ptr_src = reinterpret_cast<glm::u8vec4*>(m_data.get());
auto ptr_dst = reinterpret_cast<glm::u8vec4*>(ret.m_data.get());
std::fill_n(ptr_dst, size * size, glm::u8vec4(0));
std::fill_n(ptr_dst, size * size, bg);
for (int y = 0; y < height; y++)
std::copy_n(ptr_src + y * width, width, ptr_dst + pad_x + (y + pad_y) * ret.width);
}