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/fpdfapi/fpdf_render/render_int.h" | 7 #include "core/fpdfapi/fpdf_render/render_int.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_page/pageint.h" | 9 #include "core/fpdfapi/fpdf_page/pageint.h" |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 const CPDF_Type3Char* pChar = m_pFont->LoadChar(charcode); | 128 const CPDF_Type3Char* pChar = m_pFont->LoadChar(charcode); |
129 if (!pChar || !pChar->m_pBitmap) | 129 if (!pChar || !pChar->m_pBitmap) |
130 return nullptr; | 130 return nullptr; |
131 | 131 |
132 CFX_DIBitmap* pBitmap = pChar->m_pBitmap; | 132 CFX_DIBitmap* pBitmap = pChar->m_pBitmap; |
133 CFX_Matrix image_matrix, text_matrix; | 133 CFX_Matrix image_matrix, text_matrix; |
134 image_matrix = pChar->m_ImageMatrix; | 134 image_matrix = pChar->m_ImageMatrix; |
135 text_matrix.Set(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, 0, 0); | 135 text_matrix.Set(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, 0, 0); |
136 image_matrix.Concat(text_matrix); | 136 image_matrix.Concat(text_matrix); |
137 CFX_DIBitmap* pResBitmap = NULL; | 137 CFX_DIBitmap* pResBitmap = NULL; |
138 int left, top; | 138 int left = 0; |
139 int top = 0; | |
139 if (FXSYS_fabs(image_matrix.b) < FXSYS_fabs(image_matrix.a) / 100 && | 140 if (FXSYS_fabs(image_matrix.b) < FXSYS_fabs(image_matrix.a) / 100 && |
Tom Sepez
2016/03/16 18:34:58
Do we know if this is ever false? If we could some
Wei Li
2016/03/17 02:24:05
Yes, it could be true or false. Tricky thing here
Tom Sepez
2016/03/17 16:40:05
Acknowledged.
| |
140 FXSYS_fabs(image_matrix.c) < FXSYS_fabs(image_matrix.d) / 100) { | 141 FXSYS_fabs(image_matrix.c) < FXSYS_fabs(image_matrix.d) / 100) { |
141 int top_line, bottom_line; | 142 int top_line, bottom_line; |
Tom Sepez
2016/03/16 18:34:58
nit: one per line, combine with assignments.
Wei Li
2016/03/17 02:24:04
Done.
| |
142 top_line = _DetectFirstLastScan(pBitmap, TRUE); | 143 top_line = _DetectFirstLastScan(pBitmap, TRUE); |
143 bottom_line = _DetectFirstLastScan(pBitmap, FALSE); | 144 bottom_line = _DetectFirstLastScan(pBitmap, FALSE); |
144 if (top_line == 0 && bottom_line == pBitmap->GetHeight() - 1) { | 145 if (top_line == 0 && bottom_line == pBitmap->GetHeight() - 1) { |
145 FX_FLOAT top_y = image_matrix.d + image_matrix.f; | 146 FX_FLOAT top_y = image_matrix.d + image_matrix.f; |
146 FX_FLOAT bottom_y = image_matrix.f; | 147 FX_FLOAT bottom_y = image_matrix.f; |
147 FX_BOOL bFlipped = top_y > bottom_y; | 148 FX_BOOL bFlipped = top_y > bottom_y; |
148 if (bFlipped) { | 149 if (bFlipped) { |
149 FX_FLOAT temp = top_y; | 150 FX_FLOAT temp = top_y; |
150 top_y = bottom_y; | 151 top_y = bottom_y; |
151 bottom_y = temp; | 152 bottom_y = temp; |
152 } | 153 } |
153 pSize->AdjustBlue(top_y, bottom_y, top_line, bottom_line); | 154 pSize->AdjustBlue(top_y, bottom_y, top_line, bottom_line); |
154 pResBitmap = pBitmap->StretchTo( | 155 pResBitmap = pBitmap->StretchTo( |
155 (int)(FXSYS_round(image_matrix.a) * retinaScaleX), | 156 (int)(FXSYS_round(image_matrix.a) * retinaScaleX), |
156 (int)((bFlipped ? top_line - bottom_line : bottom_line - top_line) * | 157 (int)((bFlipped ? top_line - bottom_line : bottom_line - top_line) * |
157 retinaScaleY)); | 158 retinaScaleY)); |
158 top = top_line; | 159 top = top_line; |
159 if (image_matrix.a < 0) { | 160 if (image_matrix.a < 0) { |
160 image_matrix.Scale(retinaScaleX, retinaScaleY); | 161 image_matrix.Scale(retinaScaleX, retinaScaleY); |
161 left = FXSYS_round(image_matrix.e + image_matrix.a); | 162 left = FXSYS_round(image_matrix.e + image_matrix.a); |
162 } else { | 163 } else { |
163 left = FXSYS_round(image_matrix.e); | 164 left = FXSYS_round(image_matrix.e); |
164 } | 165 } |
165 } else { | 166 } else { |
Tom Sepez
2016/03/16 18:34:58
nit: empty else.
Wei Li
2016/03/17 02:24:04
Done.
| |
166 } | 167 } |
167 } | 168 } |
168 if (!pResBitmap) { | 169 if (!pResBitmap) { |
169 image_matrix.Scale(retinaScaleX, retinaScaleY); | 170 image_matrix.Scale(retinaScaleX, retinaScaleY); |
170 pResBitmap = pBitmap->TransformTo(&image_matrix, left, top); | 171 pResBitmap = pBitmap->TransformTo(&image_matrix, left, top); |
171 } | 172 } |
172 if (!pResBitmap) { | 173 if (!pResBitmap) { |
173 return NULL; | 174 return NULL; |
174 } | 175 } |
175 CFX_GlyphBitmap* pGlyph = new CFX_GlyphBitmap; | 176 CFX_GlyphBitmap* pGlyph = new CFX_GlyphBitmap; |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
779 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, | 780 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, |
780 charpos.m_OriginY); | 781 charpos.m_OriginY); |
781 path.m_Path.New()->Append(pPath, &matrix); | 782 path.m_Path.New()->Append(pPath, &matrix); |
782 path.m_Matrix = *pTextMatrix; | 783 path.m_Matrix = *pTextMatrix; |
783 path.m_bStroke = bStroke; | 784 path.m_bStroke = bStroke; |
784 path.m_FillType = bFill ? FXFILL_WINDING : 0; | 785 path.m_FillType = bFill ? FXFILL_WINDING : 0; |
785 path.CalcBoundingBox(); | 786 path.CalcBoundingBox(); |
786 ProcessPath(&path, pObj2Device); | 787 ProcessPath(&path, pObj2Device); |
787 } | 788 } |
788 } | 789 } |
OLD | NEW |