Dan Sinclair | 2eddb66 | 2017-05-25 16:49:51 -0400 | [diff] [blame] | 1 | // Copyright 2017 PDFium Authors. All rights reserved. |
| 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 | |
Dan Sinclair | 24ef633 | 2017-07-24 10:52:57 -0400 | [diff] [blame] | 7 | #include "xfa/fxfa/cxfa_ffrectangle.h" |
Dan Sinclair | 2eddb66 | 2017-05-25 16:49:51 -0400 | [diff] [blame] | 8 | |
Dan Sinclair | 39628b0 | 2018-01-03 12:01:24 -0500 | [diff] [blame] | 9 | #include "xfa/fxfa/parser/cxfa_rectangle.h" |
Dan Sinclair | 0821c95 | 2017-12-14 20:09:43 +0000 | [diff] [blame] | 10 | #include "xfa/fxfa/parser/cxfa_value.h" |
| 11 | |
Dan Sinclair | f036f12 | 2018-01-25 17:33:05 +0000 | [diff] [blame] | 12 | CXFA_FFRectangle::CXFA_FFRectangle(CXFA_Node* pNode) : CXFA_FFWidget(pNode) {} |
Dan Sinclair | 2eddb66 | 2017-05-25 16:49:51 -0400 | [diff] [blame] | 13 | |
Lei Zhang | 0e744a2 | 2020-06-02 00:44:28 +0000 | [diff] [blame] | 14 | CXFA_FFRectangle::~CXFA_FFRectangle() = default; |
Dan Sinclair | 2eddb66 | 2017-05-25 16:49:51 -0400 | [diff] [blame] | 15 | |
Tom Sepez | 45eae7b | 2020-10-13 22:50:53 +0000 | [diff] [blame] | 16 | void CXFA_FFRectangle::RenderWidget(CFGAS_GEGraphics* pGS, |
Lei Zhang | 7c9d4c2 | 2017-08-17 13:53:52 -0700 | [diff] [blame] | 17 | const CFX_Matrix& matrix, |
Tom Sepez | d7b4ec0 | 2019-04-11 19:40:21 +0000 | [diff] [blame] | 18 | HighlightOption highlight) { |
Tom Sepez | aa5c0d1 | 2019-04-10 22:29:30 +0000 | [diff] [blame] | 19 | if (!HasVisibleStatus()) |
Dan Sinclair | 2eddb66 | 2017-05-25 16:49:51 -0400 | [diff] [blame] | 20 | return; |
| 21 | |
Dan Sinclair | 1983592 | 2018-01-11 14:34:56 +0000 | [diff] [blame] | 22 | CXFA_Value* value = m_pNode->GetFormValueIfExists(); |
Dan Sinclair | 0821c95 | 2017-12-14 20:09:43 +0000 | [diff] [blame] | 23 | if (!value) |
Dan Sinclair | 2eddb66 | 2017-05-25 16:49:51 -0400 | [diff] [blame] | 24 | return; |
| 25 | |
Dan Sinclair | 2eddb66 | 2017-05-25 16:49:51 -0400 | [diff] [blame] | 26 | CFX_RectF rect = GetRectWithoutRotate(); |
Dan Sinclair | 78d8410 | 2018-01-10 19:44:26 +0000 | [diff] [blame] | 27 | CXFA_Margin* margin = m_pNode->GetMarginIfExists(); |
Henrique Nakashima | 6312bf9 | 2018-05-02 21:14:27 +0000 | [diff] [blame] | 28 | XFA_RectWithoutMargin(&rect, margin); |
Dan Sinclair | 2eddb66 | 2017-05-25 16:49:51 -0400 | [diff] [blame] | 29 | |
| 30 | CFX_Matrix mtRotate = GetRotateMatrix(); |
Lei Zhang | 7c9d4c2 | 2017-08-17 13:53:52 -0700 | [diff] [blame] | 31 | mtRotate.Concat(matrix); |
Dan Sinclair | 316dd2f | 2018-01-16 15:49:16 +0000 | [diff] [blame] | 32 | DrawBorder(pGS, value->GetRectangleIfExists(), rect, mtRotate); |
Dan Sinclair | 2eddb66 | 2017-05-25 16:49:51 -0400 | [diff] [blame] | 33 | } |