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

Unified Diff: fpdfsdk/fpdfeditpage.cpp

Issue 2425003002: FPDFPage_TransformAnnots(): don't re-insert unowned object on top of itself (Closed)
Patch Set: Created 4 years, 2 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdfeditpage.cpp
diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp
index 78790f7ce690da1acb97b042d45ac035192d7883..0b20a006a7b25ba99875537ac5aa047cb45f6e7f 100644
--- a/fpdfsdk/fpdfeditpage.cpp
+++ b/fpdfsdk/fpdfeditpage.cpp
@@ -289,22 +289,22 @@ DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page,
CPDF_AnnotList AnnotList(pPage);
for (size_t i = 0; i < AnnotList.Count(); ++i) {
CPDF_Annot* pAnnot = AnnotList.GetAt(i);
- // transformAnnots Rectangle
- CFX_FloatRect rect = pAnnot->GetRect();
+ CFX_FloatRect rect = pAnnot->GetRect(); // transformAnnots Rectangle
CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d,
(FX_FLOAT)e, (FX_FLOAT)f);
rect.Transform(&matrix);
+
CPDF_Array* pRectArray = pAnnot->GetAnnotDict()->GetArrayFor("Rect");
- if (!pRectArray)
+ if (!pRectArray) {
pRectArray = new CPDF_Array;
+ pAnnot->GetAnnotDict()->SetFor("Rect", pRectArray);
+ }
pRectArray->SetAt(0, new CPDF_Number(rect.left));
pRectArray->SetAt(1, new CPDF_Number(rect.bottom));
pRectArray->SetAt(2, new CPDF_Number(rect.right));
pRectArray->SetAt(3, new CPDF_Number(rect.top));
- pAnnot->GetAnnotDict()->SetFor("Rect", pRectArray);
- // Transform AP's rectangle
- // To Do
+ // TODO: Transform AP's rectangle
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698