Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Unified Diff: fpdfsdk/cpdfsdk_baannot.cpp

Issue 2498223005: Make CPDF_Array take unique_ptrs (Closed)
Patch Set: nits Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfdoc/cpdf_interform.cpp ('k') | fpdfsdk/fpdf_flatten.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/cpdfsdk_baannot.cpp
diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp
index 9436b3ba626801d9ea3392445574eea69f082ea5..ee4b55d290a8999065977335d380e9293c5cd845 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);
}
« no previous file with comments | « core/fpdfdoc/cpdf_interform.cpp ('k') | fpdfsdk/fpdf_flatten.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698