| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 for (const auto& pair : m_APMap) { | 126 for (const auto& pair : m_APMap) { |
| 127 delete pair.second; | 127 delete pair.second; |
| 128 } | 128 } |
| 129 m_APMap.clear(); | 129 m_APMap.clear(); |
| 130 } | 130 } |
| 131 CFX_ByteString CPDF_Annot::GetSubType() const { | 131 CFX_ByteString CPDF_Annot::GetSubType() const { |
| 132 return m_sSubtype; | 132 return m_sSubtype; |
| 133 } | 133 } |
| 134 | 134 |
| 135 void CPDF_Annot::GetRect(CPDF_Rect& rect) const { | 135 void CPDF_Annot::GetRect(CPDF_Rect& rect) const { |
| 136 if (m_pAnnotDict == NULL) { | 136 if (!m_pAnnotDict) { |
| 137 return; | 137 return; |
| 138 } | 138 } |
| 139 rect = m_pAnnotDict->GetRect("Rect"); | 139 rect = m_pAnnotDict->GetRect("Rect"); |
| 140 rect.Normalize(); | 140 rect.Normalize(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 FX_DWORD CPDF_Annot::GetFlags() const { | 143 FX_DWORD CPDF_Annot::GetFlags() const { |
| 144 return m_pAnnotDict->GetInteger("F"); | 144 return m_pAnnotDict->GetInteger("F"); |
| 145 } | 145 } |
| 146 | 146 |
| 147 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, | 147 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, |
| 148 CPDF_Annot::AppearanceMode mode) { | 148 CPDF_Annot::AppearanceMode mode) { |
| 149 CPDF_Dictionary* pAP = pAnnotDict->GetDict("AP"); | 149 CPDF_Dictionary* pAP = pAnnotDict->GetDict("AP"); |
| 150 if (pAP == NULL) { | 150 if (!pAP) { |
| 151 return NULL; | 151 return NULL; |
| 152 } | 152 } |
| 153 const FX_CHAR* ap_entry = "N"; | 153 const FX_CHAR* ap_entry = "N"; |
| 154 if (mode == CPDF_Annot::Down) | 154 if (mode == CPDF_Annot::Down) |
| 155 ap_entry = "D"; | 155 ap_entry = "D"; |
| 156 else if (mode == CPDF_Annot::Rollover) | 156 else if (mode == CPDF_Annot::Rollover) |
| 157 ap_entry = "R"; | 157 ap_entry = "R"; |
| 158 if (!pAP->KeyExist(ap_entry)) | 158 if (!pAP->KeyExist(ap_entry)) |
| 159 ap_entry = "N"; | 159 ap_entry = "N"; |
| 160 | 160 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 if (bPrinting && (annot_flags & ANNOTFLAG_PRINT) == 0) { | 260 if (bPrinting && (annot_flags & ANNOTFLAG_PRINT) == 0) { |
| 261 return; | 261 return; |
| 262 } | 262 } |
| 263 if (!bPrinting && (annot_flags & ANNOTFLAG_NOVIEW)) { | 263 if (!bPrinting && (annot_flags & ANNOTFLAG_NOVIEW)) { |
| 264 return; | 264 return; |
| 265 } | 265 } |
| 266 CPDF_Dictionary* pBS = m_pAnnotDict->GetDict("BS"); | 266 CPDF_Dictionary* pBS = m_pAnnotDict->GetDict("BS"); |
| 267 char style_char; | 267 char style_char; |
| 268 FX_FLOAT width; | 268 FX_FLOAT width; |
| 269 CPDF_Array* pDashArray = NULL; | 269 CPDF_Array* pDashArray = NULL; |
| 270 if (pBS == NULL) { | 270 if (!pBS) { |
| 271 CPDF_Array* pBorderArray = m_pAnnotDict->GetArray("Border"); | 271 CPDF_Array* pBorderArray = m_pAnnotDict->GetArray("Border"); |
| 272 style_char = 'S'; | 272 style_char = 'S'; |
| 273 if (pBorderArray) { | 273 if (pBorderArray) { |
| 274 width = pBorderArray->GetNumber(2); | 274 width = pBorderArray->GetNumber(2); |
| 275 if (pBorderArray->GetCount() == 4) { | 275 if (pBorderArray->GetCount() == 4) { |
| 276 pDashArray = pBorderArray->GetArray(3); | 276 pDashArray = pBorderArray->GetArray(3); |
| 277 if (pDashArray == NULL) { | 277 if (!pDashArray) { |
| 278 return; | 278 return; |
| 279 } | 279 } |
| 280 int nLen = pDashArray->GetCount(); | 280 int nLen = pDashArray->GetCount(); |
| 281 int i = 0; | 281 int i = 0; |
| 282 for (; i < nLen; ++i) { | 282 for (; i < nLen; ++i) { |
| 283 CPDF_Object* pObj = pDashArray->GetElementValue(i); | 283 CPDF_Object* pObj = pDashArray->GetElementValue(i); |
| 284 if (pObj && pObj->GetInteger()) { | 284 if (pObj && pObj->GetInteger()) { |
| 285 break; | 285 break; |
| 286 } | 286 } |
| 287 } | 287 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 CPDF_PathData path; | 338 CPDF_PathData path; |
| 339 width /= 2; | 339 width /= 2; |
| 340 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, | 340 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, |
| 341 rect.top - width); | 341 rect.top - width); |
| 342 int fill_type = 0; | 342 int fill_type = 0; |
| 343 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { | 343 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { |
| 344 fill_type |= FXFILL_NOPATHSMOOTH; | 344 fill_type |= FXFILL_NOPATHSMOOTH; |
| 345 } | 345 } |
| 346 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); | 346 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); |
| 347 } | 347 } |
| OLD | NEW |