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