diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-07-13 14:47:10 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-14 01:19:15 +0000 |
commit | 2b918c8d05c922287efbc8858f029026cee31442 (patch) | |
tree | 6a1b1585d88ef385576740e98457163bddb8347a /xfa/fxgraphics/cxfa_graphics.h | |
parent | 56fc9725f05b18573b06d8a422c5d9d6e626219d (diff) | |
download | pdfium-2b918c8d05c922287efbc8858f029026cee31442.tar.xz |
Fixup naming of XFA graphics classes
These files were originally renamed thinking they'd move with the
colour class up to core/. It was decided that CPWL_Color was a better
core colour class the the xfa colour so these are being renamed back to
XFA based names to make it clear where they live.
Change-Id: Ie89f2306be0609add29bd445e719567e7b439211
Reviewed-on: https://pdfium-review.googlesource.com/7754
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxgraphics/cxfa_graphics.h')
-rw-r--r-- | xfa/fxgraphics/cxfa_graphics.h | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/xfa/fxgraphics/cxfa_graphics.h b/xfa/fxgraphics/cxfa_graphics.h new file mode 100644 index 0000000000..5492d4d3be --- /dev/null +++ b/xfa/fxgraphics/cxfa_graphics.h @@ -0,0 +1,111 @@ +// 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_GRAPHICS_H_ +#define XFA_FXGRAPHICS_CXFA_GRAPHICS_H_ + +#include <memory> +#include <vector> + +#include "core/fxcrt/fx_system.h" +#include "core/fxge/cfx_defaultrenderdevice.h" +#include "core/fxge/cfx_graphstatedata.h" +#include "core/fxge/cfx_renderdevice.h" +#include "core/fxge/fx_dib.h" +#include "core/fxge/fx_font.h" + +class CXFA_Color; +class CXFA_Path; + +using FX_FillMode = int32_t; + +enum FX_DashStyle { + FX_DASHSTYLE_Solid = 0, + FX_DASHSTYLE_Dash = 1, + FX_DASHSTYLE_Dot = 2, + FX_DASHSTYLE_DashDot = 3, + FX_DASHSTYLE_DashDotDot = 4 +}; + +enum class FX_HatchStyle { + Horizontal = 0, + Vertical = 1, + ForwardDiagonal = 2, + BackwardDiagonal = 3, + Cross = 4, + DiagonalCross = 5 +}; + +class CFX_RenderDevice; + +class CXFA_Graphics { + public: + explicit CXFA_Graphics(CFX_RenderDevice* renderDevice); + ~CXFA_Graphics(); + + void SaveGraphState(); + void RestoreGraphState(); + + CFX_RectF GetClipRect() const; + CFX_Matrix* GetMatrix(); + CFX_RenderDevice* GetRenderDevice(); + + void SetLineCap(CFX_GraphStateData::LineCap lineCap); + void SetLineDash(float dashPhase, float* dashArray, int32_t dashCount); + void SetLineDash(FX_DashStyle dashStyle); + void SetLineWidth(float lineWidth, bool isActOnDash = false); + void SetStrokeColor(CXFA_Color* color); + void SetFillColor(CXFA_Color* color); + void SetClipRect(const CFX_RectF& rect); + 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, + const CFX_RectF& rect, + CFX_Matrix* matrix = nullptr); + void ConcatMatrix(const CFX_Matrix* matrix); + + protected: + int32_t m_type; + + private: + struct TInfo { + TInfo(); + explicit TInfo(const TInfo& info); + TInfo& operator=(const TInfo& other); + + CFX_GraphStateData graphState; + CFX_Matrix CTM; + bool isActOnDash; + CXFA_Color* strokeColor; + CXFA_Color* fillColor; + } m_info; + + void RenderDeviceSetLineDash(FX_DashStyle dashStyle); + 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(CXFA_Path* path, + FX_FillMode fillMode, + CFX_Matrix* matrix); + void FillPathWithShading(CXFA_Path* path, + FX_FillMode fillMode, + CFX_Matrix* matrix); + + void SetDIBitsWithMatrix(const CFX_RetainPtr<CFX_DIBSource>& source, + CFX_Matrix* matrix); + + CFX_RenderDevice* const m_renderDevice; // Not owned. + std::vector<std::unique_ptr<TInfo>> m_infoStack; +}; + +#endif // XFA_FXGRAPHICS_CXFA_GRAPHICS_H_ |