Fixed bugs

This commit is contained in:
Kirill Poljakov
2023-06-30 10:51:38 +03:00
parent 0fb4c8f13a
commit 17b632844a
10 changed files with 73 additions and 87 deletions

View File

@ -4,12 +4,13 @@
#include "../../../../../UnicodeConverter/UnicodeConverter.h"
#include "../../../../../DesktopEditor/common/File.h"
#include "CNode.h"
#include <algorithm>
#include <cwctype>
#include <sstream>
#include <string>
#include <vector>
#include <regex>
#include <list>
#include <algorithm>
namespace NSCSS
{
@ -156,20 +157,13 @@ namespace NSCSS
{
std::vector<double> arValues;
std::wstring::const_iterator oFirstPos = wsValue.begin();
std::wstring::const_iterator oSecondPos = oFirstPos;
std::wregex oPattern(LR"([-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?)");
while (true)
{
oFirstPos = std::find_if(oSecondPos, wsValue.end(), [](const wchar_t& wChar){ return iswdigit(wChar) || L'.' == wChar || L'+' == wChar || L'-' == wChar; });
std::wsregex_iterator oIter(wsValue.begin(), wsValue.end(), oPattern);
std::wsregex_iterator oEndIter;
if (wsValue.end() == oFirstPos)
break;
oSecondPos = std::find_if(oFirstPos + 1, wsValue.end(), [](const wchar_t& wChar){ return !iswdigit(wChar) && wChar != L',' && wChar != L'.'; });
arValues.push_back(std::stod(std::wstring(oFirstPos, oSecondPos)));
}
for (; oIter != oEndIter; ++oIter)
arValues.push_back(std::stod(oIter->str()));
return arValues;
}

View File

@ -482,7 +482,7 @@ namespace NSCSS
std::wstring wsCopyValue(wsValue);
std::transform(wsCopyValue.begin(), wsCopyValue.begin() + unBegin, wsCopyValue.begin(), std::tolower);
std::transform(wsCopyValue.begin(), wsCopyValue.begin() + unBegin, wsCopyValue.begin(), std::towlower);
if (std::wstring::npos == wsCopyValue.find(L"url(#"))
return std::wstring();
@ -879,13 +879,10 @@ namespace NSCSS
return wsValue;
}
Aggplus::CMatrix CMatrix::GetFinalValue(const Aggplus::CMatrix* pPrevMatrix, TransformType oWithoutType) const
Aggplus::CMatrix CMatrix::GetFinalValue(TransformType oWithoutType) const
{
Aggplus::CMatrix oMatrix;
if(NULL != pPrevMatrix)
oMatrix = *pPrevMatrix;
for (const std::pair<std::vector<double>, TransformType>& oElement : m_oValue)
{
if (oWithoutType == oElement.second)

View File

@ -214,7 +214,7 @@ namespace NSCSS
double ToDouble() const override;
std::wstring ToWString() const override;
Aggplus::CMatrix GetFinalValue(const Aggplus::CMatrix* pPrevMatrix = NULL, TransformType oWithoutType = TransformNone) const;
Aggplus::CMatrix GetFinalValue(TransformType oWithoutType = TransformNone) const;
bool operator==(const CMatrix& oMatrix) const;
};