1 // Copyright 2016 The PDFium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef CORE_FPDFDOC_CPDF_ICONFIT_H_ 8 #define CORE_FPDFDOC_CPDF_ICONFIT_H_ 9 10 #include "core/fxcrt/fx_coordinates.h" 11 #include "core/fxcrt/retain_ptr.h" 12 13 class CPDF_Dictionary; 14 15 class CPDF_IconFit { 16 public: 17 enum class ScaleMethod { kAlways = 0, kBigger, kSmaller, kNever }; 18 19 explicit CPDF_IconFit(RetainPtr<const CPDF_Dictionary> pDict); 20 CPDF_IconFit(const CPDF_IconFit& that); 21 ~CPDF_IconFit(); 22 23 ScaleMethod GetScaleMethod() const; 24 bool IsProportionalScale() const; 25 bool GetFittingBounds() const; 26 CFX_PointF GetIconBottomLeftPosition() const; 27 CFX_VectorF GetScale(const CFX_SizeF& image_size, 28 const CFX_FloatRect& rcPlate) const; 29 CFX_VectorF GetImageOffset(const CFX_SizeF& image_size, 30 const CFX_VectorF& scale, 31 const CFX_FloatRect& rcPlate) const; 32 33 private: 34 CFX_PointF GetIconPosition() const; 35 36 RetainPtr<const CPDF_Dictionary> const m_pDict; 37 }; 38 39 #endif // CORE_FPDFDOC_CPDF_ICONFIT_H_ 40