mirror of https://github.com/axmolengine/axmol.git
Texture2D::addImageAsync : Set pixel format correctly. (#15774)
This commit is contained in:
parent
4ade6fbb80
commit
29cca63822
|
@ -93,11 +93,12 @@ std::string TextureCache::getDescription() const
|
||||||
struct TextureCache::AsyncStruct
|
struct TextureCache::AsyncStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AsyncStruct(const std::string& fn, std::function<void(Texture2D*)> f) : filename(fn), callback(f), loadSuccess(false) {}
|
AsyncStruct(const std::string& fn, std::function<void(Texture2D*)> f) : filename(fn), callback(f), pixelFormat(Texture2D::getDefaultAlphaPixelFormat()), loadSuccess(false) {}
|
||||||
|
|
||||||
std::string filename;
|
std::string filename;
|
||||||
std::function<void(Texture2D*)> callback;
|
std::function<void(Texture2D*)> callback;
|
||||||
Image image;
|
Image image;
|
||||||
|
Texture2D::PixelFormat pixelFormat;
|
||||||
bool loadSuccess;
|
bool loadSuccess;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -280,7 +281,7 @@ void TextureCache::addImageAsyncCallBack(float dt)
|
||||||
// generate texture in render thread
|
// generate texture in render thread
|
||||||
texture = new (std::nothrow) Texture2D();
|
texture = new (std::nothrow) Texture2D();
|
||||||
|
|
||||||
texture->initWithImage(image);
|
texture->initWithImage(image, asyncStruct->pixelFormat);
|
||||||
//parse 9-patch info
|
//parse 9-patch info
|
||||||
this->parseNinePatchImage(image, texture, asyncStruct->filename);
|
this->parseNinePatchImage(image, texture, asyncStruct->filename);
|
||||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||||
|
|
Loading…
Reference in New Issue