| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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 CORE_FXGE_APPLE_APPLE_INT_H_ | 7 #ifndef CORE_FXGE_APPLE_APPLE_INT_H_ |
| 8 #define CORE_FXGE_APPLE_APPLE_INT_H_ | 8 #define CORE_FXGE_APPLE_APPLE_INT_H_ |
| 9 | 9 |
| 10 #include "core/fxcrt/fx_system.h" | 10 #include "core/fxcrt/fx_system.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 class CQuartz2D { | 24 class CQuartz2D { |
| 25 public: | 25 public: |
| 26 void* createGraphics(CFX_DIBitmap* bitmap); | 26 void* createGraphics(CFX_DIBitmap* bitmap); |
| 27 void destroyGraphics(void* graphics); | 27 void destroyGraphics(void* graphics); |
| 28 | 28 |
| 29 void* CreateFont(const uint8_t* pFontData, uint32_t dwFontSize); | 29 void* CreateFont(const uint8_t* pFontData, uint32_t dwFontSize); |
| 30 void DestroyFont(void* pFont); | 30 void DestroyFont(void* pFont); |
| 31 void setGraphicsTextMatrix(void* graphics, CFX_Matrix* matrix); | 31 void setGraphicsTextMatrix(void* graphics, CFX_Matrix* matrix); |
| 32 FX_BOOL drawGraphicsString(void* graphics, | 32 bool drawGraphicsString(void* graphics, |
| 33 void* font, | 33 void* font, |
| 34 FX_FLOAT fontSize, | 34 FX_FLOAT fontSize, |
| 35 uint16_t* glyphIndices, | 35 uint16_t* glyphIndices, |
| 36 CGPoint* glyphPositions, | 36 CGPoint* glyphPositions, |
| 37 int32_t chars, | 37 int32_t chars, |
| 38 FX_ARGB argb, | 38 FX_ARGB argb, |
| 39 CFX_Matrix* matrix = nullptr); | 39 CFX_Matrix* matrix = nullptr); |
| 40 void saveGraphicsState(void* graphics); | 40 void saveGraphicsState(void* graphics); |
| 41 void restoreGraphicsState(void* graphics); | 41 void restoreGraphicsState(void* graphics); |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 class CApplePlatform { | 44 class CApplePlatform { |
| 45 public: | 45 public: |
| 46 CApplePlatform() {} | 46 CApplePlatform() {} |
| 47 ~CApplePlatform() {} | 47 ~CApplePlatform() {} |
| 48 | 48 |
| 49 CQuartz2D m_quartz2d; | 49 CQuartz2D m_quartz2d; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver { | 52 class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver { |
| 53 public: | 53 public: |
| 54 CFX_QuartzDeviceDriver(CGContextRef context, int32_t deviceClass); | 54 CFX_QuartzDeviceDriver(CGContextRef context, int32_t deviceClass); |
| 55 ~CFX_QuartzDeviceDriver() override; | 55 ~CFX_QuartzDeviceDriver() override; |
| 56 | 56 |
| 57 // IFX_RenderDeviceDriver | 57 // IFX_RenderDeviceDriver |
| 58 int GetDeviceCaps(int caps_id) const override; | 58 int GetDeviceCaps(int caps_id) const override; |
| 59 CFX_Matrix GetCTM() const override; | 59 CFX_Matrix GetCTM() const override; |
| 60 void SaveState() override; | 60 void SaveState() override; |
| 61 void RestoreState(bool bKeepSaved) override; | 61 void RestoreState(bool bKeepSaved) override; |
| 62 FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, | 62 bool SetClip_PathFill(const CFX_PathData* pPathData, |
| 63 const CFX_Matrix* pObject2Device, | 63 const CFX_Matrix* pObject2Device, |
| 64 int fill_mode) override; | 64 int fill_mode) override; |
| 65 FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, | 65 bool SetClip_PathStroke(const CFX_PathData* pPathData, |
| 66 const CFX_Matrix* pObject2Device, | 66 const CFX_Matrix* pObject2Device, |
| 67 const CFX_GraphStateData* pGraphState) override; | 67 const CFX_GraphStateData* pGraphState) override; |
| 68 FX_BOOL DrawPath(const CFX_PathData* pPathData, | 68 bool DrawPath(const CFX_PathData* pPathData, |
| 69 const CFX_Matrix* pObject2Device, | 69 const CFX_Matrix* pObject2Device, |
| 70 const CFX_GraphStateData* pGraphState, | 70 const CFX_GraphStateData* pGraphState, |
| 71 uint32_t fill_color, | 71 uint32_t fill_color, |
| 72 uint32_t stroke_color, | 72 uint32_t stroke_color, |
| 73 int fill_mode, | 73 int fill_mode, |
| 74 int blend_type) override; |
| 75 bool FillRectWithBlend(const FX_RECT* pRect, |
| 76 uint32_t fill_color, |
| 77 int blend_type) override; |
| 78 bool DrawCosmeticLine(FX_FLOAT x1, |
| 79 FX_FLOAT y1, |
| 80 FX_FLOAT x2, |
| 81 FX_FLOAT y2, |
| 82 uint32_t color, |
| 83 int blend_type) override; |
| 84 bool GetClipBox(FX_RECT* pRect) override; |
| 85 bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override; |
| 86 bool SetDIBits(const CFX_DIBSource* pBitmap, |
| 87 uint32_t color, |
| 88 const FX_RECT* pSrcRect, |
| 89 int dest_left, |
| 90 int dest_top, |
| 91 int blend_type) override; |
| 92 bool StretchDIBits(const CFX_DIBSource* pBitmap, |
| 93 uint32_t color, |
| 94 int dest_left, |
| 95 int dest_top, |
| 96 int dest_width, |
| 97 int dest_height, |
| 98 const FX_RECT* pClipRect, |
| 99 uint32_t flags, |
| 100 int blend_type) override; |
| 101 bool StartDIBits(const CFX_DIBSource* pBitmap, |
| 102 int bitmap_alpha, |
| 103 uint32_t color, |
| 104 const CFX_Matrix* pMatrix, |
| 105 uint32_t flags, |
| 106 void*& handle, |
| 74 int blend_type) override; | 107 int blend_type) override; |
| 75 FX_BOOL FillRectWithBlend(const FX_RECT* pRect, | 108 bool DrawDeviceText(int nChars, |
| 76 uint32_t fill_color, | 109 const FXTEXT_CHARPOS* pCharPos, |
| 77 int blend_type) override; | 110 CFX_Font* pFont, |
| 78 FX_BOOL DrawCosmeticLine(FX_FLOAT x1, | 111 const CFX_Matrix* pObject2Device, |
| 79 FX_FLOAT y1, | 112 FX_FLOAT font_size, |
| 80 FX_FLOAT x2, | 113 uint32_t color) override; |
| 81 FX_FLOAT y2, | |
| 82 uint32_t color, | |
| 83 int blend_type) override; | |
| 84 FX_BOOL GetClipBox(FX_RECT* pRect) override; | |
| 85 FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override; | |
| 86 FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, | |
| 87 uint32_t color, | |
| 88 const FX_RECT* pSrcRect, | |
| 89 int dest_left, | |
| 90 int dest_top, | |
| 91 int blend_type) override; | |
| 92 FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, | |
| 93 uint32_t color, | |
| 94 int dest_left, | |
| 95 int dest_top, | |
| 96 int dest_width, | |
| 97 int dest_height, | |
| 98 const FX_RECT* pClipRect, | |
| 99 uint32_t flags, | |
| 100 int blend_type) override; | |
| 101 FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, | |
| 102 int bitmap_alpha, | |
| 103 uint32_t color, | |
| 104 const CFX_Matrix* pMatrix, | |
| 105 uint32_t flags, | |
| 106 void*& handle, | |
| 107 int blend_type) override; | |
| 108 FX_BOOL DrawDeviceText(int nChars, | |
| 109 const FXTEXT_CHARPOS* pCharPos, | |
| 110 CFX_Font* pFont, | |
| 111 const CFX_Matrix* pObject2Device, | |
| 112 FX_FLOAT font_size, | |
| 113 uint32_t color) override; | |
| 114 void ClearDriver() override; | 114 void ClearDriver() override; |
| 115 | 115 |
| 116 protected: | 116 protected: |
| 117 void setStrokeInfo(const CFX_GraphStateData* graphState, | 117 void setStrokeInfo(const CFX_GraphStateData* graphState, |
| 118 FX_ARGB argb, | 118 FX_ARGB argb, |
| 119 FX_FLOAT lineWidth); | 119 FX_FLOAT lineWidth); |
| 120 void setFillInfo(FX_ARGB argb); | 120 void setFillInfo(FX_ARGB argb); |
| 121 void setPathToContext(const CFX_PathData* pathData); | 121 void setPathToContext(const CFX_PathData* pathData); |
| 122 FX_FLOAT getLineWidth(const CFX_GraphStateData* graphState, | 122 FX_FLOAT getLineWidth(const CFX_GraphStateData* graphState, |
| 123 CGAffineTransform ctm); | 123 CGAffineTransform ctm); |
| 124 FX_BOOL CG_DrawGlyphRun(int nChars, | 124 bool CG_DrawGlyphRun(int nChars, |
| 125 const FXTEXT_CHARPOS* pCharPos, | 125 const FXTEXT_CHARPOS* pCharPos, |
| 126 CFX_Font* pFont, | 126 CFX_Font* pFont, |
| 127 const CFX_Matrix* pGlyphMatrix, | 127 const CFX_Matrix* pGlyphMatrix, |
| 128 const CFX_Matrix* pObject2Device, | 128 const CFX_Matrix* pObject2Device, |
| 129 FX_FLOAT font_size, | 129 FX_FLOAT font_size, |
| 130 uint32_t argb); | 130 uint32_t argb); |
| 131 void CG_SetImageTransform(int dest_left, | 131 void CG_SetImageTransform(int dest_left, |
| 132 int dest_top, | 132 int dest_top, |
| 133 int dest_width, | 133 int dest_width, |
| 134 int dest_height, | 134 int dest_height, |
| 135 CGRect* rect); | 135 CGRect* rect); |
| 136 | 136 |
| 137 CGContextRef m_context; | 137 CGContextRef m_context; |
| 138 CGAffineTransform m_foxitDevice2User; | 138 CGAffineTransform m_foxitDevice2User; |
| 139 CGAffineTransform m_user2FoxitDevice; | 139 CGAffineTransform m_user2FoxitDevice; |
| 140 int32_t m_saveCount; | 140 int32_t m_saveCount; |
| 141 | 141 |
| 142 int32_t m_width; | 142 int32_t m_width; |
| 143 int32_t m_height; | 143 int32_t m_height; |
| 144 int32_t m_bitsPerPixel; | 144 int32_t m_bitsPerPixel; |
| 145 int32_t m_deviceClass; | 145 int32_t m_deviceClass; |
| 146 int32_t m_renderCaps; | 146 int32_t m_renderCaps; |
| 147 int32_t m_horzSize; | 147 int32_t m_horzSize; |
| 148 int32_t m_vertSize; | 148 int32_t m_vertSize; |
| 149 }; | 149 }; |
| 150 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 150 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
| 151 | 151 |
| 152 #endif // CORE_FXGE_APPLE_APPLE_INT_H_ | 152 #endif // CORE_FXGE_APPLE_APPLE_INT_H_ |
| OLD | NEW |