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/fpdfdoc/fpdf_ap.h" | 7 #include "core/include/fpdfdoc/fpdf_ap.h" |
8 #include "core/include/fpdfdoc/fpdf_doc.h" | 8 #include "core/include/fpdfdoc/fpdf_doc.h" |
9 #include "core/include/fpdfdoc/fpdf_vt.h" | 9 #include "core/include/fpdfdoc/fpdf_vt.h" |
10 #include "doc_utils.h" | 10 #include "doc_utils.h" |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 CPDF_Font* pDefFont = pDoc->LoadFont(pFontDict); | 326 CPDF_Font* pDefFont = pDoc->LoadFont(pFontDict); |
327 if (!pDefFont) { | 327 if (!pDefFont) { |
328 return FALSE; | 328 return FALSE; |
329 } | 329 } |
330 CPDF_Rect rcAnnot = pAnnotDict->GetRect("Rect"); | 330 CPDF_Rect rcAnnot = pAnnotDict->GetRect("Rect"); |
331 int32_t nRotate = 0; | 331 int32_t nRotate = 0; |
332 if (CPDF_Dictionary* pMKDict = pAnnotDict->GetDict("MK")) { | 332 if (CPDF_Dictionary* pMKDict = pAnnotDict->GetDict("MK")) { |
333 nRotate = pMKDict->GetInteger("R"); | 333 nRotate = pMKDict->GetInteger("R"); |
334 } | 334 } |
335 CPDF_Rect rcBBox; | 335 CPDF_Rect rcBBox; |
336 CPDF_Matrix matrix; | 336 CFX_Matrix matrix; |
337 switch (nRotate % 360) { | 337 switch (nRotate % 360) { |
338 case 0: | 338 case 0: |
339 rcBBox = CPDF_Rect(0, 0, rcAnnot.right - rcAnnot.left, | 339 rcBBox = CPDF_Rect(0, 0, rcAnnot.right - rcAnnot.left, |
340 rcAnnot.top - rcAnnot.bottom); | 340 rcAnnot.top - rcAnnot.bottom); |
341 break; | 341 break; |
342 case 90: | 342 case 90: |
343 matrix = CPDF_Matrix(0, 1, -1, 0, rcAnnot.right - rcAnnot.left, 0); | 343 matrix = CFX_Matrix(0, 1, -1, 0, rcAnnot.right - rcAnnot.left, 0); |
344 rcBBox = CPDF_Rect(0, 0, rcAnnot.top - rcAnnot.bottom, | 344 rcBBox = CPDF_Rect(0, 0, rcAnnot.top - rcAnnot.bottom, |
345 rcAnnot.right - rcAnnot.left); | 345 rcAnnot.right - rcAnnot.left); |
346 break; | 346 break; |
347 case 180: | 347 case 180: |
348 matrix = CPDF_Matrix(-1, 0, 0, -1, rcAnnot.right - rcAnnot.left, | 348 matrix = CFX_Matrix(-1, 0, 0, -1, rcAnnot.right - rcAnnot.left, |
349 rcAnnot.top - rcAnnot.bottom); | 349 rcAnnot.top - rcAnnot.bottom); |
350 rcBBox = CPDF_Rect(0, 0, rcAnnot.right - rcAnnot.left, | 350 rcBBox = CPDF_Rect(0, 0, rcAnnot.right - rcAnnot.left, |
351 rcAnnot.top - rcAnnot.bottom); | 351 rcAnnot.top - rcAnnot.bottom); |
352 break; | 352 break; |
353 case 270: | 353 case 270: |
354 matrix = CPDF_Matrix(0, -1, 1, 0, 0, rcAnnot.top - rcAnnot.bottom); | 354 matrix = CFX_Matrix(0, -1, 1, 0, 0, rcAnnot.top - rcAnnot.bottom); |
355 rcBBox = CPDF_Rect(0, 0, rcAnnot.top - rcAnnot.bottom, | 355 rcBBox = CPDF_Rect(0, 0, rcAnnot.top - rcAnnot.bottom, |
356 rcAnnot.right - rcAnnot.left); | 356 rcAnnot.right - rcAnnot.left); |
357 break; | 357 break; |
358 } | 358 } |
359 int32_t nBorderStyle = PBS_SOLID; | 359 int32_t nBorderStyle = PBS_SOLID; |
360 FX_FLOAT fBorderWidth = 1; | 360 FX_FLOAT fBorderWidth = 1; |
361 CPVT_Dash dsBorder(3, 0, 0); | 361 CPVT_Dash dsBorder(3, 0, 0); |
362 CPVT_Color crLeftTop, crRightBottom; | 362 CPVT_Color crLeftTop, crRightBottom; |
363 if (CPDF_Dictionary* pBSDict = pAnnotDict->GetDict("BS")) { | 363 if (CPDF_Dictionary* pBSDict = pAnnotDict->GetDict("BS")) { |
364 if (pBSDict->KeyExist("W")) { | 364 if (pBSDict->KeyExist("W")) { |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 << "\n"; | 926 << "\n"; |
927 break; | 927 break; |
928 case CT_CMYK: | 928 case CT_CMYK: |
929 sColorStream << color.fColor1 << " " << color.fColor2 << " " | 929 sColorStream << color.fColor1 << " " << color.fColor2 << " " |
930 << color.fColor3 << " " << color.fColor4 << " " | 930 << color.fColor3 << " " << color.fColor4 << " " |
931 << (bFillOrStroke ? "k" : "K") << "\n"; | 931 << (bFillOrStroke ? "k" : "K") << "\n"; |
932 break; | 932 break; |
933 } | 933 } |
934 return sColorStream.GetByteString(); | 934 return sColorStream.GetByteString(); |
935 } | 935 } |
OLD | NEW |