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/include/pdfwindow/PDFWindow.h" | 7 #include "fpdfsdk/include/pdfwindow/PDFWindow.h" |
8 #include "fpdfsdk/include/pdfwindow/PWL_Icon.h" | 8 #include "fpdfsdk/include/pdfwindow/PWL_Icon.h" |
9 #include "fpdfsdk/include/pdfwindow/PWL_Label.h" | 9 #include "fpdfsdk/include/pdfwindow/PWL_Label.h" |
10 #include "fpdfsdk/include/pdfwindow/PWL_Signature.h" | 10 #include "fpdfsdk/include/pdfwindow/PWL_Signature.h" |
11 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" | 11 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" |
12 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" | 12 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" |
13 | 13 |
14 /* --------------------------------- CPWL_Signature_Image | 14 /* --------------------------------- CPWL_Signature_Image |
15 * --------------------------------- */ | 15 * --------------------------------- */ |
16 | 16 |
17 CPWL_Signature_Image::CPWL_Signature_Image() : m_pImage(NULL) {} | 17 CPWL_Signature_Image::CPWL_Signature_Image() : m_pImage(NULL) {} |
18 | 18 |
19 CPWL_Signature_Image::~CPWL_Signature_Image() {} | 19 CPWL_Signature_Image::~CPWL_Signature_Image() {} |
20 | 20 |
21 void CPWL_Signature_Image::SetImage(CFX_DIBSource* pImage) { | 21 void CPWL_Signature_Image::SetImage(CFX_DIBSource* pImage) { |
22 m_pImage = pImage; | 22 m_pImage = pImage; |
23 } | 23 } |
24 | 24 |
25 CFX_DIBSource* CPWL_Signature_Image::GetImage() { | 25 CFX_DIBSource* CPWL_Signature_Image::GetImage() { |
26 return m_pImage; | 26 return m_pImage; |
27 } | 27 } |
28 | 28 |
29 void CPWL_Signature_Image::DrawThisAppearance(CFX_RenderDevice* pDevice, | 29 void CPWL_Signature_Image::DrawThisAppearance(CFX_RenderDevice* pDevice, |
30 CPDF_Matrix* pUser2Device) { | 30 CFX_Matrix* pUser2Device) { |
31 CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); | 31 CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); |
32 | 32 |
33 if (m_pImage) { | 33 if (m_pImage) { |
34 CPDF_Rect rcClient = GetClientRect(); | 34 CPDF_Rect rcClient = GetClientRect(); |
35 | 35 |
36 FX_FLOAT x, y; | 36 FX_FLOAT x, y; |
37 pUser2Device->Transform(rcClient.left, rcClient.top, x, y); | 37 pUser2Device->Transform(rcClient.left, rcClient.top, x, y); |
38 | 38 |
39 pDevice->StretchDIBits(m_pImage, (int32_t)x, (int32_t)y, | 39 pDevice->StretchDIBits(m_pImage, (int32_t)x, (int32_t)y, |
40 (int32_t)rcClient.Width(), | 40 (int32_t)rcClient.Width(), |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 m_pDescription = new CPWL_Label; | 159 m_pDescription = new CPWL_Label; |
160 PWL_CREATEPARAM dcp = cp; | 160 PWL_CREATEPARAM dcp = cp; |
161 dcp.pParentWnd = this; | 161 dcp.pParentWnd = this; |
162 dcp.dwFlags = PWS_CHILD | PWS_VISIBLE | PWS_AUTOFONTSIZE | PES_MULTILINE | | 162 dcp.dwFlags = PWS_CHILD | PWS_VISIBLE | PWS_AUTOFONTSIZE | PES_MULTILINE | |
163 PES_AUTORETURN | PES_LEFT | PES_CENTER; | 163 PES_AUTORETURN | PES_LEFT | PES_CENTER; |
164 dcp.sTextColor = CPWL_Color(COLORTYPE_GRAY, 0); | 164 dcp.sTextColor = CPWL_Color(COLORTYPE_GRAY, 0); |
165 m_pDescription->Create(dcp); | 165 m_pDescription->Create(dcp); |
166 } | 166 } |
167 | 167 |
168 void CPWL_Signature::DrawThisAppearance(CFX_RenderDevice* pDevice, | 168 void CPWL_Signature::DrawThisAppearance(CFX_RenderDevice* pDevice, |
169 CPDF_Matrix* pUser2Device) { | 169 CFX_Matrix* pUser2Device) { |
170 CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); | 170 CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); |
171 | 171 |
172 if (m_bFlagExist) | 172 if (m_bFlagExist) |
173 CPWL_Utils::DrawIconAppStream( | 173 CPWL_Utils::DrawIconAppStream( |
174 pDevice, pUser2Device, PWL_ICONTYPE_FOXIT, | 174 pDevice, pUser2Device, PWL_ICONTYPE_FOXIT, |
175 CPWL_Utils::GetCenterSquare(GetClientRect()), | 175 CPWL_Utils::GetCenterSquare(GetClientRect()), |
176 CPWL_Color(COLORTYPE_RGB, 0.91f, 0.855f, 0.92f), | 176 CPWL_Color(COLORTYPE_RGB, 0.91f, 0.855f, 0.92f), |
177 CPWL_Color(COLORTYPE_TRANSPARENT), 255); | 177 CPWL_Color(COLORTYPE_TRANSPARENT), 255); |
178 | 178 |
179 /* | 179 /* |
(...skipping 15 matching lines...) Expand all Loading... |
195 | 195 |
196 gsd.m_LineWidth = 10.0f; | 196 gsd.m_LineWidth = 10.0f; |
197 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEncode(255,255,0,0), | 197 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEncode(255,255,0,0), |
198 FXFILL_ALTERNATE); | 198 FXFILL_ALTERNATE); |
199 */ | 199 */ |
200 } | 200 } |
201 | 201 |
202 void CPWL_Signature::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { | 202 void CPWL_Signature::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { |
203 CPWL_Wnd::GetThisAppearanceStream(sAppStream); | 203 CPWL_Wnd::GetThisAppearanceStream(sAppStream); |
204 } | 204 } |
OLD | NEW |