From 45da0f2d84c97a9856492265a1fc706d04bdfccd Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 3 Jan 2018 16:39:18 -0500 Subject: Fold CXFA_FillData into CXFA_Fill This CL removes the CXFA_FillData wrapper and puts the code directly in CXFA_Fill. Change-Id: I44ae8b53978b659480a4bb32719d086c7b91b49b Reviewed-on: https://pdfium-review.googlesource.com/22210 Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- BUILD.gn | 2 - fxjs/xfa/cjx_object.cpp | 11 ++- xfa/fxfa/cxfa_ffwidget.cpp | 37 +++++----- xfa/fxfa/parser/cxfa_box.cpp | 6 +- xfa/fxfa/parser/cxfa_box.h | 5 +- xfa/fxfa/parser/cxfa_fill.cpp | 135 +++++++++++++++++++++++++++++++++ xfa/fxfa/parser/cxfa_fill.h | 30 ++++++++ xfa/fxfa/parser/cxfa_filldata.cpp | 152 -------------------------------------- xfa/fxfa/parser/cxfa_filldata.h | 51 ------------- xfa/fxfa/parser/cxfa_fontdata.cpp | 12 ++- 10 files changed, 198 insertions(+), 243 deletions(-) delete mode 100644 xfa/fxfa/parser/cxfa_filldata.cpp delete mode 100644 xfa/fxfa/parser/cxfa_filldata.h diff --git a/BUILD.gn b/BUILD.gn index 8ba63ebc64..aa82d65c0b 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -2321,8 +2321,6 @@ if (pdf_enable_xfa) { "xfa/fxfa/parser/cxfa_field.h", "xfa/fxfa/parser/cxfa_fill.cpp", "xfa/fxfa/parser/cxfa_fill.h", - "xfa/fxfa/parser/cxfa_filldata.cpp", - "xfa/fxfa/parser/cxfa_filldata.h", "xfa/fxfa/parser/cxfa_filter.cpp", "xfa/fxfa/parser/cxfa_filter.h", "xfa/fxfa/parser/cxfa_fliplabel.cpp", diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp index a6ae86ef9f..81a6c2e64e 100644 --- a/fxjs/xfa/cjx_object.cpp +++ b/fxjs/xfa/cjx_object.cpp @@ -24,7 +24,7 @@ #include "xfa/fxfa/parser/cxfa_border.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_edge.h" -#include "xfa/fxfa/parser/cxfa_filldata.h" +#include "xfa/fxfa/parser/cxfa_fill.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/cxfa_node.h" @@ -1339,9 +1339,8 @@ void CJX_Object::Script_Som_FillColor(CFXJSE_Value* pValue, return; CXFA_Border* border = widget_data_->GetBorder(true); - CXFA_FillData borderfillData = border->GetFillData(true); - CXFA_Node* pNode = borderfillData.GetNode(); - if (!pNode) + CXFA_Fill* borderfill = border->GetFill(true); + if (!borderfill) return; if (bSetting) { @@ -1350,11 +1349,11 @@ void CJX_Object::Script_Som_FillColor(CFXJSE_Value* pValue, int32_t b; std::tie(r, g, b) = StrToRGB(pValue->ToWideString()); FX_ARGB color = ArgbEncode(0xff, r, g, b); - borderfillData.SetColor(color); + borderfill->SetColor(color); return; } - FX_ARGB color = borderfillData.GetColor(false); + FX_ARGB color = borderfill->GetColor(false); int32_t a; int32_t r; int32_t g; diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index 74df10ce86..ad0c64258b 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -34,6 +34,7 @@ #include "xfa/fxfa/parser/cxfa_box.h" #include "xfa/fxfa/parser/cxfa_corner.h" #include "xfa/fxfa/parser/cxfa_edge.h" +#include "xfa/fxfa/parser/cxfa_fill.h" #include "xfa/fxfa/parser/cxfa_image.h" #include "xfa/fxfa/parser/cxfa_margin.h" #include "xfa/fxfa/parser/cxfa_node.h" @@ -394,10 +395,10 @@ void XFA_BOX_Fill_Radial(CXFA_Box* box, CXFA_GEPath& fillPath, CFX_RectF rtFill, const CFX_Matrix& matrix) { - CXFA_FillData fillData = box->GetFillData(false); - FX_ARGB crStart = fillData.GetColor(false); - FX_ARGB crEnd = fillData.GetRadialColor(); - if (!fillData.IsRadialToEdge()) + CXFA_Fill* fill = box->GetFill(false); + FX_ARGB crStart = fill->GetColor(false); + FX_ARGB crEnd = fill->GetRadialColor(); + if (!fill->IsRadialToEdge()) std::swap(crStart, crEnd); CXFA_GEShading shading(rtFill.Center(), rtFill.Center(), 0, @@ -414,11 +415,11 @@ void XFA_BOX_Fill_Pattern(CXFA_Box* box, CXFA_GEPath& fillPath, CFX_RectF rtFill, const CFX_Matrix& matrix) { - CXFA_FillData fillData = box->GetFillData(false); - FX_ARGB crStart = fillData.GetColor(false); - FX_ARGB crEnd = fillData.GetPatternColor(); + CXFA_Fill* fill = box->GetFill(false); + FX_ARGB crStart = fill->GetColor(false); + FX_ARGB crEnd = fill->GetPatternColor(); FX_HatchStyle iHatch = FX_HatchStyle::Cross; - switch (fillData.GetPatternType()) { + switch (fill->GetPatternType()) { case XFA_AttributeEnum::CrossDiagonal: iHatch = FX_HatchStyle::DiagonalCross; break; @@ -448,13 +449,13 @@ void XFA_BOX_Fill_Linear(CXFA_Box* box, CXFA_GEPath& fillPath, CFX_RectF rtFill, const CFX_Matrix& matrix) { - CXFA_FillData fillData = box->GetFillData(false); - FX_ARGB crStart = fillData.GetColor(false); - FX_ARGB crEnd = fillData.GetLinearColor(); + CXFA_Fill* fill = box->GetFill(false); + FX_ARGB crStart = fill->GetColor(false); + FX_ARGB crEnd = fill->GetLinearColor(); CFX_PointF ptStart; CFX_PointF ptEnd; - switch (fillData.GetLinearType()) { + switch (fill->GetLinearType()) { case XFA_AttributeEnum::ToRight: ptStart = CFX_PointF(rtFill.left, rtFill.top); ptEnd = CFX_PointF(rtFill.right(), rtFill.top); @@ -486,8 +487,8 @@ void XFA_BOX_Fill(CXFA_Box* box, const CFX_RectF& rtWidget, const CFX_Matrix& matrix, uint32_t dwFlags) { - CXFA_FillData fillData = box->GetFillData(false); - if (!fillData.HasValidNode() || !fillData.IsVisible()) + CXFA_Fill* fill = box->GetFill(false); + if (!fill || !fill->IsVisible()) return; pGS->SaveGraphState(); @@ -495,7 +496,7 @@ void XFA_BOX_Fill(CXFA_Box* box, XFA_BOX_GetFillPath(box, strokes, rtWidget, fillPath, (dwFlags & XFA_DRAWBOX_ForceRound) != 0); fillPath.Close(); - XFA_Element eType = fillData.GetFillType(); + XFA_Element eType = fill->GetFillType(); switch (eType) { case XFA_Element::Radial: XFA_BOX_Fill_Radial(box, pGS, fillPath, rtWidget, matrix); @@ -509,16 +510,16 @@ void XFA_BOX_Fill(CXFA_Box* box, default: { FX_ARGB cr; if (eType == XFA_Element::Stipple) { - int32_t iRate = fillData.GetStippleRate(); + int32_t iRate = fill->GetStippleRate(); if (iRate == 0) iRate = 100; int32_t a; FX_COLORREF rgb; - std::tie(a, rgb) = ArgbToColorRef(fillData.GetStippleColor()); + std::tie(a, rgb) = ArgbToColorRef(fill->GetStippleColor()); cr = ArgbEncode(iRate * a / 100, rgb); } else { - cr = fillData.GetColor(false); + cr = fill->GetColor(false); } pGS->SetFillColor(CXFA_GEColor(cr)); pGS->FillPath(&fillPath, FXFILL_WINDING, &matrix); diff --git a/xfa/fxfa/parser/cxfa_box.cpp b/xfa/fxfa/parser/cxfa_box.cpp index 78362020da..ccb4e713ff 100644 --- a/xfa/fxfa/parser/cxfa_box.cpp +++ b/xfa/fxfa/parser/cxfa_box.cpp @@ -102,10 +102,8 @@ pdfium::Optional CXFA_Box::GetSweepAngle() { return JSObject()->TryInteger(XFA_Attribute::SweepAngle, false); } -CXFA_FillData CXFA_Box::GetFillData(bool bModified) { - CXFA_Node* pFillNode = - JSObject()->GetProperty(0, XFA_Element::Fill, bModified); - return CXFA_FillData(pFillNode); +CXFA_Fill* CXFA_Box::GetFill(bool bModified) { + return JSObject()->GetProperty(0, XFA_Element::Fill, bModified); } CXFA_Margin* CXFA_Box::GetMargin() { diff --git a/xfa/fxfa/parser/cxfa_box.h b/xfa/fxfa/parser/cxfa_box.h index dbc07c603d..5c2c8d20af 100644 --- a/xfa/fxfa/parser/cxfa_box.h +++ b/xfa/fxfa/parser/cxfa_box.h @@ -11,11 +11,10 @@ #include #include -#include "xfa/fxfa/parser/cxfa_datadata.h" -#include "xfa/fxfa/parser/cxfa_filldata.h" #include "xfa/fxfa/parser/cxfa_node.h" class CXFA_Edge; +class CXFA_Fill; class CXFA_Margin; class CXFA_Stroke; @@ -32,7 +31,7 @@ class CXFA_Box : public CXFA_Node { int32_t CountEdges(); CXFA_Edge* GetEdge(int32_t nIndex); - CXFA_FillData GetFillData(bool bModified); + CXFA_Fill* GetFill(bool bModified); CXFA_Margin* GetMargin(); std::vector GetStrokes(); diff --git a/xfa/fxfa/parser/cxfa_fill.cpp b/xfa/fxfa/parser/cxfa_fill.cpp index a26bc896d7..e4bde509c9 100644 --- a/xfa/fxfa/parser/cxfa_fill.cpp +++ b/xfa/fxfa/parser/cxfa_fill.cpp @@ -8,6 +8,12 @@ #include "fxjs/xfa/cjx_fill.h" #include "third_party/base/ptr_util.h" +#include "xfa/fxfa/parser/cxfa_color.h" +#include "xfa/fxfa/parser/cxfa_linear.h" +#include "xfa/fxfa/parser/cxfa_node.h" +#include "xfa/fxfa/parser/cxfa_pattern.h" +#include "xfa/fxfa/parser/cxfa_radial.h" +#include "xfa/fxfa/parser/cxfa_stipple.h" namespace { @@ -45,3 +51,132 @@ CXFA_Fill::CXFA_Fill(CXFA_Document* doc, XFA_PacketType packet) pdfium::MakeUnique(this)) {} CXFA_Fill::~CXFA_Fill() {} + +bool CXFA_Fill::IsVisible() { + return JSObject() + ->TryEnum(XFA_Attribute::Presence, true) + .value_or(XFA_AttributeEnum::Visible) == + XFA_AttributeEnum::Visible; +} + +void CXFA_Fill::SetColor(FX_ARGB color) { + CXFA_Color* pNode = + JSObject()->GetProperty(0, XFA_Element::Color, true); + int a; + int r; + int g; + int b; + std::tie(a, r, g, b) = ArgbDecode(color); + pNode->JSObject()->SetCData(XFA_Attribute::Value, + WideString::Format(L"%d,%d,%d", r, g, b), false, + false); +} + +FX_ARGB CXFA_Fill::GetColor(bool bText) { + if (CXFA_Color* pNode = GetChild(0, XFA_Element::Color, false)) { + pdfium::Optional wsColor = + pNode->JSObject()->TryCData(XFA_Attribute::Value, false); + if (wsColor) + return CXFA_DataData::ToColor(wsColor->AsStringView()); + } + if (bText) + return 0xFF000000; + return 0xFFFFFFFF; +} + +XFA_Element CXFA_Fill::GetFillType() const { + CXFA_Node* pChild = 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; +} + +XFA_AttributeEnum CXFA_Fill::GetPatternType() { + return GetPattern()->JSObject()->GetEnum(XFA_Attribute::Type); +} + +FX_ARGB CXFA_Fill::GetPatternColor() { + if (CXFA_Color* pColor = + GetPattern()->GetChild(0, XFA_Element::Color, false)) { + pdfium::Optional wsColor = + pColor->JSObject()->TryCData(XFA_Attribute::Value, false); + if (wsColor) + return CXFA_DataData::ToColor(wsColor->AsStringView()); + } + return 0xFF000000; +} + +int32_t CXFA_Fill::GetStippleRate() { + return GetStipple() + ->JSObject() + ->TryInteger(XFA_Attribute::Rate, true) + .value_or(50); +} + +FX_ARGB CXFA_Fill::GetStippleColor() { + if (CXFA_Color* pColor = + GetStipple()->GetChild(0, XFA_Element::Color, false)) { + pdfium::Optional wsColor = + pColor->JSObject()->TryCData(XFA_Attribute::Value, false); + if (wsColor) + return CXFA_DataData::ToColor(wsColor->AsStringView()); + } + return 0xFF000000; +} + +XFA_AttributeEnum CXFA_Fill::GetLinearType() { + return GetLinear() + ->JSObject() + ->TryEnum(XFA_Attribute::Type, true) + .value_or(XFA_AttributeEnum::ToRight); +} + +FX_ARGB CXFA_Fill::GetLinearColor() { + if (CXFA_Color* pColor = + GetLinear()->GetChild(0, XFA_Element::Color, false)) { + pdfium::Optional wsColor = + pColor->JSObject()->TryCData(XFA_Attribute::Value, false); + if (wsColor) + return CXFA_DataData::ToColor(wsColor->AsStringView()); + } + return 0xFF000000; +} + +bool CXFA_Fill::IsRadialToEdge() { + return GetRadial() + ->JSObject() + ->TryEnum(XFA_Attribute::Type, true) + .value_or(XFA_AttributeEnum::ToEdge) == XFA_AttributeEnum::ToEdge; +} + +FX_ARGB CXFA_Fill::GetRadialColor() { + if (CXFA_Color* pColor = + GetRadial()->GetChild(0, XFA_Element::Color, false)) { + pdfium::Optional wsColor = + pColor->JSObject()->TryCData(XFA_Attribute::Value, false); + if (wsColor) + return CXFA_DataData::ToColor(wsColor->AsStringView()); + } + return 0xFF000000; +} + +CXFA_Stipple* CXFA_Fill::GetStipple() { + return JSObject()->GetProperty(0, XFA_Element::Stipple, true); +} + +CXFA_Radial* CXFA_Fill::GetRadial() { + return JSObject()->GetProperty(0, XFA_Element::Radial, true); +} + +CXFA_Linear* CXFA_Fill::GetLinear() { + return JSObject()->GetProperty(0, XFA_Element::Linear, true); +} + +CXFA_Pattern* CXFA_Fill::GetPattern() { + return JSObject()->GetProperty(0, XFA_Element::Pattern, true); +} diff --git a/xfa/fxfa/parser/cxfa_fill.h b/xfa/fxfa/parser/cxfa_fill.h index ba18b91b72..a5ee7609ee 100644 --- a/xfa/fxfa/parser/cxfa_fill.h +++ b/xfa/fxfa/parser/cxfa_fill.h @@ -9,10 +9,40 @@ #include "xfa/fxfa/parser/cxfa_node.h" +class CXFA_Linear; +class CXFA_Pattern; +class CXFA_Radial; +class CXFA_Stipple; + class CXFA_Fill : public CXFA_Node { public: CXFA_Fill(CXFA_Document* doc, XFA_PacketType packet); ~CXFA_Fill() override; + + bool IsVisible(); + + FX_ARGB GetColor(bool bText); + void SetColor(FX_ARGB color); + + XFA_Element GetFillType() const; + + XFA_AttributeEnum GetPatternType(); + FX_ARGB GetPatternColor(); + + XFA_AttributeEnum GetLinearType(); + FX_ARGB GetLinearColor(); + + int32_t GetStippleRate(); + FX_ARGB GetStippleColor(); + + bool IsRadialToEdge(); + FX_ARGB GetRadialColor(); + + private: + CXFA_Stipple* GetStipple(); + CXFA_Radial* GetRadial(); + CXFA_Linear* GetLinear(); + CXFA_Pattern* GetPattern(); }; #endif // XFA_FXFA_PARSER_CXFA_FILL_H_ diff --git a/xfa/fxfa/parser/cxfa_filldata.cpp b/xfa/fxfa/parser/cxfa_filldata.cpp deleted file mode 100644 index 067d75246c..0000000000 --- a/xfa/fxfa/parser/cxfa_filldata.cpp +++ /dev/null @@ -1,152 +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_filldata.h" - -#include "xfa/fxfa/parser/cxfa_color.h" -#include "xfa/fxfa/parser/cxfa_linear.h" -#include "xfa/fxfa/parser/cxfa_node.h" -#include "xfa/fxfa/parser/cxfa_pattern.h" -#include "xfa/fxfa/parser/cxfa_radial.h" -#include "xfa/fxfa/parser/cxfa_stipple.h" - -CXFA_FillData::CXFA_FillData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} - -CXFA_FillData::~CXFA_FillData() {} - -bool CXFA_FillData::IsVisible() const { - return m_pNode->JSObject() - ->TryEnum(XFA_Attribute::Presence, true) - .value_or(XFA_AttributeEnum::Visible) == - XFA_AttributeEnum::Visible; -} - -void CXFA_FillData::SetColor(FX_ARGB color) { - CXFA_Color* pNode = - m_pNode->JSObject()->GetProperty(0, XFA_Element::Color, true); - int a; - int r; - int g; - int b; - std::tie(a, r, g, b) = ArgbDecode(color); - pNode->JSObject()->SetCData(XFA_Attribute::Value, - WideString::Format(L"%d,%d,%d", r, g, b), false, - false); -} - -FX_ARGB CXFA_FillData::GetColor(bool bText) const { - if (CXFA_Color* pNode = - m_pNode->GetChild(0, XFA_Element::Color, false)) { - pdfium::Optional wsColor = - pNode->JSObject()->TryCData(XFA_Attribute::Value, false); - if (wsColor) - return CXFA_DataData::ToColor(wsColor->AsStringView()); - } - if (bText) - return 0xFF000000; - return 0xFFFFFFFF; -} - -XFA_Element CXFA_FillData::GetFillType() const { - 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; -} - -XFA_AttributeEnum CXFA_FillData::GetPatternType() const { - return GetPattern()->JSObject()->GetEnum(XFA_Attribute::Type); -} - -FX_ARGB CXFA_FillData::GetPatternColor() const { - if (CXFA_Color* pColor = - GetPattern()->GetChild(0, XFA_Element::Color, false)) { - pdfium::Optional wsColor = - pColor->JSObject()->TryCData(XFA_Attribute::Value, false); - if (wsColor) - return CXFA_DataData::ToColor(wsColor->AsStringView()); - } - return 0xFF000000; -} - -int32_t CXFA_FillData::GetStippleRate() const { - return GetStipple() - ->JSObject() - ->TryInteger(XFA_Attribute::Rate, true) - .value_or(50); -} - -FX_ARGB CXFA_FillData::GetStippleColor() const { - if (CXFA_Color* pColor = - GetStipple()->GetChild(0, XFA_Element::Color, false)) { - pdfium::Optional wsColor = - pColor->JSObject()->TryCData(XFA_Attribute::Value, false); - if (wsColor) - return CXFA_DataData::ToColor(wsColor->AsStringView()); - } - return 0xFF000000; -} - -XFA_AttributeEnum CXFA_FillData::GetLinearType() const { - return GetLinear() - ->JSObject() - ->TryEnum(XFA_Attribute::Type, true) - .value_or(XFA_AttributeEnum::ToRight); -} - -FX_ARGB CXFA_FillData::GetLinearColor() const { - if (CXFA_Color* pColor = - GetLinear()->GetChild(0, XFA_Element::Color, false)) { - pdfium::Optional wsColor = - pColor->JSObject()->TryCData(XFA_Attribute::Value, false); - if (wsColor) - return CXFA_DataData::ToColor(wsColor->AsStringView()); - } - return 0xFF000000; -} - -bool CXFA_FillData::IsRadialToEdge() const { - return GetRadial() - ->JSObject() - ->TryEnum(XFA_Attribute::Type, true) - .value_or(XFA_AttributeEnum::ToEdge) == XFA_AttributeEnum::ToEdge; -} - -FX_ARGB CXFA_FillData::GetRadialColor() const { - if (CXFA_Color* pColor = - GetRadial()->GetChild(0, XFA_Element::Color, false)) { - pdfium::Optional wsColor = - pColor->JSObject()->TryCData(XFA_Attribute::Value, false); - if (wsColor) - return CXFA_DataData::ToColor(wsColor->AsStringView()); - } - return 0xFF000000; -} - -CXFA_Stipple* CXFA_FillData::GetStipple() const { - return m_pNode->JSObject()->GetProperty(0, XFA_Element::Stipple, - true); -} - -CXFA_Radial* CXFA_FillData::GetRadial() const { - return m_pNode->JSObject()->GetProperty(0, XFA_Element::Radial, - true); -} - -CXFA_Linear* CXFA_FillData::GetLinear() const { - return m_pNode->JSObject()->GetProperty(0, XFA_Element::Linear, - true); -} - -CXFA_Pattern* CXFA_FillData::GetPattern() const { - return m_pNode->JSObject()->GetProperty(0, XFA_Element::Pattern, - true); -} diff --git a/xfa/fxfa/parser/cxfa_filldata.h b/xfa/fxfa/parser/cxfa_filldata.h deleted file mode 100644 index 94e840e230..0000000000 --- a/xfa/fxfa/parser/cxfa_filldata.h +++ /dev/null @@ -1,51 +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 - -#ifndef XFA_FXFA_PARSER_CXFA_FILLDATA_H_ -#define XFA_FXFA_PARSER_CXFA_FILLDATA_H_ - -#include "core/fxcrt/fx_system.h" -#include "core/fxge/fx_dib.h" -#include "xfa/fxfa/parser/cxfa_datadata.h" - -class CXFA_Linear; -class CXFA_Node; -class CXFA_Pattern; -class CXFA_Radial; -class CXFA_Stipple; - -class CXFA_FillData : public CXFA_DataData { - public: - explicit CXFA_FillData(CXFA_Node* pNode); - ~CXFA_FillData() override; - - bool IsVisible() const; - - FX_ARGB GetColor(bool bText) const; - void SetColor(FX_ARGB color); - - XFA_Element GetFillType() const; - - XFA_AttributeEnum GetPatternType() const; - FX_ARGB GetPatternColor() const; - - XFA_AttributeEnum GetLinearType() const; - FX_ARGB GetLinearColor() const; - - int32_t GetStippleRate() const; - FX_ARGB GetStippleColor() const; - - bool IsRadialToEdge() const; - FX_ARGB GetRadialColor() const; - - private: - CXFA_Stipple* GetStipple() const; - CXFA_Radial* GetRadial() const; - CXFA_Linear* GetLinear() const; - CXFA_Pattern* GetPattern() const; -}; - -#endif // XFA_FXFA_PARSER_CXFA_FILLDATA_H_ diff --git a/xfa/fxfa/parser/cxfa_fontdata.cpp b/xfa/fxfa/parser/cxfa_fontdata.cpp index 88dc930dab..64b5af0794 100644 --- a/xfa/fxfa/parser/cxfa_fontdata.cpp +++ b/xfa/fxfa/parser/cxfa_fontdata.cpp @@ -8,7 +8,6 @@ #include "core/fxge/fx_dib.h" #include "xfa/fxfa/parser/cxfa_fill.h" -#include "xfa/fxfa/parser/cxfa_filldata.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/cxfa_node.h" @@ -78,13 +77,12 @@ bool CXFA_FontData::IsItalic() const { } void CXFA_FontData::SetColor(FX_ARGB color) { - CXFA_FillData( - m_pNode->JSObject()->GetProperty(0, XFA_Element::Fill, true)) - .SetColor(color); + m_pNode->JSObject() + ->GetProperty(0, XFA_Element::Fill, true) + ->SetColor(color); } FX_ARGB CXFA_FontData::GetColor() const { - CXFA_FillData fillData( - m_pNode->GetChild(0, XFA_Element::Fill, false)); - return fillData.HasValidNode() ? fillData.GetColor(true) : 0xFF000000; + CXFA_Fill* fill = m_pNode->GetChild(0, XFA_Element::Fill, false); + return fill ? fill->GetColor(true) : 0xFF000000; } -- cgit v1.2.3