Skip to content

Commit

Permalink
Merge pull request #749 from XenuIsWatching/svg_scaling
Browse files Browse the repository at this point in the history
Fix issue with svg scaling
  • Loading branch information
pjft authored May 12, 2021
2 parents 577c1df + 3c4117b commit c6bbd38
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion es-core/src/resources/TextureData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ bool TextureData::initSVGFromMemory(const unsigned char* fileData, size_t length
unsigned char* dataRGBA = new unsigned char[mWidth * mHeight * 4];

NSVGrasterizer* rast = nsvgCreateRasterizer();
nsvgRasterize(rast, svgImage, 0, 0, mHeight / svgImage->height, dataRGBA, (int)mWidth, (int)mHeight, (int)mWidth * 4);
float scale = Math::min(mHeight / svgImage->height, mWidth / svgImage->width);
nsvgRasterize(rast, svgImage, 0, 0, scale, dataRGBA, (int)mWidth, (int)mHeight, (int)mWidth * 4);
nsvgDeleteRasterizer(rast);

ImageIO::flipPixelsVert(dataRGBA, mWidth, mHeight);
Expand Down

0 comments on commit c6bbd38

Please sign in to comment.