| 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 #include "../../../include/fxge/fx_ge.h" | 7 #include "../../../include/fxge/fx_ge.h" |
| 8 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ | 8 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ |
| 9 #include "../../../include/fxge/fx_ge_win32.h" | 9 #include "../../../include/fxge/fx_ge_win32.h" |
| 10 #include <crtdbg.h> | 10 #include <crtdbg.h> |
| 11 #include "../agg/include/fxfx_agg_clip_liang_barsky.h" | |
| 12 #include "dwrite_int.h" | 11 #include "dwrite_int.h" |
| 13 #include "win32_int.h" | 12 #include "win32_int.h" |
| 14 #include "../ge/text_int.h" | 13 #include "../ge/text_int.h" |
| 15 #include "../dib/dib_int.h" | 14 #include "../dib/dib_int.h" |
| 16 #include "../agg/include/fx_agg_driver.h" | |
| 17 #include "../../../include/fxge/fx_freetype.h" | 15 #include "../../../include/fxge/fx_freetype.h" |
| 18 #include "../../../include/fxcodec/fx_codec.h" | 16 #include "../../../include/fxcodec/fx_codec.h" |
| 17 #include "agg_clip_liang_barsky.h" |
| 19 class CWin32FontInfo : public IFX_SystemFontInfo | 18 class CWin32FontInfo : public IFX_SystemFontInfo |
| 20 { | 19 { |
| 21 public: | 20 public: |
| 22 CWin32FontInfo(); | 21 CWin32FontInfo(); |
| 23 ~CWin32FontInfo(); | 22 ~CWin32FontInfo(); |
| 24 virtual void Release(); | 23 virtual void Release(); |
| 25 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper); | 24 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper); |
| 26 virtual void* MapFont(int weight, FX_BOOL bItalic, int charset
, int pitch_family, FX_LPCSTR face, FX_BOOL& bExact); | 25 virtual void* MapFont(int weight, FX_BOOL bItalic, int charset
, int pitch_family, FX_LPCSTR face, FX_BOOL& bExact); |
| 27 virtual void* GetFont(FX_LPCSTR face) | 26 virtual void* GetFont(FX_LPCSTR face) |
| 28 { | 27 { |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 lppt[2].y = FXSYS_round(posy); | 697 lppt[2].y = FXSYS_round(posy); |
| 699 PolyBezierTo(hDC, lppt, 3); | 698 PolyBezierTo(hDC, lppt, 3); |
| 700 i += 2; | 699 i += 2; |
| 701 } | 700 } |
| 702 if (pPoints[i].m_Flag & PT_CLOSEFIGURE) { | 701 if (pPoints[i].m_Flag & PT_CLOSEFIGURE) { |
| 703 CloseFigure(hDC); | 702 CloseFigure(hDC); |
| 704 } | 703 } |
| 705 } | 704 } |
| 706 EndPath(hDC); | 705 EndPath(hDC); |
| 707 } | 706 } |
| 707 |
| 708 void CGdiDeviceDriver::DrawLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT
y2) | 708 void CGdiDeviceDriver::DrawLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT
y2) |
| 709 { | 709 { |
| 710 int flag1 = (x1 < 0) | ((x1 > m_Width) << 1) | ((y1 < 0) << 2) | ((y1 > m_He
ight) << 3); | 710 int flag1 = (x1 < 0) | ((x1 > m_Width) << 1) | ((y1 < 0) << 2) | ((y1 > m_He
ight) << 3); |
| 711 int flag2 = (x2 < 0) | ((x2 > m_Width) << 1) | ((y2 < 0) << 2) | ((y2 > m_He
ight) << 3); | 711 int flag2 = (x2 < 0) | ((x2 > m_Width) << 1) | ((y2 < 0) << 2) | ((y2 > m_He
ight) << 3); |
| 712 if (flag1 & flag2) { | 712 if (flag1 & flag2) { |
| 713 return; | 713 return; |
| 714 } | 714 } |
| 715 if (flag1 || flag2) { | 715 if (flag1 || flag2) { |
| 716 agg::rect_base<FX_FLOAT> rect(0.0f, 0.0f, (FX_FLOAT)(m_Width), (FX_FLOAT
)(m_Height)); | 716 CFX_FloatRect rect(0.0f, 0.0f, (FX_FLOAT)(m_Width), (FX_FLOAT)(m_Height)
); |
| 717 FX_FLOAT x[2], y[2]; | 717 FX_FLOAT x[2], y[2]; |
| 718 int np = agg::clip_liang_barsky<FX_FLOAT>(x1, y1, x2, y2, rect, x, y); | 718 int np = clip_liang_barsky(x1, y1, x2, y2, rect, x, y); |
| 719 if (np == 0) { | 719 if (np == 0) { |
| 720 return; | 720 return; |
| 721 } | 721 } |
| 722 if (np == 1) { | 722 if (np == 1) { |
| 723 x2 = x[0]; | 723 x2 = x[0]; |
| 724 y2 = y[0]; | 724 y2 = y[0]; |
| 725 } else { | 725 } else { |
| 726 x1 = x[0]; | 726 x1 = x[0]; |
| 727 y1 = y[0]; | 727 y1 = y[0]; |
| 728 x2 = x[np - 1]; | 728 x2 = x[np - 1]; |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1191 if (m_hDC) { | 1191 if (m_hDC) { |
| 1192 SelectObject(m_hDC, m_hOldBitmap); | 1192 SelectObject(m_hDC, m_hOldBitmap); |
| 1193 DeleteDC(m_hDC); | 1193 DeleteDC(m_hDC); |
| 1194 } | 1194 } |
| 1195 if (m_hBitmap) { | 1195 if (m_hBitmap) { |
| 1196 DeleteObject(m_hBitmap); | 1196 DeleteObject(m_hBitmap); |
| 1197 } | 1197 } |
| 1198 delete GetBitmap(); | 1198 delete GetBitmap(); |
| 1199 } | 1199 } |
| 1200 #endif | 1200 #endif |
| OLD | NEW |