Browse Source

Bring back the comment mentioning the need for a temporary buffer

pull/141/head
Patrick Desaulniers 6 years ago
parent
commit
f82df26dee
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      dgl/src/SVG.cpp

+ 2
- 2
dgl/src/SVG.cpp View File

@@ -41,9 +41,8 @@ void SVG::loadFromMemory(const char* const rawData, const uint dataSize, const f
free(fRGBAData);
fRGBAData = nullptr;
}

NSVGrasterizer* rasterizer = nsvgCreateRasterizer();
// nsvgParse modifies the input data, so we must use a temporary buffer
char* tmpBuffer = (char*)malloc(dataSize);

DISTRHO_SAFE_ASSERT_RETURN(tmpBuffer != nullptr, )
@@ -66,6 +65,7 @@ void SVG::loadFromMemory(const char* const rawData, const uint dataSize, const f

fRGBAData = (unsigned char*)malloc(scaledWidth * scaledHeight * 4);

NSVGrasterizer* rasterizer = nsvgCreateRasterizer();
nsvgRasterize(rasterizer, image, 0, 0, scaling, fRGBAData, scaledWidth, scaledHeight, scaledWidth * 4);

fSize.setSize(scaledWidth, scaledHeight);


Loading…
Cancel
Save