diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-04-03 14:05:17 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-03 21:47:59 +0000 |
commit | 3a1d9b48cb5485cdb93f1cc9857e5d829868629c (patch) | |
tree | 9f49629c7bb9a73357821841da549ac9149d7b12 /core/fpdfapi/render/cpdf_transferfunc.cpp | |
parent | ac35589d5d1a593497cf28d91ab6a236f25833c3 (diff) | |
download | pdfium-3a1d9b48cb5485cdb93f1cc9857e5d829868629c.tar.xz |
RefCount CPDF_TransferFunc all the time.
Prefer internal reference counts over ad-hoc schemes.
Change-Id: I8d420e9e9827ac39fdc0bc8146a532caeee10f26
Reviewed-on: https://pdfium-review.googlesource.com/3615
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi/render/cpdf_transferfunc.cpp')
-rw-r--r-- | core/fpdfapi/render/cpdf_transferfunc.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/fpdfapi/render/cpdf_transferfunc.cpp b/core/fpdfapi/render/cpdf_transferfunc.cpp index ed1f27dfad..a7ee42fa01 100644 --- a/core/fpdfapi/render/cpdf_transferfunc.cpp +++ b/core/fpdfapi/render/cpdf_transferfunc.cpp @@ -11,6 +11,8 @@ CPDF_TransferFunc::CPDF_TransferFunc(CPDF_Document* pDoc) : m_pPDFDoc(pDoc) {} +CPDF_TransferFunc::~CPDF_TransferFunc() {} + FX_COLORREF CPDF_TransferFunc::TranslateColor(FX_COLORREF rgb) const { return FXSYS_RGB(m_Samples[FXSYS_GetRValue(rgb)], m_Samples[256 + FXSYS_GetGValue(rgb)], @@ -19,7 +21,8 @@ FX_COLORREF CPDF_TransferFunc::TranslateColor(FX_COLORREF rgb) const { CFX_RetainPtr<CFX_DIBSource> CPDF_TransferFunc::TranslateImage( const CFX_RetainPtr<CFX_DIBSource>& pSrc) { - auto pDest = pdfium::MakeRetain<CPDF_DIBTransferFunc>(this); + CFX_RetainPtr<CPDF_TransferFunc> pHolder(this); + auto pDest = pdfium::MakeRetain<CPDF_DIBTransferFunc>(pHolder); pDest->LoadSrc(pSrc); return pDest; } |