From fe75997a8a8d7fc555d91c3aad595112a46ad7a2 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 13 Jul 2017 13:51:04 -0400 Subject: Rename cfx_color to cxfa_color This CL renames CFX_Color to CXFA_Color. The class has some XFA specific things like shadings and patterns in it and doesn't make sense as the colour base class. Change-Id: I1d2230b9f03a1017777ce673419926429b769e7c Reviewed-on: https://pdfium-review.googlesource.com/7752 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- xfa/fxgraphics/cfx_color.cpp | 46 ----------------------------------------- xfa/fxgraphics/cfx_color.h | 43 -------------------------------------- xfa/fxgraphics/cfx_graphics.cpp | 6 +++--- xfa/fxgraphics/cfx_graphics.h | 10 ++++----- xfa/fxgraphics/cxfa_color.cpp | 46 +++++++++++++++++++++++++++++++++++++++++ xfa/fxgraphics/cxfa_color.h | 43 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 97 insertions(+), 97 deletions(-) delete mode 100644 xfa/fxgraphics/cfx_color.cpp delete mode 100644 xfa/fxgraphics/cfx_color.h create mode 100644 xfa/fxgraphics/cxfa_color.cpp create mode 100644 xfa/fxgraphics/cxfa_color.h (limited to 'xfa/fxgraphics') diff --git a/xfa/fxgraphics/cfx_color.cpp b/xfa/fxgraphics/cfx_color.cpp deleted file mode 100644 index 36025a82c8..0000000000 --- a/xfa/fxgraphics/cfx_color.cpp +++ /dev/null @@ -1,46 +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/fxgraphics/cfx_color.h" - -CFX_Color::CFX_Color() : m_type(FX_COLOR_None) {} - -CFX_Color::CFX_Color(const FX_ARGB argb) { - Set(argb); -} - -CFX_Color::CFX_Color(CFX_Pattern* pattern, const FX_ARGB argb) { - Set(pattern, argb); -} - -CFX_Color::CFX_Color(CFX_Shading* shading) { - Set(shading); -} - -CFX_Color::~CFX_Color() { - m_type = FX_COLOR_None; -} - -void CFX_Color::Set(const FX_ARGB argb) { - m_type = FX_COLOR_Solid; - m_info.argb = argb; - m_info.pattern = nullptr; -} - -void CFX_Color::Set(CFX_Pattern* pattern, const FX_ARGB argb) { - if (!pattern) - return; - m_type = FX_COLOR_Pattern; - m_info.argb = argb; - m_info.pattern = pattern; -} - -void CFX_Color::Set(CFX_Shading* shading) { - if (!shading) - return; - m_type = FX_COLOR_Shading; - m_shading = shading; -} diff --git a/xfa/fxgraphics/cfx_color.h b/xfa/fxgraphics/cfx_color.h deleted file mode 100644 index 75f7fe2010..0000000000 --- a/xfa/fxgraphics/cfx_color.h +++ /dev/null @@ -1,43 +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_COLOR_H_ -#define XFA_FXGRAPHICS_CFX_COLOR_H_ - -#include "core/fxge/fx_dib.h" -#include "xfa/fxgraphics/cfx_graphics.h" - -class CFX_Pattern; -class CFX_Shading; - -enum { FX_COLOR_None = 0, FX_COLOR_Solid, FX_COLOR_Pattern, FX_COLOR_Shading }; - -class CFX_Color { - public: - CFX_Color(); - explicit CFX_Color(const FX_ARGB argb); - explicit CFX_Color(CFX_Shading* shading); - CFX_Color(CFX_Pattern* pattern, const FX_ARGB argb); - virtual ~CFX_Color(); - - void Set(const FX_ARGB argb); - void Set(CFX_Pattern* pattern, const FX_ARGB argb); - void Set(CFX_Shading* shading); - - private: - friend class CFX_Graphics; - - int32_t m_type; - union { - struct { - FX_ARGB argb; - CFX_Pattern* pattern; - } m_info; - CFX_Shading* m_shading; - }; -}; - -#endif // XFA_FXGRAPHICS_CFX_COLOR_H_ diff --git a/xfa/fxgraphics/cfx_graphics.cpp b/xfa/fxgraphics/cfx_graphics.cpp index a67932f052..0865221aa9 100644 --- a/xfa/fxgraphics/cfx_graphics.cpp +++ b/xfa/fxgraphics/cfx_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/cfx_color.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" namespace { @@ -165,7 +165,7 @@ void CFX_Graphics::SetLineWidth(float lineWidth, bool isActOnDash) { } } -void CFX_Graphics::SetStrokeColor(CFX_Color* color) { +void CFX_Graphics::SetStrokeColor(CXFA_Color* color) { if (!color) return; if (m_type == FX_CONTEXT_Device && m_renderDevice) { @@ -173,7 +173,7 @@ void CFX_Graphics::SetStrokeColor(CFX_Color* color) { } } -void CFX_Graphics::SetFillColor(CFX_Color* color) { +void CFX_Graphics::SetFillColor(CXFA_Color* color) { if (!color) return; if (m_type == FX_CONTEXT_Device && m_renderDevice) { diff --git a/xfa/fxgraphics/cfx_graphics.h b/xfa/fxgraphics/cfx_graphics.h index 8785a387d6..0ce9bf4b32 100644 --- a/xfa/fxgraphics/cfx_graphics.h +++ b/xfa/fxgraphics/cfx_graphics.h @@ -17,7 +17,7 @@ #include "core/fxge/fx_dib.h" #include "core/fxge/fx_font.h" -class CFX_Color; +class CXFA_Color; class CFX_Path; using FX_FillMode = int32_t; @@ -57,8 +57,8 @@ class CFX_Graphics { void SetLineDash(float dashPhase, float* dashArray, int32_t dashCount); void SetLineDash(FX_DashStyle dashStyle); void SetLineWidth(float lineWidth, bool isActOnDash = false); - void SetStrokeColor(CFX_Color* color); - void SetFillColor(CFX_Color* color); + 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, @@ -81,8 +81,8 @@ class CFX_Graphics { CFX_GraphStateData graphState; CFX_Matrix CTM; bool isActOnDash; - CFX_Color* strokeColor; - CFX_Color* fillColor; + CXFA_Color* strokeColor; + CXFA_Color* fillColor; } m_info; void RenderDeviceSetLineDash(FX_DashStyle dashStyle); diff --git a/xfa/fxgraphics/cxfa_color.cpp b/xfa/fxgraphics/cxfa_color.cpp new file mode 100644 index 0000000000..27a0cbe569 --- /dev/null +++ b/xfa/fxgraphics/cxfa_color.cpp @@ -0,0 +1,46 @@ +// 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/fxgraphics/cxfa_color.h" + +CXFA_Color::CXFA_Color() : m_type(FX_COLOR_None) {} + +CXFA_Color::CXFA_Color(const FX_ARGB argb) { + Set(argb); +} + +CXFA_Color::CXFA_Color(CFX_Pattern* pattern, const FX_ARGB argb) { + Set(pattern, argb); +} + +CXFA_Color::CXFA_Color(CFX_Shading* shading) { + Set(shading); +} + +CXFA_Color::~CXFA_Color() { + m_type = FX_COLOR_None; +} + +void CXFA_Color::Set(const FX_ARGB argb) { + m_type = FX_COLOR_Solid; + m_info.argb = argb; + m_info.pattern = nullptr; +} + +void CXFA_Color::Set(CFX_Pattern* pattern, const FX_ARGB argb) { + if (!pattern) + return; + m_type = FX_COLOR_Pattern; + m_info.argb = argb; + m_info.pattern = pattern; +} + +void CXFA_Color::Set(CFX_Shading* shading) { + if (!shading) + return; + m_type = FX_COLOR_Shading; + m_shading = shading; +} diff --git a/xfa/fxgraphics/cxfa_color.h b/xfa/fxgraphics/cxfa_color.h new file mode 100644 index 0000000000..16ef1d7d4d --- /dev/null +++ b/xfa/fxgraphics/cxfa_color.h @@ -0,0 +1,43 @@ +// 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_COLOR_H_ +#define XFA_FXGRAPHICS_CXFA_COLOR_H_ + +#include "core/fxge/fx_dib.h" +#include "xfa/fxgraphics/cfx_graphics.h" + +class CFX_Pattern; +class CFX_Shading; + +enum { FX_COLOR_None = 0, FX_COLOR_Solid, FX_COLOR_Pattern, FX_COLOR_Shading }; + +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); + virtual ~CXFA_Color(); + + void Set(const FX_ARGB argb); + void Set(CFX_Pattern* pattern, const FX_ARGB argb); + void Set(CFX_Shading* shading); + + private: + friend class CFX_Graphics; + + int32_t m_type; + union { + struct { + FX_ARGB argb; + CFX_Pattern* pattern; + } m_info; + CFX_Shading* m_shading; + }; +}; + +#endif // XFA_FXGRAPHICS_CXFA_COLOR_H_ -- cgit v1.2.3