| 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/pdfwindow/PWL_Icon.h" | 7 #include "fpdfsdk/pdfwindow/PWL_Icon.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" |
| 11 #include "fpdfsdk/pdfwindow/PWL_Utils.h" | 11 #include "fpdfsdk/pdfwindow/PWL_Utils.h" |
| 12 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" | 12 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" |
| 13 | 13 |
| 14 CPWL_Image::CPWL_Image() : m_pPDFStream(NULL) {} | 14 CPWL_Image::CPWL_Image() : m_pPDFStream(nullptr) {} |
| 15 | 15 |
| 16 CPWL_Image::~CPWL_Image() {} | 16 CPWL_Image::~CPWL_Image() {} |
| 17 | 17 |
| 18 CFX_ByteString CPWL_Image::GetImageAppStream() { | 18 CFX_ByteString CPWL_Image::GetImageAppStream() { |
| 19 CFX_ByteTextBuf sAppStream; | 19 CFX_ByteTextBuf sAppStream; |
| 20 | 20 |
| 21 CFX_ByteString sAlias = GetImageAlias(); | 21 CFX_ByteString sAlias = GetImageAlias(); |
| 22 CFX_FloatRect rcPlate = GetClientRect(); | 22 CFX_FloatRect rcPlate = GetClientRect(); |
| 23 CFX_Matrix mt; | 23 CFX_Matrix mt; |
| 24 mt.SetReverse(GetImageMatrix()); | 24 mt.SetReverse(GetImageMatrix()); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 void CPWL_Image::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) { | 101 void CPWL_Image::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) { |
| 102 fHScale = 1.0f; | 102 fHScale = 1.0f; |
| 103 fVScale = 1.0f; | 103 fVScale = 1.0f; |
| 104 } | 104 } |
| 105 | 105 |
| 106 void CPWL_Image::GetImageOffset(FX_FLOAT& x, FX_FLOAT& y) { | 106 void CPWL_Image::GetImageOffset(FX_FLOAT& x, FX_FLOAT& y) { |
| 107 x = 0.0f; | 107 x = 0.0f; |
| 108 y = 0.0f; | 108 y = 0.0f; |
| 109 } | 109 } |
| 110 | 110 |
| 111 CPWL_Icon::CPWL_Icon() : m_pIconFit(NULL) {} | 111 CPWL_Icon::CPWL_Icon() : m_pIconFit(nullptr) {} |
| 112 | 112 |
| 113 CPWL_Icon::~CPWL_Icon() {} | 113 CPWL_Icon::~CPWL_Icon() {} |
| 114 | 114 |
| 115 int32_t CPWL_Icon::GetScaleMethod() { | 115 int32_t CPWL_Icon::GetScaleMethod() { |
| 116 if (m_pIconFit) | 116 if (m_pIconFit) |
| 117 return m_pIconFit->GetScaleMethod(); | 117 return m_pIconFit->GetScaleMethod(); |
| 118 | 118 |
| 119 return 0; | 119 return 0; |
| 120 } | 120 } |
| 121 | 121 |
| 122 FX_BOOL CPWL_Icon::IsProportionalScale() { | 122 FX_BOOL CPWL_Icon::IsProportionalScale() { |
| 123 if (m_pIconFit) | 123 if (m_pIconFit) |
| 124 return m_pIconFit->IsProportionalScale(); | 124 return m_pIconFit->IsProportionalScale(); |
| 125 | 125 |
| 126 return FALSE; | 126 return FALSE; |
| 127 } | 127 } |
| 128 | 128 |
| 129 void CPWL_Icon::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) { | 129 void CPWL_Icon::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) { |
| 130 if (m_pIconFit) { | 130 if (m_pIconFit) { |
| 131 fLeft = 0.0f; | 131 fLeft = 0.0f; |
| 132 fBottom = 0.0f; | 132 fBottom = 0.0f; |
| 133 CPDF_Array* pA = | 133 CPDF_Array* pA = m_pIconFit->GetDict() |
| 134 m_pIconFit->GetDict() ? m_pIconFit->GetDict()->GetArrayBy("A") : NULL; | 134 ? m_pIconFit->GetDict()->GetArrayBy("A") |
| 135 : nullptr; |
| 135 if (pA) { | 136 if (pA) { |
| 136 size_t dwCount = pA->GetCount(); | 137 size_t dwCount = pA->GetCount(); |
| 137 if (dwCount > 0) | 138 if (dwCount > 0) |
| 138 fLeft = pA->GetNumberAt(0); | 139 fLeft = pA->GetNumberAt(0); |
| 139 if (dwCount > 1) | 140 if (dwCount > 1) |
| 140 fBottom = pA->GetNumberAt(1); | 141 fBottom = pA->GetNumberAt(1); |
| 141 } | 142 } |
| 142 } else { | 143 } else { |
| 143 fLeft = 0.0f; | 144 fLeft = 0.0f; |
| 144 fBottom = 0.0f; | 145 fBottom = 0.0f; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 FX_FLOAT fImageFactHeight = fImageHeight * fVScale; | 210 FX_FLOAT fImageFactHeight = fImageHeight * fVScale; |
| 210 | 211 |
| 211 FX_FLOAT fPlateWidth, fPlateHeight; | 212 FX_FLOAT fPlateWidth, fPlateHeight; |
| 212 CFX_FloatRect rcPlate = GetClientRect(); | 213 CFX_FloatRect rcPlate = GetClientRect(); |
| 213 fPlateWidth = rcPlate.right - rcPlate.left; | 214 fPlateWidth = rcPlate.right - rcPlate.left; |
| 214 fPlateHeight = rcPlate.top - rcPlate.bottom; | 215 fPlateHeight = rcPlate.top - rcPlate.bottom; |
| 215 | 216 |
| 216 x = (fPlateWidth - fImageFactWidth) * fLeft; | 217 x = (fPlateWidth - fImageFactWidth) * fLeft; |
| 217 y = (fPlateHeight - fImageFactHeight) * fBottom; | 218 y = (fPlateHeight - fImageFactHeight) * fBottom; |
| 218 } | 219 } |
| OLD | NEW |