diff options
Diffstat (limited to 'xfa/fxgraphics')
-rw-r--r-- | xfa/fxgraphics/cxfa_gecolor.cpp (renamed from xfa/fxgraphics/cxfa_color.cpp) | 15 | ||||
-rw-r--r-- | xfa/fxgraphics/cxfa_gecolor.h (renamed from xfa/fxgraphics/cxfa_color.h) | 32 | ||||
-rw-r--r-- | xfa/fxgraphics/cxfa_gepath.cpp (renamed from xfa/fxgraphics/cxfa_path.cpp) | 57 | ||||
-rw-r--r-- | xfa/fxgraphics/cxfa_gepath.h (renamed from xfa/fxgraphics/cxfa_path.h) | 14 | ||||
-rw-r--r-- | xfa/fxgraphics/cxfa_gepattern.cpp (renamed from xfa/fxgraphics/cxfa_pattern.cpp) | 12 | ||||
-rw-r--r-- | xfa/fxgraphics/cxfa_gepattern.h (renamed from xfa/fxgraphics/cxfa_pattern.h) | 18 | ||||
-rw-r--r-- | xfa/fxgraphics/cxfa_geshading.cpp (renamed from xfa/fxgraphics/cxfa_shading.cpp) | 34 | ||||
-rw-r--r-- | xfa/fxgraphics/cxfa_geshading.h | 56 | ||||
-rw-r--r-- | xfa/fxgraphics/cxfa_graphics.cpp | 34 | ||||
-rw-r--r-- | xfa/fxgraphics/cxfa_graphics.h | 25 | ||||
-rw-r--r-- | xfa/fxgraphics/cxfa_shading.h | 56 |
11 files changed, 179 insertions, 174 deletions
diff --git a/xfa/fxgraphics/cxfa_color.cpp b/xfa/fxgraphics/cxfa_gecolor.cpp index 731d144c41..3dca4a7df5 100644 --- a/xfa/fxgraphics/cxfa_color.cpp +++ b/xfa/fxgraphics/cxfa_gecolor.cpp @@ -4,26 +4,27 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxgraphics/cxfa_color.h" +#include "xfa/fxgraphics/cxfa_gecolor.h" -CXFA_Color::CXFA_Color() : m_type(Invalid) {} +CXFA_GEColor::CXFA_GEColor() : m_type(Invalid) {} -CXFA_Color::CXFA_Color(const FX_ARGB argb) : m_type(Solid), m_argb(argb) { +CXFA_GEColor::CXFA_GEColor(const FX_ARGB argb) : m_type(Solid), m_argb(argb) { m_pointer.pattern = nullptr; } -CXFA_Color::CXFA_Color(CXFA_Pattern* pattern, const FX_ARGB argb) +CXFA_GEColor::CXFA_GEColor(CXFA_GEPattern* pattern, const FX_ARGB argb) : m_type(Pattern), m_argb(argb) { m_pointer.pattern = pattern; } -CXFA_Color::CXFA_Color(CXFA_Shading* shading) : m_type(Shading), m_argb(0) { +CXFA_GEColor::CXFA_GEColor(CXFA_GEShading* shading) + : m_type(Shading), m_argb(0) { m_pointer.shading = shading; } -CXFA_Color::~CXFA_Color() {} +CXFA_GEColor::~CXFA_GEColor() {} -CXFA_Color& CXFA_Color::operator=(const CXFA_Color& that) { +CXFA_GEColor& CXFA_GEColor::operator=(const CXFA_GEColor& that) { if (this != &that) { m_type = that.m_type; switch (m_type) { diff --git a/xfa/fxgraphics/cxfa_color.h b/xfa/fxgraphics/cxfa_gecolor.h index 4ae790507b..b60585b7a4 100644 --- a/xfa/fxgraphics/cxfa_color.h +++ b/xfa/fxgraphics/cxfa_gecolor.h @@ -4,47 +4,47 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef XFA_FXGRAPHICS_CXFA_COLOR_H_ -#define XFA_FXGRAPHICS_CXFA_COLOR_H_ +#ifndef XFA_FXGRAPHICS_CXFA_GECOLOR_H_ +#define XFA_FXGRAPHICS_CXFA_GECOLOR_H_ #include "core/fxge/fx_dib.h" -class CXFA_Pattern; -class CXFA_Shading; +class CXFA_GEPattern; +class CXFA_GEShading; -class CXFA_Color { +class CXFA_GEColor { public: enum Type { Invalid, Solid, Pattern, Shading }; - CXFA_Color(); - explicit CXFA_Color(const FX_ARGB argb); - explicit CXFA_Color(CXFA_Shading* shading); - CXFA_Color(CXFA_Pattern* pattern, const FX_ARGB argb); - ~CXFA_Color(); + CXFA_GEColor(); + explicit CXFA_GEColor(const FX_ARGB argb); + explicit CXFA_GEColor(CXFA_GEShading* shading); + CXFA_GEColor(CXFA_GEPattern* pattern, const FX_ARGB argb); + ~CXFA_GEColor(); Type GetType() const { return m_type; } FX_ARGB GetArgb() const { ASSERT(m_type == Solid || m_type == Pattern); return m_argb; } - CXFA_Pattern* GetPattern() const { + CXFA_GEPattern* GetPattern() const { ASSERT(m_type == Pattern); return m_pointer.pattern; } - CXFA_Shading* GetShading() const { + CXFA_GEShading* GetShading() const { ASSERT(m_type == Shading); return m_pointer.shading; } - CXFA_Color& operator=(const CXFA_Color& that); + CXFA_GEColor& operator=(const CXFA_GEColor& that); private: Type m_type; FX_ARGB m_argb; union { - CXFA_Pattern* pattern; - CXFA_Shading* shading; + CXFA_GEPattern* pattern; + CXFA_GEShading* shading; } m_pointer; }; -#endif // XFA_FXGRAPHICS_CXFA_COLOR_H_ +#endif // XFA_FXGRAPHICS_CXFA_GECOLOR_H_ diff --git a/xfa/fxgraphics/cxfa_path.cpp b/xfa/fxgraphics/cxfa_gepath.cpp index 6d7ed0be58..88372f72ac 100644 --- a/xfa/fxgraphics/cxfa_path.cpp +++ b/xfa/fxgraphics/cxfa_gepath.cpp @@ -4,52 +4,52 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxgraphics/cxfa_path.h" +#include "xfa/fxgraphics/cxfa_gepath.h" #include "core/fxge/cfx_pathdata.h" #include "third_party/base/ptr_util.h" -CXFA_Path::CXFA_Path() {} +CXFA_GEPath::CXFA_GEPath() {} -CXFA_Path::~CXFA_Path() {} +CXFA_GEPath::~CXFA_GEPath() {} -void CXFA_Path::Clear() { +void CXFA_GEPath::Clear() { data_.Clear(); } -void CXFA_Path::Close() { +void CXFA_GEPath::Close() { data_.ClosePath(); } -void CXFA_Path::MoveTo(const CFX_PointF& point) { +void CXFA_GEPath::MoveTo(const CFX_PointF& point) { data_.AppendPoint(point, FXPT_TYPE::MoveTo, false); } -void CXFA_Path::LineTo(const CFX_PointF& point) { +void CXFA_GEPath::LineTo(const CFX_PointF& point) { data_.AppendPoint(point, FXPT_TYPE::LineTo, false); } -void CXFA_Path::BezierTo(const CFX_PointF& c1, - const CFX_PointF& c2, - const CFX_PointF& to) { +void CXFA_GEPath::BezierTo(const CFX_PointF& c1, + const CFX_PointF& c2, + const CFX_PointF& to) { data_.AppendPoint(c1, FXPT_TYPE::BezierTo, false); data_.AppendPoint(c2, FXPT_TYPE::BezierTo, false); data_.AppendPoint(to, FXPT_TYPE::BezierTo, false); } -void CXFA_Path::ArcTo(const CFX_PointF& pos, - const CFX_SizeF& size, - float start_angle, - float sweep_angle) { +void CXFA_GEPath::ArcTo(const CFX_PointF& pos, + const CFX_SizeF& size, + float start_angle, + float sweep_angle) { CFX_SizeF new_size = size / 2.0f; ArcToInternal(CFX_PointF(pos.x + new_size.width, pos.y + new_size.height), new_size, start_angle, sweep_angle); } -void CXFA_Path::ArcToInternal(const CFX_PointF& pos, - const CFX_SizeF& size, - float start_angle, - float sweep_angle) { +void CXFA_GEPath::ArcToInternal(const CFX_PointF& pos, + const CFX_SizeF& size, + float start_angle, + float sweep_angle) { float x0 = cos(sweep_angle / 2); float y0 = sin(sweep_angle / 2); float tx = ((1.0f - x0) * 4) / (3 * 1.0f); @@ -73,23 +73,26 @@ void CXFA_Path::ArcToInternal(const CFX_PointF& pos, data_.AppendPoint(bezier, FXPT_TYPE::BezierTo, false); } -void CXFA_Path::AddLine(const CFX_PointF& p1, const CFX_PointF& p2) { +void CXFA_GEPath::AddLine(const CFX_PointF& p1, const CFX_PointF& p2) { data_.AppendPoint(p1, FXPT_TYPE::MoveTo, false); data_.AppendPoint(p2, FXPT_TYPE::LineTo, false); } -void CXFA_Path::AddRectangle(float left, float top, float width, float height) { +void CXFA_GEPath::AddRectangle(float left, + float top, + float width, + float height) { data_.AppendRect(left, top, left + width, top + height); } -void CXFA_Path::AddEllipse(const CFX_RectF& rect) { +void CXFA_GEPath::AddEllipse(const CFX_RectF& rect) { AddArc(rect.TopLeft(), rect.Size(), 0, FX_PI * 2); } -void CXFA_Path::AddArc(const CFX_PointF& original_pos, - const CFX_SizeF& original_size, - float start_angle, - float sweep_angle) { +void CXFA_GEPath::AddArc(const CFX_PointF& original_pos, + const CFX_SizeF& original_size, + float start_angle, + float sweep_angle) { if (sweep_angle == 0) return; @@ -137,12 +140,12 @@ void CXFA_Path::AddArc(const CFX_PointF& original_pos, } while (!done); } -void CXFA_Path::AddSubpath(CXFA_Path* path) { +void CXFA_GEPath::AddSubpath(CXFA_GEPath* path) { if (!path) return; data_.Append(&path->data_, nullptr); } -void CXFA_Path::TransformBy(const CFX_Matrix& mt) { +void CXFA_GEPath::TransformBy(const CFX_Matrix& mt) { data_.Transform(&mt); } diff --git a/xfa/fxgraphics/cxfa_path.h b/xfa/fxgraphics/cxfa_gepath.h index 9c71a4d5ff..0c3afc4edf 100644 --- a/xfa/fxgraphics/cxfa_path.h +++ b/xfa/fxgraphics/cxfa_gepath.h @@ -4,17 +4,17 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef XFA_FXGRAPHICS_CXFA_PATH_H_ -#define XFA_FXGRAPHICS_CXFA_PATH_H_ +#ifndef XFA_FXGRAPHICS_CXFA_GEPATH_H_ +#define XFA_FXGRAPHICS_CXFA_GEPATH_H_ #include "core/fxcrt/fx_system.h" #include "core/fxge/cfx_pathdata.h" #include "xfa/fxgraphics/cxfa_graphics.h" -class CXFA_Path final { +class CXFA_GEPath final { public: - CXFA_Path(); - ~CXFA_Path(); + CXFA_GEPath(); + ~CXFA_GEPath(); const CFX_PathData* GetPathData() const { return &data_; } @@ -41,7 +41,7 @@ class CXFA_Path final { float startAngle, float sweepAngle); - void AddSubpath(CXFA_Path* path); + void AddSubpath(CXFA_GEPath* path); private: void ArcToInternal(const CFX_PointF& pos, @@ -52,4 +52,4 @@ class CXFA_Path final { CFX_PathData data_; }; -#endif // XFA_FXGRAPHICS_CXFA_PATH_H_ +#endif // XFA_FXGRAPHICS_CXFA_GEPATH_H_ diff --git a/xfa/fxgraphics/cxfa_pattern.cpp b/xfa/fxgraphics/cxfa_gepattern.cpp index ea6cea87a5..2a6a0e4934 100644 --- a/xfa/fxgraphics/cxfa_pattern.cpp +++ b/xfa/fxgraphics/cxfa_gepattern.cpp @@ -4,12 +4,12 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxgraphics/cxfa_pattern.h" +#include "xfa/fxgraphics/cxfa_gepattern.h" -CXFA_Pattern::CXFA_Pattern(FX_HatchStyle hatchStyle, - const FX_ARGB foreArgb, - const FX_ARGB backArgb, - CFX_Matrix* matrix) +CXFA_GEPattern::CXFA_GEPattern(FX_HatchStyle hatchStyle, + const FX_ARGB foreArgb, + const FX_ARGB backArgb, + CFX_Matrix* matrix) : m_hatchStyle(hatchStyle), m_foreArgb(foreArgb), m_backArgb(backArgb) { if (matrix) m_matrix = *matrix; @@ -17,4 +17,4 @@ CXFA_Pattern::CXFA_Pattern(FX_HatchStyle hatchStyle, m_matrix.SetIdentity(); } -CXFA_Pattern::~CXFA_Pattern() {} +CXFA_GEPattern::~CXFA_GEPattern() {} diff --git a/xfa/fxgraphics/cxfa_pattern.h b/xfa/fxgraphics/cxfa_gepattern.h index 838ec98b01..0f4ced20ea 100644 --- a/xfa/fxgraphics/cxfa_pattern.h +++ b/xfa/fxgraphics/cxfa_gepattern.h @@ -4,8 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef XFA_FXGRAPHICS_CXFA_PATTERN_H_ -#define XFA_FXGRAPHICS_CXFA_PATTERN_H_ +#ifndef XFA_FXGRAPHICS_CXFA_GEPATTERN_H_ +#define XFA_FXGRAPHICS_CXFA_GEPATTERN_H_ #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_system.h" @@ -14,14 +14,14 @@ class CFX_DIBitmap; class CFX_Matrix; -class CXFA_Pattern { +class CXFA_GEPattern { public: - CXFA_Pattern(FX_HatchStyle hatchStyle, - const FX_ARGB foreArgb, - const FX_ARGB backArgb, - CFX_Matrix* matrix = nullptr); + CXFA_GEPattern(FX_HatchStyle hatchStyle, + const FX_ARGB foreArgb, + const FX_ARGB backArgb, + CFX_Matrix* matrix = nullptr); - virtual ~CXFA_Pattern(); + virtual ~CXFA_GEPattern(); private: friend class CXFA_Graphics; @@ -33,4 +33,4 @@ class CXFA_Pattern { const FX_ARGB m_backArgb; }; -#endif // XFA_FXGRAPHICS_CXFA_PATTERN_H_ +#endif // XFA_FXGRAPHICS_CXFA_GEPATTERN_H_ diff --git a/xfa/fxgraphics/cxfa_shading.cpp b/xfa/fxgraphics/cxfa_geshading.cpp index 599a3f9d42..f6911696a1 100644 --- a/xfa/fxgraphics/cxfa_shading.cpp +++ b/xfa/fxgraphics/cxfa_geshading.cpp @@ -4,14 +4,14 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxgraphics/cxfa_shading.h" +#include "xfa/fxgraphics/cxfa_geshading.h" -CXFA_Shading::CXFA_Shading(const CFX_PointF& beginPoint, - const CFX_PointF& endPoint, - bool isExtendedBegin, - bool isExtendedEnd, - const FX_ARGB beginArgb, - const FX_ARGB endArgb) +CXFA_GEShading::CXFA_GEShading(const CFX_PointF& beginPoint, + const CFX_PointF& endPoint, + bool isExtendedBegin, + bool isExtendedEnd, + const FX_ARGB beginArgb, + const FX_ARGB endArgb) : m_type(FX_SHADING_Axial), m_beginPoint(beginPoint), m_endPoint(endPoint), @@ -24,14 +24,14 @@ CXFA_Shading::CXFA_Shading(const CFX_PointF& beginPoint, InitArgbArray(); } -CXFA_Shading::CXFA_Shading(const CFX_PointF& beginPoint, - const CFX_PointF& endPoint, - const float beginRadius, - const float endRadius, - bool isExtendedBegin, - bool isExtendedEnd, - const FX_ARGB beginArgb, - const FX_ARGB endArgb) +CXFA_GEShading::CXFA_GEShading(const CFX_PointF& beginPoint, + const CFX_PointF& endPoint, + const float beginRadius, + const float endRadius, + bool isExtendedBegin, + bool isExtendedEnd, + const FX_ARGB beginArgb, + const FX_ARGB endArgb) : m_type(FX_SHADING_Radial), m_beginPoint(beginPoint), m_endPoint(endPoint), @@ -44,9 +44,9 @@ CXFA_Shading::CXFA_Shading(const CFX_PointF& beginPoint, InitArgbArray(); } -CXFA_Shading::~CXFA_Shading() {} +CXFA_GEShading::~CXFA_GEShading() {} -void CXFA_Shading::InitArgbArray() { +void CXFA_GEShading::InitArgbArray() { int32_t a1; int32_t r1; int32_t g1; diff --git a/xfa/fxgraphics/cxfa_geshading.h b/xfa/fxgraphics/cxfa_geshading.h new file mode 100644 index 0000000000..fc7a13e619 --- /dev/null +++ b/xfa/fxgraphics/cxfa_geshading.h @@ -0,0 +1,56 @@ +// 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_FXGRAPHICS_CXFA_GESHADING_H_ +#define XFA_FXGRAPHICS_CXFA_GESHADING_H_ + +#include "core/fxcrt/fx_coordinates.h" +#include "core/fxcrt/fx_system.h" +#include "core/fxge/fx_dib.h" + +#define FX_SHADING_Steps 256 + +enum CXFA_GEShading_Type { FX_SHADING_Axial = 1, FX_SHADING_Radial }; + +class CXFA_GEShading { + public: + // Axial shading. + CXFA_GEShading(const CFX_PointF& beginPoint, + const CFX_PointF& endPoint, + bool isExtendedBegin, + bool isExtendedEnd, + const FX_ARGB beginArgb, + const FX_ARGB endArgb); + + // Radial shading. + CXFA_GEShading(const CFX_PointF& beginPoint, + const CFX_PointF& endPoint, + const float beginRadius, + const float endRadius, + bool isExtendedBegin, + bool isExtendedEnd, + const FX_ARGB beginArgb, + const FX_ARGB endArgb); + virtual ~CXFA_GEShading(); + + private: + friend class CXFA_Graphics; + + void InitArgbArray(); + + const CXFA_GEShading_Type m_type; + const CFX_PointF m_beginPoint; + const CFX_PointF m_endPoint; + const float m_beginRadius; + const float m_endRadius; + const bool m_isExtendedBegin; + const bool m_isExtendedEnd; + const FX_ARGB m_beginArgb; + const FX_ARGB m_endArgb; + FX_ARGB m_argbArray[FX_SHADING_Steps]; +}; + +#endif // XFA_FXGRAPHICS_CXFA_GESHADING_H_ diff --git a/xfa/fxgraphics/cxfa_graphics.cpp b/xfa/fxgraphics/cxfa_graphics.cpp index 7cb83e10aa..66a109ddaa 100644 --- a/xfa/fxgraphics/cxfa_graphics.cpp +++ b/xfa/fxgraphics/cxfa_graphics.cpp @@ -12,10 +12,10 @@ #include "core/fxge/cfx_renderdevice.h" #include "core/fxge/cfx_unicodeencoding.h" #include "third_party/base/ptr_util.h" -#include "xfa/fxgraphics/cxfa_color.h" -#include "xfa/fxgraphics/cxfa_path.h" -#include "xfa/fxgraphics/cxfa_pattern.h" -#include "xfa/fxgraphics/cxfa_shading.h" +#include "xfa/fxgraphics/cxfa_gecolor.h" +#include "xfa/fxgraphics/cxfa_gepath.h" +#include "xfa/fxgraphics/cxfa_gepattern.h" +#include "xfa/fxgraphics/cxfa_geshading.h" namespace { @@ -168,24 +168,24 @@ void CXFA_Graphics::EnableActOnDash() { m_info.isActOnDash = true; } -void CXFA_Graphics::SetStrokeColor(const CXFA_Color& color) { +void CXFA_Graphics::SetStrokeColor(const CXFA_GEColor& color) { if (m_type == FX_CONTEXT_Device && m_renderDevice) m_info.strokeColor = color; } -void CXFA_Graphics::SetFillColor(const CXFA_Color& color) { +void CXFA_Graphics::SetFillColor(const CXFA_GEColor& color) { if (m_type == FX_CONTEXT_Device && m_renderDevice) m_info.fillColor = color; } -void CXFA_Graphics::StrokePath(CXFA_Path* path, const CFX_Matrix* matrix) { +void CXFA_Graphics::StrokePath(CXFA_GEPath* path, const CFX_Matrix* matrix) { if (!path) return; if (m_type == FX_CONTEXT_Device && m_renderDevice) RenderDeviceStrokePath(path, matrix); } -void CXFA_Graphics::FillPath(CXFA_Path* path, +void CXFA_Graphics::FillPath(CXFA_GEPath* path, FX_FillMode fillMode, const CFX_Matrix* matrix) { if (!path) @@ -268,9 +268,9 @@ void CXFA_Graphics::RenderDeviceSetLineDash(FX_DashStyle dashStyle) { } } -void CXFA_Graphics::RenderDeviceStrokePath(const CXFA_Path* path, +void CXFA_Graphics::RenderDeviceStrokePath(const CXFA_GEPath* path, const CFX_Matrix* matrix) { - if (m_info.strokeColor.GetType() != CXFA_Color::Solid) + if (m_info.strokeColor.GetType() != CXFA_GEColor::Solid) return; CFX_Matrix m = m_info.CTM; @@ -281,7 +281,7 @@ void CXFA_Graphics::RenderDeviceStrokePath(const CXFA_Path* path, m_info.strokeColor.GetArgb(), 0); } -void CXFA_Graphics::RenderDeviceFillPath(const CXFA_Path* path, +void CXFA_Graphics::RenderDeviceFillPath(const CXFA_GEPath* path, FX_FillMode fillMode, const CFX_Matrix* matrix) { CFX_Matrix m = m_info.CTM; @@ -289,14 +289,14 @@ void CXFA_Graphics::RenderDeviceFillPath(const CXFA_Path* path, m.Concat(*matrix); switch (m_info.fillColor.GetType()) { - case CXFA_Color::Solid: + case CXFA_GEColor::Solid: m_renderDevice->DrawPath(path->GetPathData(), &m, &m_info.graphState, m_info.fillColor.GetArgb(), 0x0, fillMode); return; - case CXFA_Color::Pattern: + case CXFA_GEColor::Pattern: FillPathWithPattern(path, fillMode, m); return; - case CXFA_Color::Shading: + case CXFA_GEColor::Shading: FillPathWithShading(path, fillMode, m); return; default: @@ -329,10 +329,10 @@ void CXFA_Graphics::RenderDeviceStretchImage( FXSYS_round(r.left - left), FXSYS_round(r.top - top)); } -void CXFA_Graphics::FillPathWithPattern(const CXFA_Path* path, +void CXFA_Graphics::FillPathWithPattern(const CXFA_GEPath* path, FX_FillMode fillMode, const CFX_Matrix& matrix) { - CXFA_Pattern* pattern = m_info.fillColor.GetPattern(); + CXFA_GEPattern* pattern = m_info.fillColor.GetPattern(); RetainPtr<CFX_DIBitmap> bitmap = m_renderDevice->GetBitmap(); int32_t width = bitmap->GetWidth(); int32_t height = bitmap->GetHeight(); @@ -363,7 +363,7 @@ void CXFA_Graphics::FillPathWithPattern(const CXFA_Path* path, SetDIBitsWithMatrix(bmp, pattern->m_matrix); } -void CXFA_Graphics::FillPathWithShading(const CXFA_Path* path, +void CXFA_Graphics::FillPathWithShading(const CXFA_GEPath* path, FX_FillMode fillMode, const CFX_Matrix& matrix) { RetainPtr<CFX_DIBitmap> bitmap = m_renderDevice->GetBitmap(); diff --git a/xfa/fxgraphics/cxfa_graphics.h b/xfa/fxgraphics/cxfa_graphics.h index 6b9dcb9a86..16cd123fc7 100644 --- a/xfa/fxgraphics/cxfa_graphics.h +++ b/xfa/fxgraphics/cxfa_graphics.h @@ -16,9 +16,9 @@ #include "core/fxge/cfx_renderdevice.h" #include "core/fxge/fx_dib.h" #include "core/fxge/fx_font.h" -#include "xfa/fxgraphics/cxfa_color.h" +#include "xfa/fxgraphics/cxfa_gecolor.h" -class CXFA_Path; +class CXFA_GEPath; using FX_FillMode = int32_t; @@ -58,11 +58,11 @@ class CXFA_Graphics { void SetLineDash(FX_DashStyle dashStyle); void SetLineWidth(float lineWidth); void EnableActOnDash(); - void SetStrokeColor(const CXFA_Color& color); - void SetFillColor(const CXFA_Color& color); + void SetStrokeColor(const CXFA_GEColor& color); + void SetFillColor(const CXFA_GEColor& color); void SetClipRect(const CFX_RectF& rect); - void StrokePath(CXFA_Path* path, const CFX_Matrix* matrix); - void FillPath(CXFA_Path* path, + void StrokePath(CXFA_GEPath* path, const CFX_Matrix* matrix); + void FillPath(CXFA_GEPath* path, FX_FillMode fillMode, const CFX_Matrix* matrix); void StretchImage(const RetainPtr<CFX_DIBSource>& source, @@ -82,23 +82,24 @@ class CXFA_Graphics { CFX_GraphStateData graphState; CFX_Matrix CTM; bool isActOnDash; - CXFA_Color strokeColor; - CXFA_Color fillColor; + CXFA_GEColor strokeColor; + CXFA_GEColor fillColor; } m_info; void RenderDeviceSetLineDash(FX_DashStyle dashStyle); - void RenderDeviceStrokePath(const CXFA_Path* path, const CFX_Matrix* matrix); - void RenderDeviceFillPath(const CXFA_Path* path, + void RenderDeviceStrokePath(const CXFA_GEPath* path, + const CFX_Matrix* matrix); + void RenderDeviceFillPath(const CXFA_GEPath* path, FX_FillMode fillMode, const CFX_Matrix* matrix); void RenderDeviceStretchImage(const RetainPtr<CFX_DIBSource>& source, const CFX_RectF& rect, const CFX_Matrix& matrix); - void FillPathWithPattern(const CXFA_Path* path, + void FillPathWithPattern(const CXFA_GEPath* path, FX_FillMode fillMode, const CFX_Matrix& matrix); - void FillPathWithShading(const CXFA_Path* path, + void FillPathWithShading(const CXFA_GEPath* path, FX_FillMode fillMode, const CFX_Matrix& matrix); diff --git a/xfa/fxgraphics/cxfa_shading.h b/xfa/fxgraphics/cxfa_shading.h deleted file mode 100644 index 22ef941250..0000000000 --- a/xfa/fxgraphics/cxfa_shading.h +++ /dev/null @@ -1,56 +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_FXGRAPHICS_CXFA_SHADING_H_ -#define XFA_FXGRAPHICS_CXFA_SHADING_H_ - -#include "core/fxcrt/fx_coordinates.h" -#include "core/fxcrt/fx_system.h" -#include "core/fxge/fx_dib.h" - -#define FX_SHADING_Steps 256 - -enum CXFA_Shading_Type { FX_SHADING_Axial = 1, FX_SHADING_Radial }; - -class CXFA_Shading { - public: - // Axial shading. - CXFA_Shading(const CFX_PointF& beginPoint, - const CFX_PointF& endPoint, - bool isExtendedBegin, - bool isExtendedEnd, - const FX_ARGB beginArgb, - const FX_ARGB endArgb); - - // Radial shading. - CXFA_Shading(const CFX_PointF& beginPoint, - const CFX_PointF& endPoint, - const float beginRadius, - const float endRadius, - bool isExtendedBegin, - bool isExtendedEnd, - const FX_ARGB beginArgb, - const FX_ARGB endArgb); - virtual ~CXFA_Shading(); - - private: - friend class CXFA_Graphics; - - void InitArgbArray(); - - const CXFA_Shading_Type m_type; - const CFX_PointF m_beginPoint; - const CFX_PointF m_endPoint; - const float m_beginRadius; - const float m_endRadius; - const bool m_isExtendedBegin; - const bool m_isExtendedEnd; - const FX_ARGB m_beginArgb; - const FX_ARGB m_endArgb; - FX_ARGB m_argbArray[FX_SHADING_Steps]; -}; - -#endif // XFA_FXGRAPHICS_CXFA_SHADING_H_ |