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_DESKTOP_ | 8 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ |
9 #include <windows.h> | 9 #include <windows.h> |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 phase -= 0.5f; | 814 phase -= 0.5f; |
815 } | 815 } |
816 } | 816 } |
817 CallFunc(GdipSetPenDashOffset)(pPen, phase); | 817 CallFunc(GdipSetPenDashOffset)(pPen, phase); |
818 FX_Free(pDashArray); | 818 FX_Free(pDashArray); |
819 pDashArray = NULL; | 819 pDashArray = NULL; |
820 } | 820 } |
821 CallFunc(GdipSetPenMiterLimit)(pPen, pGraphState->m_MiterLimit); | 821 CallFunc(GdipSetPenMiterLimit)(pPen, pGraphState->m_MiterLimit); |
822 return pPen; | 822 return pPen; |
823 } | 823 } |
824 static BOOL IsSmallTriangle(PointF* points, const CFX_AffineMatrix* pMatrix, int
& v1, int& v2) | 824 static FX_BOOL IsSmallTriangle(PointF* points, const CFX_AffineMatrix* pMatrix,
int& v1, int& v2) |
825 { | 825 { |
826 int pairs[] = {1, 2, 0, 2, 0, 1}; | 826 int pairs[] = {1, 2, 0, 2, 0, 1}; |
827 for (int i = 0; i < 3; i ++) { | 827 for (int i = 0; i < 3; i ++) { |
828 int pair1 = pairs[i * 2]; | 828 int pair1 = pairs[i * 2]; |
829 int pair2 = pairs[i * 2 + 1]; | 829 int pair2 = pairs[i * 2 + 1]; |
830 FX_FLOAT x1 = points[pair1].X, x2 = points[pair2].X; | 830 FX_FLOAT x1 = points[pair1].X, x2 = points[pair2].X; |
831 FX_FLOAT y1 = points[pair1].Y, y2 = points[pair2].Y; | 831 FX_FLOAT y1 = points[pair1].Y, y2 = points[pair2].Y; |
832 if (pMatrix) { | 832 if (pMatrix) { |
833 pMatrix->Transform(x1, y1); | 833 pMatrix->Transform(x1, y1); |
834 pMatrix->Transform(x2, y2); | 834 pMatrix->Transform(x2, y2); |
835 } | 835 } |
836 FX_FLOAT dx = x1 - x2; | 836 FX_FLOAT dx = x1 - x2; |
837 FX_FLOAT dy = y1 - y2; | 837 FX_FLOAT dy = y1 - y2; |
838 FX_FLOAT distance_square = FXSYS_Mul(dx, dx) + FXSYS_Mul(dy, dy); | 838 FX_FLOAT distance_square = FXSYS_Mul(dx, dx) + FXSYS_Mul(dy, dy); |
839 if (distance_square < (1.0f * 2 + 1.0f / 4)) { | 839 if (distance_square < (1.0f * 2 + 1.0f / 4)) { |
840 v1 = i; | 840 v1 = i; |
841 v2 = pair1; | 841 v2 = pair1; |
842 return TRUE; | 842 return TRUE; |
843 } | 843 } |
844 } | 844 } |
845 return FALSE; | 845 return FALSE; |
846 } | 846 } |
847 BOOL CGdiplusExt::DrawPath(HDC hDC, const CFX_PathData* pPathData, | 847 FX_BOOL CGdiplusExt::DrawPath(HDC hDC, const CFX_PathData* pPathData, |
848 const CFX_AffineMatrix* pObject2Device, | 848 const CFX_AffineMatrix* pObject2Device, |
849 const CFX_GraphStateData* pGraphState, | 849 const CFX_GraphStateData* pGraphState, |
850 FX_DWORD fill_argb, | 850 FX_DWORD fill_argb, |
851 FX_DWORD stroke_argb, | 851 FX_DWORD stroke_argb, |
852 int fill_mode | 852 int fill_mode |
853 ) | 853 ) |
854 { | 854 { |
855 int nPoints = pPathData->GetPointCount(); | 855 int nPoints = pPathData->GetPointCount(); |
856 if (nPoints == 0) { | 856 if (nPoints == 0) { |
857 return TRUE; | 857 return TRUE; |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1246 for (int i = 0; i < height; i ++) { | 1246 for (int i = 0; i < height; i ++) { |
1247 FXSYS_memcpy(pData + dest_pitch * i, pInfo->pScan0 + pInfo->Stride *
i, dest_pitch); | 1247 FXSYS_memcpy(pData + dest_pitch * i, pInfo->pScan0 + pInfo->Stride *
i, dest_pitch); |
1248 } | 1248 } |
1249 } | 1249 } |
1250 CFX_DIBitmap* pDIBitmap = _FX_WindowsDIB_LoadFromBuf(pInfo->pbmi, pData, pIn
fo->pbmi->bmiHeader.biBitCount == 32); | 1250 CFX_DIBitmap* pDIBitmap = _FX_WindowsDIB_LoadFromBuf(pInfo->pbmi, pData, pIn
fo->pbmi->bmiHeader.biBitCount == 32); |
1251 FX_Free(pData); | 1251 FX_Free(pData); |
1252 FreeDIBitmap(pInfo); | 1252 FreeDIBitmap(pInfo); |
1253 return pDIBitmap; | 1253 return pDIBitmap; |
1254 } | 1254 } |
1255 #endif | 1255 #endif |
OLD | NEW |