mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 14:50:05 +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);
|
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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue