diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-07-20 11:08:03 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-20 15:52:52 +0000 |
commit | dc11ec85ebf637efe99dd9195a2a6a52c3e4d48f (patch) | |
tree | c534ee86ebfc63474d77292cc6780c8c65d19e57 /fpdfsdk/pdfwindow/cpwl_icon.h | |
parent | 14ddd425193946692042fcd910857963d333be3b (diff) | |
download | pdfium-dc11ec85ebf637efe99dd9195a2a6a52c3e4d48f.tar.xz |
Cleanup CPWL_Icon AppStream generation
This CL moves the AppSteam generation code for CPWL_Icon to a separate
method. The CPWL_Image code is also folded directly into CPWL_Icon as it
is the only subclass.
Change-Id: I7936bac4af76e34d0f73d48ca00f5713c5f20095
Reviewed-on: https://pdfium-review.googlesource.com/8314
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/pdfwindow/cpwl_icon.h')
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_icon.h | 47 |
1 files changed, 18 insertions, 29 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_icon.h b/fpdfsdk/pdfwindow/cpwl_icon.h index 0b82a4b5d6..e97c540bf6 100644 --- a/fpdfsdk/pdfwindow/cpwl_icon.h +++ b/fpdfsdk/pdfwindow/cpwl_icon.h @@ -7,48 +7,37 @@ #ifndef FPDFSDK_PDFWINDOW_CPWL_ICON_H_ #define FPDFSDK_PDFWINDOW_CPWL_ICON_H_ +#include <utility> + #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_string.h" #include "fpdfsdk/pdfwindow/cpwl_wnd.h" -class CPWL_Image : public CPWL_Wnd { - public: - CPWL_Image(); - ~CPWL_Image() override; - - virtual void GetScale(float& fHScale, float& fVScale); - virtual void GetImageOffset(float& x, float& y); - - CPDF_Stream* GetPDFStream() const; - void SetPDFStream(CPDF_Stream* pStream); - void GetImageSize(float& fWidth, float& fHeight); - CFX_Matrix GetImageMatrix(); - CFX_ByteString GetImageAlias(); - void SetImageAlias(const char* sImageAlias); - - protected: - CFX_UnownedPtr<CPDF_Stream> m_pPDFStream; - CFX_ByteString m_sImageAlias; -}; - -class CPWL_Icon : public CPWL_Image { +class CPWL_Icon : public CPWL_Wnd { public: CPWL_Icon(); ~CPWL_Icon() override; - CPDF_IconFit* GetIconFit() const; + void SetIconFit(CPDF_IconFit* pIconFit) { m_pIconFit = pIconFit; } + void SetPDFStream(CPDF_Stream* pStream) { m_pPDFStream = pStream; } - // CPWL_Image - void GetScale(float& fHScale, float& fVScale) override; - void GetImageOffset(float& x, float& y) override; + // horizontal scale, vertical scale + std::pair<float, float> GetScale(); - int32_t GetScaleMethod(); - bool IsProportionalScale(); - void GetIconPosition(float& fLeft, float& fBottom); + // x, y + std::pair<float, float> GetImageOffset(); - void SetIconFit(CPDF_IconFit* pIconFit) { m_pIconFit = pIconFit; } + CFX_Matrix GetImageMatrix(); + CFX_ByteString GetImageAlias(); private: + // left, bottom + std::pair<float, float> GetIconPosition(); + + // width, height + std::pair<float, float> GetImageSize(); + + CFX_UnownedPtr<CPDF_Stream> m_pPDFStream; CFX_UnownedPtr<CPDF_IconFit> m_pIconFit; }; |