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 "fpdfsdk/include/pdfwindow/PDFWindow.h" | 7 #include "fpdfsdk/include/pdfwindow/PDFWindow.h" |
8 #include "fpdfsdk/include/pdfwindow/PWL_Icon.h" | 8 #include "fpdfsdk/include/pdfwindow/PWL_Icon.h" |
9 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" | 9 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" |
10 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" | 10 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" |
11 | 11 |
12 /* ------------------------------- CPWL_Image ---------------------------------- | 12 /* ------------------------------- CPWL_Image ---------------------------------- |
13 */ | 13 */ |
14 | 14 |
15 CPWL_Image::CPWL_Image() : m_pPDFStream(NULL) {} | 15 CPWL_Image::CPWL_Image() : m_pPDFStream(NULL) {} |
16 | 16 |
17 CPWL_Image::~CPWL_Image() {} | 17 CPWL_Image::~CPWL_Image() {} |
18 | 18 |
19 CFX_ByteString CPWL_Image::GetImageAppStream() { | 19 CFX_ByteString CPWL_Image::GetImageAppStream() { |
20 CFX_ByteTextBuf sAppStream; | 20 CFX_ByteTextBuf sAppStream; |
21 | 21 |
22 CFX_ByteString sAlias = GetImageAlias(); | 22 CFX_ByteString sAlias = GetImageAlias(); |
23 CPDF_Rect rcPlate = GetClientRect(); | 23 CPDF_Rect rcPlate = GetClientRect(); |
24 CPDF_Matrix mt; | 24 CFX_Matrix mt; |
25 mt.SetReverse(GetImageMatrix()); | 25 mt.SetReverse(GetImageMatrix()); |
26 | 26 |
27 FX_FLOAT fHScale = 1.0f; | 27 FX_FLOAT fHScale = 1.0f; |
28 FX_FLOAT fVScale = 1.0f; | 28 FX_FLOAT fVScale = 1.0f; |
29 GetScale(fHScale, fVScale); | 29 GetScale(fHScale, fVScale); |
30 | 30 |
31 FX_FLOAT fx = 0.0f; | 31 FX_FLOAT fx = 0.0f; |
32 FX_FLOAT fy = 0.0f; | 32 FX_FLOAT fy = 0.0f; |
33 GetImageOffset(fx, fy); | 33 GetImageOffset(fx, fy); |
34 | 34 |
(...skipping 30 matching lines...) Expand all Loading... |
65 if (m_pPDFStream) { | 65 if (m_pPDFStream) { |
66 if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict()) { | 66 if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict()) { |
67 CPDF_Rect rect = pDict->GetRect("BBox"); | 67 CPDF_Rect rect = pDict->GetRect("BBox"); |
68 | 68 |
69 fWidth = rect.right - rect.left; | 69 fWidth = rect.right - rect.left; |
70 fHeight = rect.top - rect.bottom; | 70 fHeight = rect.top - rect.bottom; |
71 } | 71 } |
72 } | 72 } |
73 } | 73 } |
74 | 74 |
75 CPDF_Matrix CPWL_Image::GetImageMatrix() { | 75 CFX_Matrix CPWL_Image::GetImageMatrix() { |
76 if (m_pPDFStream) { | 76 if (m_pPDFStream) { |
77 if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict()) { | 77 if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict()) { |
78 return pDict->GetMatrix("Matrix"); | 78 return pDict->GetMatrix("Matrix"); |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 return CPDF_Matrix(); | 82 return CFX_Matrix(); |
83 } | 83 } |
84 | 84 |
85 CFX_ByteString CPWL_Image::GetImageAlias() { | 85 CFX_ByteString CPWL_Image::GetImageAlias() { |
86 if (m_sImageAlias.IsEmpty()) { | 86 if (m_sImageAlias.IsEmpty()) { |
87 if (m_pPDFStream) { | 87 if (m_pPDFStream) { |
88 if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict()) { | 88 if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict()) { |
89 return pDict->GetString("Name"); | 89 return pDict->GetString("Name"); |
90 } | 90 } |
91 } | 91 } |
92 } else | 92 } else |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 FX_FLOAT fImageFactHeight = fImageHeight * fVScale; | 221 FX_FLOAT fImageFactHeight = fImageHeight * fVScale; |
222 | 222 |
223 FX_FLOAT fPlateWidth, fPlateHeight; | 223 FX_FLOAT fPlateWidth, fPlateHeight; |
224 CPDF_Rect rcPlate = GetClientRect(); | 224 CPDF_Rect rcPlate = GetClientRect(); |
225 fPlateWidth = rcPlate.right - rcPlate.left; | 225 fPlateWidth = rcPlate.right - rcPlate.left; |
226 fPlateHeight = rcPlate.top - rcPlate.bottom; | 226 fPlateHeight = rcPlate.top - rcPlate.bottom; |
227 | 227 |
228 x = (fPlateWidth - fImageFactWidth) * fLeft; | 228 x = (fPlateWidth - fImageFactWidth) * fLeft; |
229 y = (fPlateHeight - fImageFactHeight) * fBottom; | 229 y = (fPlateHeight - fImageFactHeight) * fBottom; |
230 } | 230 } |
OLD | NEW |