Yes< thank you, I have fixed that but it still does not work
I tried to run it with debug, and I see that the size of data from file is smaller than data from string by one
Here is my final version
void SvgSlide::load(SkScalar w, SkScalar h) {
if (fDom) {
fDom->unref();
fDom = nullptr;
}
auto data = SkData::MakeWithCString(
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!-- The default glyf "
"will be much smaller than the colr glyf layers. -->\n<svg\n version=\"1.1\"\n "
"viewBox=\"0 0 158.75 211.66667\"\n height=\"800\"\n width=\"600\">\n <g\n "
"transform=\"translate(0,-85.333351)\"\n id=\"layer1\">\n <path\n "
"transform=\"matrix(1,0,0,1.3773044,0.80180858,-33.549844)\"\n d=\"m "
"79.11178,236.39392 c -5.497887,0 -73.0286729,-67.53078 -73.028673,-73.02867 "
"-2e-7,-5.49789 67.530782,-73.028671 73.028669,-73.028672 5.497888,0 "
"73.028674,67.530782 73.028674,73.028672 0,5.49789 -67.530782,73.02867 "
"-73.02867,73.02867 z\"\n id=\"path5299\"\n "
"style=\"fill:#ff2a2a;stroke:none;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:"
"none;stroke-opacity:1\" />\n <path\n "
"transform=\"matrix(0.60436993,0,0,0.81236352,32.100808,58.741857)\"\n d=\"m "
"79.11178,236.39392 c -5.497887,0 -73.0286729,-67.53078 -73.028673,-73.02867 "
"-2e-7,-5.49789 67.530782,-73.028671 73.028669,-73.028672 5.497888,0 "
"73.028674,67.530782 73.028674,73.028672 0,5.49789 -67.530782,73.02867 "
"-73.02867,73.02867 z\"\n id=\"path5299-5\"\n "
"style=\"fill:none;stroke:#2b0000;stroke-width:14.19605827;stroke-miterlimit:4;stroke-"
"dasharray:none;stroke-opacity:1\" />\n </g>\n</svg>\n");
auto st = SkMemoryStream::Make(data);
auto fileData = SkData::MakeFromFileName(fPath.c_str());
std::cout << fileData->equals(data.get()) << std::endl;
// auto stream = SkStream::MakeFromFile(fPath.c_str());
auto stream = SkMemoryStream::Make(fileData);
if (!stream) {
SkDebugf("Could not open %s.\n", fPath.c_str());
return;
}
auto rp = skresources::DataURIResourceProviderProxy::Make(
skresources::FileResourceProvider::Make(SkOSPath::Dirname(fPath.c_str()),
/*predecode=*/true),
/*predecode=*/true);
fDom = SkSVGDOM::Builder()
.setFontManager(ToolUtils::TestFontMgr())
// .setResourceProvider(std::move(rp))
.make(*stream);
if (fDom) {
fDom->setContainerSize(SkSize::Make(w, h));
}
}