| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef XFA_FXGRAPHICS_CFX_GRAPHICS_H_ | 7 #ifndef XFA_FXGRAPHICS_CFX_GRAPHICS_H_ |
| 8 #define XFA_FXGRAPHICS_CFX_GRAPHICS_H_ | 8 #define XFA_FXGRAPHICS_CFX_GRAPHICS_H_ |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 FX_HATCHSTYLE_SolidDiamond = 52 | 96 FX_HATCHSTYLE_SolidDiamond = 52 |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 class CFX_RenderDevice; | 99 class CFX_RenderDevice; |
| 100 | 100 |
| 101 class CFX_Graphics { | 101 class CFX_Graphics { |
| 102 public: | 102 public: |
| 103 CFX_Graphics(); | 103 CFX_Graphics(); |
| 104 virtual ~CFX_Graphics(); | 104 virtual ~CFX_Graphics(); |
| 105 | 105 |
| 106 FWL_Error Create(CFX_RenderDevice* renderDevice, | 106 FWL_Error Create(CFX_RenderDevice* renderDevice, bool isAntialiasing = true); |
| 107 FX_BOOL isAntialiasing = TRUE); | |
| 108 FWL_Error Create(int32_t width, | 107 FWL_Error Create(int32_t width, |
| 109 int32_t height, | 108 int32_t height, |
| 110 FXDIB_Format format, | 109 FXDIB_Format format, |
| 111 FX_BOOL isNative = TRUE, | 110 bool isNative = true, |
| 112 FX_BOOL isAntialiasing = TRUE); | 111 bool isAntialiasing = true); |
| 113 | 112 |
| 114 FWL_Error GetDeviceCap(const int32_t capID, FX_DeviceCap& capVal); | 113 FWL_Error GetDeviceCap(const int32_t capID, FX_DeviceCap& capVal); |
| 115 FWL_Error IsPrinterDevice(FX_BOOL& isPrinter); | 114 FWL_Error IsPrinterDevice(bool& isPrinter); |
| 116 FWL_Error EnableAntialiasing(FX_BOOL isAntialiasing); | 115 FWL_Error EnableAntialiasing(bool isAntialiasing); |
| 117 | 116 |
| 118 FWL_Error SaveGraphState(); | 117 FWL_Error SaveGraphState(); |
| 119 FWL_Error RestoreGraphState(); | 118 FWL_Error RestoreGraphState(); |
| 120 | 119 |
| 121 FWL_Error GetLineCap(CFX_GraphStateData::LineCap& lineCap) const; | 120 FWL_Error GetLineCap(CFX_GraphStateData::LineCap& lineCap) const; |
| 122 FWL_Error GetDashCount(int32_t& dashCount) const; | 121 FWL_Error GetDashCount(int32_t& dashCount) const; |
| 123 FWL_Error GetLineDash(FX_FLOAT& dashPhase, FX_FLOAT* dashArray) const; | 122 FWL_Error GetLineDash(FX_FLOAT& dashPhase, FX_FLOAT* dashArray) const; |
| 124 FWL_Error GetLineJoin(CFX_GraphStateData::LineJoin& lineJoin) const; | 123 FWL_Error GetLineJoin(CFX_GraphStateData::LineJoin& lineJoin) const; |
| 125 FWL_Error GetMiterLimit(FX_FLOAT& miterLimit) const; | 124 FWL_Error GetMiterLimit(FX_FLOAT& miterLimit) const; |
| 126 FWL_Error GetLineWidth(FX_FLOAT& lineWidth) const; | 125 FWL_Error GetLineWidth(FX_FLOAT& lineWidth) const; |
| 127 FWL_Error GetStrokeAlignment(FX_StrokeAlignment& strokeAlignment) const; | 126 FWL_Error GetStrokeAlignment(FX_StrokeAlignment& strokeAlignment) const; |
| 128 FWL_Error GetClipRect(CFX_RectF& rect) const; | 127 FWL_Error GetClipRect(CFX_RectF& rect) const; |
| 129 CFX_Matrix* GetMatrix(); | 128 CFX_Matrix* GetMatrix(); |
| 130 CFX_RenderDevice* GetRenderDevice(); | 129 CFX_RenderDevice* GetRenderDevice(); |
| 131 | 130 |
| 132 FWL_Error SetLineCap(CFX_GraphStateData::LineCap lineCap); | 131 FWL_Error SetLineCap(CFX_GraphStateData::LineCap lineCap); |
| 133 FWL_Error SetLineDash(FX_FLOAT dashPhase, | 132 FWL_Error SetLineDash(FX_FLOAT dashPhase, |
| 134 FX_FLOAT* dashArray, | 133 FX_FLOAT* dashArray, |
| 135 int32_t dashCount); | 134 int32_t dashCount); |
| 136 FWL_Error SetLineDash(FX_DashStyle dashStyle); | 135 FWL_Error SetLineDash(FX_DashStyle dashStyle); |
| 137 FWL_Error SetLineJoin(CFX_GraphStateData::LineJoin lineJoin); | 136 FWL_Error SetLineJoin(CFX_GraphStateData::LineJoin lineJoin); |
| 138 FWL_Error SetMiterLimit(FX_FLOAT miterLimit); | 137 FWL_Error SetMiterLimit(FX_FLOAT miterLimit); |
| 139 FWL_Error SetLineWidth(FX_FLOAT lineWidth, FX_BOOL isActOnDash = FALSE); | 138 FWL_Error SetLineWidth(FX_FLOAT lineWidth, bool isActOnDash = false); |
| 140 FWL_Error SetStrokeAlignment(FX_StrokeAlignment strokeAlignment); | 139 FWL_Error SetStrokeAlignment(FX_StrokeAlignment strokeAlignment); |
| 141 FWL_Error SetStrokeColor(CFX_Color* color); | 140 FWL_Error SetStrokeColor(CFX_Color* color); |
| 142 FWL_Error SetFillColor(CFX_Color* color); | 141 FWL_Error SetFillColor(CFX_Color* color); |
| 143 FWL_Error SetClipRect(const CFX_RectF& rect); | 142 FWL_Error SetClipRect(const CFX_RectF& rect); |
| 144 FWL_Error SetFont(CFX_Font* font); | 143 FWL_Error SetFont(CFX_Font* font); |
| 145 FWL_Error SetFontSize(const FX_FLOAT size); | 144 FWL_Error SetFontSize(const FX_FLOAT size); |
| 146 FWL_Error SetFontHScale(const FX_FLOAT scale); | 145 FWL_Error SetFontHScale(const FX_FLOAT scale); |
| 147 FWL_Error SetCharSpacing(const FX_FLOAT spacing); | 146 FWL_Error SetCharSpacing(const FX_FLOAT spacing); |
| 148 FWL_Error SetTextDrawingMode(const int32_t mode); | 147 FWL_Error SetTextDrawingMode(const int32_t mode); |
| 149 | 148 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 160 FWL_Error StretchImage(CFX_DIBSource* source, | 159 FWL_Error StretchImage(CFX_DIBSource* source, |
| 161 const CFX_RectF& rect, | 160 const CFX_RectF& rect, |
| 162 CFX_Matrix* matrix = nullptr); | 161 CFX_Matrix* matrix = nullptr); |
| 163 FWL_Error ConcatMatrix(const CFX_Matrix* matrix); | 162 FWL_Error ConcatMatrix(const CFX_Matrix* matrix); |
| 164 FWL_Error ClearClip(); | 163 FWL_Error ClearClip(); |
| 165 FWL_Error ShowText(const CFX_PointF& point, | 164 FWL_Error ShowText(const CFX_PointF& point, |
| 166 const CFX_WideString& text, | 165 const CFX_WideString& text, |
| 167 CFX_Matrix* matrix = nullptr); | 166 CFX_Matrix* matrix = nullptr); |
| 168 void CalcTextRect(CFX_RectF& rect, | 167 void CalcTextRect(CFX_RectF& rect, |
| 169 const CFX_WideString& text, | 168 const CFX_WideString& text, |
| 170 FX_BOOL isMultiline = FALSE, | 169 bool isMultiline = false, |
| 171 CFX_Matrix* matrix = nullptr); | 170 CFX_Matrix* matrix = nullptr); |
| 172 FWL_Error Transfer(CFX_Graphics* graphics, const CFX_Matrix* matrix); | 171 FWL_Error Transfer(CFX_Graphics* graphics, const CFX_Matrix* matrix); |
| 173 FWL_Error Transfer(CFX_Graphics* graphics, | 172 FWL_Error Transfer(CFX_Graphics* graphics, |
| 174 FX_FLOAT srcLeft, | 173 FX_FLOAT srcLeft, |
| 175 FX_FLOAT srcTop, | 174 FX_FLOAT srcTop, |
| 176 const CFX_RectF& dstRect, | 175 const CFX_RectF& dstRect, |
| 177 const CFX_Matrix* matrix); | 176 const CFX_Matrix* matrix); |
| 178 | 177 |
| 179 FWL_Error InverseRect(const CFX_RectF& rect); | 178 FWL_Error InverseRect(const CFX_RectF& rect); |
| 180 FWL_Error XorDIBitmap(const CFX_DIBitmap* srcBitmap, const CFX_RectF& rect); | 179 FWL_Error XorDIBitmap(const CFX_DIBitmap* srcBitmap, const CFX_RectF& rect); |
| 181 FWL_Error EqvDIBitmap(const CFX_DIBitmap* srcBitmap, const CFX_RectF& rect); | 180 FWL_Error EqvDIBitmap(const CFX_DIBitmap* srcBitmap, const CFX_RectF& rect); |
| 182 | 181 |
| 183 protected: | 182 protected: |
| 184 int32_t m_type; | 183 int32_t m_type; |
| 185 | 184 |
| 186 private: | 185 private: |
| 187 struct TInfo { | 186 struct TInfo { |
| 188 TInfo(); | 187 TInfo(); |
| 189 explicit TInfo(const TInfo& info); | 188 explicit TInfo(const TInfo& info); |
| 190 TInfo& operator=(const TInfo& other); | 189 TInfo& operator=(const TInfo& other); |
| 191 | 190 |
| 192 CFX_GraphStateData graphState; | 191 CFX_GraphStateData graphState; |
| 193 FX_BOOL isAntialiasing; | 192 bool isAntialiasing; |
| 194 FX_StrokeAlignment strokeAlignment; | 193 FX_StrokeAlignment strokeAlignment; |
| 195 CFX_Matrix CTM; | 194 CFX_Matrix CTM; |
| 196 FX_BOOL isActOnDash; | 195 bool isActOnDash; |
| 197 CFX_Color* strokeColor; | 196 CFX_Color* strokeColor; |
| 198 CFX_Color* fillColor; | 197 CFX_Color* fillColor; |
| 199 CFX_Font* font; | 198 CFX_Font* font; |
| 200 FX_FLOAT fontSize; | 199 FX_FLOAT fontSize; |
| 201 FX_FLOAT fontHScale; | 200 FX_FLOAT fontHScale; |
| 202 FX_FLOAT fontSpacing; | 201 FX_FLOAT fontSpacing; |
| 203 } m_info; | 202 } m_info; |
| 204 | 203 |
| 205 FWL_Error RenderDeviceSetLineDash(FX_DashStyle dashStyle); | 204 FWL_Error RenderDeviceSetLineDash(FX_DashStyle dashStyle); |
| 206 FWL_Error RenderDeviceStrokePath(CFX_Path* path, CFX_Matrix* matrix); | 205 FWL_Error RenderDeviceStrokePath(CFX_Path* path, CFX_Matrix* matrix); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 233 FXTEXT_CHARPOS* charPos, | 232 FXTEXT_CHARPOS* charPos, |
| 234 CFX_RectF& rect); | 233 CFX_RectF& rect); |
| 235 | 234 |
| 236 CFX_RenderDevice* m_renderDevice; | 235 CFX_RenderDevice* m_renderDevice; |
| 237 CFX_ArrayTemplate<TInfo*> m_infoStack; | 236 CFX_ArrayTemplate<TInfo*> m_infoStack; |
| 238 std::unique_ptr<CAGG_Graphics> m_aggGraphics; | 237 std::unique_ptr<CAGG_Graphics> m_aggGraphics; |
| 239 friend class CAGG_Graphics; | 238 friend class CAGG_Graphics; |
| 240 }; | 239 }; |
| 241 | 240 |
| 242 #endif // XFA_FXGRAPHICS_CFX_GRAPHICS_H_ | 241 #endif // XFA_FXGRAPHICS_CFX_GRAPHICS_H_ |
| OLD | NEW |