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