Commit 7e4d0d72 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

ускорить потом конвертацию стринг в инт и дабл

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63681 954022d7-b5bf-4e40-9824-e11837661b57
parent 9b9646da
...@@ -369,7 +369,7 @@ namespace XPS ...@@ -369,7 +369,7 @@ namespace XPS
std::vector<CWString> arrElements = wsTransform.split(','); std::vector<CWString> arrElements = wsTransform.split(',');
double arrRes[6] ={ 1.0, 0.0, 0.0, 1.0, 0.0, 0.0 }; double arrRes[6] ={ 1.0, 0.0, 0.0, 1.0, 0.0, 0.0 };
for (int nIndex = 0, nCount = min(6, arrElements.size()); nIndex < nCount; nIndex++) for (int nIndex = 0, nCount = std::min(6, (int)arrElements.size()); nIndex < nCount; nIndex++)
arrRes[nIndex] = GetDouble(arrElements[nIndex].c_str()); arrRes[nIndex] = GetDouble(arrElements[nIndex].c_str());
pState->PushTransform(arrRes); pState->PushTransform(arrRes);
......
...@@ -176,7 +176,7 @@ namespace XPS ...@@ -176,7 +176,7 @@ namespace XPS
{ {
CPdfRenderer* pPdf = (CPdfRenderer*)pRenderer; CPdfRenderer* pPdf = (CPdfRenderer*)pRenderer;
pPdf->put_BrushGradientColors(m_pColors, m_pPositions, m_lCount); pPdf->put_BrushGradientColors(m_pColors, m_pPositions, m_lCount);
pPdf->SetRadialGradient(m_dXo, m_dYo, 0, m_dXc, m_dYc, max(m_dRadX, m_dRadY)); pPdf->SetRadialGradient(m_dXo, m_dYo, 0, m_dXc, m_dYc, std::max(m_dRadX, m_dRadY));
} }
else else
{ {
...@@ -352,7 +352,7 @@ namespace XPS ...@@ -352,7 +352,7 @@ namespace XPS
} }
} }
LONG lCount = min(vColors.size(), vPositions.size()); LONG lCount = std::min(vColors.size(), vPositions.size());
if (lCount <= 0) if (lCount <= 0)
{ {
delete pBrush; delete pBrush;
......
...@@ -111,8 +111,8 @@ namespace XPSEllipse ...@@ -111,8 +111,8 @@ namespace XPSEllipse
// Выясним в каких четвертях находятся начальная и конечная точки // Выясним в каких четвертях находятся начальная и конечная точки
unsigned int nFirstPointQuard = int(fAngle1) / 90 + 1; unsigned int nFirstPointQuard = int(fAngle1) / 90 + 1;
unsigned int nSecondPointQuard = int(fAngle2) / 90 + 1; unsigned int nSecondPointQuard = int(fAngle2) / 90 + 1;
nSecondPointQuard = min(4, max(1, nSecondPointQuard)); nSecondPointQuard = std::min((unsigned int)4, std::max((unsigned int)1, nSecondPointQuard));
nFirstPointQuard = min(4, max(1, nFirstPointQuard)); nFirstPointQuard = std::min((unsigned int)4, std::max((unsigned int)1, nFirstPointQuard));
// Проведем линию в начальную точку дуги // Проведем линию в начальную точку дуги
double fStartX = 0.0, fStartY = 0.0, fEndX = 0.0, fEndY = 0.0; double fStartX = 0.0, fStartY = 0.0, fEndX = 0.0, fEndY = 0.0;
...@@ -495,7 +495,7 @@ namespace XPS ...@@ -495,7 +495,7 @@ namespace XPS
} }
dFloat = (bNegative ? (double)(-dFloat) : (double)dFloat); dFloat = (bNegative ? (double)(-dFloat) : (double)dFloat);
nExp = max(20, min(0, nExp)); nExp = std::max(20, std::min(0, nExp));
while (nExp) while (nExp)
{ {
...@@ -692,15 +692,15 @@ namespace XPS ...@@ -692,15 +692,15 @@ namespace XPS
} }
double GetDouble(const CWString& wsString) double GetDouble(const CWString& wsString)
{ {
return _wtof(wsString.c_str()); return std::stod(wsString.c_str());
} }
double GetDouble(const std::wstring& wsString) double GetDouble(const std::wstring& wsString)
{ {
return _wtof(wsString.c_str()); return std::stod(wsString.c_str());
} }
int GetInteger(const std::wstring& wsString) int GetInteger(const std::wstring& wsString)
{ {
return _wtoi(wsString.c_str()); return std::stoi(wsString.c_str());
} }
bool GetBool(const std::wstring& wsString) bool GetBool(const std::wstring& wsString)
{ {
...@@ -747,12 +747,12 @@ namespace XPS ...@@ -747,12 +747,12 @@ namespace XPS
if (3 == arrElements.size()) if (3 == arrElements.size())
{ {
nAlpha = 255; nAlpha = 255;
nBgr = (((int)(min(GetDouble(arrElements[2]), 1.0) * 255)) << 16) + (((int)(min(GetDouble(arrElements[1]), 1.0) * 255)) << 8) + ((int)(min(GetDouble(arrElements[0]), 1.0) * 255)); nBgr = (((int)(std::min(GetDouble(arrElements[2]), 1.0) * 255)) << 16) + (((int)(std::min(GetDouble(arrElements[1]), 1.0) * 255)) << 8) + ((int)(std::min(GetDouble(arrElements[0]), 1.0) * 255));
} }
else if (4 == arrElements.size()) else if (4 == arrElements.size())
{ {
nAlpha = GetDouble(arrElements[0]) * 255; nAlpha = GetDouble(arrElements[0]) * 255;
nBgr = (((int)(min(GetDouble(arrElements[3]), 1.0) * 255)) << 16) + (((int)(min(GetDouble(arrElements[2]), 1.0) * 255)) << 8) + ((int)(min(GetDouble(arrElements[1]), 1.0) * 255)); nBgr = (((int)(std::min(GetDouble(arrElements[3]), 1.0) * 255)) << 16) + (((int)(std::min(GetDouble(arrElements[2]), 1.0) * 255)) << 8) + ((int)(std::min(GetDouble(arrElements[1]), 1.0) * 255));
} }
} }
else else
...@@ -1223,7 +1223,7 @@ namespace XPS ...@@ -1223,7 +1223,7 @@ namespace XPS
// промежутке [pUnicode + nUnicodePos, pUnicode + nUnicodePos + nCodeUnitCount] // промежутке [pUnicode + nUnicodePos, pUnicode + nUnicodePos + nCodeUnitCount]
int nUnicodesCount = 0; int nUnicodesCount = 0;
unsigned int* pUnicodes = NULL; unsigned int* pUnicodes = NULL;
nCodeUnitCount = min(nUtf16Len - nUtf16Pos, nCodeUnitCount); nCodeUnitCount = std::min(nUtf16Len - nUtf16Pos, nCodeUnitCount);
if (nCodeUnitCount) if (nCodeUnitCount)
{ {
pUnicodes = new unsigned int[nCodeUnitCount]; pUnicodes = new unsigned int[nCodeUnitCount];
...@@ -1267,7 +1267,7 @@ namespace XPS ...@@ -1267,7 +1267,7 @@ namespace XPS
// Равномерно распределяем юникоды по глифам, в идеале их количество должно совпадать. // Равномерно распределяем юникоды по глифам, в идеале их количество должно совпадать.
// Если юникодов больше, то лишние удаляем, если их меньше, то недостающие заполняем пробелами. // Если юникодов больше, то лишние удаляем, если их меньше, то недостающие заполняем пробелами.
nUnicodesCount = min(nUnicodesCount, nGlyphCount); nUnicodesCount = std::min(nUnicodesCount, nGlyphCount);
for (int nIndex = 0; nIndex < nGlyphCount; nIndex++) for (int nIndex = 0; nIndex < nGlyphCount; nIndex++)
{ {
if (nIndex < nUnicodesCount) if (nIndex < nUnicodesCount)
...@@ -1682,12 +1682,12 @@ namespace XPS ...@@ -1682,12 +1682,12 @@ namespace XPS
if (3 == vElements.size()) if (3 == vElements.size())
{ {
nAlpha = 255; nAlpha = 255;
nBgr = (((int)(min(GetDouble(vElements[2]), 1.0) * 255)) << 16) + (((int)(min(GetDouble(vElements[1]), 1.0) * 255)) << 8) + ((int)(min(GetDouble(vElements[0]), 1.0) * 255)); nBgr = (((int)(std::min(GetDouble(vElements[2]), 1.0) * 255)) << 16) + (((int)(std::min(GetDouble(vElements[1]), 1.0) * 255)) << 8) + ((int)(std::min(GetDouble(vElements[0]), 1.0) * 255));
} }
else if (4 == vElements.size()) else if (4 == vElements.size())
{ {
nAlpha = (int)(min(GetDouble(vElements[0]), 1.0) * 255); nAlpha = (int)(std::min(GetDouble(vElements[0]), 1.0) * 255);
nBgr = (((int)(min(GetDouble(vElements[3]), 1.0) * 255)) << 16) + (((int)(min(GetDouble(vElements[2]), 1.0) * 255)) << 8) + ((int)(min(GetDouble(vElements[1]), 1.0) * 255)); nBgr = (((int)(std::min(GetDouble(vElements[3]), 1.0) * 255)) << 16) + (((int)(std::min(GetDouble(vElements[2]), 1.0) * 255)) << 8) + ((int)(std::min(GetDouble(vElements[1]), 1.0) * 255));
} }
} }
} }
......
...@@ -93,7 +93,7 @@ namespace XPS ...@@ -93,7 +93,7 @@ namespace XPS
void CWString::create(const wchar_t* wsString, bool bCopy, int nLen) void CWString::create(const wchar_t* wsString, bool bCopy, int nLen)
{ {
clear(); clear();
unsigned int unLen = -1 == nLen ? min(wcslen(wsString), MAX_STRING_LEN) : (unsigned int)nLen; unsigned int unLen = -1 == nLen ? std::min((unsigned int)wcslen(wsString), (unsigned int)MAX_STRING_LEN) : (unsigned int)nLen;
m_unLen = unLen; m_unLen = unLen;
if (bCopy) if (bCopy)
{ {
...@@ -160,7 +160,7 @@ namespace XPS ...@@ -160,7 +160,7 @@ namespace XPS
const wchar_t* wsLeft = this->c_str(); const wchar_t* wsLeft = this->c_str();
const wchar_t* wsRight = wsString.c_str(); const wchar_t* wsRight = wsString.c_str();
unsigned int unLen = min(m_unLen, wsString.m_unLen); unsigned int unLen = std::min(m_unLen, wsString.m_unLen);
for (unsigned int unPos = 0; unPos < unLen; unPos++) for (unsigned int unPos = 0; unPos < unLen; unPos++)
{ {
if (wsLeft[unPos] < wsRight[unPos]) if (wsLeft[unPos] < wsRight[unPos])
...@@ -194,7 +194,7 @@ namespace XPS ...@@ -194,7 +194,7 @@ namespace XPS
bool CWString::operator==(const wchar_t* wsString) const bool CWString::operator==(const wchar_t* wsString) const
{ {
const wchar_t* wsLeft = this->c_str(); const wchar_t* wsLeft = this->c_str();
unsigned unLen = min(wcslen(wsString), MAX_STRING_LEN); unsigned unLen = std::min((unsigned int)wcslen(wsString), (unsigned int)MAX_STRING_LEN);
if (m_unLen != unLen) if (m_unLen != unLen)
return false; return false;
...@@ -221,7 +221,7 @@ namespace XPS ...@@ -221,7 +221,7 @@ namespace XPS
} }
int CWString::tointeger() const int CWString::tointeger() const
{ {
return _wtoi(c_str()); return std::stoi(c_str());
} }
std::vector<CWString> CWString::split(wchar_t wChar, bool bCopy) std::vector<CWString> CWString::split(wchar_t wChar, bool bCopy)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment