Merge pull request #454 from pjft/svg-resizes

Adjust mutex for SVG initialization and resizing
This commit is contained in:
John Rassa 2018-06-14 18:14:36 -04:00 committed by GitHub
commit 678d1af3a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,11 +35,9 @@ void TextureData::initFromPath(const std::string& path)
bool TextureData::initSVGFromMemory(const unsigned char* fileData, size_t length)
{
// If already initialised then don't read again
{
std::unique_lock<std::mutex> lock(mMutex);
if (mDataRGBA)
return true;
}
std::unique_lock<std::mutex> lock(mMutex);
if (mDataRGBA)
return true;
// nsvgParse excepts a modifiable, null-terminated string
char* copy = (char*)malloc(length + 1);
@ -84,7 +82,6 @@ bool TextureData::initSVGFromMemory(const unsigned char* fileData, size_t length
ImageIO::flipPixelsVert(dataRGBA, mWidth, mHeight);
std::unique_lock<std::mutex> lock(mMutex);
mDataRGBA = dataRGBA;
return true;