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 "core/fxge/agg/fx_agg_driver.h" | 7 #include "core/fxge/agg/fx_agg_driver.h" |
8 #include "core/fxge/dib/dib_int.h" | 8 #include "core/fxge/dib/dib_int.h" |
9 #include "core/fxge/ge/fx_text_int.h" | 9 #include "core/fxge/ge/fx_text_int.h" |
10 #include "core/include/fxcrt/fx_ext.h" | 10 #include "core/include/fxcrt/fx_ext.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 } | 62 } |
63 CGContextRef context = (CGContextRef)graphics; | 63 CGContextRef context = (CGContextRef)graphics; |
64 CGFloat ty = CGBitmapContextGetHeight(context) - matrix->f; | 64 CGFloat ty = CGBitmapContextGetHeight(context) - matrix->f; |
65 CGContextSetTextMatrix( | 65 CGContextSetTextMatrix( |
66 context, CGAffineTransformMake(matrix->a, matrix->b, matrix->c, matrix->d, | 66 context, CGAffineTransformMake(matrix->a, matrix->b, matrix->c, matrix->d, |
67 matrix->e, ty)); | 67 matrix->e, ty)); |
68 } | 68 } |
69 FX_BOOL CQuartz2D::drawGraphicsString(void* graphics, | 69 FX_BOOL CQuartz2D::drawGraphicsString(void* graphics, |
70 void* font, | 70 void* font, |
71 FX_FLOAT fontSize, | 71 FX_FLOAT fontSize, |
72 FX_WORD* glyphIndices, | 72 uint16_t* glyphIndices, |
73 CGPoint* glyphPositions, | 73 CGPoint* glyphPositions, |
74 int32_t charsCount, | 74 int32_t charsCount, |
75 FX_ARGB argb, | 75 FX_ARGB argb, |
76 CFX_Matrix* matrix) { | 76 CFX_Matrix* matrix) { |
77 if (!graphics) { | 77 if (!graphics) { |
78 return FALSE; | 78 return FALSE; |
79 } | 79 } |
80 CGContextRef context = (CGContextRef)graphics; | 80 CGContextRef context = (CGContextRef)graphics; |
81 CGContextSetFont(context, (CGFontRef)font); | 81 CGContextSetFont(context, (CGFontRef)font); |
82 CGContextSetFontSize(context, fontSize); | 82 CGContextSetFontSize(context, fontSize); |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 if (!pFont->GetPlatformFont()) { | 753 if (!pFont->GetPlatformFont()) { |
754 if (pFont->GetPsName() == CFX_WideString::FromLocal("DFHeiStd-W5")) { | 754 if (pFont->GetPsName() == CFX_WideString::FromLocal("DFHeiStd-W5")) { |
755 return FALSE; | 755 return FALSE; |
756 } | 756 } |
757 pFont->SetPlatformFont( | 757 pFont->SetPlatformFont( |
758 quartz2d.CreateFont(pFont->GetFontData(), pFont->GetSize())); | 758 quartz2d.CreateFont(pFont->GetFontData(), pFont->GetSize())); |
759 if (!pFont->GetPlatformFont()) { | 759 if (!pFont->GetPlatformFont()) { |
760 return FALSE; | 760 return FALSE; |
761 } | 761 } |
762 } | 762 } |
763 CFX_FixedBufGrow<FX_WORD, 32> glyph_indices(nChars); | 763 CFX_FixedBufGrow<uint16_t, 32> glyph_indices(nChars); |
764 CFX_FixedBufGrow<CGPoint, 32> glyph_positions(nChars); | 764 CFX_FixedBufGrow<CGPoint, 32> glyph_positions(nChars); |
765 for (int i = 0; i < nChars; i++) { | 765 for (int i = 0; i < nChars; i++) { |
766 glyph_indices[i] = pCharPos[i].m_ExtGID; | 766 glyph_indices[i] = pCharPos[i].m_ExtGID; |
767 glyph_positions[i].x = pCharPos[i].m_OriginX; | 767 glyph_positions[i].x = pCharPos[i].m_OriginX; |
768 glyph_positions[i].y = pCharPos[i].m_OriginY; | 768 glyph_positions[i].y = pCharPos[i].m_OriginY; |
769 } | 769 } |
770 CFX_Matrix text_matrix; | 770 CFX_Matrix text_matrix; |
771 if (pObject2Device) { | 771 if (pObject2Device) { |
772 text_matrix.Concat(*pObject2Device); | 772 text_matrix.Concat(*pObject2Device); |
773 } | 773 } |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 } | 1039 } |
1040 CFX_DIBitmap* pBitmap = new CFX_DIBitmap; | 1040 CFX_DIBitmap* pBitmap = new CFX_DIBitmap; |
1041 if (!pBitmap->Create(width, height, format)) { | 1041 if (!pBitmap->Create(width, height, format)) { |
1042 delete pBitmap; | 1042 delete pBitmap; |
1043 return FALSE; | 1043 return FALSE; |
1044 } | 1044 } |
1045 m_bOwnedBitmap = TRUE; | 1045 m_bOwnedBitmap = TRUE; |
1046 return Attach(pBitmap); | 1046 return Attach(pBitmap); |
1047 } | 1047 } |
1048 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 1048 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
OLD | NEW |