diff options
Diffstat (limited to 'xfa/fxgraphics')
-rw-r--r-- | xfa/fxgraphics/cfx_shading.h | 56 | ||||
-rw-r--r-- | xfa/fxgraphics/cxfa_color.cpp | 8 | ||||
-rw-r--r-- | xfa/fxgraphics/cxfa_color.h | 20 | ||||
-rw-r--r-- | xfa/fxgraphics/cxfa_graphics.cpp (renamed from xfa/fxgraphics/cfx_graphics.cpp) | 91 | ||||
-rw-r--r-- | xfa/fxgraphics/cxfa_graphics.h (renamed from xfa/fxgraphics/cfx_graphics.h) | 26 | ||||
-rw-r--r-- | xfa/fxgraphics/cxfa_path.cpp (renamed from xfa/fxgraphics/cfx_path.cpp) | 54 | ||||
-rw-r--r-- | xfa/fxgraphics/cxfa_path.h (renamed from xfa/fxgraphics/cfx_path.h) | 16 | ||||
-rw-r--r-- | xfa/fxgraphics/cxfa_pattern.cpp (renamed from xfa/fxgraphics/cfx_pattern.cpp) | 12 | ||||
-rw-r--r-- | xfa/fxgraphics/cxfa_pattern.h (renamed from xfa/fxgraphics/cfx_pattern.h) | 22 | ||||
-rw-r--r-- | xfa/fxgraphics/cxfa_shading.cpp (renamed from xfa/fxgraphics/cfx_shading.cpp) | 34 | ||||
-rw-r--r-- | xfa/fxgraphics/cxfa_shading.h | 56 |
11 files changed, 198 insertions, 197 deletions
diff --git a/xfa/fxgraphics/cfx_shading.h b/xfa/fxgraphics/cfx_shading.h deleted file mode 100644 index 1fb34d2b07..0000000000 --- a/xfa/fxgraphics/cfx_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_CFX_SHADING_H_ -#define XFA_FXGRAPHICS_CFX_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 CFX_Shading_Type { FX_SHADING_Axial = 1, FX_SHADING_Radial }; - -class CFX_Shading { - public: - // Axial shading. - CFX_Shading(const CFX_PointF& beginPoint, - const CFX_PointF& endPoint, - bool isExtendedBegin, - bool isExtendedEnd, - const FX_ARGB beginArgb, - const FX_ARGB endArgb); - - // Radial shading. - CFX_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 ~CFX_Shading(); - - private: - friend class CFX_Graphics; - - void InitArgbArray(); - - const CFX_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_CFX_SHADING_H_ diff --git a/xfa/fxgraphics/cxfa_color.cpp b/xfa/fxgraphics/cxfa_color.cpp index 27a0cbe569..79c0e5f794 100644 --- a/xfa/fxgraphics/cxfa_color.cpp +++ b/xfa/fxgraphics/cxfa_color.cpp @@ -12,11 +12,11 @@ CXFA_Color::CXFA_Color(const FX_ARGB argb) { Set(argb); } -CXFA_Color::CXFA_Color(CFX_Pattern* pattern, const FX_ARGB argb) { +CXFA_Color::CXFA_Color(CXFA_Pattern* pattern, const FX_ARGB argb) { Set(pattern, argb); } -CXFA_Color::CXFA_Color(CFX_Shading* shading) { +CXFA_Color::CXFA_Color(CXFA_Shading* shading) { Set(shading); } @@ -30,7 +30,7 @@ void CXFA_Color::Set(const FX_ARGB argb) { m_info.pattern = nullptr; } -void CXFA_Color::Set(CFX_Pattern* pattern, const FX_ARGB argb) { +void CXFA_Color::Set(CXFA_Pattern* pattern, const FX_ARGB argb) { if (!pattern) return; m_type = FX_COLOR_Pattern; @@ -38,7 +38,7 @@ void CXFA_Color::Set(CFX_Pattern* pattern, const FX_ARGB argb) { m_info.pattern = pattern; } -void CXFA_Color::Set(CFX_Shading* shading) { +void CXFA_Color::Set(CXFA_Shading* shading) { if (!shading) return; m_type = FX_COLOR_Shading; diff --git a/xfa/fxgraphics/cxfa_color.h b/xfa/fxgraphics/cxfa_color.h index 16ef1d7d4d..f5bba27586 100644 --- a/xfa/fxgraphics/cxfa_color.h +++ b/xfa/fxgraphics/cxfa_color.h @@ -8,10 +8,10 @@ #define XFA_FXGRAPHICS_CXFA_COLOR_H_ #include "core/fxge/fx_dib.h" -#include "xfa/fxgraphics/cfx_graphics.h" +#include "xfa/fxgraphics/cxfa_graphics.h" -class CFX_Pattern; -class CFX_Shading; +class CXFA_Pattern; +class CXFA_Shading; enum { FX_COLOR_None = 0, FX_COLOR_Solid, FX_COLOR_Pattern, FX_COLOR_Shading }; @@ -19,24 +19,24 @@ class CXFA_Color { public: CXFA_Color(); explicit CXFA_Color(const FX_ARGB argb); - explicit CXFA_Color(CFX_Shading* shading); - CXFA_Color(CFX_Pattern* pattern, const FX_ARGB argb); + explicit CXFA_Color(CXFA_Shading* shading); + CXFA_Color(CXFA_Pattern* pattern, const FX_ARGB argb); virtual ~CXFA_Color(); void Set(const FX_ARGB argb); - void Set(CFX_Pattern* pattern, const FX_ARGB argb); - void Set(CFX_Shading* shading); + void Set(CXFA_Pattern* pattern, const FX_ARGB argb); + void Set(CXFA_Shading* shading); private: - friend class CFX_Graphics; + friend class CXFA_Graphics; int32_t m_type; union { struct { FX_ARGB argb; - CFX_Pattern* pattern; + CXFA_Pattern* pattern; } m_info; - CFX_Shading* m_shading; + CXFA_Shading* m_shading; }; }; diff --git a/xfa/fxgraphics/cfx_graphics.cpp b/xfa/fxgraphics/cxfa_graphics.cpp index 0865221aa9..8648abb81d 100644 --- a/xfa/fxgraphics/cfx_graphics.cpp +++ b/xfa/fxgraphics/cxfa_graphics.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxgraphics/cfx_graphics.h" +#include "xfa/fxgraphics/cxfa_graphics.h" #include <memory> @@ -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/cfx_path.h" -#include "xfa/fxgraphics/cfx_pattern.h" -#include "xfa/fxgraphics/cfx_shading.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" namespace { @@ -97,16 +97,16 @@ const FX_HATCHDATA hatchBitmapData[FX_HATCHSTYLE_Total] = { } // namespace -CFX_Graphics::CFX_Graphics(CFX_RenderDevice* renderDevice) +CXFA_Graphics::CXFA_Graphics(CFX_RenderDevice* renderDevice) : m_type(FX_CONTEXT_None), m_renderDevice(renderDevice) { if (!renderDevice) return; m_type = FX_CONTEXT_Device; } -CFX_Graphics::~CFX_Graphics() {} +CXFA_Graphics::~CXFA_Graphics() {} -void CFX_Graphics::SaveGraphState() { +void CXFA_Graphics::SaveGraphState() { if (m_type != FX_CONTEXT_Device || !m_renderDevice) return; @@ -114,7 +114,7 @@ void CFX_Graphics::SaveGraphState() { m_infoStack.push_back(pdfium::MakeUnique<TInfo>(m_info)); } -void CFX_Graphics::RestoreGraphState() { +void CXFA_Graphics::RestoreGraphState() { if (m_type != FX_CONTEXT_Device || !m_renderDevice) return; @@ -127,15 +127,15 @@ void CFX_Graphics::RestoreGraphState() { return; } -void CFX_Graphics::SetLineCap(CFX_GraphStateData::LineCap lineCap) { +void CXFA_Graphics::SetLineCap(CFX_GraphStateData::LineCap lineCap) { if (m_type == FX_CONTEXT_Device && m_renderDevice) { m_info.graphState.m_LineCap = lineCap; } } -void CFX_Graphics::SetLineDash(float dashPhase, - float* dashArray, - int32_t dashCount) { +void CXFA_Graphics::SetLineDash(float dashPhase, + float* dashArray, + int32_t dashCount) { if (dashCount > 0 && !dashArray) return; @@ -153,19 +153,19 @@ void CFX_Graphics::SetLineDash(float dashPhase, } } -void CFX_Graphics::SetLineDash(FX_DashStyle dashStyle) { +void CXFA_Graphics::SetLineDash(FX_DashStyle dashStyle) { if (m_type == FX_CONTEXT_Device && m_renderDevice) RenderDeviceSetLineDash(dashStyle); } -void CFX_Graphics::SetLineWidth(float lineWidth, bool isActOnDash) { +void CXFA_Graphics::SetLineWidth(float lineWidth, bool isActOnDash) { if (m_type == FX_CONTEXT_Device && m_renderDevice) { m_info.graphState.m_LineWidth = lineWidth; m_info.isActOnDash = isActOnDash; } } -void CFX_Graphics::SetStrokeColor(CXFA_Color* color) { +void CXFA_Graphics::SetStrokeColor(CXFA_Color* color) { if (!color) return; if (m_type == FX_CONTEXT_Device && m_renderDevice) { @@ -173,7 +173,7 @@ void CFX_Graphics::SetStrokeColor(CXFA_Color* color) { } } -void CFX_Graphics::SetFillColor(CXFA_Color* color) { +void CXFA_Graphics::SetFillColor(CXFA_Color* color) { if (!color) return; if (m_type == FX_CONTEXT_Device && m_renderDevice) { @@ -181,32 +181,32 @@ void CFX_Graphics::SetFillColor(CXFA_Color* color) { } } -void CFX_Graphics::StrokePath(CFX_Path* path, CFX_Matrix* matrix) { +void CXFA_Graphics::StrokePath(CXFA_Path* path, CFX_Matrix* matrix) { if (!path) return; if (m_type == FX_CONTEXT_Device && m_renderDevice) RenderDeviceStrokePath(path, matrix); } -void CFX_Graphics::FillPath(CFX_Path* path, - FX_FillMode fillMode, - CFX_Matrix* matrix) { +void CXFA_Graphics::FillPath(CXFA_Path* path, + FX_FillMode fillMode, + CFX_Matrix* matrix) { if (!path) return; if (m_type == FX_CONTEXT_Device && m_renderDevice) RenderDeviceFillPath(path, fillMode, matrix); } -void CFX_Graphics::StretchImage(const CFX_RetainPtr<CFX_DIBSource>& source, - const CFX_RectF& rect, - CFX_Matrix* matrix) { +void CXFA_Graphics::StretchImage(const CFX_RetainPtr<CFX_DIBSource>& source, + const CFX_RectF& rect, + CFX_Matrix* matrix) { if (!source) return; if (m_type == FX_CONTEXT_Device && m_renderDevice) RenderDeviceStretchImage(source, rect, matrix); } -void CFX_Graphics::ConcatMatrix(const CFX_Matrix* matrix) { +void CXFA_Graphics::ConcatMatrix(const CFX_Matrix* matrix) { if (!matrix) return; if (m_type == FX_CONTEXT_Device && m_renderDevice) { @@ -214,13 +214,13 @@ void CFX_Graphics::ConcatMatrix(const CFX_Matrix* matrix) { } } -CFX_Matrix* CFX_Graphics::GetMatrix() { +CFX_Matrix* CXFA_Graphics::GetMatrix() { if (m_type == FX_CONTEXT_Device && m_renderDevice) return &m_info.CTM; return nullptr; } -CFX_RectF CFX_Graphics::GetClipRect() const { +CFX_RectF CXFA_Graphics::GetClipRect() const { if (m_type != FX_CONTEXT_Device || !m_renderDevice) return CFX_RectF(); @@ -228,7 +228,7 @@ CFX_RectF CFX_Graphics::GetClipRect() const { return CFX_Rect(r.left, r.top, r.Width(), r.Height()).As<float>(); } -void CFX_Graphics::SetClipRect(const CFX_RectF& rect) { +void CXFA_Graphics::SetClipRect(const CFX_RectF& rect) { if (m_type == FX_CONTEXT_Device && m_renderDevice) { m_renderDevice->SetClip_Rect( FX_RECT(FXSYS_round(rect.left), FXSYS_round(rect.top), @@ -236,11 +236,11 @@ void CFX_Graphics::SetClipRect(const CFX_RectF& rect) { } } -CFX_RenderDevice* CFX_Graphics::GetRenderDevice() { +CFX_RenderDevice* CXFA_Graphics::GetRenderDevice() { return m_renderDevice; } -void CFX_Graphics::RenderDeviceSetLineDash(FX_DashStyle dashStyle) { +void CXFA_Graphics::RenderDeviceSetLineDash(FX_DashStyle dashStyle) { switch (dashStyle) { case FX_DASHSTYLE_Solid: { m_info.graphState.SetDashCount(0); @@ -271,7 +271,8 @@ void CFX_Graphics::RenderDeviceSetLineDash(FX_DashStyle dashStyle) { } } -void CFX_Graphics::RenderDeviceStrokePath(CFX_Path* path, CFX_Matrix* matrix) { +void CXFA_Graphics::RenderDeviceStrokePath(CXFA_Path* path, + CFX_Matrix* matrix) { if (!m_info.strokeColor) return; CFX_Matrix m(m_info.CTM.a, m_info.CTM.b, m_info.CTM.c, m_info.CTM.d, @@ -290,9 +291,9 @@ void CFX_Graphics::RenderDeviceStrokePath(CFX_Path* path, CFX_Matrix* matrix) { } } -void CFX_Graphics::RenderDeviceFillPath(CFX_Path* path, - FX_FillMode fillMode, - CFX_Matrix* matrix) { +void CXFA_Graphics::RenderDeviceFillPath(CXFA_Path* path, + FX_FillMode fillMode, + CFX_Matrix* matrix) { if (!m_info.fillColor) return; CFX_Matrix m(m_info.CTM.a, m_info.CTM.b, m_info.CTM.c, m_info.CTM.d, @@ -317,7 +318,7 @@ void CFX_Graphics::RenderDeviceFillPath(CFX_Path* path, } } -void CFX_Graphics::RenderDeviceStretchImage( +void CXFA_Graphics::RenderDeviceStretchImage( const CFX_RetainPtr<CFX_DIBSource>& source, const CFX_RectF& rect, CFX_Matrix* matrix) { @@ -343,10 +344,10 @@ void CFX_Graphics::RenderDeviceStretchImage( FXSYS_round(r.left - left), FXSYS_round(r.top - top)); } -void CFX_Graphics::FillPathWithPattern(CFX_Path* path, - FX_FillMode fillMode, - CFX_Matrix* matrix) { - CFX_Pattern* pattern = m_info.fillColor->m_info.pattern; +void CXFA_Graphics::FillPathWithPattern(CXFA_Path* path, + FX_FillMode fillMode, + CFX_Matrix* matrix) { + CXFA_Pattern* pattern = m_info.fillColor->m_info.pattern; CFX_RetainPtr<CFX_DIBitmap> bitmap = m_renderDevice->GetBitmap(); int32_t width = bitmap->GetWidth(); int32_t height = bitmap->GetHeight(); @@ -380,9 +381,9 @@ void CFX_Graphics::FillPathWithPattern(CFX_Path* path, SetDIBitsWithMatrix(bmp, &pattern->m_matrix); } -void CFX_Graphics::FillPathWithShading(CFX_Path* path, - FX_FillMode fillMode, - CFX_Matrix* matrix) { +void CXFA_Graphics::FillPathWithShading(CXFA_Path* path, + FX_FillMode fillMode, + CFX_Matrix* matrix) { CFX_RetainPtr<CFX_DIBitmap> bitmap = m_renderDevice->GetBitmap(); int32_t width = bitmap->GetWidth(); int32_t height = bitmap->GetHeight(); @@ -498,7 +499,7 @@ void CFX_Graphics::FillPathWithShading(CFX_Path* path, } } -void CFX_Graphics::SetDIBitsWithMatrix( +void CXFA_Graphics::SetDIBitsWithMatrix( const CFX_RetainPtr<CFX_DIBSource>& source, CFX_Matrix* matrix) { if (matrix->IsIdentity()) { @@ -515,17 +516,17 @@ void CFX_Graphics::SetDIBitsWithMatrix( } } -CFX_Graphics::TInfo::TInfo() +CXFA_Graphics::TInfo::TInfo() : isActOnDash(false), strokeColor(nullptr), fillColor(nullptr) {} -CFX_Graphics::TInfo::TInfo(const TInfo& info) +CXFA_Graphics::TInfo::TInfo(const TInfo& info) : graphState(info.graphState), CTM(info.CTM), isActOnDash(info.isActOnDash), strokeColor(info.strokeColor), fillColor(info.fillColor) {} -CFX_Graphics::TInfo& CFX_Graphics::TInfo::operator=(const TInfo& other) { +CXFA_Graphics::TInfo& CXFA_Graphics::TInfo::operator=(const TInfo& other) { graphState.Copy(other.graphState); CTM = other.CTM; isActOnDash = other.isActOnDash; diff --git a/xfa/fxgraphics/cfx_graphics.h b/xfa/fxgraphics/cxfa_graphics.h index 0ce9bf4b32..5492d4d3be 100644 --- a/xfa/fxgraphics/cfx_graphics.h +++ b/xfa/fxgraphics/cxfa_graphics.h @@ -4,8 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef XFA_FXGRAPHICS_CFX_GRAPHICS_H_ -#define XFA_FXGRAPHICS_CFX_GRAPHICS_H_ +#ifndef XFA_FXGRAPHICS_CXFA_GRAPHICS_H_ +#define XFA_FXGRAPHICS_CXFA_GRAPHICS_H_ #include <memory> #include <vector> @@ -18,7 +18,7 @@ #include "core/fxge/fx_font.h" class CXFA_Color; -class CFX_Path; +class CXFA_Path; using FX_FillMode = int32_t; @@ -41,10 +41,10 @@ enum class FX_HatchStyle { class CFX_RenderDevice; -class CFX_Graphics { +class CXFA_Graphics { public: - explicit CFX_Graphics(CFX_RenderDevice* renderDevice); - ~CFX_Graphics(); + explicit CXFA_Graphics(CFX_RenderDevice* renderDevice); + ~CXFA_Graphics(); void SaveGraphState(); void RestoreGraphState(); @@ -60,8 +60,8 @@ class CFX_Graphics { void SetStrokeColor(CXFA_Color* color); void SetFillColor(CXFA_Color* color); void SetClipRect(const CFX_RectF& rect); - void StrokePath(CFX_Path* path, CFX_Matrix* matrix = nullptr); - void FillPath(CFX_Path* path, + void StrokePath(CXFA_Path* path, CFX_Matrix* matrix = nullptr); + void FillPath(CXFA_Path* path, FX_FillMode fillMode = FXFILL_WINDING, CFX_Matrix* matrix = nullptr); void StretchImage(const CFX_RetainPtr<CFX_DIBSource>& source, @@ -86,18 +86,18 @@ class CFX_Graphics { } m_info; void RenderDeviceSetLineDash(FX_DashStyle dashStyle); - void RenderDeviceStrokePath(CFX_Path* path, CFX_Matrix* matrix); - void RenderDeviceFillPath(CFX_Path* path, + void RenderDeviceStrokePath(CXFA_Path* path, CFX_Matrix* matrix); + void RenderDeviceFillPath(CXFA_Path* path, FX_FillMode fillMode, CFX_Matrix* matrix); void RenderDeviceStretchImage(const CFX_RetainPtr<CFX_DIBSource>& source, const CFX_RectF& rect, CFX_Matrix* matrix); - void FillPathWithPattern(CFX_Path* path, + void FillPathWithPattern(CXFA_Path* path, FX_FillMode fillMode, CFX_Matrix* matrix); - void FillPathWithShading(CFX_Path* path, + void FillPathWithShading(CXFA_Path* path, FX_FillMode fillMode, CFX_Matrix* matrix); @@ -108,4 +108,4 @@ class CFX_Graphics { std::vector<std::unique_ptr<TInfo>> m_infoStack; }; -#endif // XFA_FXGRAPHICS_CFX_GRAPHICS_H_ +#endif // XFA_FXGRAPHICS_CXFA_GRAPHICS_H_ diff --git a/xfa/fxgraphics/cfx_path.cpp b/xfa/fxgraphics/cxfa_path.cpp index fc0051ad4c..6d7ed0be58 100644 --- a/xfa/fxgraphics/cfx_path.cpp +++ b/xfa/fxgraphics/cxfa_path.cpp @@ -4,52 +4,52 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxgraphics/cfx_path.h" +#include "xfa/fxgraphics/cxfa_path.h" #include "core/fxge/cfx_pathdata.h" #include "third_party/base/ptr_util.h" -CFX_Path::CFX_Path() {} +CXFA_Path::CXFA_Path() {} -CFX_Path::~CFX_Path() {} +CXFA_Path::~CXFA_Path() {} -void CFX_Path::Clear() { +void CXFA_Path::Clear() { data_.Clear(); } -void CFX_Path::Close() { +void CXFA_Path::Close() { data_.ClosePath(); } -void CFX_Path::MoveTo(const CFX_PointF& point) { +void CXFA_Path::MoveTo(const CFX_PointF& point) { data_.AppendPoint(point, FXPT_TYPE::MoveTo, false); } -void CFX_Path::LineTo(const CFX_PointF& point) { +void CXFA_Path::LineTo(const CFX_PointF& point) { data_.AppendPoint(point, FXPT_TYPE::LineTo, false); } -void CFX_Path::BezierTo(const CFX_PointF& c1, - const CFX_PointF& c2, - const CFX_PointF& to) { +void CXFA_Path::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 CFX_Path::ArcTo(const CFX_PointF& pos, - const CFX_SizeF& size, - float start_angle, - float sweep_angle) { +void CXFA_Path::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 CFX_Path::ArcToInternal(const CFX_PointF& pos, - const CFX_SizeF& size, - float start_angle, - float sweep_angle) { +void CXFA_Path::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,23 @@ void CFX_Path::ArcToInternal(const CFX_PointF& pos, data_.AppendPoint(bezier, FXPT_TYPE::BezierTo, false); } -void CFX_Path::AddLine(const CFX_PointF& p1, const CFX_PointF& p2) { +void CXFA_Path::AddLine(const CFX_PointF& p1, const CFX_PointF& p2) { data_.AppendPoint(p1, FXPT_TYPE::MoveTo, false); data_.AppendPoint(p2, FXPT_TYPE::LineTo, false); } -void CFX_Path::AddRectangle(float left, float top, float width, float height) { +void CXFA_Path::AddRectangle(float left, float top, float width, float height) { data_.AppendRect(left, top, left + width, top + height); } -void CFX_Path::AddEllipse(const CFX_RectF& rect) { +void CXFA_Path::AddEllipse(const CFX_RectF& rect) { AddArc(rect.TopLeft(), rect.Size(), 0, FX_PI * 2); } -void CFX_Path::AddArc(const CFX_PointF& original_pos, - const CFX_SizeF& original_size, - float start_angle, - float sweep_angle) { +void CXFA_Path::AddArc(const CFX_PointF& original_pos, + const CFX_SizeF& original_size, + float start_angle, + float sweep_angle) { if (sweep_angle == 0) return; @@ -137,12 +137,12 @@ void CFX_Path::AddArc(const CFX_PointF& original_pos, } while (!done); } -void CFX_Path::AddSubpath(CFX_Path* path) { +void CXFA_Path::AddSubpath(CXFA_Path* path) { if (!path) return; data_.Append(&path->data_, nullptr); } -void CFX_Path::TransformBy(const CFX_Matrix& mt) { +void CXFA_Path::TransformBy(const CFX_Matrix& mt) { data_.Transform(&mt); } diff --git a/xfa/fxgraphics/cfx_path.h b/xfa/fxgraphics/cxfa_path.h index 186465f810..9c71a4d5ff 100644 --- a/xfa/fxgraphics/cfx_path.h +++ b/xfa/fxgraphics/cxfa_path.h @@ -4,17 +4,17 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef XFA_FXGRAPHICS_CFX_PATH_H_ -#define XFA_FXGRAPHICS_CFX_PATH_H_ +#ifndef XFA_FXGRAPHICS_CXFA_PATH_H_ +#define XFA_FXGRAPHICS_CXFA_PATH_H_ #include "core/fxcrt/fx_system.h" #include "core/fxge/cfx_pathdata.h" -#include "xfa/fxgraphics/cfx_graphics.h" +#include "xfa/fxgraphics/cxfa_graphics.h" -class CFX_Path final { +class CXFA_Path final { public: - CFX_Path(); - ~CFX_Path(); + CXFA_Path(); + ~CXFA_Path(); const CFX_PathData* GetPathData() const { return &data_; } @@ -41,7 +41,7 @@ class CFX_Path final { float startAngle, float sweepAngle); - void AddSubpath(CFX_Path* path); + void AddSubpath(CXFA_Path* path); private: void ArcToInternal(const CFX_PointF& pos, @@ -52,4 +52,4 @@ class CFX_Path final { CFX_PathData data_; }; -#endif // XFA_FXGRAPHICS_CFX_PATH_H_ +#endif // XFA_FXGRAPHICS_CXFA_PATH_H_ diff --git a/xfa/fxgraphics/cfx_pattern.cpp b/xfa/fxgraphics/cxfa_pattern.cpp index a20ec24aa5..ea6cea87a5 100644 --- a/xfa/fxgraphics/cfx_pattern.cpp +++ b/xfa/fxgraphics/cxfa_pattern.cpp @@ -4,12 +4,12 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxgraphics/cfx_pattern.h" +#include "xfa/fxgraphics/cxfa_pattern.h" -CFX_Pattern::CFX_Pattern(FX_HatchStyle hatchStyle, - const FX_ARGB foreArgb, - const FX_ARGB backArgb, - CFX_Matrix* matrix) +CXFA_Pattern::CXFA_Pattern(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 @@ CFX_Pattern::CFX_Pattern(FX_HatchStyle hatchStyle, m_matrix.SetIdentity(); } -CFX_Pattern::~CFX_Pattern() {} +CXFA_Pattern::~CXFA_Pattern() {} diff --git a/xfa/fxgraphics/cfx_pattern.h b/xfa/fxgraphics/cxfa_pattern.h index ef0008a3ea..838ec98b01 100644 --- a/xfa/fxgraphics/cfx_pattern.h +++ b/xfa/fxgraphics/cxfa_pattern.h @@ -4,27 +4,27 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef XFA_FXGRAPHICS_CFX_PATTERN_H_ -#define XFA_FXGRAPHICS_CFX_PATTERN_H_ +#ifndef XFA_FXGRAPHICS_CXFA_PATTERN_H_ +#define XFA_FXGRAPHICS_CXFA_PATTERN_H_ #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_system.h" -#include "xfa/fxgraphics/cfx_graphics.h" +#include "xfa/fxgraphics/cxfa_graphics.h" class CFX_DIBitmap; class CFX_Matrix; -class CFX_Pattern { +class CXFA_Pattern { public: - CFX_Pattern(FX_HatchStyle hatchStyle, - const FX_ARGB foreArgb, - const FX_ARGB backArgb, - CFX_Matrix* matrix = nullptr); + CXFA_Pattern(FX_HatchStyle hatchStyle, + const FX_ARGB foreArgb, + const FX_ARGB backArgb, + CFX_Matrix* matrix = nullptr); - virtual ~CFX_Pattern(); + virtual ~CXFA_Pattern(); private: - friend class CFX_Graphics; + friend class CXFA_Graphics; CFX_Matrix m_matrix; @@ -33,4 +33,4 @@ class CFX_Pattern { const FX_ARGB m_backArgb; }; -#endif // XFA_FXGRAPHICS_CFX_PATTERN_H_ +#endif // XFA_FXGRAPHICS_CXFA_PATTERN_H_ diff --git a/xfa/fxgraphics/cfx_shading.cpp b/xfa/fxgraphics/cxfa_shading.cpp index b099bb97b1..599a3f9d42 100644 --- a/xfa/fxgraphics/cfx_shading.cpp +++ b/xfa/fxgraphics/cxfa_shading.cpp @@ -4,14 +4,14 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxgraphics/cfx_shading.h" +#include "xfa/fxgraphics/cxfa_shading.h" -CFX_Shading::CFX_Shading(const CFX_PointF& beginPoint, - const CFX_PointF& endPoint, - bool isExtendedBegin, - bool isExtendedEnd, - const FX_ARGB beginArgb, - const FX_ARGB endArgb) +CXFA_Shading::CXFA_Shading(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 @@ CFX_Shading::CFX_Shading(const CFX_PointF& beginPoint, InitArgbArray(); } -CFX_Shading::CFX_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_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) : m_type(FX_SHADING_Radial), m_beginPoint(beginPoint), m_endPoint(endPoint), @@ -44,9 +44,9 @@ CFX_Shading::CFX_Shading(const CFX_PointF& beginPoint, InitArgbArray(); } -CFX_Shading::~CFX_Shading() {} +CXFA_Shading::~CXFA_Shading() {} -void CFX_Shading::InitArgbArray() { +void CXFA_Shading::InitArgbArray() { int32_t a1; int32_t r1; int32_t g1; diff --git a/xfa/fxgraphics/cxfa_shading.h b/xfa/fxgraphics/cxfa_shading.h new file mode 100644 index 0000000000..22ef941250 --- /dev/null +++ b/xfa/fxgraphics/cxfa_shading.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_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_ |