RichText: EncodeHTML now using image style width / height instead of rescaling internally

git-svn-id: svn://ultimatepp.org/upp/trunk@15277 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2020-10-20 10:42:09 +00:00
parent abc82450f3
commit 138820564b

View file

@ -341,28 +341,23 @@ String DefaultHtmlObjectSaver::GetHtml(const RichObject& object, const String& l
String name;
name << namebase << "_" << im++ << ".png";
Size psz = object.GetPixelSize();
String lname;
lname << "L$" << name;
Size sz = z * object.GetSize();
if(abs(100 * (psz.cx - sz.cx) / sz.cx) < imtolerance)
sz = psz;
PNGEncoder png;
png.SaveFile(AppendFileName(outdir, name), object.ToImage(sz));
png.SaveFile(AppendFileName(outdir, name), object.ToImage(psz));
String el = "</a>";
if(IsNull(link)) {
if(psz.cx * psz.cy != 0)
html << "<a href=\"" << lname << "\">";
html << "<a href=\"" << name << "\">";
else
el.Clear();
}
else
html << "<a href=\"" << link << "\">";
html << "<img src=\"" << name << "\" border=\"0\" alt=\"\">";
html << Format("<img src=\"%s\" border=\"0\" alt=\"\" style=\"width: %d`px; height: %d`px\">",
name, sz.cx, sz.cy);
html << el;
if(IsNull(link) && psz.cx * psz.cy != 0) {
PNGEncoder png;
png.SaveFile(AppendFileName(outdir, lname), object.ToImage(psz));
}
return String(html);
}