Break another CFGAS_GEGraphics friendship
This time, it is with CFGAS_GEPattern.
-- move FX_HashStyle enum and nest.
-- include the actual file that provides FX_ARGB.
Change-Id: I67588b25363c27f935a30a08e241c393b0e8cb39
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/80670
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fgas/graphics/cfgas_gegraphics.cpp b/xfa/fgas/graphics/cfgas_gegraphics.cpp
index 845b219..77480b4 100644
--- a/xfa/fgas/graphics/cfgas_gegraphics.cpp
+++ b/xfa/fgas/graphics/cfgas_gegraphics.cpp
@@ -247,7 +247,8 @@
bmp->Create(width, height, FXDIB_Format::kArgb);
m_renderDevice->GetDIBits(bmp, 0, 0);
- FX_HatchStyle hatchStyle = m_info.fillColor.GetPattern()->m_hatchStyle;
+ CFGAS_GEPattern::HatchStyle hatchStyle =
+ m_info.fillColor.GetPattern()->GetHatchStyle();
const FX_HATCHDATA& data =
GetHatchBitmapData(static_cast<size_t>(hatchStyle));
@@ -260,10 +261,12 @@
CFX_DefaultRenderDevice device;
device.Attach(bmp, false, nullptr, false);
- device.FillRect(rect, m_info.fillColor.GetPattern()->m_backArgb);
+ device.FillRect(rect, m_info.fillColor.GetPattern()->GetBackArgb());
for (int32_t j = rect.bottom; j < rect.top; j += mask->GetHeight()) {
- for (int32_t i = rect.left; i < rect.right; i += mask->GetWidth())
- device.SetBitMask(mask, i, j, m_info.fillColor.GetPattern()->m_foreArgb);
+ for (int32_t i = rect.left; i < rect.right; i += mask->GetWidth()) {
+ device.SetBitMask(mask, i, j,
+ m_info.fillColor.GetPattern()->GetForeArgb());
+ }
}
CFX_RenderDevice::StateRestorer restorer(m_renderDevice);
m_renderDevice->SetClip_PathFill(path.GetPathData(), &matrix, fill_options);
diff --git a/xfa/fgas/graphics/cfgas_gegraphics.h b/xfa/fgas/graphics/cfgas_gegraphics.h
index f7dc999..377cb0d 100644
--- a/xfa/fgas/graphics/cfgas_gegraphics.h
+++ b/xfa/fgas/graphics/cfgas_gegraphics.h
@@ -17,15 +17,6 @@
#include "third_party/base/span.h"
#include "xfa/fgas/graphics/cfgas_gecolor.h"
-enum class FX_HatchStyle {
- Horizontal = 0,
- Vertical = 1,
- ForwardDiagonal = 2,
- BackwardDiagonal = 3,
- Cross = 4,
- DiagonalCross = 5
-};
-
class CFGAS_GEPath;
class CFX_DIBBase;
class CFX_RenderDevice;
diff --git a/xfa/fgas/graphics/cfgas_gepattern.cpp b/xfa/fgas/graphics/cfgas_gepattern.cpp
index 0fe96fd..9d5f05f 100644
--- a/xfa/fgas/graphics/cfgas_gepattern.cpp
+++ b/xfa/fgas/graphics/cfgas_gepattern.cpp
@@ -6,9 +6,9 @@
#include "xfa/fgas/graphics/cfgas_gepattern.h"
-CFGAS_GEPattern::CFGAS_GEPattern(FX_HatchStyle hatchStyle,
- const FX_ARGB foreArgb,
- const FX_ARGB backArgb)
+CFGAS_GEPattern::CFGAS_GEPattern(HatchStyle hatchStyle,
+ FX_ARGB foreArgb,
+ FX_ARGB backArgb)
: m_hatchStyle(hatchStyle), m_foreArgb(foreArgb), m_backArgb(backArgb) {}
CFGAS_GEPattern::~CFGAS_GEPattern() = default;
diff --git a/xfa/fgas/graphics/cfgas_gepattern.h b/xfa/fgas/graphics/cfgas_gepattern.h
index d3e5760..b700ca7 100644
--- a/xfa/fgas/graphics/cfgas_gepattern.h
+++ b/xfa/fgas/graphics/cfgas_gepattern.h
@@ -7,22 +7,28 @@
#ifndef XFA_FGAS_GRAPHICS_CFGAS_GEPATTERN_H_
#define XFA_FGAS_GRAPHICS_CFGAS_GEPATTERN_H_
-#include "core/fxcrt/fx_coordinates.h"
-#include "core/fxcrt/fx_system.h"
-#include "xfa/fgas/graphics/cfgas_gegraphics.h"
+#include "core/fxge/dib/fx_dib.h"
class CFGAS_GEPattern final {
public:
- CFGAS_GEPattern(FX_HatchStyle hatchStyle,
- const FX_ARGB foreArgb,
- const FX_ARGB backArgb);
+ enum class HatchStyle {
+ Horizontal = 0,
+ Vertical = 1,
+ ForwardDiagonal = 2,
+ BackwardDiagonal = 3,
+ Cross = 4,
+ DiagonalCross = 5
+ };
+ CFGAS_GEPattern(HatchStyle hatchStyle, FX_ARGB foreArgb, FX_ARGB backArgb);
~CFGAS_GEPattern();
- private:
- friend class CFGAS_GEGraphics;
+ HatchStyle GetHatchStyle() const { return m_hatchStyle; }
+ FX_ARGB GetForeArgb() const { return m_foreArgb; }
+ FX_ARGB GetBackArgb() const { return m_backArgb; }
- const FX_HatchStyle m_hatchStyle;
+ private:
+ const HatchStyle m_hatchStyle;
const FX_ARGB m_foreArgb;
const FX_ARGB m_backArgb;
};
diff --git a/xfa/fxfa/parser/cxfa_pattern.cpp b/xfa/fxfa/parser/cxfa_pattern.cpp
index 8109f1d..f8b22ea 100644
--- a/xfa/fxfa/parser/cxfa_pattern.cpp
+++ b/xfa/fxfa/parser/cxfa_pattern.cpp
@@ -57,22 +57,22 @@
const CFX_Matrix& matrix) {
CXFA_Color* pColor = GetColorIfExists();
FX_ARGB crEnd = pColor ? pColor->GetValue() : CXFA_Color::kBlackColor;
- FX_HatchStyle iHatch = FX_HatchStyle::Cross;
+ CFGAS_GEPattern::HatchStyle iHatch = CFGAS_GEPattern::HatchStyle::Cross;
switch (GetType()) {
case XFA_AttributeValue::CrossDiagonal:
- iHatch = FX_HatchStyle::DiagonalCross;
+ iHatch = CFGAS_GEPattern::HatchStyle::DiagonalCross;
break;
case XFA_AttributeValue::DiagonalLeft:
- iHatch = FX_HatchStyle::ForwardDiagonal;
+ iHatch = CFGAS_GEPattern::HatchStyle::ForwardDiagonal;
break;
case XFA_AttributeValue::DiagonalRight:
- iHatch = FX_HatchStyle::BackwardDiagonal;
+ iHatch = CFGAS_GEPattern::HatchStyle::BackwardDiagonal;
break;
case XFA_AttributeValue::Horizontal:
- iHatch = FX_HatchStyle::Horizontal;
+ iHatch = CFGAS_GEPattern::HatchStyle::Horizontal;
break;
case XFA_AttributeValue::Vertical:
- iHatch = FX_HatchStyle::Vertical;
+ iHatch = CFGAS_GEPattern::HatchStyle::Vertical;
break;
default:
break;