summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-04-20 16:33:30 -0700
committerTom Sepez <tsepez@chromium.org>2015-04-20 16:33:30 -0700
commitced4c2bf1d0d1bab14a6145b35b3baecb175a691 (patch)
tree864cc9992284424365607b330ac218bfb840bf73 /core/src/fpdfdoc
parent7a8387e670a2f879b9b2f1fc7bb67064f73fb249 (diff)
downloadpdfium-ced4c2bf1d0d1bab14a6145b35b3baecb175a691.tar.xz
Merge to XFA: Remove Release() combo patch.
Includes: Original Review URL: https://codereview.chromium.org/1098043002 Original Review URL: https://codereview.chromium.org/1097843003 Original Review URL: https://codereview.chromium.org/1093213002 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1092033004
Diffstat (limited to 'core/src/fpdfdoc')
-rw-r--r--core/src/fpdfdoc/doc_annot.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp
index 8952845570..3285487ca0 100644
--- a/core/src/fpdfdoc/doc_annot.cpp
+++ b/core/src/fpdfdoc/doc_annot.cpp
@@ -4,8 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "../../../third_party/base/nonstd_unique_ptr.h"
#include "../../include/fpdfdoc/fpdf_doc.h"
#include "../../include/fpdfapi/fpdf_pageobj.h"
+
CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
{
ASSERT(pPage != NULL);
@@ -323,19 +325,14 @@ CPDF_PageObject* CPDF_Annot::GetBorder(FX_BOOL bPrint, const CPDF_RenderOptions*
int B = (FX_INT32)(pColor->GetNumber(2) * 255);
argb = ArgbEncode(0xff, R, G, B);
}
- CPDF_PathObject *pPathObject = FX_NEW CPDF_PathObject();
- if (!pPathObject) {
- return NULL;
- }
+ nonstd::unique_ptr<CPDF_PathObject> pPathObject(new CPDF_PathObject());
CPDF_GraphStateData *pGraphState = pPathObject->m_GraphState.GetModify();
if (!pGraphState) {
- pPathObject->Release();
return NULL;
}
pGraphState->m_LineWidth = width;
CPDF_ColorStateData *pColorData = pPathObject->m_ColorState.GetModify();
if (!pColorData) {
- pPathObject->Release();
return NULL;
}
pColorData->m_StrokeRGB = argb;
@@ -349,7 +346,6 @@ CPDF_PageObject* CPDF_Annot::GetBorder(FX_BOOL bPrint, const CPDF_RenderOptions*
}
pGraphState->m_DashArray = FX_Alloc(FX_FLOAT, dash_count);
if (pGraphState->m_DashArray == NULL) {
- pPathObject->Release();
return NULL;
}
pGraphState->m_DashCount = dash_count;
@@ -363,7 +359,6 @@ CPDF_PageObject* CPDF_Annot::GetBorder(FX_BOOL bPrint, const CPDF_RenderOptions*
} else {
pGraphState->m_DashArray = FX_Alloc(FX_FLOAT, 2);
if (pGraphState->m_DashArray == NULL) {
- pPathObject->Release();
return NULL;
}
pGraphState->m_DashCount = 2;
@@ -378,7 +373,7 @@ CPDF_PageObject* CPDF_Annot::GetBorder(FX_BOOL bPrint, const CPDF_RenderOptions*
pPathData->AppendRect(rect.left + width, rect.bottom + width, rect.right - width, rect.top - width);
}
pPathObject->CalcBoundingBox();
- return pPathObject;
+ return pPathObject.release();
}
void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, const CFX_AffineMatrix* pUser2Device, const CPDF_RenderOptions* pOptions)
{