Skip to content

Cannot parse some SVG's tile by tile #55

Closed
@erentknn

Description

I have two SVG's. One is smaller (12k x 7k) other one is bigger (28k x 32k) I can parse the smaller one tile by tile with no problem. But with other one I get Access Violation error. I triple checked the code and cannot find any problem. Here is a sample code to reproduce it:

std::vector<std::vector<float>> tileParamList; // coordinates from the json file
const int width = 1024;
const int height = 1024;
auto svgImage = lunasvg::Document::loadFromData(svgStr);

for (int i = 0; i < tileParamList.size(); i++)
{
	lunasvg::Bitmap bitmap{ width, height };
	lunasvg::Matrix matrix{ 1, 0, 0, 1, -tileParamList[i][0], -tileParamList[i][1] };
	
	svgImage->render(bitmap, matrix); <----------- HERE

	auto res = cv::Mat(height, width, CV_8UC4);
	res.data = bitmap.data();
	cv::cvtColor(res, res, CV_RGBA2GRAY);
	res = res > 0;
}

SVG and tileList can be found here: broken.zip
And other SVG can be found here (One that works correctly. Note: First few iterations might be blank image.): notbroken.zip

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions