summaryrefslogtreecommitdiff
path: root/core/fxge/agg
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-12-06 06:29:28 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-06 06:29:28 -0800
commit1a1d7648d3e338b756e464cebb2ae1a815359afa (patch)
treedefa2de6d2cb61efd95ef212eb3e89e1a5811032 /core/fxge/agg
parent7341149c634e0ab9a619898826440f6e952cf0aa (diff)
downloadpdfium-1a1d7648d3e338b756e464cebb2ae1a815359afa.tar.xz
Return unique_ptrs from CFX_DIBitmap::Clone().
Because that's what clone does. Perform immediate release in some spots to avoid disrupting too much at once. Review-Url: https://codereview.chromium.org/2534953004
Diffstat (limited to 'core/fxge/agg')
-rw-r--r--core/fxge/agg/fx_agg_driver.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index e341e8c045..2258a257f1 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -1602,7 +1602,7 @@ bool CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
FX_RECT rect(left, top, left + pBitmap->GetWidth(),
top + pBitmap->GetHeight());
- CFX_DIBitmap* pBack = nullptr;
+ std::unique_ptr<CFX_DIBitmap> pBack;
if (m_pOriDevice) {
pBack = m_pOriDevice->Clone(&rect);
if (!pBack)
@@ -1616,18 +1616,15 @@ bool CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
return true;
}
- bool bRet = true;
left = std::min(left, 0);
top = std::min(top, 0);
if (m_bRgbByteOrder) {
RgbByteOrderTransferBitmap(pBitmap, 0, 0, rect.Width(), rect.Height(),
- pBack, left, top);
- } else {
- bRet = pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), pBack,
- left, top);
+ pBack.get(), left, top);
+ return true;
}
- delete pBack;
- return bRet;
+ return pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), pBack.get(),
+ left, top);
}
CFX_DIBitmap* CFX_AggDeviceDriver::GetBackDrop() {