summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_baannot.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-11-16 12:26:06 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-16 12:26:06 -0800
commit8a3aa459fc5284f51bcd7e98e95bf6214f47bb67 (patch)
tree13fb383936d679aded19054f4e7a0387dd52de76 /fpdfsdk/cpdfsdk_baannot.cpp
parent14a60c50b10de1d9e4edd3629ea210a816940a75 (diff)
downloadpdfium-8a3aa459fc5284f51bcd7e98e95bf6214f47bb67.tar.xz
Make CPDF_Array take unique_ptrs
BUG= Review-Url: https://codereview.chromium.org/2498223005
Diffstat (limited to 'fpdfsdk/cpdfsdk_baannot.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_baannot.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp
index 9436b3ba62..ee4b55d290 100644
--- a/fpdfsdk/cpdfsdk_baannot.cpp
+++ b/fpdfsdk/cpdfsdk_baannot.cpp
@@ -162,7 +162,7 @@ int CPDFSDK_BAAnnot::GetStructParent() const {
void CPDFSDK_BAAnnot::SetBorderWidth(int nWidth) {
CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayFor("Border");
if (pBorder) {
- pBorder->SetAt(2, new CPDF_Number(nWidth));
+ pBorder->SetNewAt<CPDF_Number>(2, nWidth);
} else {
CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS");
if (!pBSDict) {
@@ -242,9 +242,12 @@ BorderStyle CPDFSDK_BAAnnot::GetBorderStyle() const {
void CPDFSDK_BAAnnot::SetColor(FX_COLORREF color) {
CPDF_Array* pArray = new CPDF_Array;
- pArray->AddNumber((FX_FLOAT)FXSYS_GetRValue(color) / 255.0f);
- pArray->AddNumber((FX_FLOAT)FXSYS_GetGValue(color) / 255.0f);
- pArray->AddNumber((FX_FLOAT)FXSYS_GetBValue(color) / 255.0f);
+ pArray->AddNew<CPDF_Number>(static_cast<FX_FLOAT>(FXSYS_GetRValue(color)) /
+ 255.0f);
+ pArray->AddNew<CPDF_Number>(static_cast<FX_FLOAT>(FXSYS_GetGValue(color)) /
+ 255.0f);
+ pArray->AddNew<CPDF_Number>(static_cast<FX_FLOAT>(FXSYS_GetBValue(color)) /
+ 255.0f);
m_pAnnot->GetAnnotDict()->SetFor("C", pArray);
}