mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 06:50:06 +00:00
Format texture_atlas.cpp
This commit is contained in:
parent
fdcc5f01c9
commit
9d13023a51
1 changed files with 13 additions and 14 deletions
|
|
@ -390,10 +390,9 @@ TextureAtlas::Impl::LoadImage(const std::string& imagePath, double scale)
|
|||
|
||||
QUrl url = QUrl::fromUserInput(qImagePath);
|
||||
|
||||
|
||||
if (url.isLocalFile())
|
||||
{
|
||||
QString suffix = QFileInfo(qImagePath).suffix().toLower();
|
||||
QString suffix = QFileInfo(qImagePath).suffix().toLower();
|
||||
QString qLocalImagePath = url.toString(QUrl::PreferLocalFile);
|
||||
|
||||
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 (numChannels == 3)
|
||||
{
|
||||
std::for_each(
|
||||
std::execution::par,
|
||||
view.begin(),
|
||||
view.end(),
|
||||
[](boost::gil::rgba8_pixel_t& pixel)
|
||||
{
|
||||
static const boost::gil::rgba8_pixel_t kBlack {0, 0, 0, 255};
|
||||
if (pixel == kBlack)
|
||||
{
|
||||
pixel[3] = 0;
|
||||
}
|
||||
});
|
||||
std::for_each(std::execution::par,
|
||||
view.begin(),
|
||||
view.end(),
|
||||
[](boost::gil::rgba8_pixel_t& pixel)
|
||||
{
|
||||
static const boost::gil::rgba8_pixel_t kBlack {
|
||||
0, 0, 0, 255};
|
||||
if (pixel == kBlack)
|
||||
{
|
||||
pixel[3] = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
stbi_image_free(pixelData);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue