这篇教程C++ FX_Alloc函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中FX_Alloc函数的典型用法代码示例。如果您正苦于以下问题:C++ FX_Alloc函数的具体用法?C++ FX_Alloc怎么用?C++ FX_Alloc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了FX_Alloc函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: FX_Allocint32_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,
示例2: FX_AllocFX_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,
示例3: FX_Freevoid 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,
示例4: FX_Freevoid 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,
示例5: FX_Freevoid 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,
示例6: FX_AllocFX_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,
示例7: FX_Allocvoid 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,
示例8: m_FileCFX_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,
示例9: FX_Allocvoid* 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,
示例10: FX_Allocvoid 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,
示例11: FX_AllocFX_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,
示例12: CacheOptimizationvoid 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,
示例13: FX_Freevoid 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,
示例14: FX_File_CopyFX_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,
示例15: FX_Freevoid 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,
示例16: FX_Allocvoid 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,
示例17: FX_Reallocvoid 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,
示例18: FXSYS_assertFX_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,
示例19: _DecodeAllScanlinesFX_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,
示例20: FXSYS_fopenvoid 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,
示例21: ASSERTuint8_t* CFX_BaseMassArrayImp::AddSpaceTo(int32_t index) { ASSERT(index > -1); uint8_t* pChunk; if (index < m_iBlockCount) { pChunk = (uint8_t*)m_pData->GetAt(index / m_iChunkSize); } else { int32_t iMemSize = m_iChunkSize * m_iBlockSize; while (TRUE) { if (index < m_iChunkCount * m_iChunkSize) { pChunk = (uint8_t*)m_pData->GetAt(index / m_iChunkSize); break; } else { pChunk = FX_Alloc(uint8_t, iMemSize); if (m_iChunkCount < m_pData->GetSize()) { m_pData->SetAt(m_iChunkCount, pChunk); } else { m_pData->Add(pChunk); } m_iChunkCount++; } } } ASSERT(pChunk); m_iBlockCount = index + 1; return pChunk + (index % m_iChunkSize) * m_iBlockSize;}
开发者ID:gradescope,项目名称:pdfium,代码行数:26,
示例22: FX_AllocFXFT_Face CFGAS_FontMgr::LoadFace(IFX_SeekableReadStream* pFontStream, int32_t iFaceIndex) { if (!pFontStream) return nullptr; CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); pFontMgr->InitFTLibrary(); FXFT_Library library = pFontMgr->GetFTLibrary(); if (!library) return nullptr; FXFT_Stream ftStream = FX_Alloc(FXFT_StreamRec, 1); FXSYS_memset(ftStream, 0, sizeof(FXFT_StreamRec)); ftStream->base = nullptr; ftStream->descriptor.pointer = pFontStream; ftStream->pos = 0; ftStream->size = static_cast<unsigned long>(pFontStream->GetSize()); ftStream->read = _ftStreamRead; ftStream->close = _ftStreamClose; FXFT_Open_Args ftArgs; FXSYS_memset(&ftArgs, 0, sizeof(FXFT_Open_Args)); ftArgs.flags |= FT_OPEN_STREAM; ftArgs.stream = ftStream; FXFT_Face pFace = nullptr; if (FXFT_Open_Face(library, &ftArgs, iFaceIndex, &pFace)) { FX_Free(ftStream); return nullptr; } FXFT_Set_Pixel_Sizes(pFace, 0, 64); return pFace;}
开发者ID:documentcloud,项目名称:pdfium,代码行数:34,
示例23: lpfCallbackCPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpfCallback, FX_LPVOID pUserData) const{ CPDF_Dictionary *pCloneDict = (CPDF_Dictionary*)m_pDict->Clone(bDirect); IFX_FileStream *pFS = NULL; if (lpfCallback) { pFS = lpfCallback((CPDF_Stream*)this, pUserData); } if (!pFS) { CPDF_StreamAcc acc; acc.LoadAllData(this, TRUE); FX_DWORD streamSize = acc.GetSize(); return new CPDF_Stream(acc.DetachData(), streamSize, pCloneDict); } CPDF_Stream* pObj = new CPDF_Stream(NULL, 0, NULL); CPDF_StreamFilter *pSF = GetStreamFilter(TRUE); if (pSF) { FX_LPBYTE pBuf = FX_Alloc(FX_BYTE, 4096); FX_DWORD dwRead; do { dwRead = pSF->ReadBlock(pBuf, 4096); if (dwRead) { pFS->WriteBlock(pBuf, dwRead); } } while (dwRead == 4096); pFS->Flush(); FX_Free(pBuf); delete pSF; } pObj->InitStream((IFX_FileRead*)pFS, pCloneDict); return pObj;}
开发者ID:duanhjlt,项目名称:pdfium,代码行数:31,
示例24: m_AllocStepCFX_BinaryBuf::CFX_BinaryBuf(FX_STRSIZE size) : m_AllocStep(0) , m_DataSize(size) , m_AllocSize(size){ m_pBuffer = FX_Alloc(uint8_t, size);}
开发者ID:abbro-ca,项目名称:pdfium,代码行数:7,
示例25: FXFC_LoadFileFX_BOOL FXFC_LoadFile(FX_LPVOID p, FX_LPCSTR name, FX_LPBYTE& pBuffer, FX_DWORD& size){ FXFC_PACKAGE* pPackage = (FXFC_PACKAGE*)p; FXSYS_fseek(pPackage->m_pFile, pPackage->m_IndexOffset, FXSYS_SEEK_SET); FX_BYTE buf[128]; for (int i = 0; i < pPackage->m_nFiles; i ++) { FXSYS_fread(buf, pPackage->m_IndexSize, 1, pPackage->m_pFile); if (FXSYS_stricmp((FX_LPCSTR)buf, name) == 0) { FX_DWORD offset = *(FX_DWORD*)&buf[64]; size = *(FX_DWORD*)&buf[68]; pBuffer = FX_Alloc(FX_BYTE, size); FXSYS_fseek(pPackage->m_pFile, offset, FXSYS_SEEK_SET); FXSYS_fread(pBuffer, size, 1, pPackage->m_pFile); if (buf[72]) { FX_DWORD orig_size; FX_LPBYTE comp_buf = pBuffer; CPDF_ModuleMgr::Get()->GetFlateModule()->FlateOrLZWDecode(FALSE, comp_buf, size, FALSE, 0, 0, 0, 0, 0, pBuffer, orig_size); FX_Free(comp_buf); size = orig_size; } return TRUE; } } return FALSE;}
开发者ID:151706061,项目名称:PDFium,代码行数:26,
示例26: FX_Allocvoid CPDF_SecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict, uint32_t permissions, FX_BOOL bEncryptMetadata, const uint8_t* key) { uint8_t buf[16]; buf[0] = (uint8_t)permissions; buf[1] = (uint8_t)(permissions >> 8); buf[2] = (uint8_t)(permissions >> 16); buf[3] = (uint8_t)(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'; uint8_t* aes = FX_Alloc(uint8_t, 2048); CRYPT_AESSetKey(aes, 16, key, 32, TRUE); uint8_t iv[16], buf1[16]; FXSYS_memset(iv, 0, 16); CRYPT_AESSetIV(aes, iv); CRYPT_AESEncrypt(aes, buf1, buf, 16); FX_Free(aes); pEncryptDict->SetAtString("Perms", CFX_ByteString(buf1, 16));}
开发者ID:gradescope,项目名称:pdfium,代码行数:26,
示例27: BC_EXCEPTION_CHECK_ReturnVoidvoid CBC_QRDecodedBitStreamParser::DecodeByteSegment( CBC_CommonBitSource* bits, CFX_ByteString& result, int32_t count, CBC_CommonCharacterSetECI* currentCharacterSetECI, CFX_Int32Array* byteSegments, int32_t byteModeDecode, int32_t& e) { if (count < 0) { e = BCExceptionNotFound; BC_EXCEPTION_CHECK_ReturnVoid(e); } if ((count << 3) > bits->Available()) { e = BCExceptionRead; BC_EXCEPTION_CHECK_ReturnVoid(e); } uint8_t* readBytes = FX_Alloc(uint8_t, count); FXSYS_memset(readBytes, 0x00, count); for (int32_t i = 0; i < count; i++) { readBytes[i] = (uint8_t)bits->ReadBits(8, e); BC_EXCEPTION_CHECK_ReturnVoid(e); } CFX_ByteString bs(readBytes, count); result += bs; FX_Free(readBytes);}
开发者ID:andoma,项目名称:pdfium,代码行数:26,
注:本文中的FX_Alloc函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ FX_BSTRC函数代码示例 C++ FXSYS_round函数代码示例 |