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/fxcrt/fx_ext.h" | 7 #include "../../../include/fxcrt/fx_ext.h" |
8 #include "../../../include/fxge/fx_freetype.h" | 8 #include "../../../include/fxge/fx_freetype.h" |
9 #include "../../../include/fxge/fx_ge.h" | 9 #include "../../../include/fxge/fx_ge.h" |
10 #include "../agg/include/fx_agg_driver.h" | 10 #include "../agg/include/fx_agg_driver.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 m, CGAffineTransformMake(matrix->a, matrix->b, matrix->c, matrix->d, | 86 m, CGAffineTransformMake(matrix->a, matrix->b, matrix->c, matrix->d, |
87 matrix->e, matrix->f)); | 87 matrix->e, matrix->f)); |
88 CGContextSetTextMatrix(context, m); | 88 CGContextSetTextMatrix(context, m); |
89 } | 89 } |
90 int32_t a, r, g, b; | 90 int32_t a, r, g, b; |
91 ArgbDecode(argb, a, r, g, b); | 91 ArgbDecode(argb, a, r, g, b); |
92 CGContextSetRGBFillColor(context, r / 255.f, g / 255.f, b / 255.f, a / 255.f); | 92 CGContextSetRGBFillColor(context, r / 255.f, g / 255.f, b / 255.f, a / 255.f); |
93 CGContextSaveGState(context); | 93 CGContextSaveGState(context); |
94 #if CGFLOAT_IS_DOUBLE | 94 #if CGFLOAT_IS_DOUBLE |
95 CGPoint* glyphPositionsCG = new CGPoint[charsCount]; | 95 CGPoint* glyphPositionsCG = new CGPoint[charsCount]; |
96 if (!glyphPositionsCG) { | |
97 return FALSE; | |
98 } | |
99 for (int index = 0; index < charsCount; ++index) { | 96 for (int index = 0; index < charsCount; ++index) { |
100 glyphPositionsCG[index].x = glyphPositions[index].x; | 97 glyphPositionsCG[index].x = glyphPositions[index].x; |
101 glyphPositionsCG[index].y = glyphPositions[index].y; | 98 glyphPositionsCG[index].y = glyphPositions[index].y; |
102 } | 99 } |
103 #else | 100 #else |
104 CGPoint* glyphPositionsCG = (CGPoint*)glyphPositions; | 101 CGPoint* glyphPositionsCG = (CGPoint*)glyphPositions; |
105 #endif | 102 #endif |
106 CGContextShowGlyphsAtPositions(context, (CGGlyph*)glyphIndices, | 103 CGContextShowGlyphsAtPositions(context, (CGGlyph*)glyphIndices, |
107 glyphPositionsCG, charsCount); | 104 glyphPositionsCG, charsCount); |
108 #if CGFLOAT_IS_DOUBLE | 105 #if CGFLOAT_IS_DOUBLE |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 join = kCGLineJoinBevel; | 898 join = kCGLineJoinBevel; |
902 break; | 899 break; |
903 } | 900 } |
904 case CFX_GraphStateData::LineJoinMiter: | 901 case CFX_GraphStateData::LineJoinMiter: |
905 default: { join = kCGLineJoinMiter; } | 902 default: { join = kCGLineJoinMiter; } |
906 } | 903 } |
907 CGContextSetLineJoin(_context, join); | 904 CGContextSetLineJoin(_context, join); |
908 if (graphState->m_DashCount) { | 905 if (graphState->m_DashCount) { |
909 #if CGFLOAT_IS_DOUBLE | 906 #if CGFLOAT_IS_DOUBLE |
910 CGFloat* dashArray = new CGFloat[graphState->m_DashCount]; | 907 CGFloat* dashArray = new CGFloat[graphState->m_DashCount]; |
911 if (!dashArray) { | |
912 return; | |
913 } | |
914 for (int index = 0; index < graphState->m_DashCount; ++index) { | 908 for (int index = 0; index < graphState->m_DashCount; ++index) { |
915 dashArray[index] = graphState->m_DashArray[index]; | 909 dashArray[index] = graphState->m_DashArray[index]; |
916 } | 910 } |
917 #else | 911 #else |
918 CGFloat* dashArray = (CGFloat*)graphState->m_DashArray; | 912 CGFloat* dashArray = (CGFloat*)graphState->m_DashArray; |
919 #endif | 913 #endif |
920 CGContextSetLineDash(_context, graphState->m_DashPhase, dashArray, | 914 CGContextSetLineDash(_context, graphState->m_DashPhase, dashArray, |
921 graphState->m_DashCount); | 915 graphState->m_DashCount); |
922 #if CGFLOAT_IS_DOUBLE | 916 #if CGFLOAT_IS_DOUBLE |
923 delete[] dashArray; | 917 delete[] dashArray; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 } | 1041 } |
1048 CFX_DIBitmap* pBitmap = new CFX_DIBitmap; | 1042 CFX_DIBitmap* pBitmap = new CFX_DIBitmap; |
1049 if (!pBitmap->Create(width, height, format)) { | 1043 if (!pBitmap->Create(width, height, format)) { |
1050 delete pBitmap; | 1044 delete pBitmap; |
1051 return FALSE; | 1045 return FALSE; |
1052 } | 1046 } |
1053 m_bOwnedBitmap = TRUE; | 1047 m_bOwnedBitmap = TRUE; |
1054 return Attach(pBitmap); | 1048 return Attach(pBitmap); |
1055 } | 1049 } |
1056 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 1050 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
OLD | NEW |