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

все лонги переделаны на инты.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62191 954022d7-b5bf-4e40-9824-e11837661b57
parent ae84bdc8
......@@ -5,13 +5,13 @@
namespace MetaFile
{
unsigned char GetLowestBit(unsigned long ulValue)
unsigned char GetLowestBit(unsigned int ulValue)
{
if (0 == ulValue)
return 0;
unsigned char unOffset = 0;
unsigned long ulBit = 1;
unsigned int ulBit = 1;
while (!(ulValue & ulBit))
{
ulBit = ulBit << 1;
......@@ -24,7 +24,7 @@ namespace MetaFile
return unOffset;
}
bool ReadImageCoreHeader(BYTE* pHeaderBuffer, unsigned long ulHeaderBufferLen, BYTE* pImageBuffer, unsigned long ulImageBufferLen, BYTE** ppDstBuffer, unsigned long* pulWidth, unsigned long* pulHeight)
bool ReadImageCoreHeader(BYTE* pHeaderBuffer, unsigned int ulHeaderBufferLen, BYTE* pImageBuffer, unsigned int ulImageBufferLen, BYTE** ppDstBuffer, unsigned int* pulWidth, unsigned int* pulHeight)
{
CDataStream oHeaderStream;
oHeaderStream.SetStream(pHeaderBuffer, ulHeaderBufferLen);
......@@ -44,7 +44,7 @@ namespace MetaFile
return false;
}
bool ReadImageInfoHeader(BYTE* pHeaderBuffer, unsigned long ulHeaderBufferLen, BYTE* pImageBuffer, unsigned long ulImageBufferLen, BYTE** ppDstBuffer, unsigned long* pulWidth, unsigned long* pulHeight)
bool ReadImageInfoHeader(BYTE* pHeaderBuffer, unsigned int ulHeaderBufferLen, BYTE* pImageBuffer, unsigned int ulImageBufferLen, BYTE** ppDstBuffer, unsigned int* pulWidth, unsigned int* pulHeight)
{
CDataStream oHeaderStream;
oHeaderStream.SetStream(pHeaderBuffer, ulHeaderBufferLen);
......@@ -83,11 +83,11 @@ namespace MetaFile
return false;
BYTE* pBgraBuffer = NULL;
unsigned long ulWidth = 0;
unsigned long ulHeight = 0;
unsigned int ulWidth = 0;
unsigned int ulHeight = 0;
BYTE* pBuffer = pImageBuffer;
long lBufLen = ulImageBufferLen;
int lBufLen = ulImageBufferLen;
*ppDstBuffer = NULL;
*pulWidth = 0;
......@@ -121,7 +121,7 @@ namespace MetaFile
oHeaderStream >> oColor1 >> oColor2;
//
long lCalcLen = (((nWidth * ushPlanes * ushBitCount + 31) & ~31) / 8) * abs(nHeight);
int lCalcLen = (((nWidth * ushPlanes * ushBitCount + 31) & ~31) / 8) * abs(nHeight);
if (lCalcLen != lBufLen)
return false;
......@@ -194,7 +194,7 @@ namespace MetaFile
// 4 - 1
//
long lCalcLen = (((nWidth * ushPlanes * ushBitCount + 31) & ~31) / 8) * abs(nHeight);
int lCalcLen = (((nWidth * ushPlanes * ushBitCount + 31) & ~31) / 8) * abs(nHeight);
if (lCalcLen != lBufLen)
return false;
......@@ -371,8 +371,8 @@ namespace MetaFile
}
else if (BI_BITCOUNT_4 == ushBitCount)
{
unsigned long ulMaskR = 0x1f, ulMaskB = 0x7C00, ulMaskG = 0x3E0;
unsigned long ulShiftR = 0, ulShiftB = 10, ulShiftG = 5;
unsigned int ulMaskR = 0x1f, ulMaskB = 0x7C00, ulMaskG = 0x3E0;
unsigned int ulShiftR = 0, ulShiftB = 10, ulShiftG = 5;
double dKoefR = 255 / 31.0, dKoefB = 255 / 31.0, dKoefG = 255 / 31.0;
if (BI_RGB == unCompression)
......@@ -384,9 +384,9 @@ namespace MetaFile
}
else if (BI_BITFIELDS == unCompression)
{
oHeaderStream >> ulMaskR;
oHeaderStream >> ulMaskG;
oHeaderStream >> ulMaskB;
oHeaderStream >> ulMaskG;
oHeaderStream >> ulMaskR;
ulShiftR = GetLowestBit(ulMaskR);
ulShiftB = GetLowestBit(ulMaskB);
......@@ -400,7 +400,7 @@ namespace MetaFile
return false;
//
long lCalcLen = (((nWidth * ushPlanes * ushBitCount + 31) & ~31) / 8) * abs(nHeight);
int lCalcLen = (((nWidth * ushPlanes * ushBitCount + 31) & ~31) / 8) * abs(nHeight);
if (lCalcLen != lBufLen)
return false;
......@@ -433,9 +433,9 @@ namespace MetaFile
unsigned char unG = (ushValue & ulMaskG) >> ulShiftG;
unsigned char unB = (ushValue & ulMaskB) >> ulShiftB;
pBgraBuffer[nIndex + 0] = (unsigned char)(unB * dKoefB);
pBgraBuffer[nIndex + 0] = (unsigned char)(unR * dKoefR);
pBgraBuffer[nIndex + 1] = (unsigned char)(unG * dKoefG);
pBgraBuffer[nIndex + 2] = (unsigned char)(unR * dKoefR);
pBgraBuffer[nIndex + 2] = (unsigned char)(unB * dKoefB);
pBgraBuffer[nIndex + 3] = 255;
}
pBuffer += nAdd; lBufLen -= nAdd;
......@@ -454,9 +454,9 @@ namespace MetaFile
unsigned char unG = (ushValue & ulMaskG) >> ulShiftG;
unsigned char unB = (ushValue & ulMaskB) >> ulShiftB;
pBgraBuffer[nIndex + 0] = (unsigned char)(unB * dKoefB);
pBgraBuffer[nIndex + 0] = (unsigned char)(unR * dKoefR);
pBgraBuffer[nIndex + 1] = (unsigned char)(unG * dKoefG);
pBgraBuffer[nIndex + 2] = (unsigned char)(unR * dKoefR);
pBgraBuffer[nIndex + 2] = (unsigned char)(unB * dKoefB);
pBgraBuffer[nIndex + 3] = 255;
}
pBuffer += nAdd; lBufLen -= nAdd;
......@@ -478,7 +478,7 @@ namespace MetaFile
return false; // TODO: ,
//
long lCalcLen = (((nWidth * ushPlanes * ushBitCount + 31) & ~31) / 8) * abs(nHeight);
int lCalcLen = (((nWidth * ushPlanes * ushBitCount + 31) & ~31) / 8) * abs(nHeight);
if (lCalcLen != lBufLen)
return false;
......@@ -546,7 +546,7 @@ namespace MetaFile
return false; // TO DO: ,
//
long lCalcLen = (((nWidth * ushPlanes * ushBitCount + 31) & ~31) / 8) * abs(nHeight);
int lCalcLen = (((nWidth * ushPlanes * ushBitCount + 31) & ~31) / 8) * abs(nHeight);
if (lCalcLen != lBufLen)
return false;
......@@ -626,7 +626,7 @@ namespace MetaFile
return false;
}
void ReadImage(BYTE* pHeaderBuffer, unsigned long ulHeaderBufferLen, BYTE* pImageBuffer, unsigned long ulImageBufferLen, BYTE** ppDstBuffer, unsigned long* pulWidth, unsigned long* pulHeight)
void ReadImage(BYTE* pHeaderBuffer, unsigned int ulHeaderBufferLen, BYTE* pImageBuffer, unsigned int ulImageBufferLen, BYTE** ppDstBuffer, unsigned int* pulWidth, unsigned int* pulHeight)
{
if (ulHeaderBufferLen <= 0 || NULL == pHeaderBuffer || NULL == pImageBuffer || ulImageBufferLen < 0)
return;
......@@ -635,7 +635,7 @@ namespace MetaFile
oHeaderStream.SetStream(pHeaderBuffer, ulHeaderBufferLen);
//
unsigned long ulHeaderSize;
unsigned int ulHeaderSize;
oHeaderStream >> ulHeaderSize;
if (ulHeaderSize < 0x0000000C)
......
......@@ -40,7 +40,7 @@ namespace MetaFile
{
}
void SetStream(BYTE* pBuf, unsigned long unSize)
void SetStream(BYTE* pBuf, unsigned int unSize)
{
pBuffer = pBuf;
pCur = pBuf;
......@@ -65,12 +65,12 @@ namespace MetaFile
pCur += 2;
return ushResult;
};
unsigned long ReadULong()
unsigned int ReadULong()
{
if (pCur + 4 >= pEnd)
return 0;
unsigned long unResult = (unsigned long)((pCur[0] << 0) | ((pCur[1]) << 8) | ((pCur[2]) << 16) | ((pCur[3]) << 24));
unsigned int unResult = (unsigned int)((pCur[0] << 0) | ((pCur[1]) << 8) | ((pCur[2]) << 16) | ((pCur[3]) << 24));
pCur += 4;
return unResult;
};
......@@ -90,8 +90,8 @@ namespace MetaFile
return output;
long lIntValue = (long)((pCur[0] << 16) | ((pCur[1]) << 8) | ((pCur[2]) << 0));
long lFracValue = (long)(pCur[3]);
int lIntValue = (int)((pCur[0] << 16) | ((pCur[1]) << 8) | ((pCur[2]) << 0));
int lFracValue = (int)(pCur[3]);
pCur += 4;
return (double)(lIntValue + (lFracValue / 16.0));
};
......@@ -103,11 +103,11 @@ namespace MetaFile
{
return (short)ReadUShort();
};
long ReadLong()
int ReadLong()
{
return (long)ReadULong();
return (int)ReadULong();
};
void ReadBytes(unsigned char* pBuffer, unsigned long ulSize)
void ReadBytes(unsigned char* pBuffer, unsigned int ulSize)
{
size_t ulRemainSize = (pEnd - pCur);
size_t ulFinalSize = (ulRemainSize > ulSize ? ulSize : ulRemainSize);
......@@ -117,7 +117,7 @@ namespace MetaFile
pBuffer[ulIndex] = ReadChar();
}
};
void ReadBytes(unsigned short* pBuffer, unsigned long ulSize)
void ReadBytes(unsigned short* pBuffer, unsigned int ulSize)
{
size_t ulRemainSize = (pEnd - pCur) / 2;
size_t ulFinalSize = (ulRemainSize > ulSize ? ulSize : ulRemainSize);
......@@ -127,7 +127,7 @@ namespace MetaFile
pBuffer[ulIndex] = ReadUShort();
}
}
void ReadBytes(unsigned long* pBuffer, unsigned long ulSize)
void ReadBytes(unsigned int* pBuffer, unsigned int ulSize)
{
size_t ulRemainSize = (pEnd - pCur) / 4;
size_t ulFinalSize = (ulRemainSize > ulSize ? ulSize : ulRemainSize);
......@@ -147,12 +147,12 @@ namespace MetaFile
nValue = ReadUShort();
return *this;
}
CDataStream& operator>>(unsigned long& nValue)
CDataStream& operator>>(unsigned int& nValue)
{
nValue = ReadULong();
return *this;
}
CDataStream& operator>>(unsigned int& nValue)
CDataStream& operator>>(unsigned long& nValue)
{
nValue = ReadULong();
return *this;
......@@ -172,12 +172,12 @@ namespace MetaFile
nValue = ReadShort();
return *this;
}
CDataStream& operator>>(long& nValue)
CDataStream& operator>>(int& nValue)
{
nValue = ReadLong();
return *this;
}
CDataStream& operator>>(int& nValue)
CDataStream& operator>>(long& nValue)
{
nValue = ReadLong();
return *this;
......@@ -299,11 +299,11 @@ namespace MetaFile
if (oVector.NumAxes <= 0)
return *this;
oVector.Values = new long[oVector.NumAxes];
oVector.Values = new int[oVector.NumAxes];
if (!oVector.Values)
return *this;
for (unsigned long ulIndex = 0; ulIndex < oVector.NumAxes; ulIndex++)
for (unsigned int ulIndex = 0; ulIndex < oVector.NumAxes; ulIndex++)
*this >> oVector.Values[ulIndex];
return *this;
......@@ -455,17 +455,17 @@ namespace MetaFile
return false;
}
unsigned long Tell()
unsigned int Tell()
{
return (unsigned long)(pCur - pBuffer);
return (unsigned int)(pCur - pBuffer);
}
void Skip(unsigned long ulSkip)
void Skip(unsigned int ulSkip)
{
pCur += ulSkip;
}
void SeekBack(unsigned long ulSkipBack)
void SeekBack(unsigned int ulSkipBack)
{
pCur -= ulSkipBack;
}
......@@ -475,9 +475,9 @@ namespace MetaFile
pCur = pBuffer;
}
unsigned long CanRead()
unsigned int CanRead()
{
return (unsigned long)(pEnd - pCur);
return (unsigned int)(pEnd - pCur);
}
private:
......@@ -487,7 +487,7 @@ namespace MetaFile
BYTE *pEnd;
};
void ReadImage(BYTE* pHeaderBuffer, unsigned long ulHeaderBufferLen, BYTE* pImageBuffer, unsigned long ulImageBufferLen, BYTE** ppDstBuffer, unsigned long* pulWidth, unsigned long* pulHeight);
void ReadImage(BYTE* pHeaderBuffer, unsigned int ulHeaderBufferLen, BYTE* pImageBuffer, unsigned int ulImageBufferLen, BYTE** ppDstBuffer, unsigned int* pulWidth, unsigned int* pulHeight);
};
#endif //_METAFILE_WMF_EMF_COMMON_H
\ No newline at end of file
This diff is collapsed.
......@@ -25,7 +25,7 @@ namespace MetaFile
if (DibBuffer)
delete[] DibBuffer;
}
void CEmfLogBrushEx::SetDibPattern(unsigned char* pBuffer, unsigned long ulWidth, unsigned long ulHeight)
void CEmfLogBrushEx::SetDibPattern(unsigned char* pBuffer, unsigned int ulWidth, unsigned int ulHeight)
{
DibBuffer = pBuffer;
DibWidth = ulWidth;
......@@ -34,13 +34,13 @@ namespace MetaFile
if (ulWidth <= 0 || ulHeight <= 0)
return;
unsigned long ulBufferSize = 4 * ulWidth * ulHeight;
unsigned int ulBufferSize = 4 * ulWidth * ulHeight;
Aggplus::CImage oImage;
BYTE* pBufferPtr = new BYTE[ulBufferSize];
oImage.Create(pBufferPtr, ulWidth, ulHeight, 4 * ulWidth);
// pBufferPtr
for (unsigned long ulIndex = 0; ulIndex < ulBufferSize; ulIndex += 4)
for (unsigned int ulIndex = 0; ulIndex < ulBufferSize; ulIndex += 4)
{
pBufferPtr[0] = (unsigned char)pBuffer[ulIndex + 0];
pBufferPtr[1] = (unsigned char)pBuffer[ulIndex + 1];
......
......@@ -38,17 +38,17 @@ namespace MetaFile
{
return EMF_OBJECT_BRUSH;
}
void SetDibPattern(unsigned char* pBuffer, unsigned long ulWidth, unsigned long ulHeight);
void SetDibPattern(unsigned char* pBuffer, unsigned int ulWidth, unsigned int ulHeight);
public:
unsigned long BrushStyle;
unsigned int BrushStyle;
TEmfColor Color;
unsigned long BrushHatch;
unsigned long BrushAlpha;
unsigned int BrushHatch;
unsigned int BrushAlpha;
std::wstring DibPatternPath;
unsigned char* DibBuffer;
unsigned long DibWidth;
unsigned long DibHeigth;
unsigned int DibWidth;
unsigned int DibHeigth;
};
class CEmfLogFont : public CEmfObjectBase
......@@ -93,11 +93,11 @@ namespace MetaFile
public:
unsigned long PenStyle;
unsigned long Width;
unsigned int PenStyle;
unsigned int Width;
TEmfColor Color;
unsigned long NumStyleEntries;
unsigned long* StyleEntry;
unsigned int NumStyleEntries;
unsigned int* StyleEntry;
};
class CEmfLogPalette : public CEmfObjectBase
......
......@@ -18,19 +18,22 @@ namespace MetaFile
virtual void End() = 0;
// pBuffer - BGRA ulWidth, ulHeight,
virtual void DrawBitmap(long lX, long lY, long lW, long lH, BYTE* pBuffer, unsigned long ulWidth, unsigned long ulHeight) = 0;
virtual void DrawBitmap(int lX, int lY, int lW, int lH, BYTE* pBuffer, unsigned int ulWidth, unsigned int ulHeight) = 0;
virtual void DrawText(const wchar_t* wsText, unsigned long ulCharsCount, long lX, long lY) = 0;
virtual void DrawText(const wchar_t* wsText, unsigned int ulCharsCount, int lX, int lY) = 0;
virtual void StartPath() = 0;
virtual void MoveTo(long lX, long lY) = 0;
virtual void LineTo(long lX, long lY) = 0;
virtual void CurveTo(long lX1, long lY1, long lX2, long lY2, long lXe, long lYe) = 0;
virtual void ArcTo(long lLeft, long lTop, long lRight, long lBottom, double dStartAngle, double dSweepAngle) = 0;
virtual void MoveTo(int lX, int lY) = 0;
virtual void LineTo(int lX, int lY) = 0;
virtual void CurveTo(int lX1, int lY1, int lX2, int lY2, int lXe, int lYe) = 0;
virtual void ArcTo(int lLeft, int lTop, int lRight, int lBottom, double dStartAngle, double dSweepAngle) = 0;
virtual void ClosePath() = 0;
virtual void DrawPath(long lType = 0) = 0;
virtual void DrawPath(int lType = 0) = 0;
virtual void EndPath() = 0;
virtual void ResetClip() = 0;
virtual void IntersectClip(int lLeft, int lTop, int lRight, int lBottom) = 0;
virtual void UpdateDC() = 0;
};
......
......@@ -30,7 +30,7 @@ namespace MetaFile
return true;
}
bool CEmfPath::MoveTo(long lX, long lY)
bool CEmfPath::MoveTo(int lX, int lY)
{
CEmfPathCommandBase* pCommand = new CEmfPathMoveTo(lX, lY);
if (!pCommand)
......@@ -60,7 +60,7 @@ namespace MetaFile
return true;
}
bool CEmfPath::LineTo(long lX, long lY)
bool CEmfPath::LineTo(int lX, int lY)
{
CEmfPathCommandBase* pCommand = new CEmfPathLineTo(lX, lY);
if (!pCommand)
......@@ -90,7 +90,7 @@ namespace MetaFile
return true;
}
bool CEmfPath::CurveTo(long lX1, long lY1, long lX2, long lY2, long lXE, long lYE)
bool CEmfPath::CurveTo(int lX1, int lY1, int lX2, int lY2, int lXE, int lYE)
{
CEmfPathCommandBase* pCommand = new CEmfPathCurveTo(lX1, lY1, lX2, lY2, lXE, lYE);
if (!pCommand)
......@@ -100,7 +100,7 @@ namespace MetaFile
return true;
}
bool CEmfPath::ArcTo(long lL, long lT, long lR, long lB, double dStart, double dSweep)
bool CEmfPath::ArcTo(int lL, int lT, int lR, int lB, double dStart, double dSweep)
{
CEmfPathCommandBase* pCommand = new CEmfPathArcTo(lL, lT, lR, lB, dStart, dSweep);
if (!pCommand)
......@@ -126,7 +126,7 @@ namespace MetaFile
{
pOutput->StartPath();
for (unsigned long ulIndex = 0; ulIndex < m_pCommands.size(); ulIndex++)
for (unsigned int ulIndex = 0; ulIndex < m_pCommands.size(); ulIndex++)
{
CEmfPathCommandBase* pCommand = m_pCommands.at(ulIndex);
switch (pCommand->GetType())
......@@ -163,7 +163,7 @@ namespace MetaFile
}
}
long lType = (bStroke ? 1 : 0) + (bFill ? 2 : 0);
int lType = (bStroke ? 1 : 0) + (bFill ? 2 : 0);
pOutput->DrawPath(lType);
pOutput->EndPath();
}
......@@ -172,7 +172,7 @@ namespace MetaFile
}
void CEmfPath::Clear()
{
for (unsigned long ulIndex = 0; ulIndex < m_pCommands.size(); ulIndex++)
for (unsigned int ulIndex = 0; ulIndex < m_pCommands.size(); ulIndex++)
{
CEmfPathCommandBase* pCommand = m_pCommands.at(ulIndex);
delete pCommand;
......
......@@ -43,7 +43,7 @@ namespace MetaFile
x = oPoint.x;
y = oPoint.y;
}
CEmfPathMoveTo(long lX, long lY)
CEmfPathMoveTo(int lX, int lY)
{
x = lX;
y = lY;
......@@ -58,8 +58,8 @@ namespace MetaFile
public:
long x;
long y;
int x;
int y;
};
class CEmfPathLineTo : public CEmfPathCommandBase
{
......@@ -74,7 +74,7 @@ namespace MetaFile
x = oPoint.x;
y = oPoint.y;
}
CEmfPathLineTo(long lX, long lY)
CEmfPathLineTo(int lX, int lY)
{
x = lX;
y = lY;
......@@ -89,8 +89,8 @@ namespace MetaFile
public:
long x;
long y;
int x;
int y;
};
class CEmfPathCurveTo : public CEmfPathCommandBase
{
......@@ -113,7 +113,7 @@ namespace MetaFile
xE = oPointE.x;
yE = oPointE.y;
}
CEmfPathCurveTo(long lX1, long lY1, long lX2, long lY2, long lXE, long lYE)
CEmfPathCurveTo(int lX1, int lY1, int lX2, int lY2, int lXE, int lYE)
{
x1 = lX1;
y1 = lY1;
......@@ -132,17 +132,17 @@ namespace MetaFile
public:
long x1;
long y1;
long x2;
long y2;
long xE;
long yE;
int x1;
int y1;
int x2;
int y2;
int xE;
int yE;
};
class CEmfPathArcTo : public CEmfPathCommandBase
{
public:
CEmfPathArcTo(long lL, long lT, long lR, long lB, double dStart, double dSweep)
CEmfPathArcTo(int lL, int lT, int lR, int lB, double dStart, double dSweep)
{
left = lL;
top = lT;
......@@ -161,10 +161,10 @@ namespace MetaFile
public:
long left;
long top;
long right;
long bottom;
int left;
int top;
int right;
int bottom;
double start;
double sweep;
};
......@@ -194,14 +194,14 @@ namespace MetaFile
bool MoveTo(TEmfPointS& oPoint);
bool MoveTo(TEmfPointL& oPoint);
bool MoveTo(long lX, long lY);
bool MoveTo(int lX, int lY);
bool LineTo(TEmfPointS& oPoint);
bool LineTo(TEmfPointL& oPoint);
bool LineTo(long lX, long lY);
bool LineTo(int lX, int lY);
bool CurveTo(TEmfPointS& oPoint1, TEmfPointS& oPoint2, TEmfPointS& oPointE);
bool CurveTo(TEmfPointL& oPoint1, TEmfPointL& oPoint2, TEmfPointL& oPointE);
bool CurveTo(long lX1, long lY1, long lX2, long lY2, long lXE, long lYE);
bool ArcTo(long lL, long lT, long lR, long lB, double dStart, double dSweep);
bool CurveTo(int lX1, int lY1, int lX2, int lY2, int lXE, int lYE);
bool ArcTo(int lL, int lT, int lR, int lB, double dStart, double dSweep);
bool Close();
void Draw(CEmfOutputDevice* pOutput, bool bStroke, bool bFill);
......
......@@ -99,7 +99,7 @@ namespace MetaFile
{
return m_pDC;
}
void CEmfPlayer::RegisterObject(unsigned long ulIndex, CEmfObjectBase* pObject)
void CEmfPlayer::RegisterObject(unsigned int ulIndex, CEmfObjectBase* pObject)
{
CEmfObjectMap::const_iterator oPos = m_mObjects.find(ulIndex);
if (m_mObjects.end() != oPos)
......@@ -109,9 +109,9 @@ namespace MetaFile
m_mObjects.erase(ulIndex);
}
m_mObjects.insert(std::pair<unsigned long, CEmfObjectBase*>(ulIndex, pObject));
m_mObjects.insert(std::pair<unsigned int, CEmfObjectBase*>(ulIndex, pObject));
}
void CEmfPlayer::SelectObject(unsigned long ulIndex)
void CEmfPlayer::SelectObject(unsigned int ulIndex)
{
CEmfObjectMap::const_iterator oPos = m_mObjects.find(ulIndex);
if (m_mObjects.end() != oPos)
......@@ -131,7 +131,7 @@ namespace MetaFile
}
}
}
void CEmfPlayer::SelectPalette(unsigned long ulIndex)
void CEmfPlayer::SelectPalette(unsigned int ulIndex)
{
// DEFAULT_PALETTE
if (ulIndex == 0x8000000F)
......@@ -145,7 +145,7 @@ namespace MetaFile
m_pDC->SetPalette((CEmfLogPalette*)pObject);
}
}
void CEmfPlayer::DeleteObject(unsigned long ulIndex)
void CEmfPlayer::DeleteObject(unsigned int ulIndex)
{
// TODO: DC_BRUSH DC_PEN
......@@ -180,7 +180,7 @@ namespace MetaFile
// DC_BRUSH DC_PEN
}
void CEmfPlayer::InitStockBrush(bool bNull, unsigned char r, unsigned char g, unsigned char b, unsigned long ulIndex)
void CEmfPlayer::InitStockBrush(bool bNull, unsigned char r, unsigned char g, unsigned char b, unsigned int ulIndex)
{
CEmfLogBrushEx* pBrush = new CEmfLogBrushEx();
if (!pBrush)
......@@ -196,7 +196,7 @@ namespace MetaFile
RegisterObject(ulIndex, (CEmfObjectBase*)pBrush);
}
void CEmfPlayer::InitStockPen(bool bNull, unsigned char r, unsigned char g, unsigned char b, unsigned long ulIndex)
void CEmfPlayer::InitStockPen(bool bNull, unsigned char r, unsigned char g, unsigned char b, unsigned int ulIndex)
{
CEmfLogPen* pPen = new CEmfLogPen();
if (!pPen)
......@@ -266,10 +266,11 @@ namespace MetaFile
pNewDC->m_oWindow.Copy(&m_oWindow);
pNewDC->m_oViewport.Copy(&m_oViewport);
pNewDC->m_oCurPos = m_oCurPos;
pNewDC->m_oClip = m_oClip;
return pNewDC;
}
void CEmfDC::SetMapMode(unsigned long ulMapMode)
void CEmfDC::SetMapMode(unsigned int ulMapMode)
{
m_ulMapMode = ulMapMode;
......@@ -323,7 +324,7 @@ namespace MetaFile
}
}
}
unsigned long CEmfDC::GetMapMode()
unsigned int CEmfDC::GetMapMode()
{
return m_ulMapMode;
}
......@@ -335,7 +336,7 @@ namespace MetaFile
{
return &m_oInverseTransform;
}
void CEmfDC::MultiplyTransform(TEmfXForm& oForm, unsigned long ulMode)
void CEmfDC::MultiplyTransform(TEmfXForm& oForm, unsigned int ulMode)
{
m_oTransform.Multiply(oForm, ulMode);
......@@ -393,19 +394,19 @@ namespace MetaFile
{
return m_pFont;
}
void CEmfDC::SetTextAlign(unsigned long ulAlign)
void CEmfDC::SetTextAlign(unsigned int ulAlign)
{
m_ulTextAlign = ulAlign;
}
unsigned long CEmfDC::GetTextAlign()
unsigned int CEmfDC::GetTextAlign()
{
return m_ulTextAlign;
}
void CEmfDC::SetBgMode(unsigned long ulBgMode)
void CEmfDC::SetBgMode(unsigned int ulBgMode)
{
m_ulBgMode = ulBgMode;
}
unsigned long CEmfDC::GetBgMode()
unsigned int CEmfDC::GetBgMode()
{
return m_ulBgMode;
}
......@@ -417,19 +418,19 @@ namespace MetaFile
{
return m_oBgColor;
}
void CEmfDC::SetMiterLimit(unsigned long ulMiter)
void CEmfDC::SetMiterLimit(unsigned int ulMiter)
{
m_ulMiterLimit = ulMiter;
}
unsigned long CEmfDC::GetMiterLimit()
unsigned int CEmfDC::GetMiterLimit()
{
return m_ulMiterLimit;
}
void CEmfDC::SetFillMode(unsigned long ulFillMode)
void CEmfDC::SetFillMode(unsigned int ulFillMode)
{
m_ulFillMode = ulFillMode;
}
unsigned long CEmfDC::GetFillMode()
unsigned int CEmfDC::GetFillMode()
{
return m_ulFillMode;
}
......@@ -446,11 +447,11 @@ namespace MetaFile
{
return m_pPen;
}
void CEmfDC::SetStretchMode(unsigned long& oMode)
void CEmfDC::SetStretchMode(unsigned int& oMode)
{
m_ulStretchMode = oMode;
}
unsigned long CEmfDC::GetStretchMode()
unsigned int CEmfDC::GetStretchMode()
{
return m_ulStretchMode;
}
......@@ -504,7 +505,7 @@ namespace MetaFile
}
bool CEmfDC::UpdatePixelMetrics()
{
unsigned long ulMapMode = m_ulMapMode;
unsigned int ulMapMode = m_ulMapMode;
if (MM_ISOTROPIC == ulMapMode)
{
if (0 == m_oWindow.ulW || 0 == m_oViewport.ulW)
......@@ -525,11 +526,11 @@ namespace MetaFile
return true;
}
void CEmfDC::SetRop2Mode(unsigned long& nMode)
void CEmfDC::SetRop2Mode(unsigned int& nMode)
{
m_ulRop2Mode = nMode;
}
unsigned long CEmfDC::GetRop2Mode()
unsigned int CEmfDC::GetRop2Mode()
{
return m_ulRop2Mode;
}
......@@ -550,7 +551,7 @@ namespace MetaFile
{
SetCurPos(oPoint.x, oPoint.y);
}
void CEmfDC::SetCurPos(long lX, long lY)
void CEmfDC::SetCurPos(int lX, int lY)
{
m_oCurPos.x = lX;
m_oCurPos.y = lY;
......@@ -559,4 +560,12 @@ namespace MetaFile
{
return m_oCurPos;
}
CEmfClip* CEmfDC::GetClip()
{
return &m_oClip;
}
void CEmfDC::ClipToPath()
{
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@
#include <map>
#include "EmfTypes.h"
#include "EmfObjects.h"
#include "EmfClip.h"
namespace MetaFile
{
......@@ -21,20 +22,20 @@ namespace MetaFile
CEmfDC* SaveDC();
CEmfDC* RestoreDC();
CEmfDC* GetDC();
void RegisterObject(unsigned long ulIndex, CEmfObjectBase* pObject);
void SelectObject(unsigned long ulIndex);
void DeleteObject(unsigned long ulIndex);
void SelectPalette(unsigned long ulIndex);
void RegisterObject(unsigned int ulIndex, CEmfObjectBase* pObject);
void SelectObject(unsigned int ulIndex);
void DeleteObject(unsigned int ulIndex);
void SelectPalette(unsigned int ulIndex);
private:
void InitStockObjects();
void InitStockBrush(bool bNull, unsigned char r, unsigned char g, unsigned char b, unsigned long ulIndex);
void InitStockPen(bool bNull, unsigned char r, unsigned char g, unsigned char b, unsigned long ulIndex);
void InitStockBrush(bool bNull, unsigned char r, unsigned char g, unsigned char b, unsigned int ulIndex);
void InitStockPen(bool bNull, unsigned char r, unsigned char g, unsigned char b, unsigned int ulIndex);
private:
typedef std::map < unsigned long, CEmfObjectBase* > CEmfObjectMap;
typedef std::map < unsigned int, CEmfObjectBase* > CEmfObjectMap;
CEmfDC* m_pDC;
std::vector<CEmfDC*> m_vDCStack;
......@@ -50,11 +51,11 @@ namespace MetaFile
~CEmfDC();
CEmfDC* Copy();
void SetMapMode(unsigned long ulMapMode);
unsigned long GetMapMode();
void SetMapMode(unsigned int ulMapMode);
unsigned int GetMapMode();
TEmfXForm* GetTransform();
TEmfXForm* GetInverseTransform();
void MultiplyTransform(TEmfXForm& oForm, unsigned long ulMode);
void MultiplyTransform(TEmfXForm& oForm, unsigned int ulMode);
void SetTextColor(TEmfColor& oColor);
TEmfColor& GetTextColor();
void SetBrush(CEmfLogBrushEx* pBrush);
......@@ -63,21 +64,21 @@ namespace MetaFile
void SetFont(CEmfLogFont* pFont);
void RemoveFont(CEmfLogFont* pFont);
CEmfLogFont* GetFont();
void SetTextAlign(unsigned long ulAlign);
unsigned long GetTextAlign();
void SetBgMode(unsigned long ulBgMode);
unsigned long GetBgMode();
void SetTextAlign(unsigned int ulAlign);
unsigned int GetTextAlign();
void SetBgMode(unsigned int ulBgMode);
unsigned int GetBgMode();
void SetBgColor(TEmfColor& oColor);
TEmfColor& GetBgColor();
void SetMiterLimit(unsigned long ulMiter);
unsigned long GetMiterLimit();
void SetFillMode(unsigned long ulFillMode);
unsigned long GetFillMode();
void SetMiterLimit(unsigned int ulMiter);
unsigned int GetMiterLimit();
void SetFillMode(unsigned int ulFillMode);
unsigned int GetFillMode();
void SetPen(CEmfLogPen* pPen);
void RemovePen(CEmfLogPen* pPen);
CEmfLogPen* GetPen();
void SetStretchMode(unsigned long& oMode);
unsigned long GetStretchMode();
void SetStretchMode(unsigned int& oMode);
unsigned int GetStretchMode();
double GetPixelWidth();
double GetPixelHeight();
void SetWindowOrigin(TEmfPointL& oPoint);
......@@ -86,14 +87,16 @@ namespace MetaFile
void SetViewportOrigin(TEmfPointL& oPoint);
void SetViewportExtents(TEmfSizeL& oPoint);
TEmfWindow* GetViewport();
void SetRop2Mode(unsigned long& nMode);
unsigned long GetRop2Mode();
void SetRop2Mode(unsigned int& nMode);
unsigned int GetRop2Mode();
void SetPalette(CEmfLogPalette* pPalette);
void RemovePalette(CEmfLogPalette* pPalette);
CEmfLogPalette* GetPalette();
void SetCurPos(TEmfPointL& oPoint);
void SetCurPos(long lX, long lY);
void SetCurPos(int lX, int lY);
TEmfPointL& GetCurPos();
CEmfClip* GetClip();
void ClipToPath();
private:
......@@ -105,7 +108,7 @@ namespace MetaFile
CEmfLogPen m_oDefaultPen;
CEmfLogBrushEx m_oDefaultBrush;
unsigned long m_ulMapMode;
unsigned int m_ulMapMode;
CEmfLogBrushEx* m_pBrush;
CEmfLogPen* m_pPen;
CEmfLogFont* m_pFont;
......@@ -114,17 +117,18 @@ namespace MetaFile
TEmfXForm m_oInverseTransform;
TEmfColor m_oTextColor;
TEmfColor m_oBgColor;
unsigned long m_ulTextAlign;
unsigned long m_ulBgMode;
unsigned long m_ulMiterLimit;
unsigned long m_ulFillMode;
unsigned long m_ulStretchMode;
unsigned long m_ulRop2Mode;
unsigned int m_ulTextAlign;
unsigned int m_ulBgMode;
unsigned int m_ulMiterLimit;
unsigned int m_ulFillMode;
unsigned int m_ulStretchMode;
unsigned int m_ulRop2Mode;
double m_dPixelWidth;
double m_dPixelHeight;
TEmfWindow m_oWindow;
TEmfWindow m_oViewport;
TEmfPointL m_oCurPos;
CEmfClip m_oClip;
};
}
......
......@@ -208,10 +208,10 @@ namespace MetaFile
struct TEmfWindow
{
long lX;
long lY;
long ulW;
long ulH;
int lX;
int lY;
int ulW;
int ulH;
void Init()
{
......@@ -232,16 +232,16 @@ namespace MetaFile
struct TEmfRectL
{
long lLeft;
long lTop;
long lRight;
long lBottom;
int lLeft;
int lTop;
int lRight;
int lBottom;
};
struct TEmfPointL
{
long x;
long y;
int x;
int y;
TEmfPointL& operator=(TEmfPointL& oPoint)
{
......@@ -266,23 +266,23 @@ namespace MetaFile
struct TEmfSizeL
{
unsigned long cx;
unsigned long cy;
unsigned int cx;
unsigned int cy;
};
struct TEmfHeader
{
TEmfRectL oBounds;
TEmfRectL oFrame;
unsigned long ulSignature;
unsigned long ulVersion;
unsigned long ulSize;
unsigned long ulRecords;
unsigned int ulSignature;
unsigned int ulVersion;
unsigned int ulSize;
unsigned int ulRecords;
unsigned short ushObjects;
unsigned short ushReserved;
unsigned long ulSizeDescription;
unsigned long ulOffsetDescription;
unsigned long ulPalEntries;
unsigned int ulSizeDescription;
unsigned int ulOffsetDescription;
unsigned int ulPalEntries;
TEmfSizeL oDevice;
TEmfSizeL oMillimeters;
TEmfRectL oFrameToBounds;
......@@ -291,20 +291,20 @@ namespace MetaFile
struct TEmfStretchDIBITS
{
TEmfRectL Bounds;
long xDest;
long yDest;
long xSrc;
long ySrc;
long cxSrc;
long cySrc;
unsigned long offBmiSrc;
unsigned long cbBmiSrc;
unsigned long offBitsSrc;
unsigned long cbBitsSrc;
unsigned long UsageSrc;
unsigned long BitBltRasterOperation;
long cxDest;
long cyDest;
int xDest;
int yDest;
int xSrc;
int ySrc;
int cxSrc;
int cySrc;
unsigned int offBmiSrc;
unsigned int cbBmiSrc;
unsigned int offBitsSrc;
unsigned int cbBitsSrc;
unsigned int UsageSrc;
unsigned int BitBltRasterOperation;
int cxDest;
int cyDest;
};
#define MWT_IDENTITY 0x01
......@@ -341,7 +341,7 @@ namespace MetaFile
Dy = pOther->Dy;
}
void Multiply(TEmfXForm &oOther, unsigned long ulMode)
void Multiply(TEmfXForm &oOther, unsigned int ulMode)
{
if (MWT_IDENTITY == ulMode)
Init();
......@@ -399,19 +399,19 @@ namespace MetaFile
struct TEmfEmrText
{
TEmfPointL Reference;
unsigned long Chars;
unsigned long offString;
unsigned long Options;
unsigned int Chars;
unsigned int offString;
unsigned int Options;
TEmfRectL Rectangle;
unsigned long offDx;
unsigned int offDx;
void* OutputString; // unsinged short* unsigned char*
unsigned long* OutputDx;
unsigned int* OutputDx;
};
struct TEmfExtTextoutW
{
TEmfRectL Bounds;
unsigned long iGraphicsMode;
unsigned int iGraphicsMode;
double exScale;
double eyScale;
TEmfEmrText wEmrText;
......@@ -419,11 +419,11 @@ namespace MetaFile
struct TEmfLogFont
{
long Height;
long Width;
long Escapement;
long Orientation;
long Weight;
int Height;
int Width;
int Escapement;
int Orientation;
int Weight;
unsigned char Italic;
unsigned char Underline;
unsigned char StrikOut;
......@@ -445,55 +445,55 @@ namespace MetaFile
struct TEmfDesignVector
{
unsigned long Signature;
unsigned long NumAxes;
long* Values;
unsigned int Signature;
unsigned int NumAxes;
int* Values;
};
struct TEmfBitBlt
{
TEmfRectL Bounds;
long xDest;
long yDest;
long cxDest;
long cyDest;
unsigned long BitBltRasterOperation;
long xSrc;
long ySrc;
int xDest;
int yDest;
int cxDest;
int cyDest;
unsigned int BitBltRasterOperation;
int xSrc;
int ySrc;
TEmfXForm XfromSrc;
TEmfColor BkColorSrc;
unsigned long UsageSrc;
unsigned long offBmiSrc;
unsigned long cbBmiSrc;
unsigned long offBitsSrc;
unsigned long cbBitsSrc;
unsigned int UsageSrc;
unsigned int offBmiSrc;
unsigned int cbBmiSrc;
unsigned int offBitsSrc;
unsigned int cbBitsSrc;
};
struct TEmfSetDiBitsToDevice
{
TEmfRectL Bounds;
long xDest;
long yDest;
long xSrc;
long ySrc;
long cxSrc;
long cySrc;
unsigned long offBmiSrc;
unsigned long cbBmiSrc;
unsigned long offBitsSrc;
unsigned long cbBitsSrc;
unsigned long UsageSrc;
unsigned long iStartScan;
unsigned long cScans;
int xDest;
int yDest;
int xSrc;
int ySrc;
int cxSrc;
int cySrc;
unsigned int offBmiSrc;
unsigned int cbBmiSrc;
unsigned int offBitsSrc;
unsigned int cbBitsSrc;
unsigned int UsageSrc;
unsigned int iStartScan;
unsigned int cScans;
};
struct TEmfDibPatternBrush
{
unsigned long Usage;
unsigned long offBmi;
unsigned long cbBmi;
unsigned long offBits;
unsigned long cbBits;
unsigned int Usage;
unsigned int offBmi;
unsigned int cbBmi;
unsigned int offBits;
unsigned int cbBits;
};
struct TEmfLogPaletteEntry
......
......@@ -35,10 +35,10 @@ namespace MetaFile
m_pRenderer = pRenderer;
TEmfRectL* pBounds = m_pEmfFile->GetDCBounds();
long lL = pBounds->lLeft;
long lR = pBounds->lRight;
long lT = pBounds->lTop;
long lB = pBounds->lBottom;
int lL = pBounds->lLeft;
int lR = pBounds->lRight;
int lT = pBounds->lTop;
int lB = pBounds->lBottom;
m_dScaleX = (lR - lL <= 0) ? 1 : m_dW / (double)(lR - lL);
m_dScaleY = (lB - lT <= 0) ? 1 : m_dH / (double)(lB - lT);
......@@ -57,11 +57,12 @@ namespace MetaFile
CheckEndPath();
}
void DrawBitmap(long lX, long lY, long lW, long lH, BYTE* pBuffer, unsigned long ulWidth, unsigned long ulHeight)
void DrawBitmap(int lX, int lY, int lW, int lH, BYTE* pBuffer, unsigned int ulWidth, unsigned int ulHeight)
{
CheckEndPath();
UpdateTransform();
UpdateClip();
Aggplus::CImage oImage;
BYTE* pBufferPtr = new BYTE[4 * ulWidth * ulHeight];
......@@ -80,11 +81,12 @@ namespace MetaFile
TEmfPointD oBR = TranslatePoint(lX + lW, lY + lH);
m_pRenderer->DrawImage(&oImage, oTL.x, oTL.y, oBR.x - oTL.x, oBR.y - oTL.y);
}
void DrawText(const wchar_t* wsText, unsigned long ulCharsCount, long lX, long lY)
void DrawText(const wchar_t* wsText, unsigned int ulCharsCount, int lX, int lY)
{
CheckEndPath();
UpdateTransform();
UpdateClip();
CEmfDC* pDC = m_pEmfFile->GetDC();
if (!pDC)
......@@ -96,7 +98,7 @@ namespace MetaFile
TEmfLogFont* pLogFont = &pFont->LogFontEx.LogFont;
long lLogicalFontHeight = pLogFont->Height;
int lLogicalFontHeight = pLogFont->Height;
if (lLogicalFontHeight < 0)
lLogicalFontHeight = -lLogicalFontHeight;
if (lLogicalFontHeight < 0.01)
......@@ -108,7 +110,7 @@ namespace MetaFile
m_pRenderer->put_FontName(wsFaceName);
m_pRenderer->put_FontSize(dFontHeight);
long lStyle = 0;
int lStyle = 0;
if (pLogFont->Weight > 550)
lStyle |= 0x01;
if (pLogFont->Italic)
......@@ -163,7 +165,7 @@ namespace MetaFile
double dY = oTextPoint.y;
//
unsigned long ulTextAlign = pDC->GetTextAlign();
unsigned int ulTextAlign = pDC->GetTextAlign();
if (ulTextAlign & TA_BASELINE)
{
//
......@@ -256,12 +258,12 @@ namespace MetaFile
if (bChangeCTM)
m_pRenderer->ResetTransform();
}
void StartPath()
{
CheckEndPath();
UpdateTransform();
UpdateClip();
m_lDrawPathType = -1;
if (true == UpdateBrush())
......@@ -286,19 +288,19 @@ namespace MetaFile
m_bStartedPath = true;
}
void MoveTo(long lX, long lY)
void MoveTo(int lX, int lY)
{
CheckStartPath(true);
TEmfPointD oPoint = TranslatePoint(lX, lY);
m_pRenderer->PathCommandMoveTo(oPoint.x, oPoint.y);
}
void LineTo(long lX, long lY)
void LineTo(int lX, int lY)
{
CheckStartPath(false);
TEmfPointD oPoint = TranslatePoint(lX, lY);
m_pRenderer->PathCommandLineTo(oPoint.x, oPoint.y);
}
void CurveTo(long lX1, long lY1, long lX2, long lY2, long lXe, long lYe)
void CurveTo(int lX1, int lY1, int lX2, int lY2, int lXe, int lYe)
{
CheckStartPath(false);
......@@ -307,7 +309,7 @@ namespace MetaFile
TEmfPointD oPointE = TranslatePoint(lXe, lYe);
m_pRenderer->PathCommandCurveTo(oPoint1.x, oPoint1.y, oPoint2.x, oPoint2.y, oPointE.x, oPointE.y);
}
void ArcTo(long lLeft, long lTop, long lRight, long lBottom, double dStart, double dSweep)
void ArcTo(int lLeft, int lTop, int lRight, int lBottom, double dStart, double dSweep)
{
CheckStartPath(false);
......@@ -321,7 +323,7 @@ namespace MetaFile
m_pRenderer->PathCommandClose();
}
void DrawPath(long lType = 0)
void DrawPath(int lType = 0)
{
if (lType <= 0)
{
......@@ -333,11 +335,9 @@ namespace MetaFile
bool bStroke = lType & 1 ? true : false;
bool bFill = lType & 2 ? true : false;
long m_lEndType = -1;
int m_lEndType = -1;
if (bStroke && m_lDrawPathType & c_nStroke)
m_lEndType = c_nStroke;
else
if (bStroke && (m_lDrawPathType & c_nStroke))
m_lEndType = c_nStroke;
if (bFill)
......@@ -363,6 +363,30 @@ namespace MetaFile
{
CheckEndPath();
}
void ResetClip()
{
m_pRenderer->BeginCommand(c_nResetClipType);
m_pRenderer->EndCommand(c_nResetClipType);
}
void IntersectClip(int lLeft, int lTop, int lRight, int lBottom)
{
m_pRenderer->BeginCommand(c_nClipType);
m_pRenderer->BeginCommand(c_nPathType);
m_pRenderer->PathCommandStart();
TEmfPointD oTL = TranslatePoint(lLeft, lTop);
TEmfPointD oBR = TranslatePoint(lRight, lBottom);
m_pRenderer->PathCommandMoveTo(oTL.x, oTL.y);
m_pRenderer->PathCommandLineTo(oTL.x, oBR.y);
m_pRenderer->PathCommandLineTo(oBR.x, oBR.y);
m_pRenderer->PathCommandLineTo(oBR.x, oTL.y);
m_pRenderer->PathCommandLineTo(oTL.x, oTL.y);
m_pRenderer->EndCommand(c_nPathType);
m_pRenderer->EndCommand(c_nClipType);
m_pRenderer->PathCommandEnd();
}
private:
......@@ -391,7 +415,7 @@ namespace MetaFile
}
}
TEmfPointD TranslatePoint(long lX, long lY)
TEmfPointD TranslatePoint(int lX, int lY)
{
double dX = m_pEmfFile->TranslateX(lX);
double dY = m_pEmfFile->TranslateY(lY);
......@@ -425,7 +449,7 @@ namespace MetaFile
if (!pBrush)
return false;
long lColor = METAFILE_RGBA(pBrush->Color.r, pBrush->Color.g, pBrush->Color.b);
int lColor = METAFILE_RGBA(pBrush->Color.r, pBrush->Color.g, pBrush->Color.b);
if (BS_NULL == pBrush->BrushStyle)
return false;
......@@ -467,17 +491,17 @@ namespace MetaFile
if (!pPen)
return false;
long lColor = METAFILE_RGBA(pPen->Color.r, pPen->Color.g, pPen->Color.b);
int lColor = METAFILE_RGBA(pPen->Color.r, pPen->Color.g, pPen->Color.b);
// TODO: dWidth PS_GEOMETRIC
double dWidth = pPen->Width * m_dScaleX * pDC->GetPixelWidth();
if (dWidth <= 0.01)
dWidth = 0;
unsigned long ulPenType = pPen->PenStyle & PS_TYPE_MASK;
unsigned long ulPenEndCap = pPen->PenStyle & PS_ENDCAP_MASK;
unsigned long ulPenJoin = pPen->PenStyle & PS_JOIN_MASK;
unsigned long ulPenStyle = pPen->PenStyle & PS_STYLE_MASK;
unsigned int ulPenType = pPen->PenStyle & PS_TYPE_MASK;
unsigned int ulPenEndCap = pPen->PenStyle & PS_ENDCAP_MASK;
unsigned int ulPenJoin = pPen->PenStyle & PS_JOIN_MASK;
unsigned int ulPenStyle = pPen->PenStyle & PS_STYLE_MASK;
BYTE nCapStyle = 0;
if (PS_ENDCAP_ROUND == ulPenEndCap)
......@@ -531,11 +555,25 @@ namespace MetaFile
return true;
}
bool UpdateClip()
{
CEmfDC* pDC = m_pEmfFile->GetDC();
if (!pDC)
return false;
CEmfClip* pClip = pDC->GetClip();
if (!pClip)
return false;
pClip->ClipOnRenderer(this);
return true;
}
private:
IRenderer* m_pRenderer;
long m_lDrawPathType;
int m_lDrawPathType;
double m_dX; //
double m_dY; //
double m_dW; //
......
......@@ -126,7 +126,7 @@ namespace MetaFile
m_lType = 0;
};
long CMetaFile::GetType()
int CMetaFile::GetType()
{
return m_lType;
}
......
......@@ -9,9 +9,9 @@
namespace MetaFile
{
const long c_lMetaWmf = 0x01;
const long c_lMetaEmf = 0x02;
const long c_lMetaSvg = 0x04;
const int c_lMetaWmf = 0x01;
const int c_lMetaEmf = 0x02;
const int c_lMetaSvg = 0x04;
// )
class CMetaFile
......@@ -24,7 +24,7 @@ namespace MetaFile
bool DrawOnRenderer(IRenderer* pRenderer, double dX, double dY, double dWidth, double dHeight);
void Close();
void GetBounds(double* pdX, double* pdY, double* pdW, double* pdH);
long GetType();
int GetType();
void ConvertToRaster(const wchar_t* wsOutFilePath, unsigned int unFileType, int nWidth, int nHeight = -1);
CFontManager* get_FontManager();
......@@ -35,7 +35,7 @@ namespace MetaFile
CWmfFile m_oWmfFile;
TWmfRectF m_oWmfRect;
CEmfFile m_oEmfFile;
long m_lType;
int m_lType;
};
}
......
......@@ -109,7 +109,7 @@ public:
#ifdef NO_PIE
return;
#endif
long lDrawPathType = -1;
int lDrawPathType = -1;
if ( SetBrush( pArc->pDC ) )
lDrawPathType = c_nWindingFillMode;
......@@ -253,7 +253,7 @@ public:
#ifdef NO_ELLIPSE
return;
#endif
long lDrawPathType = -1;
int lDrawPathType = -1;
if ( SetBrush( pArc->pDC ) )
lDrawPathType = c_nWindingFillMode;
......@@ -344,7 +344,7 @@ public:
#endif
TWmfDC *pDC = pPolyPoly->pDC;
long lDrawPathType = -1;
int lDrawPathType = -1;
if ( SetBrush( pDC ) )
{
......@@ -401,7 +401,7 @@ public:
#endif
TWmfDC *pDC = pPolyLine->pDC;
long lDrawPathType = -1;
int lDrawPathType = -1;
if (SetBrush(pDC))
{
......@@ -451,7 +451,7 @@ public:
#ifdef NO_RECT
return;
#endif
long lDrawPathType = -1;
int lDrawPathType = -1;
if (SetBrush(pRect->pDC))
lDrawPathType = c_nWindingFillMode;
......@@ -610,7 +610,7 @@ public:
BYTE *pBuffer = pReadBitmap->pBuffer;
long lBufLen = pReadBitmap->lLength;
int lBufLen = pReadBitmap->lLength;
// Считываем заголовок
unsigned int unHeaderSize = ReadUInt ( pBuffer ); pBuffer += 4; lBufLen -=4;
......@@ -649,7 +649,7 @@ public:
if (m_pWmfFile->m_pFontManager)
{
TWmfFont *pFont = pText->pDC->pFont;
long lStyle = (pFont->ushWeight > 550 ? 1 : 0) + (pFont->unItalic ? 2 : 0);
int lStyle = (pFont->ushWeight > 550 ? 1 : 0) + (pFont->unItalic ? 2 : 0);
m_pWmfFile->m_pFontManager->LoadFontByName(ascii_to_unicode(pText->pDC->pFont->sFaceName), dSize, lStyle, 72, 72);
m_pWmfFile->m_pFontManager->LoadString1(ascii_to_unicode(pText->sText), 0, 0);
......@@ -743,9 +743,9 @@ public:
if (OPAQUE == pText->pDC->ushBGMode)
{
long lOldColor = m_oBrush.Color1;
long lOldAlpha = m_oBrush.Alpha1;
long lOldType = m_oBrush.Type;
int lOldColor = m_oBrush.Color1;
int lOldAlpha = m_oBrush.Alpha1;
int lOldType = m_oBrush.Type;
m_oBrush.Color1 = (RGB(pText->pDC->oBGColor.r, pText->pDC->oBGColor.g, pText->pDC->oBGColor.b));
m_oBrush.Alpha1 = 255;
......@@ -1328,7 +1328,7 @@ private:
{
TWmfPen *pPen = pDC->pPen;
long lColor = METAFILE_RGBA(pPen->oColor.r, pPen->oColor.g, pPen->oColor.b);
int lColor = METAFILE_RGBA(pPen->oColor.r, pPen->oColor.g, pPen->oColor.b);
double dWidth = pPen->dWidth * m_dScaleX ;
if ( dWidth <= 0.01 )
......@@ -1398,7 +1398,7 @@ private:
bool SetBrush(TWmfDC *pDC)
{
TWmfBrush *pBrush = pDC->pBrush;
long lColor = METAFILE_RGBA(pBrush->oColor.r, pBrush->oColor.g, pBrush->oColor.b);
int lColor = METAFILE_RGBA(pBrush->oColor.r, pBrush->oColor.g, pBrush->oColor.b);
if ( BS_NULL == pBrush->ushStyle )
return false;
......@@ -1558,7 +1558,7 @@ private:
return (BYTE)(pBuffer[0]);
}
bool ReadImage_CoreHeader(TWmfBMPRead *pReadBitmap, BYTE *pBuffer, long lBufLen)
bool ReadImage_CoreHeader(TWmfBMPRead *pReadBitmap, BYTE *pBuffer, int lBufLen)
{
unsigned short ushWidth = ReadUShort( pBuffer ); pBuffer += 2; lBufLen -= 2;
unsigned short ushHeight = ReadUShort( pBuffer ); pBuffer += 2; lBufLen -= 2;
......@@ -1571,7 +1571,7 @@ private:
return false;
}
bool ReadImage_InfoHeader(TWmfBMPRead *pReadBitmap, BYTE *pBuffer, long lBufLen)
bool ReadImage_InfoHeader(TWmfBMPRead *pReadBitmap, BYTE *pBuffer, int lBufLen)
{
int nWidth = ReadInt(pBuffer); pBuffer += 4; lBufLen -= 4;
int nHeight = ReadInt(pBuffer); pBuffer += 4; lBufLen -= 4;
......@@ -1633,7 +1633,7 @@ private:
pBuffer++; lBufLen--;
// Считываем саму картинку
long lCalcLen = (((nWidth * ushPlanes * ushBitCount + 31) & ~31) / 8) * abs(nHeight);
int lCalcLen = (((nWidth * ushPlanes * ushBitCount + 31) & ~31) / 8) * abs(nHeight);
if (lCalcLen != lBufLen)
return false;
......@@ -1788,7 +1788,7 @@ private:
return false; // TO DO: Сделать данный вариант, как только будет файлы с данным типом
// Считываем саму картинку
long lCalcLen = (((nWidth * ushPlanes * ushBitCount + 31) & ~31) / 8) * abs(nHeight);
int lCalcLen = (((nWidth * ushPlanes * ushBitCount + 31) & ~31) / 8) * abs(nHeight);
if (lCalcLen != lBufLen)
return false;
......
......@@ -192,7 +192,7 @@ public:
bool bNewColor = true;
for (unsigned long ulIndex = 0; ulIndex < m_ulCount; ulIndex++)
for (unsigned int ulIndex = 0; ulIndex < m_ulCount; ulIndex++)
{
if ( ( pRGB->r == m_pRGB[ulIndex].r ) && ( pRGB->g == m_pRGB[ulIndex].g ) && ( pRGB->b == m_pRGB[ulIndex].b ) )
{
......@@ -223,9 +223,9 @@ public:
unsigned long GetColorIndex(TWmfRGB *pRGB)
unsigned int GetColorIndex(TWmfRGB *pRGB)
{
unsigned long ulBest = 0;
unsigned int ulBest = 0;
unsigned int unDistBest = 766;
......@@ -235,7 +235,7 @@ public:
}
//
for (unsigned long ulIndex = 0; ulIndex < m_ulCount; ulIndex++)
for (unsigned int ulIndex = 0; ulIndex < m_ulCount; ulIndex++)
{
if ( ( pRGB->r == m_pRGB[ulIndex].r ) && ( pRGB->g == m_pRGB[ulIndex].g ) && ( pRGB->b == m_pRGB[ulIndex].b ) )
{
......@@ -249,7 +249,7 @@ public:
return ulBest;
//
for (unsigned long ulIndex = 0; ulIndex < m_ulCount; ulIndex++)
for (unsigned int ulIndex = 0; ulIndex < m_ulCount; ulIndex++)
{
unsigned int unDistR = (unsigned int) abs(((int) (pRGB->r)) - ((int) (m_pRGB[ulIndex].r)));
unsigned int unDistG = (unsigned int) abs(((int) (pRGB->g)) - ((int) (m_pRGB[ulIndex].g)));
......@@ -267,12 +267,12 @@ public:
return ulBest;
}
unsigned long GetCount()
unsigned int GetCount()
{
return m_ulCount;
}
TWmfRGB* GetColor(unsigned long ulIndex)
TWmfRGB* GetColor(unsigned int ulIndex)
{
if ( CheckError() || ulIndex >= m_ulCount )
return ((TWmfRGB *)&c_oColorRed);
......@@ -344,8 +344,8 @@ private:
private:
unsigned long m_ulmax;
unsigned long m_ulCount;
unsigned int m_ulmax;
unsigned int m_ulCount;
TWmfRGB *m_pRGB;
......
This diff is collapsed.
......@@ -73,8 +73,8 @@ struct TMemoryInfo
unsigned char *pMemory; //
unsigned char *pPointer; //
long lPos; //
long lLength; //
int lPos; //
int lLength; //
bool bNeedDelete; //
};
......@@ -132,7 +132,7 @@ typedef struct _TWmfMetaHeader
TWmfHead *pHeader;
FILE *pFileIn;
long lPos;
int lPos;
int nPlaceable;
} TWmfMetaHeader, *TWmfFile;
......@@ -261,13 +261,13 @@ struct TWmfAttributes
char **psAttrs;
unsigned long ulCount;
unsigned long ulMax;
unsigned int ulCount;
unsigned int ulMax;
unsigned char *sBuffer;
unsigned long ulLength;
unsigned long ulOffset;
unsigned int ulLength;
unsigned int ulOffset;
};
// Structure containing list of lists of XML attributes
......@@ -275,8 +275,8 @@ struct TWmfAttributeStore
{
TWmfAttributes *pAttrlist;
unsigned long ulCount;
unsigned long ulMax;
unsigned int ulCount;
unsigned int ulMax;
};
struct TWmfRegion;
......@@ -405,8 +405,8 @@ struct TWmfPolyRectangle
struct TWmfBMPRead
{
long lOffset;
long lLength;
int lOffset;
int lLength;
unsigned char *pBuffer;
unsigned short ushWidth;
......@@ -591,7 +591,7 @@ struct TWmfPlayer
unsigned char *pParameters; /* meta file parameter values */
unsigned long ulFlags;
unsigned int ulFlags;
struct
{
......@@ -604,10 +604,10 @@ struct TWmfPlayer
struct TWmfRecord
{
unsigned long ulSize;
unsigned int ulSize;
unsigned int unFunction;
unsigned char *sParameter;
long lPosition;
int lPosition;
};
//---------------------------------------------------------------------------------------------------
......
......@@ -183,13 +183,7 @@ static bool WmfOpenTempFile(std::wstring *pwsName, FILE **ppFile, wchar_t *wsMod
for (int nIndex = 0; nIndex < 1000; ++nIndex)
{
wsFileName = wsTemp;
wchar_t buffer[24];
#if defined (_WIN32) || defined (_WIN64)
itow(nTime + nIndex,buffer,10);
wsFileName.append(buffer);
#else
wsFileName.append(std::to_wstring(nTime + nIndex));
#endif
if (wsExt)
{
......
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