blob: e578cccba0e862b6cc6c5ac8367ec0aa0325d2ec [file] [log] [blame]
Dan Sinclair2eddb662017-05-25 16:49:51 -04001// 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 Sinclair24ef6332017-07-24 10:52:57 -04007#include "xfa/fxfa/cxfa_ffrectangle.h"
Dan Sinclair2eddb662017-05-25 16:49:51 -04008
Dan Sinclair39628b02018-01-03 12:01:24 -05009#include "xfa/fxfa/parser/cxfa_rectangle.h"
Dan Sinclair0821c952017-12-14 20:09:43 +000010#include "xfa/fxfa/parser/cxfa_value.h"
11
Dan Sinclairf036f122018-01-25 17:33:05 +000012CXFA_FFRectangle::CXFA_FFRectangle(CXFA_Node* pNode) : CXFA_FFWidget(pNode) {}
Dan Sinclair2eddb662017-05-25 16:49:51 -040013
Lei Zhang0e744a22020-06-02 00:44:28 +000014CXFA_FFRectangle::~CXFA_FFRectangle() = default;
Dan Sinclair2eddb662017-05-25 16:49:51 -040015
Tom Sepez45eae7b2020-10-13 22:50:53 +000016void CXFA_FFRectangle::RenderWidget(CFGAS_GEGraphics* pGS,
Lei Zhang7c9d4c22017-08-17 13:53:52 -070017 const CFX_Matrix& matrix,
Tom Sepezd7b4ec02019-04-11 19:40:21 +000018 HighlightOption highlight) {
Tom Sepezaa5c0d12019-04-10 22:29:30 +000019 if (!HasVisibleStatus())
Dan Sinclair2eddb662017-05-25 16:49:51 -040020 return;
21
Dan Sinclair19835922018-01-11 14:34:56 +000022 CXFA_Value* value = m_pNode->GetFormValueIfExists();
Dan Sinclair0821c952017-12-14 20:09:43 +000023 if (!value)
Dan Sinclair2eddb662017-05-25 16:49:51 -040024 return;
25
Dan Sinclair2eddb662017-05-25 16:49:51 -040026 CFX_RectF rect = GetRectWithoutRotate();
Dan Sinclair78d84102018-01-10 19:44:26 +000027 CXFA_Margin* margin = m_pNode->GetMarginIfExists();
Henrique Nakashima6312bf92018-05-02 21:14:27 +000028 XFA_RectWithoutMargin(&rect, margin);
Dan Sinclair2eddb662017-05-25 16:49:51 -040029
30 CFX_Matrix mtRotate = GetRotateMatrix();
Lei Zhang7c9d4c22017-08-17 13:53:52 -070031 mtRotate.Concat(matrix);
Dan Sinclair316dd2f2018-01-16 15:49:16 +000032 DrawBorder(pGS, value->GetRectangleIfExists(), rect, mtRotate);
Dan Sinclair2eddb662017-05-25 16:49:51 -040033}