OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "core/include/fpdfapi/fpdf_pageobj.h" | 7 #include "core/include/fpdfapi/fpdf_pageobj.h" |
8 #include "core/include/fpdfdoc/fpdf_doc.h" | 8 #include "core/include/fpdfdoc/fpdf_doc.h" |
9 #include "third_party/base/nonstd_unique_ptr.h" | 9 #include "third_party/base/nonstd_unique_ptr.h" |
10 | 10 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 m_APMap.GetNextAssoc(pos, pForm, pObjects); | 130 m_APMap.GetNextAssoc(pos, pForm, pObjects); |
131 delete (CPDF_PageObjects*)pObjects; | 131 delete (CPDF_PageObjects*)pObjects; |
132 } | 132 } |
133 m_APMap.RemoveAll(); | 133 m_APMap.RemoveAll(); |
134 } | 134 } |
135 CFX_ByteString CPDF_Annot::GetSubType() const { | 135 CFX_ByteString CPDF_Annot::GetSubType() const { |
136 return m_sSubtype; | 136 return m_sSubtype; |
137 } | 137 } |
138 | 138 |
139 void CPDF_Annot::GetRect(CPDF_Rect& rect) const { | 139 void CPDF_Annot::GetRect(CPDF_Rect& rect) const { |
140 if (m_pAnnotDict == NULL) { | 140 if (!m_pAnnotDict) { |
141 return; | 141 return; |
142 } | 142 } |
143 rect = m_pAnnotDict->GetRect("Rect"); | 143 rect = m_pAnnotDict->GetRect("Rect"); |
144 rect.Normalize(); | 144 rect.Normalize(); |
145 } | 145 } |
146 | 146 |
147 FX_DWORD CPDF_Annot::GetFlags() const { | 147 FX_DWORD CPDF_Annot::GetFlags() const { |
148 return m_pAnnotDict->GetInteger("F"); | 148 return m_pAnnotDict->GetInteger("F"); |
149 } | 149 } |
150 | 150 |
151 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, | 151 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, |
152 CPDF_Annot::AppearanceMode mode) { | 152 CPDF_Annot::AppearanceMode mode) { |
153 CPDF_Dictionary* pAP = pAnnotDict->GetDict("AP"); | 153 CPDF_Dictionary* pAP = pAnnotDict->GetDict("AP"); |
154 if (pAP == NULL) { | 154 if (!pAP) { |
155 return NULL; | 155 return NULL; |
156 } | 156 } |
157 const FX_CHAR* ap_entry = "N"; | 157 const FX_CHAR* ap_entry = "N"; |
158 if (mode == CPDF_Annot::Down) | 158 if (mode == CPDF_Annot::Down) |
159 ap_entry = "D"; | 159 ap_entry = "D"; |
160 else if (mode == CPDF_Annot::Rollover) | 160 else if (mode == CPDF_Annot::Rollover) |
161 ap_entry = "R"; | 161 ap_entry = "R"; |
162 if (!pAP->KeyExist(ap_entry)) | 162 if (!pAP->KeyExist(ap_entry)) |
163 ap_entry = "N"; | 163 ap_entry = "N"; |
164 | 164 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 if (bPrinting && (annot_flags & ANNOTFLAG_PRINT) == 0) { | 264 if (bPrinting && (annot_flags & ANNOTFLAG_PRINT) == 0) { |
265 return; | 265 return; |
266 } | 266 } |
267 if (!bPrinting && (annot_flags & ANNOTFLAG_NOVIEW)) { | 267 if (!bPrinting && (annot_flags & ANNOTFLAG_NOVIEW)) { |
268 return; | 268 return; |
269 } | 269 } |
270 CPDF_Dictionary* pBS = m_pAnnotDict->GetDict("BS"); | 270 CPDF_Dictionary* pBS = m_pAnnotDict->GetDict("BS"); |
271 char style_char; | 271 char style_char; |
272 FX_FLOAT width; | 272 FX_FLOAT width; |
273 CPDF_Array* pDashArray = NULL; | 273 CPDF_Array* pDashArray = NULL; |
274 if (pBS == NULL) { | 274 if (!pBS) { |
275 CPDF_Array* pBorderArray = m_pAnnotDict->GetArray("Border"); | 275 CPDF_Array* pBorderArray = m_pAnnotDict->GetArray("Border"); |
276 style_char = 'S'; | 276 style_char = 'S'; |
277 if (pBorderArray) { | 277 if (pBorderArray) { |
278 width = pBorderArray->GetNumber(2); | 278 width = pBorderArray->GetNumber(2); |
279 if (pBorderArray->GetCount() == 4) { | 279 if (pBorderArray->GetCount() == 4) { |
280 pDashArray = pBorderArray->GetArray(3); | 280 pDashArray = pBorderArray->GetArray(3); |
281 if (pDashArray == NULL) { | 281 if (!pDashArray) { |
282 return; | 282 return; |
283 } | 283 } |
284 int nLen = pDashArray->GetCount(); | 284 int nLen = pDashArray->GetCount(); |
285 int i = 0; | 285 int i = 0; |
286 for (; i < nLen; ++i) { | 286 for (; i < nLen; ++i) { |
287 CPDF_Object* pObj = pDashArray->GetElementValue(i); | 287 CPDF_Object* pObj = pDashArray->GetElementValue(i); |
288 if (pObj && pObj->GetInteger()) { | 288 if (pObj && pObj->GetInteger()) { |
289 break; | 289 break; |
290 } | 290 } |
291 } | 291 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 CPDF_PathData path; | 342 CPDF_PathData path; |
343 width /= 2; | 343 width /= 2; |
344 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, | 344 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, |
345 rect.top - width); | 345 rect.top - width); |
346 int fill_type = 0; | 346 int fill_type = 0; |
347 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { | 347 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { |
348 fill_type |= FXFILL_NOPATHSMOOTH; | 348 fill_type |= FXFILL_NOPATHSMOOTH; |
349 } | 349 } |
350 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); | 350 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); |
351 } | 351 } |
OLD | NEW |