diff options
Diffstat (limited to 'core/src/fpdfapi/fpdf_render')
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp | 22 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp | 32 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp | 48 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp | 4 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp | 14 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/render_int.h | 32 |
6 files changed, 78 insertions, 74 deletions
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp index d22bd4b760..46f1640793 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp @@ -29,7 +29,8 @@ void CPDF_PageRenderCache::ClearAll() { FX_POSITION pos = m_ImageCaches.GetStartPosition(); while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_ImageCaches.GetNextAssoc(pos, key, value); delete (CPDF_ImageCache*)value; } @@ -47,7 +48,8 @@ void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) FX_POSITION pos = m_ImageCaches.GetStartPosition(); int i = 0; while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_ImageCaches.GetNextAssoc(pos, key, value); pCACHEINFO[i].time = ((CPDF_ImageCache*)value)->GetTimeCount(); pCACHEINFO[i++].pStream = ((CPDF_ImageCache*)value)->GetStream(); @@ -72,7 +74,7 @@ void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) } void CPDF_PageRenderCache::ClearImageCache(CPDF_Stream* pStream) { - FX_LPVOID value = m_ImageCaches.GetValueAt(pStream); + void* value = m_ImageCaches.GetValueAt(pStream); if (value == NULL) { m_ImageCaches.RemoveKey(pStream); return; @@ -86,7 +88,8 @@ FX_DWORD CPDF_PageRenderCache::EstimateSize() FX_DWORD dwSize = 0; FX_POSITION pos = m_ImageCaches.GetStartPosition(); while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_ImageCaches.GetNextAssoc(pos, key, value); dwSize += ((CPDF_ImageCache*)value)->EstimateSize(); } @@ -99,7 +102,7 @@ FX_DWORD CPDF_PageRenderCache::GetCachedSize(CPDF_Stream* pStream) const return m_nCacheSize; } CPDF_ImageCache* pImageCache; - if (!m_ImageCaches.Lookup(pStream, (FX_LPVOID&)pImageCache)) { + if (!m_ImageCaches.Lookup(pStream, (void*&)pImageCache)) { return 0; } return pImageCache->EstimateSize(); @@ -109,7 +112,7 @@ void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*& int32_t downsampleWidth, int32_t downsampleHeight) { CPDF_ImageCache* pImageCache; - FX_BOOL bFind = m_ImageCaches.Lookup(pStream, (FX_LPVOID&)pImageCache); + FX_BOOL bFind = m_ImageCaches.Lookup(pStream, (void*&)pImageCache); if (!bFind) { pImageCache = new CPDF_ImageCache(m_pPage->m_pDocument, pStream); } @@ -124,7 +127,7 @@ void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*& } FX_BOOL CPDF_PageRenderCache::StartGetCachedBitmap(CPDF_Stream* pStream, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t downsampleWidth, int32_t downsampleHeight) { - m_bCurFindCache = m_ImageCaches.Lookup(pStream, (FX_LPVOID&)m_pCurImageCache); + m_bCurFindCache = m_ImageCaches.Lookup(pStream, (void*&)m_pCurImageCache); if (!m_bCurFindCache) { m_pCurImageCache = new CPDF_ImageCache(m_pPage->m_pDocument, pStream); } @@ -159,7 +162,7 @@ FX_BOOL CPDF_PageRenderCache::Continue(IFX_Pause* pPause) void CPDF_PageRenderCache::ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap) { CPDF_ImageCache* pImageCache; - if (!m_ImageCaches.Lookup(pStream, (FX_LPVOID&)pImageCache)) { + if (!m_ImageCaches.Lookup(pStream, (void*&)pImageCache)) { if (pBitmap == NULL) { return; } @@ -209,7 +212,8 @@ void CPDF_PageRenderCache::ClearImageData() { FX_POSITION pos = m_ImageCaches.GetStartPosition(); while (pos) { - FX_LPVOID key, value; + void* key; + void* value; m_ImageCaches.GetNextAssoc(pos, key, value); ((CPDF_ImageCache*)value)->ClearImageData(); } diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp index 699f84830f..669ba4da49 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -141,7 +141,7 @@ CPDF_DIBTransferFunc::CPDF_DIBTransferFunc(const CPDF_TransferFunc* pTransferFun m_RampG = &pTransferFunc->m_Samples[256]; m_RampB = &pTransferFunc->m_Samples[512]; } -void CPDF_DIBTransferFunc::TranslateScanline(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf) const +void CPDF_DIBTransferFunc::TranslateScanline(uint8_t* dest_buf, const uint8_t* src_buf) const { int i; FX_BOOL bSkip = FALSE; @@ -234,7 +234,7 @@ void CPDF_DIBTransferFunc::TranslateScanline(FX_LPBYTE dest_buf, FX_LPCBYTE src_ break; } } -void CPDF_DIBTransferFunc::TranslateDownSamples(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf, int pixels, int Bpp) const +void CPDF_DIBTransferFunc::TranslateDownSamples(uint8_t* dest_buf, const uint8_t* src_buf, int pixels, int Bpp) const { if (Bpp == 8) { for (int i = 0; i < pixels; i ++) { @@ -519,8 +519,8 @@ FX_BOOL CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) int matte_g = FXARGB_G(m_Loader.m_MatteColor); int matte_b = FXARGB_B(m_Loader.m_MatteColor); for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = (FX_LPBYTE)bitmap_device1.GetBitmap()->GetScanline(row); - FX_LPCBYTE mask_scan = bitmap_device2.GetBitmap()->GetScanline(row); + uint8_t* dest_scan = (uint8_t*)bitmap_device1.GetBitmap()->GetScanline(row); + const uint8_t* mask_scan = bitmap_device2.GetBitmap()->GetScanline(row); for (int col = 0; col < width; col ++) { int alpha = *mask_scan ++; if (alpha) { @@ -606,8 +606,8 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() int matte_g = FXARGB_G(m_Loader.m_MatteColor); int matte_b = FXARGB_B(m_Loader.m_MatteColor); for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_scan = (FX_LPBYTE)bitmap_device1.GetBitmap()->GetScanline(row); - FX_LPCBYTE mask_scan = bitmap_device2.GetBitmap()->GetScanline(row); + uint8_t* dest_scan = (uint8_t*)bitmap_device1.GetBitmap()->GetScanline(row); + const uint8_t* mask_scan = bitmap_device2.GetBitmap()->GetScanline(row); for (int col = 0; col < width; col ++) { int alpha = *mask_scan ++; if (alpha) { @@ -823,7 +823,7 @@ CPDF_QuickStretcher::~CPDF_QuickStretcher() delete m_pDecoder; } } -ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, const CPDF_Dictionary* pParams); FX_BOOL CPDF_QuickStretcher::Start(CPDF_ImageObject* pImageObj, CFX_AffineMatrix* pImage2Device, const FX_RECT* pClipBox) { @@ -903,7 +903,7 @@ FX_BOOL CPDF_QuickStretcher::Start(CPDF_ImageObject* pImageObj, CFX_AffineMatrix } FX_BOOL CPDF_QuickStretcher::Continue(IFX_Pause* pPause) { - FX_LPBYTE result_buf = m_pBitmap->GetBuffer(); + uint8_t* result_buf = m_pBitmap->GetBuffer(); int src_width = m_pDecoder ? m_pDecoder->GetWidth() : m_SrcWidth; int src_height = m_pDecoder ? m_pDecoder->GetHeight() : m_SrcHeight; int src_pitch = src_width * m_Bpp; @@ -916,7 +916,7 @@ FX_BOOL CPDF_QuickStretcher::Continue(IFX_Pause* pPause) dest_y = m_LineIndex; src_y = (dest_y + m_ClipTop) * src_height / m_DestHeight; } - FX_LPCBYTE src_scan; + const uint8_t* src_scan; if (m_pDecoder) { src_scan = m_pDecoder->GetScanline(src_y); if (src_scan == NULL) { @@ -929,11 +929,11 @@ FX_BOOL CPDF_QuickStretcher::Continue(IFX_Pause* pPause) } src_scan += src_y * src_pitch; } - FX_LPBYTE result_scan = result_buf + dest_y * m_pBitmap->GetPitch(); + uint8_t* result_scan = result_buf + dest_y * m_pBitmap->GetPitch(); for (int x = 0; x < m_ResultWidth; x ++) { int dest_x = m_ClipLeft + x; int src_x = (m_bFlipX ? (m_DestWidth - dest_x - 1) : dest_x) * src_width / m_DestWidth; - FX_LPCBYTE src_pixel = src_scan + src_x * m_Bpp; + const uint8_t* src_pixel = src_scan + src_x * m_Bpp; if (m_pCS == NULL) { *result_scan = src_pixel[2]; result_scan ++; @@ -1049,11 +1049,11 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, delete pMask; return NULL; } - FX_LPBYTE dest_buf = pMask->GetBuffer(); + uint8_t* dest_buf = pMask->GetBuffer(); int dest_pitch = pMask->GetPitch(); - FX_LPBYTE src_buf = bitmap.GetBuffer(); + uint8_t* src_buf = bitmap.GetBuffer(); int src_pitch = bitmap.GetPitch(); - FX_LPBYTE pTransfer = FX_Alloc(uint8_t, 256); + uint8_t* pTransfer = FX_Alloc(uint8_t, 256); if (pFunc) { CFX_FixedBufGrow<FX_FLOAT, 16> results(pFunc->CountOutputs()); for (int i = 0; i < 256; i ++) { @@ -1070,8 +1070,8 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, if (bLuminosity) { int Bpp = bitmap.GetBPP() / 8; for (int row = 0; row < height; row ++) { - FX_LPBYTE dest_pos = dest_buf + row * dest_pitch; - FX_LPBYTE src_pos = src_buf + row * src_pitch; + uint8_t* dest_pos = dest_buf + row * dest_pitch; + uint8_t* src_pos = src_buf + row * src_pitch; for (int col = 0; col < width; col ++) { *dest_pos ++ = pTransfer[FXRGB2GRAY(src_pos[2], src_pos[1], *src_pos)]; src_pos += Bpp; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index d45cc1151f..2cbe2e8eb6 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -16,7 +16,7 @@ namespace { -unsigned int _GetBits8(FX_LPCBYTE pData, int bitpos, int nbits) +unsigned int _GetBits8(const uint8_t* pData, int bitpos, int nbits) { unsigned int byte = pData[bitpos / 8]; if (nbits == 8) { @@ -584,9 +584,9 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, FX } return pCompData; } -ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, const CPDF_Dictionary* pParams); -ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, +ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, const CPDF_Dictionary* pParams); int CPDF_DIBSource::CreateDecoder() { @@ -597,7 +597,7 @@ int CPDF_DIBSource::CreateDecoder() if (m_bDoBpcCheck && m_bpc == 0) { return 0; } - FX_LPCBYTE src_data = m_pStreamAcc->GetData(); + const uint8_t* src_data = m_pStreamAcc->GetData(); FX_DWORD src_size = m_pStreamAcc->GetSize(); const CPDF_Dictionary* pParams = m_pStreamAcc->GetImageParam(); if (decoder == FX_BSTRC("CCITTFaxDecode")) { @@ -750,7 +750,7 @@ void CPDF_DIBSource::LoadJpxBitmap() m_bpc < 8) { int scale = 8 - m_bpc; for (FX_DWORD row = 0; row < height; ++row) { - FX_LPBYTE scanline = (FX_LPBYTE)m_pCachedBitmap->GetScanline(row); + uint8_t* scanline = (uint8_t*)m_pCachedBitmap->GetScanline(row); for (FX_DWORD col = 0; col < width; ++col) { *scanline = (*scanline) >> scale; ++scanline; @@ -960,7 +960,7 @@ void CPDF_DIBSource::ValidateDictParam() } } #define NORMALCOLOR_MAX(color, max) (color) > (max) ? (max) : (color) < 0 ? 0 : (color); -void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan) const +void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan, const uint8_t* src_scan) const { if (m_bpc == 0) { return; @@ -968,7 +968,7 @@ void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_ int max_data = (1 << m_bpc) - 1; if (m_bDefaultDecode) { if (m_Family == PDFCS_DEVICERGB || m_Family == PDFCS_CALRGB) { - FX_LPCBYTE src_pos = src_scan; + const uint8_t* src_pos = src_scan; switch (m_bpc) { case 16: for (int col = 0; col < m_Width; col ++) { @@ -1070,14 +1070,14 @@ void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_ } } } -FX_LPBYTE CPDF_DIBSource::GetBuffer() const +uint8_t* CPDF_DIBSource::GetBuffer() const { if (m_pCachedBitmap) { return m_pCachedBitmap->GetBuffer(); } return NULL; } -FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const +const uint8_t* CPDF_DIBSource::GetScanline(int line) const { if (m_bpc == 0) { return NULL; @@ -1086,7 +1086,7 @@ FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const if (!src_pitch.IsValid()) return NULL; FX_DWORD src_pitch_value = src_pitch.ValueOrDie(); - FX_LPCBYTE pSrcLine = NULL; + const uint8_t* pSrcLine = NULL; if (m_pCachedBitmap) { if (line >= m_pCachedBitmap->GetHeight()) { line = m_pCachedBitmap->GetHeight() - 1; @@ -1100,7 +1100,7 @@ FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const } } if (pSrcLine == NULL) { - FX_LPBYTE pLineBuf = m_pMaskedLine ? m_pMaskedLine : m_pLineBuf; + uint8_t* pLineBuf = m_pMaskedLine ? m_pMaskedLine : m_pLineBuf; FXSYS_memset8(pLineBuf, 0xff, m_Pitch); return pLineBuf; } @@ -1152,8 +1152,8 @@ FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const } } if (m_bColorKey) { - FX_LPBYTE pDestPixel = m_pMaskedLine; - FX_LPCBYTE pSrcPixel = m_pLineBuf; + uint8_t* pDestPixel = m_pMaskedLine; + const uint8_t* pSrcPixel = m_pLineBuf; for (int col = 0; col < m_Width; col ++) { uint8_t index = *pSrcPixel++; if (m_pPalette) { @@ -1174,9 +1174,9 @@ FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const } if (m_bColorKey) { if (m_nComponents == 3 && m_bpc == 8) { - FX_LPBYTE alpha_channel = m_pMaskedLine + 3; + uint8_t* alpha_channel = m_pMaskedLine + 3; for (int col = 0; col < m_Width; col ++) { - FX_LPCBYTE pPixel = pSrcLine + col * 3; + const uint8_t* pPixel = pSrcLine + col * 3; alpha_channel[col * 4] = (pPixel[0] < m_pCompData[0].m_ColorKeyMin || pPixel[0] > m_pCompData[0].m_ColorKeyMax || pPixel[1] < m_pCompData[1].m_ColorKeyMin || pPixel[1] > m_pCompData[1].m_ColorKeyMax || pPixel[2] < m_pCompData[2].m_ColorKeyMin || pPixel[2] > m_pCompData[2].m_ColorKeyMax) ? 0xff : 0; @@ -1190,8 +1190,8 @@ FX_LPCBYTE CPDF_DIBSource::GetScanline(int line) const pSrcLine = m_pLineBuf; } if (m_bColorKey) { - FX_LPCBYTE pSrcPixel = pSrcLine; - FX_LPBYTE pDestPixel = m_pMaskedLine; + const uint8_t* pSrcPixel = pSrcLine; + uint8_t* pDestPixel = m_pMaskedLine; for (int col = 0; col < m_Width; col ++) { *pDestPixel++ = *pSrcPixel++; *pDestPixel++ = *pSrcPixel++; @@ -1209,7 +1209,7 @@ FX_BOOL CPDF_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const } return FALSE; } -void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_bpp, +void CPDF_DIBSource::DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const { if (line < 0 || dest_scan == NULL || dest_bpp <= 0 || @@ -1223,7 +1223,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ return; } - FX_LPCBYTE pSrcLine = NULL; + const uint8_t* pSrcLine = NULL; if (m_pCachedBitmap) { pSrcLine = m_pCachedBitmap->GetScanline(line); } else if (m_pDecoder) { @@ -1344,7 +1344,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ src_x = src_width - src_x - 1; } src_x %= src_width; - FX_LPBYTE pDestPixel = dest_scan + i * 4; + uint8_t* pDestPixel = dest_scan + i * 4; uint8_t index = pSrcLine[src_x]; if (m_pPalette) { *pDestPixel++ = FXARGB_B(m_pPalette[index]); @@ -1386,13 +1386,13 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ int dest_x = clip_left + i; FX_DWORD src_x = (bFlipX ? (dest_width - dest_x - 1) : dest_x) * (int64_t)src_width / dest_width; src_x %= src_width; - FX_LPCBYTE pSrcPixel = NULL; + const uint8_t* pSrcPixel = NULL; if (m_bpc % 8 == 0) { pSrcPixel = pSrcLine + src_x * orig_Bpp; } else { pSrcPixel = pSrcLine + (int)(src_x * orig_Not8Bpp); } - FX_LPBYTE pDestPixel = dest_scan + i * dest_Bpp; + uint8_t* pDestPixel = dest_scan + i * dest_Bpp; FX_ARGB argb; if (src_x == last_src_x) { argb = last_argb; @@ -1536,7 +1536,7 @@ FX_BOOL CPDF_ImageLoader::Load(const CPDF_ImageObject* pImage, CPDF_PageRenderCa } return FALSE; } -FX_BOOL CPDF_ImageLoader::StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_LPVOID& LoadHandle, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t nDownsampleWidth, int32_t nDownsampleHeight) +FX_BOOL CPDF_ImageLoader::StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, void*& LoadHandle, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t nDownsampleWidth, int32_t nDownsampleHeight) { m_nDownsampleWidth = nDownsampleWidth; m_nDownsampleHeight = nDownsampleHeight; @@ -1545,7 +1545,7 @@ FX_BOOL CPDF_ImageLoader::StartLoadImage(const CPDF_ImageObject* pImage, CPDF_Pa LoadHandle = pLoaderHandle; return ret; } -FX_BOOL CPDF_ImageLoader::Continue(FX_LPVOID LoadHandle, IFX_Pause* pPause) +FX_BOOL CPDF_ImageLoader::Continue(void* LoadHandle, IFX_Pause* pPause) { return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause); } diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index e02cd421ff..2243bff979 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -357,7 +357,7 @@ static void _DrawGouraud(CFX_DIBitmap* pBitmap, int alpha, CPDF_MeshVertex trian if (end_x > pBitmap->GetWidth()) { end_x = pBitmap->GetWidth(); } - FX_LPBYTE dib_buf = pBitmap->GetBuffer() + y * pBitmap->GetPitch() + start_x * 4; + uint8_t* dib_buf = pBitmap->GetBuffer() + y * pBitmap->GetPitch() + start_x * 4; FX_FLOAT r_unit = (r[end_index] - r[start_index]) / (max_x - min_x); FX_FLOAT g_unit = (g[end_index] - g[start_index]) / (max_x - min_x); FX_FLOAT b_unit = (b[end_index] - b[start_index]) / (max_x - min_x); @@ -1066,7 +1066,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, CPDF_Pag if (pPattern->m_bColored) { *dest_buf = *src_buf; } else { - *dest_buf = (*(FX_LPBYTE)src_buf << 24) | (fill_argb & 0xffffff); + *dest_buf = (*(uint8_t*)src_buf << 24) | (fill_argb & 0xffffff); } } else { if (pPattern->m_bColored) { diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp index 410e78a67b..e8ef861ba1 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -33,17 +33,17 @@ CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(FX_DWORD charcode, const CFX_AffineM m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); } CFX_GlyphBitmap* pGlyphBitmap; - if(pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(uintptr_t)charcode, (void*&)pGlyphBitmap)) { + if(pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)charcode, (void*&)pGlyphBitmap)) { return pGlyphBitmap; } pGlyphBitmap = RenderGlyph(pSizeCache, charcode, pMatrix, retinaScaleX, retinaScaleY); - pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)charcode, pGlyphBitmap); + pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)charcode, pGlyphBitmap); return pGlyphBitmap; } CPDF_Type3Glyphs::~CPDF_Type3Glyphs() { FX_POSITION pos = m_GlyphMap.GetStartPosition(); - FX_LPVOID Key; + void* Key; CFX_GlyphBitmap* pGlyphBitmap; while(pos) { m_GlyphMap.GetNextAssoc(pos, Key, (void*&)pGlyphBitmap); @@ -76,7 +76,7 @@ void CPDF_Type3Glyphs::AdjustBlue(FX_FLOAT top, FX_FLOAT bottom, int& top_line, top_line = _AdjustBlue(top, m_TopBlueCount, m_TopBlue); bottom_line = _AdjustBlue(bottom, m_BottomBlueCount, m_BottomBlue); } -static FX_BOOL _IsScanLine1bpp(FX_LPBYTE pBuf, int width) +static FX_BOOL _IsScanLine1bpp(uint8_t* pBuf, int width) { int size = width / 8; for (int i = 0; i < size; i ++) @@ -89,7 +89,7 @@ static FX_BOOL _IsScanLine1bpp(FX_LPBYTE pBuf, int width) } return FALSE; } -static FX_BOOL _IsScanLine8bpp(FX_LPBYTE pBuf, int width) +static FX_BOOL _IsScanLine8bpp(uint8_t* pBuf, int width) { for (int i = 0; i < width; i ++) if (pBuf[i] > 0x40) { @@ -104,7 +104,7 @@ static int _DetectFirstLastScan(const CFX_DIBitmap* pBitmap, FX_BOOL bFirst) if (bpp > 8) { width *= bpp / 8; } - FX_LPBYTE pBuf = pBitmap->GetBuffer(); + uint8_t* pBuf = pBitmap->GetBuffer(); int line = bFirst ? 0 : height - 1; int line_step = bFirst ? 1 : -1; int line_end = bFirst ? height : -1; @@ -564,7 +564,7 @@ void CPDF_CharPosList::Load(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pCharPos charpos.m_OriginX -= FontSize * vx / 1000; charpos.m_OriginY -= FontSize * vy / 1000; } - FX_LPCBYTE pTransform = pCIDFont->GetCIDTransform(CID); + const uint8_t* pTransform = pCIDFont->GetCIDTransform(CID); if (pTransform && !bVert) { charpos.m_AdjustMatrix[0] = _CIDTransformToFloat(pTransform[0]); charpos.m_AdjustMatrix[2] = _CIDTransformToFloat(pTransform[2]); diff --git a/core/src/fpdfapi/fpdf_render/render_int.h b/core/src/fpdfapi/fpdf_render/render_int.h index 0b6873409b..8d40b17f85 100644 --- a/core/src/fpdfapi/fpdf_render/render_int.h +++ b/core/src/fpdfapi/fpdf_render/render_int.h @@ -197,8 +197,8 @@ public: FX_BOOL Load(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL); - FX_BOOL StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_LPVOID& LoadHandle, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, int32_t nDownsampleWidth = 0, int32_t nDownsampleHeight = 0); - FX_BOOL Continue(FX_LPVOID LoadHandle, IFX_Pause* pPause); + FX_BOOL StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, void*& LoadHandle, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, int32_t nDownsampleWidth = 0, int32_t nDownsampleHeight = 0); + FX_BOOL Continue(void* LoadHandle, IFX_Pause* pPause); ~CPDF_ImageLoader(); CFX_DIBSource* m_pBitmap; CFX_DIBSource* m_pMask; @@ -250,8 +250,8 @@ protected: CPDF_QuickStretcher* m_pQuickStretcher; CFX_ImageTransformer* m_pTransformer; CPDF_ImageRenderer* m_pRenderer2; - FX_LPVOID m_DeviceHandle; - FX_LPVOID m_LoadHandle; + void* m_DeviceHandle; + void* m_LoadHandle; FX_BOOL m_bStdCS; int m_BlendType; FX_BOOL StartBitmapAlpha(); @@ -390,9 +390,9 @@ public: CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE); virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const; - virtual FX_LPBYTE GetBuffer() const; - virtual FX_LPCBYTE GetScanline(int line) const; - virtual void DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_bpp, + virtual uint8_t* GetBuffer() const; + virtual const uint8_t* GetScanline(int line) const; + virtual void DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const; virtual void SetDownSampleSize(int dest_width, int dest_height) const; CFX_DIBitmap* GetBitmap() const; @@ -410,7 +410,7 @@ public: CPDF_DIBSource* DetachMask(); CPDF_DIBSource* m_pMask; FX_DWORD m_MatteColor; - FX_LPVOID m_pJbig2Context; + void* m_pJbig2Context; CPDF_StreamAcc* m_pGlobalStream; FX_BOOL m_bStdCS; int m_Status; @@ -424,7 +424,7 @@ protected: void LoadJpxBitmap(); void LoadPalette(); int CreateDecoder(); - void TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan) const; + void TranslateScanline24bpp(uint8_t* dest_scan, const uint8_t* src_scan) const; void ValidateDictParam(); CPDF_Document* m_pDocument; const CPDF_Stream* m_pStream; @@ -442,8 +442,8 @@ protected: FX_BOOL m_bDoBpcCheck; FX_BOOL m_bColorKey; DIB_COMP_DATA* m_pCompData; - FX_LPBYTE m_pLineBuf; - FX_LPBYTE m_pMaskedLine; + uint8_t* m_pLineBuf; + uint8_t* m_pMaskedLine; nonstd::unique_ptr<CFX_DIBitmap> m_pCachedBitmap; ICodec_ScanlineDecoder* m_pDecoder; }; @@ -457,11 +457,11 @@ public: { return NULL; } - virtual void TranslateScanline(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf) const; - virtual void TranslateDownSamples(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf, int pixels, int Bpp) const; - FX_LPCBYTE m_RampR; - FX_LPCBYTE m_RampG; - FX_LPCBYTE m_RampB; + virtual void TranslateScanline(uint8_t* dest_buf, const uint8_t* src_buf) const; + virtual void TranslateDownSamples(uint8_t* dest_buf, const uint8_t* src_buf, int pixels, int Bpp) const; + const uint8_t* m_RampR; + const uint8_t* m_RampG; + const uint8_t* m_RampB; }; struct _CPDF_UniqueKeyGen { void Generate(int count, ...); |