• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 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 #include "core/fpdfdoc/cpdf_icon.h"
8 
9 #include <utility>
10 
11 #include "core/fpdfapi/parser/cpdf_dictionary.h"
12 #include "core/fpdfapi/parser/cpdf_stream.h"
13 
CPDF_Icon(RetainPtr<const CPDF_Stream> pStream)14 CPDF_Icon::CPDF_Icon(RetainPtr<const CPDF_Stream> pStream)
15     : m_pStream(std::move(pStream)) {}
16 
17 CPDF_Icon::~CPDF_Icon() = default;
18 
GetImageSize() const19 CFX_SizeF CPDF_Icon::GetImageSize() const {
20   CFX_FloatRect rect = m_pStream->GetDict()->GetRectFor("BBox");
21   return {rect.right - rect.left, rect.top - rect.bottom};
22 }
23 
GetImageMatrix() const24 CFX_Matrix CPDF_Icon::GetImageMatrix() const {
25   return m_pStream->GetDict()->GetMatrixFor("Matrix");
26 }
27 
GetImageAlias() const28 ByteString CPDF_Icon::GetImageAlias() const {
29   return m_pStream->GetDict()->GetByteStringFor("Name");
30 }
31