本文整理汇总了C++中FX_Alloc函数的典型用法代码示例。如果您正苦于以下问题:C++ FX_Alloc函数的具体用法?C++ FX_Alloc怎么用?C++ FX_Alloc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FX_Alloc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: FX_Alloc
int32_t CFDE_TxtEdtPage::GetDisplayPos(const CFX_RectF& rtClip,
FXTEXT_CHARPOS*& pCharPos,
CFX_RectF* pBBox) const {
pCharPos = FX_Alloc(FXTEXT_CHARPOS, m_nCharCount);
int32_t nCharPosCount = 0;
FDE_TEXTEDITPIECE* pPiece = nullptr;
int32_t nVisualObjCount = m_PieceMassArr.GetSize();
FXTEXT_CHARPOS* pos = pCharPos;
CFX_RectF rtObj;
for (int32_t i = 0; i < nVisualObjCount; i++) {
pPiece = m_PieceMassArr.GetPtrAt(i);
m_pTextSet->GetRect(pPiece, rtObj);
if (!rtClip.IntersectWith(rtObj)) {
continue;
}
int32_t nCount = m_pTextSet->GetDisplayPos(pPiece, pos, FALSE);
nCharPosCount += nCount;
pos += nCount;
}
if ((nCharPosCount * 5) < (m_nCharCount << 2)) {
FXTEXT_CHARPOS* pTemp = FX_Alloc(FXTEXT_CHARPOS, nCharPosCount);
FXSYS_memcpy(pTemp, pCharPos, sizeof(FXTEXT_CHARPOS) * nCharPosCount);
FX_Free(pCharPos);
pCharPos = pTemp;
}
return nCharPosCount;
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:27,代码来源:cfde_txtedtpage.cpp
示例2: FX_Alloc
FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj)
{
CPDF_Dictionary* pDict = pObj->GetDict();
if (pDict == NULL) {
return FALSE;
}
CPDF_Array* pArray0 = pDict->GetArray(FX_BSTRC("C0"));
if (m_nOutputs == 0) {
m_nOutputs = 1;
if (pArray0) {
m_nOutputs = pArray0->GetCount();
}
}
CPDF_Array* pArray1 = pDict->GetArray(FX_BSTRC("C1"));
m_pBeginValues = FX_Alloc(FX_FLOAT, m_nOutputs * 2);
m_pEndValues = FX_Alloc(FX_FLOAT, m_nOutputs * 2);
for (int i = 0; i < m_nOutputs; i ++) {
m_pBeginValues[i] = pArray0 ? pArray0->GetFloat(i) : 0.0f;
m_pEndValues[i] = pArray1 ? pArray1->GetFloat(i) : 1.0f;
}
m_Exponent = pDict->GetFloat(FX_BSTRC("N"));
m_nOrigOutputs = m_nOutputs;
if (m_nOutputs && m_nInputs > INT_MAX / m_nOutputs) {
return FALSE;
}
m_nOutputs *= m_nInputs;
return TRUE;
}
开发者ID:witwall,项目名称:pdfium,代码行数:28,代码来源:fpdf_page_func.cpp
示例3: FX_Free
void CPDF_TextObject::SetText(int nChars,
FX_DWORD* pCharCodes,
FX_FLOAT* pKernings) {
if (m_nChars > 1) {
FX_Free(m_pCharCodes);
m_pCharCodes = nullptr;
}
FX_Free(m_pCharPos);
m_pCharPos = nullptr;
int nKernings = 0;
int i;
for (i = 0; i < nChars - 1; ++i) {
if (pKernings[i] != 0) {
++nKernings;
}
}
m_nChars = nChars + nKernings;
if (m_nChars > 1) {
m_pCharCodes = FX_Alloc(FX_DWORD, m_nChars);
m_pCharPos = FX_Alloc(FX_FLOAT, m_nChars - 1);
for (int i = 0, index = 0; i < nChars; ++i) {
m_pCharCodes[index++] = pCharCodes[i];
if (pKernings[i] != 0 && i != nChars - 1) {
m_pCharCodes[index] = (FX_DWORD)-1;
m_pCharPos[index - 1] = pKernings[i];
++index;
}
}
} else {
m_pCharCodes = (FX_DWORD*)(uintptr_t)pCharCodes[0];
}
RecalcPositionData();
}
开发者ID:andoma,项目名称:pdfium,代码行数:33,代码来源:fpdf_page.cpp
示例4: FX_Free
void CPDF_TextObject::SetText(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pKernings)
{
if (m_nChars > 1 && m_pCharCodes) {
FX_Free(m_pCharCodes);
m_pCharCodes = NULL;
}
if (m_pCharPos) {
FX_Free(m_pCharPos);
m_pCharPos = NULL;
}
int nKernings = 0;
int i;
for (i = 0; i < nChars - 1; i ++)
if (pKernings[i] != 0) {
nKernings ++;
}
m_nChars = nChars + nKernings;
if (m_nChars > 1) {
m_pCharCodes = FX_Alloc(FX_DWORD, m_nChars);
m_pCharPos = FX_Alloc(FX_FLOAT, m_nChars - 1);
int index = 0;
for (int i = 0; i < nChars; i ++) {
m_pCharCodes[index++] = pCharCodes[i];
if (pKernings[i] != 0 && i != nChars - 1) {
m_pCharCodes[index] = (FX_DWORD) - 1;
m_pCharPos[index - 1] = pKernings[i];
index ++;
}
}
} else {
m_pCharCodes = (FX_DWORD*)(FX_UINTPTR)pCharCodes[0];
}
RecalcPositionData();
}
开发者ID:BlissRoms,项目名称:platform_external_pdfium,代码行数:34,代码来源:fpdf_page.cpp
示例5: FX_Free
void CPDF_TextObject::CopyData(const CPDF_PageObject* pSrc)
{
const CPDF_TextObject* pSrcObj = (const CPDF_TextObject*)pSrc;
if (m_nChars > 1 && m_pCharCodes) {
FX_Free(m_pCharCodes);
m_pCharCodes = nullptr;
}
if (m_pCharPos) {
FX_Free(m_pCharPos);
m_pCharPos = nullptr;
}
m_nChars = pSrcObj->m_nChars;
if (m_nChars > 1) {
m_pCharCodes = FX_Alloc(FX_DWORD, m_nChars);
m_pCharPos = FX_Alloc(FX_FLOAT, m_nChars - 1);
for (int i = 0; i < m_nChars; ++i) {
m_pCharCodes[i] = pSrcObj->m_pCharCodes[i];
}
for (int i = 0; i < m_nChars - 1; ++i) {
m_pCharPos[i] = pSrcObj->m_pCharPos[i];
}
} else {
m_pCharCodes = pSrcObj->m_pCharCodes;
}
m_PosX = pSrcObj->m_PosX;
m_PosY = pSrcObj->m_PosY;
}
开发者ID:mariospr,项目名称:chromium-browser,代码行数:27,代码来源:fpdf_page.cpp
示例6: FX_Alloc
FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) {
if (pObj->GetType() != PDFOBJ_STREAM) {
return FALSE;
}
CPDF_Stream* pStream = (CPDF_Stream*)pObj;
CPDF_Dictionary* pDict = pStream->GetDict();
CPDF_Array* pSize = pDict->GetArray(FX_BSTRC("Size"));
CPDF_Array* pEncode = pDict->GetArray(FX_BSTRC("Encode"));
CPDF_Array* pDecode = pDict->GetArray(FX_BSTRC("Decode"));
m_nBitsPerSample = pDict->GetInteger(FX_BSTRC("BitsPerSample"));
if (m_nBitsPerSample > 32) {
return FALSE;
}
m_SampleMax = 0xffffffff >> (32 - m_nBitsPerSample);
m_pSampleStream = new CPDF_StreamAcc;
m_pSampleStream->LoadAllData(pStream, FALSE);
m_pEncodeInfo = FX_Alloc(SampleEncodeInfo, m_nInputs);
FX_SAFE_DWORD nTotalSampleBits = 1;
for (int i = 0; i < m_nInputs; i++) {
m_pEncodeInfo[i].sizes = pSize ? pSize->GetInteger(i) : 0;
if (!pSize && i == 0) {
m_pEncodeInfo[i].sizes = pDict->GetInteger(FX_BSTRC("Size"));
}
nTotalSampleBits *= m_pEncodeInfo[i].sizes;
if (pEncode) {
m_pEncodeInfo[i].encode_min = pEncode->GetFloat(i * 2);
m_pEncodeInfo[i].encode_max = pEncode->GetFloat(i * 2 + 1);
} else {
m_pEncodeInfo[i].encode_min = 0;
if (m_pEncodeInfo[i].sizes == 1) {
m_pEncodeInfo[i].encode_max = 1;
} else {
m_pEncodeInfo[i].encode_max = (FX_FLOAT)m_pEncodeInfo[i].sizes - 1;
}
}
}
nTotalSampleBits *= m_nBitsPerSample;
nTotalSampleBits *= m_nOutputs;
FX_SAFE_DWORD nTotalSampleBytes = nTotalSampleBits;
nTotalSampleBytes += 7;
nTotalSampleBytes /= 8;
if (!nTotalSampleBytes.IsValid() || nTotalSampleBytes.ValueOrDie() == 0 ||
nTotalSampleBytes.ValueOrDie() > m_pSampleStream->GetSize()) {
return FALSE;
}
m_pDecodeInfo = FX_Alloc(SampleDecodeInfo, m_nOutputs);
for (int i = 0; i < m_nOutputs; i++) {
if (pDecode) {
m_pDecodeInfo[i].decode_min = pDecode->GetFloat(2 * i);
m_pDecodeInfo[i].decode_max = pDecode->GetFloat(2 * i + 1);
} else {
m_pDecodeInfo[i].decode_min = m_pRanges[i * 2];
m_pDecodeInfo[i].decode_max = m_pRanges[i * 2 + 1];
}
}
return TRUE;
}
开发者ID:was4444,项目名称:pdfium,代码行数:57,代码来源:fpdf_page_func.cpp
示例7: FX_Alloc
void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice,
FX_FLOAT origin_x,
FX_FLOAT origin_y,
CPDF_Font* pFont,
FX_FLOAT font_size,
const CFX_AffineMatrix* pMatrix,
const CFX_ByteString& str,
FX_ARGB fill_argb,
FX_ARGB stroke_argb,
const CFX_GraphStateData* pGraphState,
const CPDF_RenderOptions* pOptions) {
int nChars = pFont->CountChar(str, str.GetLength());
if (nChars == 0) {
return;
}
FX_DWORD charcode;
int offset = 0;
FX_DWORD* pCharCodes;
FX_FLOAT* pCharPos;
if (nChars == 1) {
charcode = pFont->GetNextChar(str, str.GetLength(), offset);
pCharCodes = (FX_DWORD*)(uintptr_t)charcode;
pCharPos = NULL;
} else {
pCharCodes = FX_Alloc(FX_DWORD, nChars);
pCharPos = FX_Alloc(FX_FLOAT, nChars - 1);
FX_FLOAT cur_pos = 0;
for (int i = 0; i < nChars; i++) {
pCharCodes[i] = pFont->GetNextChar(str, str.GetLength(), offset);
if (i) {
pCharPos[i - 1] = cur_pos;
}
cur_pos += pFont->GetCharWidthF(pCharCodes[i]) * font_size / 1000;
}
}
CFX_AffineMatrix matrix;
if (pMatrix) {
matrix = *pMatrix;
}
matrix.e = origin_x;
matrix.f = origin_y;
if (pFont->GetFontType() == PDFFONT_TYPE3)
;
else if (stroke_argb == 0) {
DrawNormalText(pDevice, nChars, pCharCodes, pCharPos, pFont, font_size,
&matrix, fill_argb, pOptions);
} else
DrawTextPath(pDevice, nChars, pCharCodes, pCharPos, pFont, font_size,
&matrix, NULL, pGraphState, fill_argb, stroke_argb, NULL);
if (nChars > 1) {
FX_Free(pCharCodes);
FX_Free(pCharPos);
}
}
开发者ID:hoanganhx86,项目名称:pdfium,代码行数:54,代码来源:fpdf_render_text.cpp
示例8: m_File
CFX_SAXReader::CFX_SAXReader()
: m_File(),
m_pHandler(nullptr),
m_iState(-1),
m_pRoot(nullptr),
m_pCurItem(nullptr),
m_dwItemID(0),
m_iDataSize(256),
m_iNameSize(256),
m_dwParseMode(0),
m_pCommentContext(nullptr) {
m_pszData = FX_Alloc(uint8_t, m_iDataSize);
m_pszName = FX_Alloc(uint8_t, m_iNameSize);
}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:14,代码来源:fx_sax_imp.cpp
示例9: FX_Alloc
void* CPDF_CryptoHandler::CryptStart(uint32_t objnum,
uint32_t gennum,
bool bEncrypt) {
if (m_Cipher == FXCIPHER_NONE) {
return this;
}
if (m_Cipher == FXCIPHER_AES && m_KeyLen == 32) {
AESCryptContext* pContext = FX_Alloc(AESCryptContext, 1);
pContext->m_bIV = true;
pContext->m_BlockOffset = 0;
CRYPT_AESSetKey(pContext->m_Context, 16, m_EncryptKey, 32, bEncrypt);
if (bEncrypt) {
for (int i = 0; i < 16; i++) {
pContext->m_Block[i] = (uint8_t)rand();
}
CRYPT_AESSetIV(pContext->m_Context, pContext->m_Block);
}
return pContext;
}
uint8_t key1[48];
PopulateKey(objnum, gennum, key1);
if (m_Cipher == FXCIPHER_AES) {
FXSYS_memcpy(key1 + m_KeyLen + 5, "sAlT", 4);
}
uint8_t realkey[16];
CRYPT_MD5Generate(
key1, m_Cipher == FXCIPHER_AES ? m_KeyLen + 9 : m_KeyLen + 5, realkey);
int realkeylen = m_KeyLen + 5;
if (realkeylen > 16) {
realkeylen = 16;
}
if (m_Cipher == FXCIPHER_AES) {
AESCryptContext* pContext = FX_Alloc(AESCryptContext, 1);
pContext->m_bIV = true;
pContext->m_BlockOffset = 0;
CRYPT_AESSetKey(pContext->m_Context, 16, realkey, 16, bEncrypt);
if (bEncrypt) {
for (int i = 0; i < 16; i++) {
pContext->m_Block[i] = (uint8_t)rand();
}
CRYPT_AESSetIV(pContext->m_Context, pContext->m_Block);
}
return pContext;
}
CRYPT_rc4_context* pContext = FX_Alloc(CRYPT_rc4_context, 1);
CRYPT_ArcFourSetup(pContext, realkey, realkeylen);
return pContext;
}
开发者ID:MIPS,项目名称:external-pdfium,代码行数:49,代码来源:cpdf_crypto_handler.cpp
示例10: FX_Alloc
void CPDF_StandardSecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict, FX_DWORD permissions,
FX_BOOL bEncryptMetadata, FX_LPCBYTE key)
{
FX_BYTE buf[16];
buf[0] = (FX_BYTE)permissions;
buf[1] = (FX_BYTE)(permissions >> 8);
buf[2] = (FX_BYTE)(permissions >> 16);
buf[3] = (FX_BYTE)(permissions >> 24);
buf[4] = 0xff;
buf[5] = 0xff;
buf[6] = 0xff;
buf[7] = 0xff;
buf[8] = bEncryptMetadata ? 'T' : 'F';
buf[9] = 'a';
buf[10] = 'd';
buf[11] = 'b';
FX_BYTE* aes = FX_Alloc(FX_BYTE, 2048);
CRYPT_AESSetKey(aes, 16, key, 32, TRUE);
FX_BYTE iv[16], buf1[16];
FXSYS_memset32(iv, 0, 16);
CRYPT_AESSetIV(aes, iv);
CRYPT_AESEncrypt(aes, buf1, buf, 16);
FX_Free(aes);
pEncryptDict->SetAtString(FX_BSTRC("Perms"), CFX_ByteString(buf1, 16));
}
开发者ID:151706061,项目名称:PDFium,代码行数:25,代码来源:fpdf_parser_encrypt.cpp
示例11: FX_Alloc
FX_BOOL CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf,
FX_DWORD src_size,
int width,
int height,
int nComps,
int bpc) {
m_pSrcBuf = src_buf;
m_SrcSize = src_size;
m_OutputWidth = m_OrigWidth = width;
m_OutputHeight = m_OrigHeight = height;
m_nComps = nComps;
m_bpc = bpc;
m_bColorTransformed = FALSE;
m_DownScale = 1;
// Aligning the pitch to 4 bytes requires an integer overflow check.
FX_SAFE_DWORD pitch = width;
pitch *= nComps;
pitch *= bpc;
pitch += 31;
pitch /= 32;
pitch *= 4;
if (!pitch.IsValid()) {
return FALSE;
}
m_Pitch = pitch.ValueOrDie();
// Overflow should already have been checked before this is called.
m_dwLineBytes = (static_cast<FX_DWORD>(width) * nComps * bpc + 7) / 8;
m_pScanline = FX_Alloc(uint8_t, m_Pitch);
return CheckDestSize();
}
开发者ID:hoanganhx86,项目名称:pdfium,代码行数:30,代码来源:fx_codec.cpp
示例12: CacheOptimization
void CPDF_PageRenderCache::CacheOptimization(FX_INT32 dwLimitCacheSize)
{
if (m_nCacheSize <= (FX_DWORD)dwLimitCacheSize) {
return;
}
int nCount = m_ImageCaches.GetCount();
CACHEINFO* pCACHEINFO = (CACHEINFO*)FX_Alloc(FX_BYTE, (sizeof (CACHEINFO)) * nCount);
FX_POSITION pos = m_ImageCaches.GetStartPosition();
int i = 0;
while (pos) {
FX_LPVOID key, value;
m_ImageCaches.GetNextAssoc(pos, key, value);
pCACHEINFO[i].time = ((CPDF_ImageCache*)value)->GetTimeCount();
pCACHEINFO[i++].pStream = ((CPDF_ImageCache*)value)->GetStream();
}
FXSYS_qsort(pCACHEINFO, nCount, sizeof (CACHEINFO), compare);
FX_DWORD nTimeCount = m_nTimeCount;
if (nTimeCount + 1 < nTimeCount) {
for (i = 0; i < nCount; i ++) {
((CPDF_ImageCache*)(m_ImageCaches[pCACHEINFO[i].pStream]))->m_dwTimeCount = i;
}
m_nTimeCount = nCount;
}
i = 0;
while(nCount > 15) {
ClearImageCache(pCACHEINFO[i++].pStream);
nCount--;
}
while (m_nCacheSize > (FX_DWORD)dwLimitCacheSize) {
ClearImageCache(pCACHEINFO[i++].pStream);
}
FX_Free(pCACHEINFO);
}
开发者ID:HelloZhu,项目名称:PDFium.js,代码行数:33,代码来源:fpdf_render_cache.cpp
示例13: FX_Free
void CPDF_Stream::SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed, FX_BOOL bKeepBuf)
{
if (m_GenNum == (FX_DWORD) - 1) {
if (m_pDataBuf) {
FX_Free(m_pDataBuf);
}
} else {
m_GenNum = (FX_DWORD) - 1;
m_pCryptoHandler = NULL;
}
if (bKeepBuf) {
m_pDataBuf = (FX_LPBYTE)pData;
} else {
m_pDataBuf = FX_Alloc(FX_BYTE, size);
if (pData) {
FXSYS_memcpy32(m_pDataBuf, pData, size);
}
}
m_dwSize = size;
if (m_pDict == NULL) {
m_pDict = new CPDF_Dictionary;
}
m_pDict->SetAtInteger(FX_BSTRC("Length"), size);
if (!bCompressed) {
m_pDict->RemoveAt(FX_BSTRC("Filter"));
m_pDict->RemoveAt(FX_BSTRC("DecodeParms"));
}
}
开发者ID:duanhjlt,项目名称:pdfium,代码行数:28,代码来源:fpdf_parser_objects.cpp
示例14: FX_File_Copy
FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst)
{
CFXCRT_FileAccess_CRT src, dst;
if (!src.Open(fileNameSrc, FX_FILEMODE_ReadOnly)) {
return FALSE;
}
FX_FILESIZE size = src.GetSize();
if (!size) {
return FALSE;
}
if (!dst.Open(fileNameDst, FX_FILEMODE_Truncate)) {
return FALSE;
}
FX_FILESIZE num = 0;
FX_LPBYTE pBuffer = FX_Alloc(FX_BYTE, 32768);
if (!pBuffer) {
return FALSE;
}
while (num = src.Read(pBuffer, 32768)) {
if (dst.Write(pBuffer, num) != num) {
break;
}
}
FX_Free(pBuffer);
return TRUE;
}
开发者ID:codemonkey85,项目名称:pdfium,代码行数:26,代码来源:fxcrt_platforms.cpp
示例15: FX_Free
void CPDF_Stream::SetData(const uint8_t* pData,
uint32_t size,
FX_BOOL bCompressed,
FX_BOOL bKeepBuf) {
if (IsMemoryBased())
FX_Free(m_pDataBuf);
m_GenNum = kMemoryBasedGenNum;
if (bKeepBuf) {
m_pDataBuf = const_cast<uint8_t*>(pData);
} else {
m_pDataBuf = FX_Alloc(uint8_t, size);
if (pData) {
FXSYS_memcpy(m_pDataBuf, pData, size);
}
}
m_dwSize = size;
if (!m_pDict)
m_pDict = new CPDF_Dictionary;
m_pDict->SetAtInteger("Length", size);
if (!bCompressed) {
m_pDict->RemoveAt("Filter");
m_pDict->RemoveAt("DecodeParms");
}
}
开发者ID:gradescope,项目名称:pdfium,代码行数:25,代码来源:cpdf_stream.cpp
示例16: FX_Alloc
void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) {
if (m_nCacheSize <= (uint32_t)dwLimitCacheSize)
return;
size_t nCount = m_ImageCache.size();
CACHEINFO* pCACHEINFO = FX_Alloc(CACHEINFO, nCount);
size_t i = 0;
for (const auto& it : m_ImageCache) {
pCACHEINFO[i].time = it.second->GetTimeCount();
pCACHEINFO[i++].pStream = it.second->GetStream();
}
FXSYS_qsort(pCACHEINFO, nCount, sizeof(CACHEINFO), compare);
uint32_t nTimeCount = m_nTimeCount;
// Check if time value is about to roll over and reset all entries.
// The comparision is legal because uint32_t is an unsigned type.
if (nTimeCount + 1 < nTimeCount) {
for (i = 0; i < nCount; i++)
m_ImageCache[pCACHEINFO[i].pStream]->m_dwTimeCount = i;
m_nTimeCount = nCount;
}
i = 0;
while (i + 15 < nCount)
ClearImageCacheEntry(pCACHEINFO[i++].pStream);
while (i < nCount && m_nCacheSize > (uint32_t)dwLimitCacheSize)
ClearImageCacheEntry(pCACHEINFO[i++].pStream);
FX_Free(pCACHEINFO);
}
开发者ID:documentcloud,项目名称:pdfium,代码行数:31,代码来源:fpdf_render_cache.cpp
示例17: FX_Realloc
void CFX_BinaryBuf::ExpandBuf(FX_STRSIZE add_size)
{
FX_STRSIZE new_size = add_size + m_DataSize;
if (m_AllocSize >= new_size) {
return;
}
int alloc_step;
if (m_AllocStep == 0) {
alloc_step = m_AllocSize / 4;
if (alloc_step < 128 ) {
alloc_step = 128;
}
} else {
alloc_step = m_AllocStep;
}
new_size = (new_size + alloc_step - 1) / alloc_step * alloc_step;
uint8_t* pNewBuffer = m_pBuffer;
if (pNewBuffer) {
pNewBuffer = FX_Realloc(uint8_t, m_pBuffer, new_size);
} else {
pNewBuffer = FX_Alloc(uint8_t, new_size);
}
m_pBuffer = pNewBuffer;
m_AllocSize = new_size;
}
开发者ID:abbro-ca,项目名称:pdfium,代码行数:25,代码来源:fx_basic_buffer.cpp
示例18: FXSYS_assert
FX_BOOL CFX_SAXFile::StartFile(IFX_FileRead* pFile,
FX_DWORD dwStart,
FX_DWORD dwLen) {
FXSYS_assert(m_pFile == NULL && pFile != NULL);
FX_DWORD dwSize = pFile->GetSize();
if (dwStart >= dwSize) {
return FALSE;
}
if (dwLen == -1 || dwStart + dwLen > dwSize) {
dwLen = dwSize - dwStart;
}
if (dwLen == 0) {
return FALSE;
}
m_dwBufSize = std::min(dwLen, kSaxFileBufSize);
m_pBuf = FX_Alloc(uint8_t, m_dwBufSize);
if (!pFile->ReadBlock(m_pBuf, dwStart, m_dwBufSize)) {
return FALSE;
}
m_dwStart = dwStart;
m_dwEnd = dwStart + dwLen;
m_dwCur = dwStart;
m_pFile = pFile;
m_dwBufIndex = 0;
return TRUE;
}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:26,代码来源:fx_sax_imp.cpp
示例19: _DecodeAllScanlines
FX_DWORD _DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
{
if (pDecoder == NULL) {
return (FX_DWORD) - 1;
}
int ncomps = pDecoder->CountComps();
int bpc = pDecoder->GetBPC();
int width = pDecoder->GetWidth();
int height = pDecoder->GetHeight();
int pitch = (width * ncomps * bpc + 7) / 8;
if (height == 0 || pitch > (1 << 30) / height) {
delete pDecoder;
return -1;
}
dest_size = pitch * height;
dest_buf = FX_Alloc( FX_BYTE, dest_size);
for (int row = 0; row < height; row ++) {
FX_LPBYTE pLine = pDecoder->GetScanline(row);
if (pLine == NULL) {
break;
}
FXSYS_memcpy32(dest_buf + row * pitch, pLine, pitch);
}
FX_DWORD srcoff = pDecoder->GetSrcOffset();
delete pDecoder;
return srcoff;
}
开发者ID:hamapu,项目名称:loilo-pdf,代码行数:27,代码来源:fpdf_page_parser_old.cpp
示例20: FXSYS_fopen
void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path)
{
FXSYS_FILE* pFile = FXSYS_fopen(path, "rb");
if (pFile == NULL) {
return;
}
FXSYS_fseek(pFile, 0, FXSYS_SEEK_END);
FX_DWORD filesize = FXSYS_ftell(pFile);
FX_BYTE buffer[16];
FXSYS_fseek(pFile, 0, FXSYS_SEEK_SET);
size_t readCnt = FXSYS_fread(buffer, 12, 1, pFile);
if (GET_TT_LONG(buffer) == 0x74746366) {
FX_DWORD nFaces = GET_TT_LONG(buffer + 8);
FX_LPBYTE offsets = FX_Alloc(FX_BYTE, nFaces * 4);
if (!offsets) {
FXSYS_fclose(pFile);
return;
}
readCnt = FXSYS_fread(offsets, nFaces * 4, 1, pFile);
for (FX_DWORD i = 0; i < nFaces; i ++) {
FX_LPBYTE p = offsets + i * 4;
ReportFace(path, pFile, filesize, GET_TT_LONG(p));
}
FX_Free(offsets);
} else {
ReportFace(path, pFile, filesize, 0);
}
FXSYS_fclose(pFile);
}
开发者ID:kakajika,项目名称:loilo-pdf,代码行数:29,代码来源:fx_ge_fontmap.cpp
注:本文中的FX_Alloc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论