diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-03-27 13:51:46 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-28 14:14:50 +0000 |
commit | 0004f29bf6ee3c6060a272c79f14993e92e053c7 (patch) | |
tree | b82385e4853a157e10148af8d95ebb6bae4fb4c7 /core/fpdfapi/render/cpdf_type3cache.cpp | |
parent | 369fe1f7f9f3a424ee3cf8f992c3128db27fa479 (diff) | |
download | pdfium-0004f29bf6ee3c6060a272c79f14993e92e053c7.tar.xz |
Refcount all CFX_DIBSources (and subclasses) all the time.
There are currently several ownership models for these objects,
including ad-hoc logic for sharing and deletion, and the
now-redundant CFX_DIBitmapRef externally-counted handle to the DIBs.
Replace them all with the internal refcount scheme.
Change-Id: I2db399dfc19219eda384f94cc989353b78ce2872
Reviewed-on: https://pdfium-review.googlesource.com/3166
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/render/cpdf_type3cache.cpp')
-rw-r--r-- | core/fpdfapi/render/cpdf_type3cache.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/fpdfapi/render/cpdf_type3cache.cpp b/core/fpdfapi/render/cpdf_type3cache.cpp index 7d0cb18172..1ba9f66203 100644 --- a/core/fpdfapi/render/cpdf_type3cache.cpp +++ b/core/fpdfapi/render/cpdf_type3cache.cpp @@ -8,6 +8,7 @@ #include <map> #include <memory> +#include <utility> #include "core/fpdfapi/font/cpdf_type3char.h" #include "core/fpdfapi/font/cpdf_type3font.h" @@ -51,7 +52,8 @@ bool IsScanLine8bpp(uint8_t* pBuf, int width) { return false; } -int DetectFirstLastScan(const CFX_DIBitmap* pBitmap, bool bFirst) { +int DetectFirstLastScan(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, + bool bFirst) { int height = pBitmap->GetHeight(); int pitch = pBitmap->GetPitch(); int width = pBitmap->GetWidth(); @@ -121,12 +123,12 @@ CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize, if (!pChar || !pChar->m_pBitmap) return nullptr; - CFX_DIBitmap* pBitmap = pChar->m_pBitmap.get(); + CFX_RetainPtr<CFX_DIBitmap> pBitmap = pChar->m_pBitmap; CFX_Matrix image_matrix = pChar->m_ImageMatrix; CFX_Matrix text_matrix(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, 0, 0); image_matrix.Concat(text_matrix); - std::unique_ptr<CFX_DIBitmap> pResBitmap; + CFX_RetainPtr<CFX_DIBitmap> pResBitmap; int left = 0; int top = 0; if (FXSYS_fabs(image_matrix.b) < FXSYS_fabs(image_matrix.a) / 100 && @@ -166,6 +168,6 @@ CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize, CFX_GlyphBitmap* pGlyph = new CFX_GlyphBitmap; pGlyph->m_Left = left; pGlyph->m_Top = -top; - pGlyph->m_Bitmap.TakeOver(pResBitmap.get()); + pGlyph->m_pBitmap->TakeOver(std::move(pResBitmap)); return pGlyph; } |