summaryrefslogtreecommitdiff
path: root/core/fpdfapi/render/cpdf_type3cache.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-03-28 09:31:32 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-03-28 16:42:55 +0000
commitf0799fe84df4d86f25d342b03525f3016d674f86 (patch)
treed6839802a68b7b6ad6fb166179ede779c3560c75 /core/fpdfapi/render/cpdf_type3cache.cpp
parent31b08d4cdaa17d7a03f35e087096a77036af98ec (diff)
downloadpdfium-f0799fe84df4d86f25d342b03525f3016d674f86.tar.xz
Revert "Revert "Refcount all CFX_DIBSources (and subclasses) all the time.""
This reverts commit 31b08d4cdaa17d7a03f35e087096a77036af98ec. Re-landing the patch after fixing skia build issue. Change-Id: Ie7039890088b803a6ec5ce365d70f57277459b48 Reviewed-on: https://pdfium-review.googlesource.com/3245 Commit-Queue: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/render/cpdf_type3cache.cpp')
-rw-r--r--core/fpdfapi/render/cpdf_type3cache.cpp10
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;
}