From 0b95042db2e6dab5876abd12ce485fff0a8e08fe Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 21 Sep 2017 15:49:49 -0400 Subject: Rename CFX_RetainPtr to RetainPtr This CL renames CFX_RetainPtr to RetainPtr and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: I8798a9f79cb0840d3f037e8d04937cedd742914e Reviewed-on: https://pdfium-review.googlesource.com/14616 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- core/fxcodec/codec/ccodec_jbig2module.h | 10 +++---- core/fxcodec/codec/ccodec_jpegmodule.h | 4 +-- core/fxcodec/codec/ccodec_progressivedecoder.h | 41 ++++++++++++-------------- core/fxcodec/codec/ccodec_tiffmodule.cpp | 39 ++++++++++++------------ core/fxcodec/codec/ccodec_tiffmodule.h | 6 ++-- core/fxcodec/codec/fx_codec_jbig.cpp | 4 +-- core/fxcodec/codec/fx_codec_jpeg.cpp | 2 +- core/fxcodec/codec/fx_codec_progress.cpp | 32 ++++++++++---------- 8 files changed, 67 insertions(+), 71 deletions(-) (limited to 'core/fxcodec/codec') diff --git a/core/fxcodec/codec/ccodec_jbig2module.h b/core/fxcodec/codec/ccodec_jbig2module.h index 6b36f19a6d..4fa4a81776 100644 --- a/core/fxcodec/codec/ccodec_jbig2module.h +++ b/core/fxcodec/codec/ccodec_jbig2module.h @@ -10,7 +10,7 @@ #include #include "core/fxcodec/fx_codec_def.h" -#include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/retain_ptr.h" class CJBig2_Context; class CJBig2_Image; @@ -25,8 +25,8 @@ class CCodec_Jbig2Context { uint32_t m_width; uint32_t m_height; - CFX_RetainPtr m_pGlobalStream; - CFX_RetainPtr m_pSrcStream; + RetainPtr m_pGlobalStream; + RetainPtr m_pSrcStream; uint8_t* m_dest_buf; uint32_t m_dest_pitch; std::unique_ptr m_pContext; @@ -42,8 +42,8 @@ class CCodec_Jbig2Module { std::unique_ptr* pContextHolder, uint32_t width, uint32_t height, - const CFX_RetainPtr& src_stream, - const CFX_RetainPtr& global_stream, + const RetainPtr& src_stream, + const RetainPtr& global_stream, uint8_t* dest_buf, uint32_t dest_pitch, IFX_PauseIndicator* pPause); diff --git a/core/fxcodec/codec/ccodec_jpegmodule.h b/core/fxcodec/codec/ccodec_jpegmodule.h index a5837177f2..d7e484d56f 100644 --- a/core/fxcodec/codec/ccodec_jpegmodule.h +++ b/core/fxcodec/codec/ccodec_jpegmodule.h @@ -9,8 +9,8 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_system.h" +#include "core/fxcrt/retain_ptr.h" class CCodec_ScanlineDecoder; class CFX_DIBSource; @@ -58,7 +58,7 @@ class CCodec_JpegModule { uint32_t GetAvailInput(Context* pContext, uint8_t** avail_buf_ptr); #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ - static bool JpegEncode(const CFX_RetainPtr& pSource, + static bool JpegEncode(const RetainPtr& pSource, uint8_t** dest_buf, FX_STRSIZE* dest_size); #endif diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.h b/core/fxcodec/codec/ccodec_progressivedecoder.h index 4417e47824..3ce19402d2 100644 --- a/core/fxcodec/codec/ccodec_progressivedecoder.h +++ b/core/fxcodec/codec/ccodec_progressivedecoder.h @@ -16,9 +16,9 @@ #include "core/fxcodec/codec/ccodec_pngmodule.h" #include "core/fxcodec/codec/ccodec_tiffmodule.h" #include "core/fxcodec/fx_codec_def.h" -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_system.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/fx_dib.h" class CCodec_ModuleMgr; @@ -44,11 +44,10 @@ class CCodec_ProgressiveDecoder : public CCodec_BmpModule::Delegate, explicit CCodec_ProgressiveDecoder(CCodec_ModuleMgr* pCodecMgr); virtual ~CCodec_ProgressiveDecoder(); - FXCODEC_STATUS LoadImageInfo( - const CFX_RetainPtr& pFile, - FXCODEC_IMAGE_TYPE imageType, - CFX_DIBAttribute* pAttribute, - bool bSkipImageTypeCheck); + FXCODEC_STATUS LoadImageInfo(const RetainPtr& pFile, + FXCODEC_IMAGE_TYPE imageType, + CFX_DIBAttribute* pAttribute, + bool bSkipImageTypeCheck); FXCODEC_IMAGE_TYPE GetType() const { return m_imagType; } int32_t GetWidth() const { return m_SrcWidth; } @@ -58,7 +57,7 @@ class CCodec_ProgressiveDecoder : public CCodec_BmpModule::Delegate, void SetClipBox(FX_RECT* clip); FXCODEC_STATUS GetFrames(int32_t& frames); - FXCODEC_STATUS StartDecode(const CFX_RetainPtr& pDIBitmap, + FXCODEC_STATUS StartDecode(const RetainPtr& pDIBitmap, int start_x, int start_y, int size_x, @@ -158,38 +157,36 @@ class CCodec_ProgressiveDecoder : public CCodec_BmpModule::Delegate, FXCODEC_STATUS& err_status); bool GifReadMoreData(CCodec_GifModule* pGifModule, FXCODEC_STATUS& err_status); - void GifDoubleLineResampleVert( - const CFX_RetainPtr& pDeviceBitmap, - double scale_y, - int des_row); - void PngOneOneMapResampleHorz( - const CFX_RetainPtr& pDeviceBitmap, - int32_t des_line, - uint8_t* src_scan, - FXCodec_Format src_format); + void GifDoubleLineResampleVert(const RetainPtr& pDeviceBitmap, + double scale_y, + int des_row); + void PngOneOneMapResampleHorz(const RetainPtr& pDeviceBitmap, + int32_t des_line, + uint8_t* src_scan, + FXCodec_Format src_format); bool DetectImageType(FXCODEC_IMAGE_TYPE imageType, CFX_DIBAttribute* pAttribute); void GetDownScale(int& down_scale); void GetTransMethod(FXDIB_Format des_format, FXCodec_Format src_format); - void ReSampleScanline(const CFX_RetainPtr& pDeviceBitmap, + void ReSampleScanline(const RetainPtr& pDeviceBitmap, int32_t des_line, uint8_t* src_scan, FXCodec_Format src_format); - void Resample(const CFX_RetainPtr& pDeviceBitmap, + void Resample(const RetainPtr& pDeviceBitmap, int32_t src_line, uint8_t* src_scan, FXCodec_Format src_format); - void ResampleVert(const CFX_RetainPtr& pDeviceBitmap, + void ResampleVert(const RetainPtr& pDeviceBitmap, double scale_y, int des_row); bool JpegReadMoreData(CCodec_JpegModule* pJpegModule, FXCODEC_STATUS& err_status); - void ResampleVertBT(const CFX_RetainPtr& pDeviceBitmap, + void ResampleVertBT(const RetainPtr& pDeviceBitmap, double scale_y, int des_row); - CFX_RetainPtr m_pFile; - CFX_RetainPtr m_pDeviceBitmap; + RetainPtr m_pFile; + RetainPtr m_pDeviceBitmap; CFX_UnownedPtr m_pCodecMgr; std::unique_ptr m_pJpegContext; std::unique_ptr m_pPngContext; diff --git a/core/fxcodec/codec/ccodec_tiffmodule.cpp b/core/fxcodec/codec/ccodec_tiffmodule.cpp index e0cb719475..07d189200e 100644 --- a/core/fxcodec/codec/ccodec_tiffmodule.cpp +++ b/core/fxcodec/codec/ccodec_tiffmodule.cpp @@ -10,9 +10,9 @@ #include "core/fxcodec/codec/codec_int.h" #include "core/fxcodec/fx_codec.h" -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_safe_types.h" #include "core/fxcrt/fx_stream.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/dib/cfx_dibitmap.h" #include "core/fxge/fx_dib.h" #include "third_party/base/logging.h" @@ -27,39 +27,39 @@ class CTiffContext : public CCodec_TiffModule::Context { CTiffContext(); ~CTiffContext() override; - bool InitDecoder(const CFX_RetainPtr& file_ptr); + bool InitDecoder(const RetainPtr& file_ptr); bool LoadFrameInfo(int32_t frame, int32_t* width, int32_t* height, int32_t* comps, int32_t* bpc, CFX_DIBAttribute* pAttribute); - bool Decode(const CFX_RetainPtr& pDIBitmap); + bool Decode(const RetainPtr& pDIBitmap); - CFX_RetainPtr io_in() const { return m_io_in; } + RetainPtr io_in() const { return m_io_in; } uint32_t offset() const { return m_offset; } void set_offset(uint32_t offset) { m_offset = offset; } private: - bool IsSupport(const CFX_RetainPtr& pDIBitmap) const; - void SetPalette(const CFX_RetainPtr& pDIBitmap, uint16_t bps); - bool Decode1bppRGB(const CFX_RetainPtr& pDIBitmap, + bool IsSupport(const RetainPtr& pDIBitmap) const; + void SetPalette(const RetainPtr& pDIBitmap, uint16_t bps); + bool Decode1bppRGB(const RetainPtr& pDIBitmap, int32_t height, int32_t width, uint16_t bps, uint16_t spp); - bool Decode8bppRGB(const CFX_RetainPtr& pDIBitmap, + bool Decode8bppRGB(const RetainPtr& pDIBitmap, int32_t height, int32_t width, uint16_t bps, uint16_t spp); - bool Decode24bppRGB(const CFX_RetainPtr& pDIBitmap, + bool Decode24bppRGB(const RetainPtr& pDIBitmap, int32_t height, int32_t width, uint16_t bps, uint16_t spp); - CFX_RetainPtr m_io_in; + RetainPtr m_io_in; uint32_t m_offset; TIFF* m_tif_ctx; }; @@ -228,7 +228,7 @@ CTiffContext::~CTiffContext() { } bool CTiffContext::InitDecoder( - const CFX_RetainPtr& file_ptr) { + const RetainPtr& file_ptr) { m_io_in = file_ptr; m_tif_ctx = tiff_open(this, "r"); return !!m_tif_ctx; @@ -291,8 +291,7 @@ bool CTiffContext::LoadFrameInfo(int32_t frame, return true; } -bool CTiffContext::IsSupport( - const CFX_RetainPtr& pDIBitmap) const { +bool CTiffContext::IsSupport(const RetainPtr& pDIBitmap) const { if (TIFFIsTiled(m_tif_ctx)) return false; @@ -322,7 +321,7 @@ bool CTiffContext::IsSupport( return planarconfig != PLANARCONFIG_SEPARATE; } -void CTiffContext::SetPalette(const CFX_RetainPtr& pDIBitmap, +void CTiffContext::SetPalette(const RetainPtr& pDIBitmap, uint16_t bps) { uint16_t* red_orig = nullptr; uint16_t* green_orig = nullptr; @@ -346,7 +345,7 @@ void CTiffContext::SetPalette(const CFX_RetainPtr& pDIBitmap, } } -bool CTiffContext::Decode1bppRGB(const CFX_RetainPtr& pDIBitmap, +bool CTiffContext::Decode1bppRGB(const RetainPtr& pDIBitmap, int32_t height, int32_t width, uint16_t bps, @@ -374,7 +373,7 @@ bool CTiffContext::Decode1bppRGB(const CFX_RetainPtr& pDIBitmap, return true; } -bool CTiffContext::Decode8bppRGB(const CFX_RetainPtr& pDIBitmap, +bool CTiffContext::Decode8bppRGB(const RetainPtr& pDIBitmap, int32_t height, int32_t width, uint16_t bps, @@ -410,7 +409,7 @@ bool CTiffContext::Decode8bppRGB(const CFX_RetainPtr& pDIBitmap, return true; } -bool CTiffContext::Decode24bppRGB(const CFX_RetainPtr& pDIBitmap, +bool CTiffContext::Decode24bppRGB(const RetainPtr& pDIBitmap, int32_t height, int32_t width, uint16_t bps, @@ -438,7 +437,7 @@ bool CTiffContext::Decode24bppRGB(const CFX_RetainPtr& pDIBitmap, return true; } -bool CTiffContext::Decode(const CFX_RetainPtr& pDIBitmap) { +bool CTiffContext::Decode(const RetainPtr& pDIBitmap) { uint32_t img_wid = pDIBitmap->GetWidth(); uint32_t img_hei = pDIBitmap->GetHeight(); uint32_t width = 0; @@ -480,7 +479,7 @@ bool CTiffContext::Decode(const CFX_RetainPtr& pDIBitmap) { } std::unique_ptr CCodec_TiffModule::CreateDecoder( - const CFX_RetainPtr& file_ptr) { + const RetainPtr& file_ptr) { auto pDecoder = pdfium::MakeUnique(); if (!pDecoder->InitDecoder(file_ptr)) return nullptr; @@ -500,7 +499,7 @@ bool CCodec_TiffModule::LoadFrameInfo(Context* pContext, } bool CCodec_TiffModule::Decode(Context* pContext, - const CFX_RetainPtr& pDIBitmap) { + const RetainPtr& pDIBitmap) { auto* ctx = static_cast(pContext); return ctx->Decode(pDIBitmap); } diff --git a/core/fxcodec/codec/ccodec_tiffmodule.h b/core/fxcodec/codec/ccodec_tiffmodule.h index 6e6e36b697..8d3bed7df2 100644 --- a/core/fxcodec/codec/ccodec_tiffmodule.h +++ b/core/fxcodec/codec/ccodec_tiffmodule.h @@ -9,8 +9,8 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_system.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/dib/cfx_dibitmap.h" class CFX_DIBAttribute; @@ -24,7 +24,7 @@ class CCodec_TiffModule { }; std::unique_ptr CreateDecoder( - const CFX_RetainPtr& file_ptr); + const RetainPtr& file_ptr); bool LoadFrameInfo(Context* ctx, int32_t frame, int32_t* width, @@ -32,7 +32,7 @@ class CCodec_TiffModule { int32_t* comps, int32_t* bpc, CFX_DIBAttribute* pAttribute); - bool Decode(Context* ctx, const CFX_RetainPtr& pDIBitmap); + bool Decode(Context* ctx, const RetainPtr& pDIBitmap); }; #endif // CORE_FXCODEC_CODEC_CCODEC_TIFFMODULE_H_ diff --git a/core/fxcodec/codec/fx_codec_jbig.cpp b/core/fxcodec/codec/fx_codec_jbig.cpp index f6ace30dd3..543aeebc87 100644 --- a/core/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/fxcodec/codec/fx_codec_jbig.cpp @@ -44,8 +44,8 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode( std::unique_ptr* pContextHolder, uint32_t width, uint32_t height, - const CFX_RetainPtr& src_stream, - const CFX_RetainPtr& global_stream, + const RetainPtr& src_stream, + const RetainPtr& global_stream, uint8_t* dest_buf, uint32_t dest_pitch, IFX_PauseIndicator* pPause) { diff --git a/core/fxcodec/codec/fx_codec_jpeg.cpp b/core/fxcodec/codec/fx_codec_jpeg.cpp index 1084529c7d..ea32f00a2e 100644 --- a/core/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/fxcodec/codec/fx_codec_jpeg.cpp @@ -508,7 +508,7 @@ uint32_t CCodec_JpegModule::GetAvailInput(Context* pContext, #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ #define JPEG_BLOCK_SIZE 1048576 -bool CCodec_JpegModule::JpegEncode(const CFX_RetainPtr& pSource, +bool CCodec_JpegModule::JpegEncode(const RetainPtr& pSource, uint8_t** dest_buf, FX_STRSIZE* dest_size) { struct jpeg_error_mgr jerr; diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp index a70041bff9..8b90d3ab84 100644 --- a/core/fxcodec/codec/fx_codec_progress.cpp +++ b/core/fxcodec/codec/fx_codec_progress.cpp @@ -396,7 +396,7 @@ bool CCodec_ProgressiveDecoder::PngReadHeader(int width, } bool CCodec_ProgressiveDecoder::PngAskScanlineBuf(int line, uint8_t*& src_buf) { - CFX_RetainPtr pDIBitmap = m_pDeviceBitmap; + RetainPtr pDIBitmap = m_pDeviceBitmap; if (!pDIBitmap) { NOTREACHED(); return false; @@ -465,7 +465,7 @@ bool CCodec_ProgressiveDecoder::PngAskScanlineBuf(int line, uint8_t*& src_buf) { } void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz( - const CFX_RetainPtr& pDeviceBitmap, + const RetainPtr& pDeviceBitmap, int32_t des_line, uint8_t* src_scan, FXCodec_Format src_format) { @@ -538,7 +538,7 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz( void CCodec_ProgressiveDecoder::PngFillScanlineBufCompleted(int pass, int line) { - CFX_RetainPtr pDIBitmap = m_pDeviceBitmap; + RetainPtr pDIBitmap = m_pDeviceBitmap; ASSERT(pDIBitmap); int src_top = m_clipBox.top; int src_bottom = m_clipBox.bottom; @@ -645,7 +645,7 @@ bool CCodec_ProgressiveDecoder::GifInputRecordPositionBuf( m_GifFrameRect = img_rc; m_SrcPassNumber = interlace ? 4 : 1; int32_t pal_index = m_GifBgIndex; - CFX_RetainPtr pDevice = m_pDeviceBitmap; + RetainPtr pDevice = m_pDeviceBitmap; if (trans_index >= pal_num) trans_index = -1; if (trans_index != -1) { @@ -695,7 +695,7 @@ bool CCodec_ProgressiveDecoder::GifInputRecordPositionBuf( void CCodec_ProgressiveDecoder::GifReadScanline(int32_t row_num, uint8_t* row_buf) { - CFX_RetainPtr pDIBitmap = m_pDeviceBitmap; + RetainPtr pDIBitmap = m_pDeviceBitmap; ASSERT(pDIBitmap); int32_t img_width = m_GifFrameRect.Width(); if (!pDIBitmap->HasAlpha()) { @@ -757,7 +757,7 @@ void CCodec_ProgressiveDecoder::GifReadScanline(int32_t row_num, } void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert( - const CFX_RetainPtr& pDeviceBitmap, + const RetainPtr& pDeviceBitmap, double scale_y, int des_row) { int des_Bpp = pDeviceBitmap->GetBPP() >> 3; @@ -883,7 +883,7 @@ bool CCodec_ProgressiveDecoder::BmpInputImagePositionBuf(uint32_t rcd_pos) { void CCodec_ProgressiveDecoder::BmpReadScanline( uint32_t row_num, const std::vector& row_buf) { - CFX_RetainPtr pDIBitmap = m_pDeviceBitmap; + RetainPtr pDIBitmap = m_pDeviceBitmap; ASSERT(pDIBitmap); std::copy(row_buf.begin(), row_buf.begin() + m_ScanlineSize, m_pDecodeBuf); int src_top = m_clipBox.top; @@ -914,7 +914,7 @@ void CCodec_ProgressiveDecoder::BmpReadScanline( } void CCodec_ProgressiveDecoder::ResampleVertBT( - const CFX_RetainPtr& pDeviceBitmap, + const RetainPtr& pDeviceBitmap, double scale_y, int des_row) { int des_Bpp = pDeviceBitmap->GetBPP() >> 3; @@ -1254,7 +1254,7 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, } FXCODEC_STATUS CCodec_ProgressiveDecoder::LoadImageInfo( - const CFX_RetainPtr& pFile, + const RetainPtr& pFile, FXCODEC_IMAGE_TYPE imageType, CFX_DIBAttribute* pAttribute, bool bSkipImageTypeCheck) { @@ -1446,7 +1446,7 @@ void CCodec_ProgressiveDecoder::GetTransMethod(FXDIB_Format des_format, } void CCodec_ProgressiveDecoder::ReSampleScanline( - const CFX_RetainPtr& pDeviceBitmap, + const RetainPtr& pDeviceBitmap, int des_line, uint8_t* src_scan, FXCodec_Format src_format) { @@ -1653,7 +1653,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline( } void CCodec_ProgressiveDecoder::ResampleVert( - const CFX_RetainPtr& pDeviceBitmap, + const RetainPtr& pDeviceBitmap, double scale_y, int des_row) { int des_Bpp = pDeviceBitmap->GetBPP() >> 3; @@ -1769,7 +1769,7 @@ void CCodec_ProgressiveDecoder::ResampleVert( } void CCodec_ProgressiveDecoder::Resample( - const CFX_RetainPtr& pDeviceBitmap, + const RetainPtr& pDeviceBitmap, int32_t src_line, uint8_t* src_scan, FXCodec_Format src_format) { @@ -1837,7 +1837,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::GetFrames(int32_t& frames) { } FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode( - const CFX_RetainPtr& pDIBitmap, + const RetainPtr& pDIBitmap, int start_x, int start_y, int size_x, @@ -2206,7 +2206,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode() { m_status = FXCODEC_STATUS_ERROR; return m_status; } - CFX_RetainPtr pClipBitmap = + RetainPtr pClipBitmap = (m_clipBox.left == 0 && m_clipBox.top == 0 && m_clipBox.right == m_SrcWidth && m_clipBox.bottom == m_SrcHeight) ? pDIBitmap @@ -2217,7 +2217,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode() { m_status = FXCODEC_STATUS_ERR_MEMORY; return m_status; } - CFX_RetainPtr pFormatBitmap; + RetainPtr pFormatBitmap; switch (m_pDeviceBitmap->GetFormat()) { case FXDIB_8bppRgb: pFormatBitmap = pdfium::MakeRetain(); @@ -2289,7 +2289,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode() { m_status = FXCODEC_STATUS_ERR_MEMORY; return m_status; } - CFX_RetainPtr pStrechBitmap = pFormatBitmap->StretchTo( + RetainPtr pStrechBitmap = pFormatBitmap->StretchTo( m_sizeX, m_sizeY, m_bInterpol ? FXDIB_INTERPOL : FXDIB_DOWNSAMPLE, nullptr); pFormatBitmap = nullptr; -- cgit v1.2.3