Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(857)

Side by Side Diff: fpdfsdk/src/pdfwindow/PWL_Signature.cpp

Issue 1737593006: Re-land "Replace CPDF_Rect and CPDF_Point with CFX types." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Ooops. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/PWL_Icon.h" 7 #include "fpdfsdk/include/pdfwindow/PWL_Icon.h"
8 #include "fpdfsdk/include/pdfwindow/PWL_Label.h" 8 #include "fpdfsdk/include/pdfwindow/PWL_Label.h"
9 #include "fpdfsdk/include/pdfwindow/PWL_Signature.h" 9 #include "fpdfsdk/include/pdfwindow/PWL_Signature.h"
10 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" 10 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
11 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" 11 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
12 12
13 CPWL_Signature_Image::CPWL_Signature_Image() : m_pImage(NULL) {} 13 CPWL_Signature_Image::CPWL_Signature_Image() : m_pImage(NULL) {}
14 14
15 CPWL_Signature_Image::~CPWL_Signature_Image() {} 15 CPWL_Signature_Image::~CPWL_Signature_Image() {}
16 16
17 void CPWL_Signature_Image::SetImage(CFX_DIBSource* pImage) { 17 void CPWL_Signature_Image::SetImage(CFX_DIBSource* pImage) {
18 m_pImage = pImage; 18 m_pImage = pImage;
19 } 19 }
20 20
21 CFX_DIBSource* CPWL_Signature_Image::GetImage() { 21 CFX_DIBSource* CPWL_Signature_Image::GetImage() {
22 return m_pImage; 22 return m_pImage;
23 } 23 }
24 24
25 void CPWL_Signature_Image::DrawThisAppearance(CFX_RenderDevice* pDevice, 25 void CPWL_Signature_Image::DrawThisAppearance(CFX_RenderDevice* pDevice,
26 CFX_Matrix* pUser2Device) { 26 CFX_Matrix* pUser2Device) {
27 CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); 27 CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);
28 28
29 if (m_pImage) { 29 if (m_pImage) {
30 CPDF_Rect rcClient = GetClientRect(); 30 CFX_FloatRect rcClient = GetClientRect();
31 31
32 FX_FLOAT x, y; 32 FX_FLOAT x, y;
33 pUser2Device->Transform(rcClient.left, rcClient.top, x, y); 33 pUser2Device->Transform(rcClient.left, rcClient.top, x, y);
34 34
35 pDevice->StretchDIBits(m_pImage, (int32_t)x, (int32_t)y, 35 pDevice->StretchDIBits(m_pImage, (int32_t)x, (int32_t)y,
36 (int32_t)rcClient.Width(), 36 (int32_t)rcClient.Width(),
37 (int32_t)rcClient.Height()); 37 (int32_t)rcClient.Height());
38 } 38 }
39 } 39 }
40 40
41 void CPWL_Signature_Image::GetThisAppearanceStream( 41 void CPWL_Signature_Image::GetThisAppearanceStream(
42 CFX_ByteTextBuf& sAppStream) { 42 CFX_ByteTextBuf& sAppStream) {
43 sAppStream << CPWL_Image::GetImageAppStream(); 43 sAppStream << CPWL_Image::GetImageAppStream();
44 } 44 }
45 45
46 void CPWL_Signature_Image::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) { 46 void CPWL_Signature_Image::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) {
47 FX_FLOAT fImageW, fImageH; 47 FX_FLOAT fImageW, fImageH;
48 48
49 GetImageSize(fImageW, fImageH); 49 GetImageSize(fImageW, fImageH);
50 50
51 CPDF_Rect rcClient = GetClientRect(); 51 CFX_FloatRect rcClient = GetClientRect();
52 52
53 fHScale = rcClient.Width() / fImageW; 53 fHScale = rcClient.Width() / fImageW;
54 fVScale = rcClient.Height() / fImageH; 54 fVScale = rcClient.Height() / fImageH;
55 } 55 }
56 56
57 CPWL_Signature::CPWL_Signature() 57 CPWL_Signature::CPWL_Signature()
58 : m_pText(NULL), 58 : m_pText(NULL),
59 m_pDescription(NULL), 59 m_pDescription(NULL),
60 m_pImage(NULL), 60 m_pImage(NULL),
61 m_bTextExist(TRUE), 61 m_bTextExist(TRUE),
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 void CPWL_Signature::SetImageStream(CPDF_Stream* pStream, 101 void CPWL_Signature::SetImageStream(CPDF_Stream* pStream,
102 const FX_CHAR* sImageAlias) { 102 const FX_CHAR* sImageAlias) {
103 m_pImage->SetPDFStream(pStream); 103 m_pImage->SetPDFStream(pStream);
104 m_pImage->SetImageAlias(sImageAlias); 104 m_pImage->SetImageAlias(sImageAlias);
105 105
106 RePosChildWnd(); 106 RePosChildWnd();
107 } 107 }
108 108
109 void CPWL_Signature::RePosChildWnd() { 109 void CPWL_Signature::RePosChildWnd() {
110 CPDF_Rect rcClient = GetClientRect(); 110 CFX_FloatRect rcClient = GetClientRect();
111 111
112 CPDF_Rect rcText = rcClient; 112 CFX_FloatRect rcText = rcClient;
113 CPDF_Rect rcDescription = rcClient; 113 CFX_FloatRect rcDescription = rcClient;
114 114
115 FX_BOOL bTextVisible = m_bTextExist && m_pText->GetText().GetLength() > 0; 115 FX_BOOL bTextVisible = m_bTextExist && m_pText->GetText().GetLength() > 0;
116 116
117 if ((bTextVisible || m_bImageExist) && 117 if ((bTextVisible || m_bImageExist) &&
118 m_pDescription->GetText().GetLength() > 0) { 118 m_pDescription->GetText().GetLength() > 0) {
119 if (rcClient.Width() >= rcClient.Height()) { 119 if (rcClient.Width() >= rcClient.Height()) {
120 rcText.right = rcText.left + rcClient.Width() / 2.0f; 120 rcText.right = rcText.left + rcClient.Width() / 2.0f;
121 rcDescription.left = rcDescription.right - rcClient.Width() / 2.0f; 121 rcDescription.left = rcDescription.right - rcClient.Width() / 2.0f;
122 } else { 122 } else {
123 rcText.bottom = rcText.top - rcClient.Height() / 2.0f; 123 rcText.bottom = rcText.top - rcClient.Height() / 2.0f;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 pDevice, pUser2Device, PWL_ICONTYPE_FOXIT, 167 pDevice, pUser2Device, PWL_ICONTYPE_FOXIT,
168 CPWL_Utils::GetCenterSquare(GetClientRect()), 168 CPWL_Utils::GetCenterSquare(GetClientRect()),
169 CPWL_Color(COLORTYPE_RGB, 0.91f, 0.855f, 0.92f), 169 CPWL_Color(COLORTYPE_RGB, 0.91f, 0.855f, 0.92f),
170 CPWL_Color(COLORTYPE_TRANSPARENT), 255); 170 CPWL_Color(COLORTYPE_TRANSPARENT), 255);
171 } 171 }
172 } 172 }
173 173
174 void CPWL_Signature::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { 174 void CPWL_Signature::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
175 CPWL_Wnd::GetThisAppearanceStream(sAppStream); 175 CPWL_Wnd::GetThisAppearanceStream(sAppStream);
176 } 176 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698