diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-11-07 20:10:51 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-07 20:10:51 +0000 |
commit | d32fa8b75a3af1cddc4517a3085a43f7a3544c90 (patch) | |
tree | 43c5c228589d768e5b66f71e0991c075826c4e2f /xfa/fxfa/parser/cxfa_fill.cpp | |
parent | c8be4ce787252eaf3b03270bc99fe1e9e9044543 (diff) | |
download | pdfium-d32fa8b75a3af1cddc4517a3085a43f7a3544c90.tar.xz |
Rename CXFA_Fill to CXFA_FillData
This CL renames CXFA_Fill to CXFA_FillData to show it is part of the
data hierarchy.
Change-Id: I4f1f3e83621dee4f9ccddb3b3d04785d094315b8
Reviewed-on: https://pdfium-review.googlesource.com/17981
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_fill.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_fill.cpp | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/xfa/fxfa/parser/cxfa_fill.cpp b/xfa/fxfa/parser/cxfa_fill.cpp deleted file mode 100644 index 8430b254a8..0000000000 --- a/xfa/fxfa/parser/cxfa_fill.cpp +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fxfa/parser/cxfa_fill.h" - -#include "xfa/fxfa/parser/cxfa_node.h" - -CXFA_Fill::CXFA_Fill(CXFA_Node* pNode) : CXFA_Data(pNode) {} - -CXFA_Fill::~CXFA_Fill() {} - -int32_t CXFA_Fill::GetPresence() { - return m_pNode->JSNode()->GetEnum(XFA_ATTRIBUTE_Presence); -} - -void CXFA_Fill::SetColor(FX_ARGB color) { - CXFA_Node* pNode = - m_pNode->JSNode()->GetProperty(0, XFA_Element::Color, true); - WideString wsColor; - int a; - int r; - int g; - int b; - std::tie(a, r, g, b) = ArgbDecode(color); - wsColor.Format(L"%d,%d,%d", r, g, b); - pNode->JSNode()->SetCData(XFA_ATTRIBUTE_Value, wsColor, false, false); -} - -FX_ARGB CXFA_Fill::GetColor(bool bText) { - if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Color, false)) { - WideStringView wsColor; - if (pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Value, wsColor, false)) - return CXFA_Data::ToColor(wsColor); - } - if (bText) - return 0xFF000000; - return 0xFFFFFFFF; -} - -XFA_Element CXFA_Fill::GetFillType() { - CXFA_Node* pChild = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); - while (pChild) { - XFA_Element eType = pChild->GetElementType(); - if (eType != XFA_Element::Color && eType != XFA_Element::Extras) - return eType; - - pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); - } - return XFA_Element::Solid; -} - -int32_t CXFA_Fill::GetPattern(FX_ARGB& foreColor) { - CXFA_Node* pNode = - m_pNode->JSNode()->GetProperty(0, XFA_Element::Pattern, true); - if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color, false)) { - WideStringView wsColor; - pColor->JSNode()->TryCData(XFA_ATTRIBUTE_Value, wsColor, false); - foreColor = CXFA_Data::ToColor(wsColor); - } else { - foreColor = 0xFF000000; - } - return pNode->JSNode()->GetEnum(XFA_ATTRIBUTE_Type); -} - -int32_t CXFA_Fill::GetStipple(FX_ARGB& stippleColor) { - CXFA_Node* pNode = - m_pNode->JSNode()->GetProperty(0, XFA_Element::Stipple, true); - int32_t eAttr = 50; - pNode->JSNode()->TryInteger(XFA_ATTRIBUTE_Rate, eAttr, true); - if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color, false)) { - WideStringView wsColor; - pColor->JSNode()->TryCData(XFA_ATTRIBUTE_Value, wsColor, false); - stippleColor = CXFA_Data::ToColor(wsColor); - } else { - stippleColor = 0xFF000000; - } - return eAttr; -} - -int32_t CXFA_Fill::GetLinear(FX_ARGB& endColor) { - CXFA_Node* pNode = - m_pNode->JSNode()->GetProperty(0, XFA_Element::Linear, true); - XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_ToRight; - pNode->JSNode()->TryEnum(XFA_ATTRIBUTE_Type, eAttr, true); - if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color, false)) { - WideStringView wsColor; - pColor->JSNode()->TryCData(XFA_ATTRIBUTE_Value, wsColor, false); - endColor = CXFA_Data::ToColor(wsColor); - } else { - endColor = 0xFF000000; - } - return eAttr; -} - -int32_t CXFA_Fill::GetRadial(FX_ARGB& endColor) { - CXFA_Node* pNode = - m_pNode->JSNode()->GetProperty(0, XFA_Element::Radial, true); - XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_ToEdge; - pNode->JSNode()->TryEnum(XFA_ATTRIBUTE_Type, eAttr, true); - if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color, false)) { - WideStringView wsColor; - pColor->JSNode()->TryCData(XFA_ATTRIBUTE_Value, wsColor, false); - endColor = CXFA_Data::ToColor(wsColor); - } else { - endColor = 0xFF000000; - } - return eAttr; -} |