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

правки для билда под виндой

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62572 954022d7-b5bf-4e40-9824-e11837661b57
parent ab923555
...@@ -505,7 +505,7 @@ SOURCES += \ ...@@ -505,7 +505,7 @@ SOURCES += \
../../../raster/JBig2/source/LeptonLib/gifio.cpp \ ../../../raster/JBig2/source/LeptonLib/gifio.cpp \
../../../raster/JBig2/source/LeptonLib/gifiostub.cpp \ ../../../raster/JBig2/source/LeptonLib/gifiostub.cpp \
../../../raster/JBig2/source/LeptonLib/gplot.cpp \ ../../../raster/JBig2/source/LeptonLib/gplot.cpp \
../../../raster/JBig2/source/LeptonLib/graphics.cpp \ ../../../raster/JBig2/source/LeptonLib/graphics1.cpp \
../../../raster/JBig2/source/LeptonLib/graymorph.cpp \ ../../../raster/JBig2/source/LeptonLib/graymorph.cpp \
../../../raster/JBig2/source/LeptonLib/graymorphlow.cpp \ ../../../raster/JBig2/source/LeptonLib/graymorphlow.cpp \
../../../raster/JBig2/source/LeptonLib/grayquant.cpp \ ../../../raster/JBig2/source/LeptonLib/grayquant.cpp \
......
...@@ -75,7 +75,7 @@ namespace Jpeg2000 ...@@ -75,7 +75,7 @@ namespace Jpeg2000
pParameters->nSubSamplingDx = 1; pParameters->nSubSamplingDx = 1;
pParameters->nSubSamplingDy = 1; pParameters->nSubSamplingDy = 1;
pParameters->bTileSizeOn = false; pParameters->bTileSizeOn = false;
pParameters->sComment = "Manufactured by Online Media Technologies Ltd."; pParameters->sComment = (char*)"Manufactured by Online Media Technologies Ltd.";
// TODO: Сделать чтение параметров кодирования // TODO: Сделать чтение параметров кодирования
//if (sXml.GetLength() > 0) //if (sXml.GetLength() > 0)
......
#pragma once #pragma once
#include "Reader.h" #include "Reader.h"
#include "../../graphics/Defines.h" #include "../../graphics/Defines.h"
#include <algorithm>
namespace Jpeg2000 namespace Jpeg2000
{ {
......
#include "MetaFileUtils.h" #include "MetaFileUtils.h"
#include "../../raster/ImageFileFormatChecker.h" #include "../../raster/ImageFileFormatChecker.h"
#include "../../raster/BgraFrame.h" #include "../../raster/BgraFrame.h"
...@@ -24,7 +24,7 @@ namespace MetaFile ...@@ -24,7 +24,7 @@ namespace MetaFile
ulBit = ulBit << 1; ulBit = ulBit << 1;
unOffset++; unOffset++;
// 32- // ограничиваемся 32-битами
if (ulBit & 0x80000000) if (ulBit & 0x80000000)
return 0; return 0;
} }
...@@ -100,7 +100,7 @@ namespace MetaFile ...@@ -100,7 +100,7 @@ namespace MetaFile
*pulWidth = 0; *pulWidth = 0;
*pulHeight = 0; *pulHeight = 0;
if (BI_BITCOUNT_0 == ushBitCount) // PNG, JPEG if (BI_BITCOUNT_0 == ushBitCount) // Значит компрессия либо PNG, либо JPEG
{ {
if (BI_JPEG != unCompression || BI_PNG != unCompression) if (BI_JPEG != unCompression || BI_PNG != unCompression)
return false; return false;
...@@ -116,19 +116,19 @@ namespace MetaFile ...@@ -116,19 +116,19 @@ namespace MetaFile
CBgraFrame oFrame; CBgraFrame oFrame;
oFrame.OpenFile(wsTempFileName); oFrame.OpenFile(wsTempFileName);
// TODO: . // TODO: Как будут файлы сделать чтение.
NSFile::CFileBinary::Remove(wsTempFileName); NSFile::CFileBinary::Remove(wsTempFileName);
return false; return false;
} }
else if (BI_BITCOUNT_1 == ushBitCount) else if (BI_BITCOUNT_1 == ushBitCount)
{ {
// , 2- // Двуцветная картинка, значит палитра состоит из 2-х цветов
TRgbQuad oColor1, oColor2; TRgbQuad oColor1, oColor2;
if (oHeaderStream.CanRead() >= 8) if (oHeaderStream.CanRead() >= 8)
oHeaderStream >> oColor1 >> oColor2; oHeaderStream >> oColor1 >> oColor2;
// // Считываем саму картинку
int 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;
...@@ -163,7 +163,7 @@ namespace MetaFile ...@@ -163,7 +163,7 @@ namespace MetaFile
int nAlpha = 255; int nAlpha = 255;
if (nX == nWidthBytes - 1) if (nX == nWidthBytes - 1)
{ {
// , // Не до конца заполненный байт иногда заполняется странным цветом, поэтому мы делаем его прозрачным
nBitCount = nLastBitCount; nBitCount = nLastBitCount;
nAlpha = 0; nAlpha = 0;
} }
...@@ -197,7 +197,7 @@ namespace MetaFile ...@@ -197,7 +197,7 @@ namespace MetaFile
int nAlpha = 255; int nAlpha = 255;
if (nX == nWidthBytes - 1) if (nX == nWidthBytes - 1)
{ {
// , // Не до конца заполненный байт иногда заполняется странным цветом, поэтому мы делаем его прозрачным
nBitCount = nLastBitCount; nBitCount = nLastBitCount;
//nAlpha = 0; //nAlpha = 0;
} }
...@@ -236,20 +236,20 @@ namespace MetaFile ...@@ -236,20 +236,20 @@ namespace MetaFile
if (oHeaderStream.CanRead() < unColorTableLen * 4) if (oHeaderStream.CanRead() < unColorTableLen * 4)
return false; return false;
// // Считываем палитру
for (unsigned short ushIndex = 0; ushIndex < unColorTableLen; ushIndex++) for (unsigned short ushIndex = 0; ushIndex < unColorTableLen; ushIndex++)
{ {
oHeaderStream >> oColorTable[ushIndex]; oHeaderStream >> oColorTable[ushIndex];
} }
// 4 - 1 // 4 бита - 1 пиксел
// // Считываем саму картинку
int 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;
// 4, 8 // Ширина в байтах должна быть кратна 4, значит сама ширина должна быть кратна 8
int nAdd = 0; int nAdd = 0;
while (0 != div_t(div(nWidth + nAdd, 8)).rem) while (0 != div_t(div(nWidth + nAdd, 8)).rem)
{ {
...@@ -353,14 +353,14 @@ namespace MetaFile ...@@ -353,14 +353,14 @@ namespace MetaFile
if (oHeaderStream.CanRead() < ushColorTableLen * 4) if (oHeaderStream.CanRead() < ushColorTableLen * 4)
return false; return false;
// // Считываем палитру
for (unsigned short ushIndex = 0; ushIndex < ushColorTableLen; ushIndex++) for (unsigned short ushIndex = 0; ushIndex < ushColorTableLen; ushIndex++)
{ {
oHeaderStream >> oColorTable[ushIndex]; oHeaderStream >> oColorTable[ushIndex];
} }
// 1 - 1 // 1 байт - 1 пиксел
// 4. // Ширина должна быть кратна 4.
int nAdd = 0; int nAdd = 0;
while (0 != div_t(div(nWidth + nAdd, 4)).rem) while (0 != div_t(div(nWidth + nAdd, 4)).rem)
{ {
...@@ -428,7 +428,7 @@ namespace MetaFile ...@@ -428,7 +428,7 @@ namespace MetaFile
if (BI_RGB == unCompression) if (BI_RGB == unCompression)
{ {
// , // Маски, сдвиги и коэффициенты уже заполнены стандартными значениями для масок
// 000000000011111 - Red // 000000000011111 - Red
// 000001111100000 - Green // 000001111100000 - Green
// 111110000000000 - Blue // 111110000000000 - Blue
...@@ -450,13 +450,13 @@ namespace MetaFile ...@@ -450,13 +450,13 @@ namespace MetaFile
else else
return false; return false;
// // Считываем саму картинку
int 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;
// 2 // 2 байт на все каналы канал
// ( * 3) 4. // (Ширина * 3) должна быть кратна 4.
int nAdd = 0; int nAdd = 0;
while (0 != div_t(div(2 * nWidth + nAdd, 4)).rem) while (0 != div_t(div(2 * nWidth + nAdd, 4)).rem)
{ {
...@@ -523,15 +523,15 @@ namespace MetaFile ...@@ -523,15 +523,15 @@ namespace MetaFile
else if (BI_BITCOUNT_5 == ushBitCount) else if (BI_BITCOUNT_5 == ushBitCount)
{ {
if (BI_RGB != unCompression) if (BI_RGB != unCompression)
return false; // TODO: , return false; // TODO: Сделать данный вариант, как только будет файлы с данным типом
// // Считываем саму картинку
int 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;
// 1 // 1 байт на каждый канал
// ( * 3) 4. // (Ширина * 3) должна быть кратна 4.
int nAdd = 0; int nAdd = 0;
while (0 != div_t(div(3 * nWidth + nAdd, 4)).rem) while (0 != div_t(div(3 * nWidth + nAdd, 4)).rem)
{ {
...@@ -594,7 +594,7 @@ namespace MetaFile ...@@ -594,7 +594,7 @@ namespace MetaFile
if (BI_RGB == unCompression) if (BI_RGB == unCompression)
{ {
// , // Маски, сдвиги и коэффициенты уже заполнены стандартными значениями для масок
} }
else if (BI_BITFIELDS == unCompression) else if (BI_BITFIELDS == unCompression)
{ {
...@@ -618,13 +618,13 @@ namespace MetaFile ...@@ -618,13 +618,13 @@ namespace MetaFile
else else
return false; return false;
// // Считываем саму картинку
int 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;
// 1 // 1 байт на каждый канал
// 4. // Ширина должна быть кратна 4.
int nAdd = 0; int nAdd = 0;
while (0 != div_t(div(nWidth + nAdd, 4)).rem) while (0 != div_t(div(nWidth + nAdd, 4)).rem)
{ {
...@@ -666,7 +666,7 @@ namespace MetaFile ...@@ -666,7 +666,7 @@ namespace MetaFile
pBgraBuffer[nIndex + 0] = pBuffer[0]; pBuffer++; lBufLen--; pBgraBuffer[nIndex + 0] = pBuffer[0]; pBuffer++; lBufLen--;
pBgraBuffer[nIndex + 1] = pBuffer[0]; pBuffer++; lBufLen--; pBgraBuffer[nIndex + 1] = pBuffer[0]; pBuffer++; lBufLen--;
pBgraBuffer[nIndex + 2] = pBuffer[0]; pBuffer++; lBufLen--; pBgraBuffer[nIndex + 2] = pBuffer[0]; pBuffer++; lBufLen--;
pBgraBuffer[nIndex + 3] = 255; pBuffer++; lBufLen--; // , pBgraBuffer[nIndex + 3] = 255; pBuffer++; lBufLen--; // Если брать значение из картинки, тогда она получается всегда прозрачной
} }
} }
for (int nX = nWidth; nX < nWidth + nAdd; nX++) for (int nX = nWidth; nX < nWidth + nAdd; nX++)
...@@ -705,7 +705,7 @@ namespace MetaFile ...@@ -705,7 +705,7 @@ namespace MetaFile
pBgraBuffer[nIndex + 0] = pBuffer[0]; pBuffer++; lBufLen--; pBgraBuffer[nIndex + 0] = pBuffer[0]; pBuffer++; lBufLen--;
pBgraBuffer[nIndex + 1] = pBuffer[0]; pBuffer++; lBufLen--; pBgraBuffer[nIndex + 1] = pBuffer[0]; pBuffer++; lBufLen--;
pBgraBuffer[nIndex + 2] = pBuffer[0]; pBuffer++; lBufLen--; pBgraBuffer[nIndex + 2] = pBuffer[0]; pBuffer++; lBufLen--;
pBgraBuffer[nIndex + 3] = 255; pBuffer++; lBufLen--; // , pBgraBuffer[nIndex + 3] = 255; pBuffer++; lBufLen--; // Если брать значение из картинки, тогда она получается всегда прозрачной
} }
} }
...@@ -739,7 +739,7 @@ namespace MetaFile ...@@ -739,7 +739,7 @@ namespace MetaFile
CDataStream oHeaderStream; CDataStream oHeaderStream;
oHeaderStream.SetStream(pHeaderBuffer, ulHeaderBufferLen); oHeaderStream.SetStream(pHeaderBuffer, ulHeaderBufferLen);
// // Считываем заголовок
unsigned int ulHeaderSize; unsigned int ulHeaderSize;
oHeaderStream >> ulHeaderSize; oHeaderStream >> ulHeaderSize;
...@@ -758,7 +758,7 @@ namespace MetaFile ...@@ -758,7 +758,7 @@ namespace MetaFile
CDataStream oHeaderStream; CDataStream oHeaderStream;
oHeaderStream.SetStream(pImageBuffer, unBufferLen); oHeaderStream.SetStream(pImageBuffer, unBufferLen);
// // Считываем заголовок
unsigned int unHeaderSize; unsigned int unHeaderSize;
oHeaderStream >> unHeaderSize; oHeaderStream >> unHeaderSize;
...@@ -811,7 +811,7 @@ namespace MetaFile ...@@ -811,7 +811,7 @@ namespace MetaFile
} }
else else
{ {
// TODO: // TODO: реализовать другие типы цветов
} }
} }
} }
...@@ -820,7 +820,7 @@ namespace MetaFile ...@@ -820,7 +820,7 @@ namespace MetaFile
double dX0 = (nL + nR) / 2.0; double dX0 = (nL + nR) / 2.0;
double dY0 = (nT + nB) / 2.0; double dY0 = (nT + nB) / 2.0;
// // Определим квадрант
int nQuarter = -1; int nQuarter = -1;
if (nX >= dX0) if (nX >= dX0)
{ {
...@@ -853,7 +853,7 @@ namespace MetaFile ...@@ -853,7 +853,7 @@ namespace MetaFile
void ProcessRasterOperation(unsigned int unRasterOperation, BYTE** ppBgra, unsigned int unWidth, unsigned int unHeight) void ProcessRasterOperation(unsigned int unRasterOperation, BYTE** ppBgra, unsigned int unWidth, unsigned int unHeight)
{ {
BYTE* pBgra = *ppBgra; BYTE* pBgra = *ppBgra;
// SRCPAINT SRCAND , . // Для битовых операций SRCPAINT и SRCAND сделаем, как будто фон чисто белый.
if (0x008800C6 == unRasterOperation) // SRCPAINT if (0x008800C6 == unRasterOperation) // SRCPAINT
{ {
BYTE* pCur = pBgra; BYTE* pCur = pBgra;
...@@ -907,7 +907,7 @@ namespace MetaFile ...@@ -907,7 +907,7 @@ namespace MetaFile
return sRes; return sRes;
} }
bool OpenTempFile(std::wstring *pwsName, FILE **ppFile, wchar_t *wsMode, wchar_t *wsExt, wchar_t *wsFolder) bool OpenTempFile(std::wstring *pwsName, FILE **ppFile, const wchar_t *wsMode, const wchar_t *wsExt, const wchar_t *wsFolder)
{ {
std::wstring wsTemp, wsFileName; std::wstring wsTemp, wsFileName;
FILE *pTempFile = NULL; FILE *pTempFile = NULL;
......
#ifndef _METAFILE_COMMON_METAFILEUTILS_H #ifndef _METAFILE_COMMON_METAFILEUTILS_H
#define _METAFILE_COMMON_METAFILEUTILS_H #define _METAFILE_COMMON_METAFILEUTILS_H
#include "MetaFileTypes.h" #include "MetaFileTypes.h"
...@@ -270,7 +270,7 @@ namespace MetaFile ...@@ -270,7 +270,7 @@ namespace MetaFile
*this >> oText.iGraphicsMode; *this >> oText.iGraphicsMode;
*this >> oText.exScale; *this >> oText.exScale;
*this >> oText.eyScale; *this >> oText.eyScale;
ReadEmrTextW(oText.wEmrText, 36); // 8 + 28 (8 - , 28 - ) ReadEmrTextW(oText.wEmrText, 36); // 8 + 28 (8 - тип и размер, 28 - размер данной структуры)
return *this; return *this;
} }
...@@ -280,7 +280,7 @@ namespace MetaFile ...@@ -280,7 +280,7 @@ namespace MetaFile
*this >> oText.iGraphicsMode; *this >> oText.iGraphicsMode;
*this >> oText.exScale; *this >> oText.exScale;
*this >> oText.eyScale; *this >> oText.eyScale;
ReadEmrTextA(oText.aEmrText, 36); // 8 + 28 (8 - , 28 - ) ReadEmrTextA(oText.aEmrText, 36); // 8 + 28 (8 - тип и размер, 28 - размер данной структуры)
return *this; return *this;
} }
...@@ -478,7 +478,7 @@ namespace MetaFile ...@@ -478,7 +478,7 @@ namespace MetaFile
for (unsigned int unIndex = 0; unIndex < oText.cStrings; unIndex++) for (unsigned int unIndex = 0; unIndex < oText.cStrings; unIndex++)
{ {
unsigned int nCurPos = Tell(); unsigned int nCurPos = Tell();
ReadEmrTextA(oText.aEmrText[unIndex], nCurPos - nStartPos + 36); // 8 + 28 (8 - , 28 - ) ReadEmrTextA(oText.aEmrText[unIndex], nCurPos - nStartPos + 36); // 8 + 28 (8 - тип и размер, 28 - размер данной структуры)
} }
} }
else else
...@@ -506,7 +506,7 @@ namespace MetaFile ...@@ -506,7 +506,7 @@ namespace MetaFile
for (unsigned int unIndex = 0; unIndex < oText.cStrings; unIndex++) for (unsigned int unIndex = 0; unIndex < oText.cStrings; unIndex++)
{ {
unsigned int nCurPos = Tell(); unsigned int nCurPos = Tell();
ReadEmrTextW(oText.wEmrText[unIndex], nCurPos - nStartPos + 36); // 8 + 28 (8 - , 28 - ) ReadEmrTextW(oText.wEmrText[unIndex], nCurPos - nStartPos + 36); // 8 + 28 (8 - тип и размер, 28 - размер данной структуры)
} }
} }
else else
...@@ -641,7 +641,7 @@ namespace MetaFile ...@@ -641,7 +641,7 @@ namespace MetaFile
*this >> pFont->Quality; *this >> pFont->Quality;
*this >> pFont->PitchAndFamily; *this >> pFont->PitchAndFamily;
// // Читаем до тех пор пока не встретим нулевой символ
unsigned char unIndex = 0; unsigned char unIndex = 0;
*this >> pFont->Facename[unIndex]; *this >> pFont->Facename[unIndex];
while (0x00 != pFont->Facename[unIndex]) while (0x00 != pFont->Facename[unIndex])
...@@ -711,7 +711,7 @@ namespace MetaFile ...@@ -711,7 +711,7 @@ namespace MetaFile
*this >> oScan.Top; *this >> oScan.Top;
*this >> oScan.Bottom; *this >> oScan.Bottom;
if (oScan.Count > 0 && oScan.Count & 1) // 2 if (oScan.Count > 0 && oScan.Count & 1) // Должно делиться на 2
{ {
unsigned short ushCount = oScan.Count >> 1; unsigned short ushCount = oScan.Count >> 1;
oScan.ScanLines = new TWmfScanLine[ushCount]; oScan.ScanLines = new TWmfScanLine[ushCount];
...@@ -890,9 +890,9 @@ namespace MetaFile ...@@ -890,9 +890,9 @@ namespace MetaFile
{ {
*this >> oText; *this >> oText;
// OutputString // Читаем OutputString
const unsigned int unCharsCount = oText.Chars; const unsigned int unCharsCount = oText.Chars;
int nSkip = oText.offString - (unOffset + 40); // 40 - TEmfEmrText int nSkip = oText.offString - (unOffset + 40); // 40 - размер структуры TEmfEmrText
Skip(nSkip); Skip(nSkip);
T* pString = new T[unCharsCount + 1]; T* pString = new T[unCharsCount + 1];
if (pString) if (pString)
...@@ -902,7 +902,7 @@ namespace MetaFile ...@@ -902,7 +902,7 @@ namespace MetaFile
oText.OutputString = (void*)pString; oText.OutputString = (void*)pString;
} }
// OutputDx // Читаем OutputDx
nSkip = oText.offDx - oText.offString - 2 * unCharsCount; nSkip = oText.offDx - oText.offString - 2 * unCharsCount;
Skip(nSkip); Skip(nSkip);
const unsigned int unDxCount = oText.Options & ETO_PDY ? 2 * unCharsCount : unCharsCount; const unsigned int unDxCount = oText.Options & ETO_PDY ? 2 * unCharsCount : unCharsCount;
...@@ -933,6 +933,6 @@ namespace MetaFile ...@@ -933,6 +933,6 @@ namespace MetaFile
void ReadImage(BYTE* pImageBuffer, unsigned int unBufferLen, unsigned int unColorUsage, BYTE** ppDstBuffer, unsigned int* punWidth, unsigned int* punHeight); void ReadImage(BYTE* pImageBuffer, unsigned int unBufferLen, unsigned int unColorUsage, BYTE** ppDstBuffer, unsigned int* punWidth, unsigned int* punHeight);
double GetEllipseAngle(int nL, int nT, int nR, int nB, int nX, int nY); double GetEllipseAngle(int nL, int nT, int nR, int nB, int nX, int nY);
void ProcessRasterOperation(unsigned int unRasterOperation, BYTE** ppBgra, unsigned int unWidth, unsigned int unHeight); void ProcessRasterOperation(unsigned int unRasterOperation, BYTE** ppBgra, unsigned int unWidth, unsigned int unHeight);
bool OpenTempFile(std::wstring *pwsName, FILE **ppFile, wchar_t *wsMode, wchar_t *wsExt, wchar_t *wsFolder); bool OpenTempFile(std::wstring *pwsName, FILE **ppFile, const wchar_t *wsMode, const wchar_t *wsExt, const wchar_t *wsFolder);
}; };
#endif // _METAFILE_COMMON_METAFILEUTILS_H #endif // _METAFILE_COMMON_METAFILEUTILS_H
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