Commit 2630fdcd authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander Trofimov

Исправлен баг с совпадающими точками градиента (баг 30379).

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@64908 954022d7-b5bf-4e40-9824-e11837661b57
parent 5b1523e8
......@@ -603,18 +603,98 @@ private:
if (!pColors || !pPoints || !lCount)
return;
// Проверим вырожденный случай, когда задана либо 1 точка, либо несколько точек с одинковым значением
bool bIrregular = false;
if (1 == lCount)
{
m_pShadingPoints = new double[2];
m_pShadingColors = new TColor[2];
bIrregular = true;
}
else
{
bIrregular = true;
for (LONG lIndex = 0; lIndex < lCount; lIndex++)
{
double dPoint1 = pPoints[lIndex];
for (LONG lIndex2 = lIndex + 1; lIndex2 < lCount; lIndex2++)
{
double dPoint2 = pPoints[lIndex2];
if (fabs(dPoint2 - dPoint1) > 0.00001)
{
bIrregular = false;
break;
}
}
if (!m_pShadingColors || !m_pShadingColors)
return;
if (!bIrregular)
break;
}
}
if (bIrregular)
{
if (1 == lCount)
{
m_pShadingPoints = new double[2];
m_pShadingColors = new TColor[2];
m_pShadingPoints[0] = 0.0;
m_pShadingPoints[1] = 1.0;
m_pShadingColors[0] = pColors[0];
m_pShadingColors[1] = pColors[0];
if (!m_pShadingColors || !m_pShadingColors)
return;
m_pShadingPoints[0] = 0.0;
m_pShadingColors[0] = pColors[0];
m_pShadingPoints[1] = 1.0;
m_pShadingColors[1] = pColors[0];
m_lShadingPointsCount = 2;
}
else
{
if (pPoints[0] < 0)
{
m_pShadingPoints = new double[2];
m_pShadingColors = new TColor[2];
if (!m_pShadingColors || !m_pShadingColors)
return;
m_pShadingPoints[0] = 0.0;
m_pShadingColors[0] = pColors[lCount - 1];
m_pShadingPoints[1] = 1.0;
m_pShadingColors[1] = pColors[lCount - 1];
m_lShadingPointsCount = 2;
}
else if (pPoints[0] > 1)
{
m_pShadingPoints = new double[2];
m_pShadingColors = new TColor[2];
if (!m_pShadingColors || !m_pShadingColors)
return;
m_pShadingPoints[0] = 0.0;
m_pShadingColors[0] = pColors[0];
m_pShadingPoints[1] = 1.0;
m_pShadingColors[1] = pColors[0];
m_lShadingPointsCount = 2;
}
else
{
m_pShadingPoints = new double[4];
m_pShadingColors = new TColor[4];
if (!m_pShadingColors || !m_pShadingColors)
return;
m_pShadingPoints[0] = 0.0;
m_pShadingColors[0] = pColors[0];
m_pShadingPoints[1] = pPoints[0];
m_pShadingColors[1] = pColors[0];
m_pShadingPoints[2] = pPoints[lCount - 1];
m_pShadingColors[2] = pColors[lCount - 1];
m_pShadingPoints[3] = 1.0;
m_pShadingColors[3] = pColors[lCount - 1];
m_lShadingPointsCount = 4;
}
}
}
else
{
......
......@@ -920,8 +920,8 @@ void TestMetafile()
}
void TestOnlineBin()
{
//std::wstring wsFolderPath = L"D://Test Files//Txt//";
std::wstring wsFolderPath = L"D://Test Files//Txt//IvanovaVeronica//";
std::wstring wsFolderPath = L"D://Test Files//Txt//Gradient//";
//std::wstring wsFolderPath = L"D://Test Files//Txt//Text//";
std::wstring wsTempFolder = L"D://Test Files//Temp//";
CApplicationFonts oFonts;
......@@ -988,7 +988,7 @@ void TestDouble()
int nResLen = 0;
double dValue = pDoubles[nIndex];
int nIVal = (int)dValue;
int nFVal = (int)(abs(dValue - nIVal) * 10000);
int nFVal = (int)(fabs(dValue - nIVal) * 10000);
int nLen = 0;
const char* sString = NSFastIntToString::GetString(abs(nIVal), nLen);
......
......@@ -11,12 +11,12 @@
#ifdef _DEBUG
#pragma comment(lib, "../x64/Debug/PdfWriter.lib")
#pragma comment(lib, "../../DesktopEditor/Qt_build/graphics/project/debug/graphics.lib")
#pragma comment(lib, "../../SDK/lib/win_64/DEBUG/graphics.lib")
#pragma comment(lib, "../../ASCOfficeUtils/ASCOfficeUtilsLib/Win/x64/Debug/ASCOfficeUtilsLib.lib")
#pragma comment(lib, "Ws2_32.lib")
#else
#pragma comment(lib, "../x64/Release/PdfWriter.lib")
#pragma comment(lib, "../../DesktopEditor/Qt_build/graphics/project/release/graphics.lib")
#pragma comment(lib, "../../SDK/lib/win_64/graphics.lib")
#pragma comment(lib, "../../ASCOfficeUtils/ASCOfficeUtilsLib/Win/x64/Release/ASCOfficeUtilsLib.lib")
#pragma comment(lib, "Ws2_32.lib")
#endif
......
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