summaryrefslogtreecommitdiff
path: root/xfa/include
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2016-03-17 08:59:42 -0400
committerDan Sinclair <dsinclair@chromium.org>2016-03-17 08:59:42 -0400
commit811b8a4f4482bb5c11ac7610e70a4c8fd34c2907 (patch)
treecafa17bad705518693c0a2ba9d8df9d50af2101e /xfa/include
parenta03c343b47938fcb1b562741ff05252b01a4e39d (diff)
downloadpdfium-811b8a4f4482bb5c11ac7610e70a4c8fd34c2907.tar.xz
Move xfa/include/fxgraphics/fx_graphics.h to xfa/fxgraphics.
This Cl moves and splits apart the fx_graphics.h file into individual classes. The .cpp files are renamed to match the .h files. pre.h was removed at the same time and its contents moved to the correct places as needed. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1810563002 .
Diffstat (limited to 'xfa/include')
-rw-r--r--xfa/include/fwl/core/fwl_note.h4
-rw-r--r--xfa/include/fwl/core/fwl_theme.h6
-rw-r--r--xfa/include/fwl/core/fwl_widget.h1
-rw-r--r--xfa/include/fwl/lightwidget/theme.h1
-rw-r--r--xfa/include/fxgraphics/fx_graphics.h435
5 files changed, 9 insertions, 438 deletions
diff --git a/xfa/include/fwl/core/fwl_note.h b/xfa/include/fwl/core/fwl_note.h
index 182c56fe3c..e41cf1dcef 100644
--- a/xfa/include/fwl/core/fwl_note.h
+++ b/xfa/include/fwl/core/fwl_note.h
@@ -7,8 +7,9 @@
#ifndef XFA_INCLUDE_FWL_CORE_FWL_NOTE_H_
#define XFA_INCLUDE_FWL_CORE_FWL_NOTE_H_
+#include "core/include/fxcrt/fx_coordinates.h"
+#include "xfa/fxgraphics/include/cfx_graphics.h"
#include "xfa/include/fwl/core/fwl_error.h"
-#include "xfa/include/fxgraphics/fx_graphics.h"
class IFWL_Widget;
class IFWL_NoteThread;
@@ -44,6 +45,7 @@ class CFWL_EvtSizeChanged;
class CFWL_EvtIdle;
class IFWL_NoteDriver;
class IFWL_NoteLoop;
+
#define FWL_MSG_Activate L"FWL_MESSAGE_Activate"
#define FWL_MSG_Deactivate L"FWL_MESSAGE_Deactivate"
#define FWL_MSG_SetFocus L"FWL_MESSAGE_SetFocus"
diff --git a/xfa/include/fwl/core/fwl_theme.h b/xfa/include/fwl/core/fwl_theme.h
index 8f9f9a6c36..69783c740a 100644
--- a/xfa/include/fwl/core/fwl_theme.h
+++ b/xfa/include/fwl/core/fwl_theme.h
@@ -7,10 +7,14 @@
#ifndef XFA_INCLUDE_FWL_CORE_FWL_THEME_H_
#define XFA_INCLUDE_FWL_CORE_FWL_THEME_H_
+#include "core/include/fxcrt/fx_coordinates.h"
+#include "core/include/fxcrt/fx_system.h"
#include "xfa/include/fwl/core/fwl_error.h"
-#include "xfa/include/fxgraphics/fx_graphics.h"
class IFWL_Widget;
+class CFX_Graphics;
+class CFX_DIBitmap;
+class CFX_Path;
#define FWL_WGTCAPACITY_CXBorder 1
#define FWL_WGTCAPACITY_CYBorder 2
diff --git a/xfa/include/fwl/core/fwl_widget.h b/xfa/include/fwl/core/fwl_widget.h
index afee2d8272..5588efe95e 100644
--- a/xfa/include/fwl/core/fwl_widget.h
+++ b/xfa/include/fwl/core/fwl_widget.h
@@ -10,7 +10,6 @@
#include "xfa/include/fwl/core/fwl_note.h"
#include "xfa/include/fwl/core/fwl_target.h"
#include "xfa/include/fwl/core/fwl_widgetdef.h"
-#include "xfa/include/fxgraphics/fx_graphics.h"
class IFWL_ThemeProvider;
class CFWL_WidgetImpProperties;
diff --git a/xfa/include/fwl/lightwidget/theme.h b/xfa/include/fwl/lightwidget/theme.h
index 824cacebc7..f47725b8ae 100644
--- a/xfa/include/fwl/lightwidget/theme.h
+++ b/xfa/include/fwl/lightwidget/theme.h
@@ -10,6 +10,7 @@
#include <memory>
#include <vector>
+#include "core/include/fxge/fx_dib.h"
#include "xfa/include/fwl/core/fwl_theme.h"
class CFWL_WidgetTP;
diff --git a/xfa/include/fxgraphics/fx_graphics.h b/xfa/include/fxgraphics/fx_graphics.h
deleted file mode 100644
index c2d22719d9..0000000000
--- a/xfa/include/fxgraphics/fx_graphics.h
+++ /dev/null
@@ -1,435 +0,0 @@
-// Copyright 2014 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_INCLUDE_FXGRAPHICS_FX_GRAPHICS_H_
-#define XFA_INCLUDE_FXGRAPHICS_FX_GRAPHICS_H_
-
-#include "core/include/fpdfapi/fpdf_pageobj.h"
-
-typedef int FX_ERR;
-#define FX_ERR_Succeeded 0
-#define FX_ERR_Indefinite -1
-#define FX_ERR_Parameter_Invalid -100
-#define FX_ERR_Property_Invalid -200
-#define FX_ERR_Intermediate_Value_Invalid -300
-#define FX_ERR_Method_Not_Supported -400
-#define FX_ERR_Out_Of_Memory -500
-
-#define FX_SHADING_Steps 256
-typedef int32_t FX_DashStyle;
-enum {
- FX_DASHSTYLE_Solid = 0,
- FX_DASHSTYLE_Dash = 1,
- FX_DASHSTYLE_Dot = 2,
- FX_DASHSTYLE_DashDot = 3,
- FX_DASHSTYLE_DashDotDot = 4
-};
-typedef int32_t FX_StrokeAlignment;
-enum {
- FX_STROKEALIGNMENT_Center = 0,
- FX_STROKEALIGNMENT_Inset = 1,
- FX_STROKEALIGNMENT_Outset = 2,
- FX_STROKEALIGNMENT_Left = 3,
- FX_STROKEALIGNMENT_Right = 4
-};
-typedef int32_t FX_HatchStyle;
-enum {
- FX_HATCHSTYLE_Horizontal = 0,
- FX_HATCHSTYLE_Vertical = 1,
- FX_HATCHSTYLE_ForwardDiagonal = 2,
- FX_HATCHSTYLE_BackwardDiagonal = 3,
- FX_HATCHSTYLE_Cross = 4,
- FX_HATCHSTYLE_DiagonalCross = 5,
- FX_HATCHSTYLE_05Percent = 6,
- FX_HATCHSTYLE_10Percent = 7,
- FX_HATCHSTYLE_20Percent = 8,
- FX_HATCHSTYLE_25Percent = 9,
- FX_HATCHSTYLE_30Percent = 10,
- FX_HATCHSTYLE_40Percent = 11,
- FX_HATCHSTYLE_50Percent = 12,
- FX_HATCHSTYLE_60Percent = 13,
- FX_HATCHSTYLE_70Percent = 14,
- FX_HATCHSTYLE_75Percent = 15,
- FX_HATCHSTYLE_80Percent = 16,
- FX_HATCHSTYLE_90Percent = 17,
- FX_HATCHSTYLE_LightDownwardDiagonal = 18,
- FX_HATCHSTYLE_LightUpwardDiagonal = 19,
- FX_HATCHSTYLE_DarkDownwardDiagonal = 20,
- FX_HATCHSTYLE_DarkUpwardDiagonal = 21,
- FX_HATCHSTYLE_WideDownwardDiagonal = 22,
- FX_HATCHSTYLE_WideUpwardDiagonal = 23,
- FX_HATCHSTYLE_LightVertical = 24,
- FX_HATCHSTYLE_LightHorizontal = 25,
- FX_HATCHSTYLE_NarrowVertical = 26,
- FX_HATCHSTYLE_NarrowHorizontal = 27,
- FX_HATCHSTYLE_DarkVertical = 28,
- FX_HATCHSTYLE_DarkHorizontal = 29,
- FX_HATCHSTYLE_DashedDownwardDiagonal = 30,
- FX_HATCHSTYLE_DashedUpwardDiagonal = 31,
- FX_HATCHSTYLE_DashedHorizontal = 32,
- FX_HATCHSTYLE_DashedVertical = 33,
- FX_HATCHSTYLE_SmallConfetti = 34,
- FX_HATCHSTYLE_LargeConfetti = 35,
- FX_HATCHSTYLE_ZigZag = 36,
- FX_HATCHSTYLE_Wave = 37,
- FX_HATCHSTYLE_DiagonalBrick = 38,
- FX_HATCHSTYLE_HorizontalBrick = 39,
- FX_HATCHSTYLE_Weave = 40,
- FX_HATCHSTYLE_Plaid = 41,
- FX_HATCHSTYLE_Divot = 42,
- FX_HATCHSTYLE_DottedGrid = 43,
- FX_HATCHSTYLE_DottedDiamond = 44,
- FX_HATCHSTYLE_Shingle = 45,
- FX_HATCHSTYLE_Trellis = 46,
- FX_HATCHSTYLE_Sphere = 47,
- FX_HATCHSTYLE_SmallGrid = 48,
- FX_HATCHSTYLE_SmallCheckerBoard = 49,
- FX_HATCHSTYLE_LargeCheckerBoard = 50,
- FX_HATCHSTYLE_OutlinedDiamond = 51,
- FX_HATCHSTYLE_SolidDiamond = 52
-};
-typedef int32_t FX_DeviceCap;
-typedef int32_t FX_FillMode;
-class CFX_RenderDevice;
-class CFX_GraphStateData;
-class CFX_Matrix;
-class CFX_DIBSource;
-class CFX_DIBitmap;
-class CFX_Font;
-class CFX_WideString;
-class CFX_PathGenerator;
-class CFX_Graphics;
-class CFX_Color;
-class CFX_Path;
-class CFX_Pattern;
-class CFX_Shading;
-
-class CAGG_Graphics {
- public:
- CAGG_Graphics();
- virtual ~CAGG_Graphics();
-
- FX_ERR Create(CFX_Graphics* owner,
- int32_t width,
- int32_t height,
- FXDIB_Format format);
-
- private:
- CFX_Graphics* m_owner;
-};
-
-class CFX_Graphics {
- public:
- CFX_Graphics();
- virtual ~CFX_Graphics();
-
- FX_ERR Create(CFX_RenderDevice* renderDevice, FX_BOOL isAntialiasing = TRUE);
- FX_ERR Create(int32_t width,
- int32_t height,
- FXDIB_Format format,
- FX_BOOL isNative = TRUE,
- FX_BOOL isAntialiasing = TRUE);
-
- FX_ERR GetDeviceCap(const int32_t capID, FX_DeviceCap& capVal);
- FX_ERR IsPrinterDevice(FX_BOOL& isPrinter);
- FX_ERR EnableAntialiasing(FX_BOOL isAntialiasing);
-
- FX_ERR SaveGraphState();
- FX_ERR RestoreGraphState();
-
- FX_ERR GetLineCap(CFX_GraphStateData::LineCap& lineCap) const;
- FX_ERR GetDashCount(int32_t& dashCount) const;
- FX_ERR GetLineDash(FX_FLOAT& dashPhase, FX_FLOAT* dashArray) const;
- FX_ERR GetLineJoin(CFX_GraphStateData::LineJoin& lineJoin) const;
- FX_ERR GetMiterLimit(FX_FLOAT& miterLimit) const;
- FX_ERR GetLineWidth(FX_FLOAT& lineWidth) const;
- FX_ERR GetStrokeAlignment(FX_StrokeAlignment& strokeAlignment) const;
- FX_ERR GetClipRect(CFX_RectF& rect) const;
- CFX_Matrix* GetMatrix();
- CFX_RenderDevice* GetRenderDevice();
-
- FX_ERR SetLineCap(CFX_GraphStateData::LineCap lineCap);
- FX_ERR SetLineDash(FX_FLOAT dashPhase,
- FX_FLOAT* dashArray,
- int32_t dashCount);
- FX_ERR SetLineDash(FX_DashStyle dashStyle);
- FX_ERR SetLineJoin(CFX_GraphStateData::LineJoin lineJoin);
- FX_ERR SetMiterLimit(FX_FLOAT miterLimit);
- FX_ERR SetLineWidth(FX_FLOAT lineWidth, FX_BOOL isActOnDash = FALSE);
- FX_ERR SetStrokeAlignment(FX_StrokeAlignment strokeAlignment);
- FX_ERR SetStrokeColor(CFX_Color* color);
- FX_ERR SetFillColor(CFX_Color* color);
- FX_ERR SetClipRect(const CFX_RectF& rect);
- FX_ERR SetFont(CFX_Font* font);
- FX_ERR SetFontSize(const FX_FLOAT size);
- FX_ERR SetFontHScale(const FX_FLOAT scale);
- FX_ERR SetCharSpacing(const FX_FLOAT spacing);
- FX_ERR SetTextDrawingMode(const int32_t mode);
-
- FX_ERR StrokePath(CFX_Path* path, CFX_Matrix* matrix = NULL);
- FX_ERR FillPath(CFX_Path* path,
- FX_FillMode fillMode = FXFILL_WINDING,
- CFX_Matrix* matrix = NULL);
- FX_ERR ClipPath(CFX_Path* path,
- FX_FillMode fillMode = FXFILL_WINDING,
- CFX_Matrix* matrix = NULL);
- FX_ERR DrawImage(CFX_DIBSource* source,
- const CFX_PointF& point,
- CFX_Matrix* matrix = NULL);
- FX_ERR StretchImage(CFX_DIBSource* source,
- const CFX_RectF& rect,
- CFX_Matrix* matrix = NULL);
- FX_ERR ConcatMatrix(const CFX_Matrix* matrix);
- FX_ERR ClearClip();
- FX_ERR ShowText(const CFX_PointF& point,
- const CFX_WideString& text,
- CFX_Matrix* matrix = NULL);
- FX_ERR CalcTextRect(CFX_RectF& rect,
- const CFX_WideString& text,
- FX_BOOL isMultiline = FALSE,
- CFX_Matrix* matrix = NULL);
- FX_ERR Transfer(CFX_Graphics* graphics, const CFX_Matrix* matrix);
- FX_ERR Transfer(CFX_Graphics* graphics,
- FX_FLOAT srcLeft,
- FX_FLOAT srcTop,
- const CFX_RectF& dstRect,
- const CFX_Matrix* matrix);
-
- FX_ERR InverseRect(const CFX_RectF& rect);
- FX_ERR XorDIBitmap(const CFX_DIBitmap* srcBitmap, const CFX_RectF& rect);
- FX_ERR EqvDIBitmap(const CFX_DIBitmap* srcBitmap, const CFX_RectF& rect);
-
- private:
- FX_ERR RenderDeviceSetLineDash(FX_DashStyle dashStyle);
- FX_ERR RenderDeviceStrokePath(CFX_Path* path, CFX_Matrix* matrix);
- FX_ERR RenderDeviceFillPath(CFX_Path* path,
- FX_FillMode fillMode,
- CFX_Matrix* matrix);
- FX_ERR RenderDeviceDrawImage(CFX_DIBSource* source,
- const CFX_PointF& point,
- CFX_Matrix* matrix);
- FX_ERR RenderDeviceStretchImage(CFX_DIBSource* source,
- const CFX_RectF& rect,
- CFX_Matrix* matrix);
- FX_ERR RenderDeviceShowText(const CFX_PointF& point,
- const CFX_WideString& text,
- CFX_Matrix* matrix);
-
- FX_ERR StrokePathWithPattern(CFX_Path* path, CFX_Matrix* matrix);
- FX_ERR StrokePathWithShading(CFX_Path* path, CFX_Matrix* matrix);
-
- FX_ERR FillPathWithPattern(CFX_Path* path,
- FX_FillMode fillMode,
- CFX_Matrix* matrix);
- FX_ERR FillPathWithShading(CFX_Path* path,
- FX_FillMode fillMode,
- CFX_Matrix* matrix);
-
- FX_ERR SetDIBitsWithMatrix(CFX_DIBSource* source, CFX_Matrix* matrix);
- FX_ERR CalcTextInfo(const CFX_WideString& text,
- FX_DWORD* charCodes,
- FXTEXT_CHARPOS* charPos,
- CFX_RectF& rect);
-
- protected:
- int32_t m_type;
-
- private:
- struct TInfo {
- TInfo()
- : isAntialiasing(TRUE),
- strokeAlignment(FX_STROKEALIGNMENT_Center),
- isActOnDash(FALSE),
- strokeColor(nullptr),
- fillColor(nullptr),
- font(nullptr),
- fontSize(40.0),
- fontHScale(1.0),
- fontSpacing(0.0) {}
- explicit TInfo(const TInfo& info);
- TInfo& operator=(const TInfo& other);
-
- CFX_GraphStateData graphState;
- FX_BOOL isAntialiasing;
- FX_StrokeAlignment strokeAlignment;
- CFX_Matrix CTM;
- FX_BOOL isActOnDash;
- CFX_Color* strokeColor;
- CFX_Color* fillColor;
- CFX_Font* font;
- FX_FLOAT fontSize;
- FX_FLOAT fontHScale;
- FX_FLOAT fontSpacing;
- } m_info;
- CFX_RenderDevice* m_renderDevice;
- CFX_PtrArray m_infoStack;
- CAGG_Graphics* m_aggGraphics;
- friend class CAGG_Graphics;
-};
-
-class CFX_Path {
- public:
- CFX_Path();
- virtual ~CFX_Path();
-
- FX_ERR Create();
- FX_ERR MoveTo(FX_FLOAT x, FX_FLOAT y);
- FX_ERR LineTo(FX_FLOAT x, FX_FLOAT y);
- FX_ERR BezierTo(FX_FLOAT ctrlX1,
- FX_FLOAT ctrlY1,
- FX_FLOAT ctrlX2,
- FX_FLOAT ctrlY2,
- FX_FLOAT toX,
- FX_FLOAT toY);
- FX_ERR ArcTo(FX_FLOAT left,
- FX_FLOAT top,
- FX_FLOAT width,
- FX_FLOAT height,
- FX_FLOAT startAngle,
- FX_FLOAT sweepAngle);
- FX_ERR Close();
-
- FX_ERR AddLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2);
- FX_ERR AddBezier(FX_FLOAT startX,
- FX_FLOAT startY,
- FX_FLOAT ctrlX1,
- FX_FLOAT ctrlY1,
- FX_FLOAT ctrlX2,
- FX_FLOAT ctrlY2,
- FX_FLOAT endX,
- FX_FLOAT endY);
- FX_ERR AddRectangle(FX_FLOAT left,
- FX_FLOAT top,
- FX_FLOAT width,
- FX_FLOAT height);
- FX_ERR AddEllipse(FX_FLOAT left,
- FX_FLOAT top,
- FX_FLOAT width,
- FX_FLOAT height);
- FX_ERR AddEllipse(const CFX_RectF& rect);
- FX_ERR AddArc(FX_FLOAT left,
- FX_FLOAT top,
- FX_FLOAT width,
- FX_FLOAT height,
- FX_FLOAT startAngle,
- FX_FLOAT sweepAngle);
- FX_ERR AddPie(FX_FLOAT left,
- FX_FLOAT top,
- FX_FLOAT width,
- FX_FLOAT height,
- FX_FLOAT startAngle,
- FX_FLOAT sweepAngle);
- FX_ERR AddSubpath(CFX_Path* path);
- FX_ERR Clear();
-
- FX_BOOL IsEmpty();
- CFX_PathData* GetPathData();
-
- private:
- CFX_PathGenerator* m_generator;
-};
-
-class CFX_Color {
- public:
- CFX_Color();
- // TODO(weili): Remove implicit conversions. Make this explicit.
- CFX_Color(const FX_ARGB argb);
- explicit CFX_Color(CFX_Pattern* pattern, const FX_ARGB argb = 0x0);
- explicit CFX_Color(CFX_Shading* shading);
- virtual ~CFX_Color();
-
- FX_ERR Set(const FX_ARGB argb);
- FX_ERR Set(CFX_Pattern* pattern, const FX_ARGB argb = 0x0);
- FX_ERR Set(CFX_Shading* shading);
-
- private:
- int32_t m_type;
- union {
- struct {
- FX_ARGB argb;
- CFX_Pattern* pattern;
- } m_info;
- CFX_Shading* m_shading;
- };
-
- friend class CFX_Graphics;
-};
-
-class CFX_Pattern {
- public:
- CFX_Pattern();
- virtual ~CFX_Pattern();
-
- FX_ERR Create(CFX_DIBitmap* bitmap,
- const FX_FLOAT xStep,
- const FX_FLOAT yStep,
- CFX_Matrix* matrix = NULL);
- FX_ERR Create(FX_HatchStyle hatchStyle,
- const FX_ARGB foreArgb,
- const FX_ARGB backArgb,
- CFX_Matrix* matrix = NULL);
-
- private:
- int32_t m_type;
- CFX_Matrix m_matrix;
- union {
- struct {
- CFX_RectF rect;
- FX_FLOAT xStep;
- FX_FLOAT yStep;
- FX_BOOL isColored;
- } m_rectInfo;
- struct {
- CFX_DIBitmap* bitmap;
- FX_FLOAT x1Step;
- FX_FLOAT y1Step;
- } m_bitmapInfo;
- struct {
- FX_HatchStyle hatchStyle;
- FX_ARGB foreArgb;
- FX_ARGB backArgb;
- } m_hatchInfo;
- };
- friend class CFX_Graphics;
-};
-
-class CFX_Shading {
- public:
- CFX_Shading();
- virtual ~CFX_Shading();
-
- FX_ERR CreateAxial(const CFX_PointF& beginPoint,
- const CFX_PointF& endPoint,
- FX_BOOL isExtendedBegin,
- FX_BOOL isExtendedEnd,
- const FX_ARGB beginArgb,
- const FX_ARGB endArgb);
- FX_ERR CreateRadial(const CFX_PointF& beginPoint,
- const CFX_PointF& endPoint,
- const FX_FLOAT beginRadius,
- const FX_FLOAT endRadius,
- FX_BOOL isExtendedBegin,
- FX_BOOL isExtendedEnd,
- const FX_ARGB beginArgb,
- const FX_ARGB endArgb);
-
- private:
- FX_ERR InitArgbArray();
-
- int32_t m_type;
- CFX_PointF m_beginPoint;
- CFX_PointF m_endPoint;
- FX_FLOAT m_beginRadius;
- FX_FLOAT m_endRadius;
- FX_BOOL m_isExtendedBegin;
- FX_BOOL m_isExtendedEnd;
- FX_ARGB m_beginArgb;
- FX_ARGB m_endArgb;
- FX_ARGB m_argbArray[FX_SHADING_Steps];
- friend class CFX_Graphics;
-};
-
-#endif // XFA_INCLUDE_FXGRAPHICS_FX_GRAPHICS_H_