Format texture_atlas.cpp

This commit is contained in:
Dan Paulat 2025-06-17 20:17:58 -05:00
parent fdcc5f01c9
commit 9d13023a51

View file

@ -390,10 +390,9 @@ TextureAtlas::Impl::LoadImage(const std::string& imagePath, double scale)
QUrl url = QUrl::fromUserInput(qImagePath); QUrl url = QUrl::fromUserInput(qImagePath);
if (url.isLocalFile()) if (url.isLocalFile())
{ {
QString suffix = QFileInfo(qImagePath).suffix().toLower(); QString suffix = QFileInfo(qImagePath).suffix().toLower();
QString qLocalImagePath = url.toString(QUrl::PreferLocalFile); QString qLocalImagePath = url.toString(QUrl::PreferLocalFile);
if (suffix == "svg") if (suffix == "svg")
@ -448,18 +447,18 @@ TextureAtlas::Impl::LoadImage(const std::string& imagePath, double scale)
// If no alpha channel, replace black with transparent // If no alpha channel, replace black with transparent
if (numChannels == 3) if (numChannels == 3)
{ {
std::for_each( std::for_each(std::execution::par,
std::execution::par, view.begin(),
view.begin(), view.end(),
view.end(), [](boost::gil::rgba8_pixel_t& pixel)
[](boost::gil::rgba8_pixel_t& pixel) {
{ static const boost::gil::rgba8_pixel_t kBlack {
static const boost::gil::rgba8_pixel_t kBlack {0, 0, 0, 255}; 0, 0, 0, 255};
if (pixel == kBlack) if (pixel == kBlack)
{ {
pixel[3] = 0; pixel[3] = 0;
} }
}); });
} }
stbi_image_free(pixelData); stbi_image_free(pixelData);