summaryrefslogtreecommitdiff
path: root/core/fpdfapi/render
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/render')
-rw-r--r--core/fpdfapi/render/cpdf_imagecacheentry.cpp2
-rw-r--r--core/fpdfapi/render/cpdf_imagerenderer.cpp6
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp15
-rw-r--r--core/fpdfapi/render/cpdf_type3cache.cpp6
-rw-r--r--core/fpdfapi/render/fpdf_render_loadimage.cpp10
-rw-r--r--core/fpdfapi/render/render_int.h2
6 files changed, 12 insertions, 29 deletions
diff --git a/core/fpdfapi/render/cpdf_imagecacheentry.cpp b/core/fpdfapi/render/cpdf_imagecacheentry.cpp
index 93ec162a7c..932d281f98 100644
--- a/core/fpdfapi/render/cpdf_imagecacheentry.cpp
+++ b/core/fpdfapi/render/cpdf_imagecacheentry.cpp
@@ -34,7 +34,7 @@ CPDF_ImageCacheEntry::~CPDF_ImageCacheEntry() {}
void CPDF_ImageCacheEntry::Reset(const CFX_DIBitmap* pBitmap) {
m_pCachedBitmap.reset();
if (pBitmap)
- m_pCachedBitmap = pdfium::WrapUnique<CFX_DIBSource>(pBitmap->Clone());
+ m_pCachedBitmap = pBitmap->Clone();
CalcSize();
}
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp
index bdcd2b3c65..eae32443d8 100644
--- a/core/fpdfapi/render/cpdf_imagerenderer.cpp
+++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp
@@ -94,7 +94,7 @@ bool CPDF_ImageRenderer::StartRenderDIBSource() {
m_pImageObject->m_GeneralState.GetTransferFunc()->TranslateImage(
m_Loader.m_pBitmap, !m_Loader.m_bCached);
if (m_Loader.m_bCached && m_Loader.m_pMask)
- m_Loader.m_pMask = m_Loader.m_pMask->Clone();
+ m_Loader.m_pMask = m_Loader.m_pMask->Clone().release();
m_Loader.m_bCached = false;
}
}
@@ -110,7 +110,7 @@ bool CPDF_ImageRenderer::StartRenderDIBSource() {
}
m_FillArgb = m_pRenderStatus->GetFillArgb(m_pImageObject);
} else if (m_pRenderStatus->m_Options.m_ColorMode == RENDER_COLOR_GRAY) {
- m_pClone.reset(m_pDIBSource->Clone());
+ m_pClone = m_pDIBSource->Clone();
m_pClone->ConvertColorScale(m_pRenderStatus->m_Options.m_BackColor,
m_pRenderStatus->m_Options.m_ForeColor);
m_pDIBSource = m_pClone.get();
@@ -400,7 +400,7 @@ bool CPDF_ImageRenderer::StartDIBSource() {
}
}
#ifdef _SKIA_SUPPORT_
- CFX_DIBitmap* premultiplied = m_pDIBSource->Clone();
+ CFX_DIBitmap* premultiplied = m_pDIBSource->Clone().release();
if (m_pDIBSource->HasAlpha())
CFX_SkiaDeviceDriver::PreMultiply(premultiplied);
if (m_pRenderStatus->m_pDevice->StartDIBitsWithBlend(
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 126e04662e..88dbb030ce 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -46,6 +46,7 @@
#include "core/fpdfapi/render/render_int.h"
#include "core/fpdfdoc/cpdf_occontext.h"
#include "core/fxcodec/fx_codec.h"
+#include "core/fxcrt/cfx_maybe_owned.h"
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxge/cfx_fxgedevice.h"
#include "core/fxge/cfx_graphstatedata.h"
@@ -2265,7 +2266,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
std::unique_ptr<CFX_DIBitmap> pEnlargedBitmap =
DrawPatternBitmap(m_pContext->GetDocument(), m_pContext->GetPageCache(),
pPattern, pObj2Device, 8, 8, m_Options.m_Flags);
- pPatternBitmap.reset(pEnlargedBitmap->StretchTo(width, height));
+ pPatternBitmap = pEnlargedBitmap->StretchTo(width, height);
} else {
pPatternBitmap = DrawPatternBitmap(
m_pContext->GetDocument(), m_pContext->GetPageCache(), pPattern,
@@ -2439,10 +2440,8 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
FX_RECT rect(left, top, left + pDIBitmap->GetWidth(),
top + pDIBitmap->GetHeight());
rect.Intersect(m_pDevice->GetClipBox());
- CFX_DIBitmap* pClone = nullptr;
- bool bClone = false;
+ CFX_MaybeOwned<CFX_DIBitmap> pClone;
if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) {
- bClone = true;
pClone = m_pDevice->GetBackDrop()->Clone(&rect);
CFX_DIBitmap* pForeBitmap = m_pDevice->GetBitmap();
pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(),
@@ -2459,17 +2458,13 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
pClone = pDIBitmap;
}
if (m_pDevice->GetBackDrop()) {
- m_pDevice->SetDIBits(pClone, rect.left, rect.top);
+ m_pDevice->SetDIBits(pClone.Get(), rect.left, rect.top);
} else {
- if (pDIBitmap->IsAlphaMask()) {
+ if (pDIBitmap->IsAlphaMask())
return;
- }
m_pDevice->SetDIBitsWithBlend(pDIBitmap, rect.left, rect.top,
blend_mode);
}
- if (bClone) {
- delete pClone;
- }
}
return;
}
diff --git a/core/fpdfapi/render/cpdf_type3cache.cpp b/core/fpdfapi/render/cpdf_type3cache.cpp
index ba92142dbf..b27fdf507e 100644
--- a/core/fpdfapi/render/cpdf_type3cache.cpp
+++ b/core/fpdfapi/render/cpdf_type3cache.cpp
@@ -143,10 +143,10 @@ CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize,
bottom_y = temp;
}
pSize->AdjustBlue(top_y, bottom_y, top_line, bottom_line);
- pResBitmap.reset(pBitmap->StretchTo(
+ pResBitmap = pBitmap->StretchTo(
(int)(FXSYS_round(image_matrix.a) * retinaScaleX),
(int)((bFlipped ? top_line - bottom_line : bottom_line - top_line) *
- retinaScaleY)));
+ retinaScaleY));
top = top_line;
if (image_matrix.a < 0) {
image_matrix.Scale(retinaScaleX, retinaScaleY);
@@ -158,7 +158,7 @@ CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize,
}
if (!pResBitmap) {
image_matrix.Scale(retinaScaleX, retinaScaleY);
- pResBitmap.reset(pBitmap->TransformTo(&image_matrix, left, top));
+ pResBitmap = pBitmap->TransformTo(&image_matrix, left, top);
}
if (!pResBitmap)
return nullptr;
diff --git a/core/fpdfapi/render/fpdf_render_loadimage.cpp b/core/fpdfapi/render/fpdf_render_loadimage.cpp
index d797b06135..f690f688b1 100644
--- a/core/fpdfapi/render/fpdf_render_loadimage.cpp
+++ b/core/fpdfapi/render/fpdf_render_loadimage.cpp
@@ -132,16 +132,6 @@ CPDF_DIBSource::~CPDF_DIBSource() {
}
}
-CFX_DIBitmap* CPDF_DIBSource::GetBitmap() const {
- return m_pCachedBitmap ? m_pCachedBitmap.get() : Clone();
-}
-
-void CPDF_DIBSource::ReleaseBitmap(CFX_DIBitmap* pBitmap) const {
- if (pBitmap && pBitmap != m_pCachedBitmap.get()) {
- delete pBitmap;
- }
-}
-
bool CPDF_DIBSource::Load(CPDF_Document* pDoc,
const CPDF_Stream* pStream,
CPDF_DIBSource** ppMask,
diff --git a/core/fpdfapi/render/render_int.h b/core/fpdfapi/render/render_int.h
index 5d04fa77bb..276370d386 100644
--- a/core/fpdfapi/render/render_int.h
+++ b/core/fpdfapi/render/render_int.h
@@ -85,8 +85,6 @@ class CPDF_DIBSource : public CFX_DIBSource {
int clip_left,
int clip_width) const override;
- CFX_DIBitmap* GetBitmap() const;
- void ReleaseBitmap(CFX_DIBitmap* pBitmap) const;
uint32_t GetMatteColor() const { return m_MatteColor; }
int StartLoadDIBSource(CPDF_Document* pDoc,