| 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/cpdf_parseoptions.h" | 9 #include "core/fpdfapi/fpdf_page/cpdf_parseoptions.h" |
| 10 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" | 10 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 const CPDF_Type3Char* pChar = m_pFont->LoadChar(charcode); | 133 const CPDF_Type3Char* pChar = m_pFont->LoadChar(charcode); |
| 134 if (!pChar || !pChar->m_pBitmap) | 134 if (!pChar || !pChar->m_pBitmap) |
| 135 return nullptr; | 135 return nullptr; |
| 136 | 136 |
| 137 CFX_DIBitmap* pBitmap = pChar->m_pBitmap; | 137 CFX_DIBitmap* pBitmap = pChar->m_pBitmap; |
| 138 CFX_Matrix image_matrix, text_matrix; | 138 CFX_Matrix image_matrix, text_matrix; |
| 139 image_matrix = pChar->m_ImageMatrix; | 139 image_matrix = pChar->m_ImageMatrix; |
| 140 text_matrix.Set(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, 0, 0); | 140 text_matrix.Set(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, 0, 0); |
| 141 image_matrix.Concat(text_matrix); | 141 image_matrix.Concat(text_matrix); |
| 142 CFX_DIBitmap* pResBitmap = NULL; | 142 CFX_DIBitmap* pResBitmap = NULL; |
| 143 int left, top; | 143 int left = 0; |
| 144 int top = 0; |
| 144 if (FXSYS_fabs(image_matrix.b) < FXSYS_fabs(image_matrix.a) / 100 && | 145 if (FXSYS_fabs(image_matrix.b) < FXSYS_fabs(image_matrix.a) / 100 && |
| 145 FXSYS_fabs(image_matrix.c) < FXSYS_fabs(image_matrix.d) / 100) { | 146 FXSYS_fabs(image_matrix.c) < FXSYS_fabs(image_matrix.d) / 100) { |
| 146 int top_line, bottom_line; | 147 int top_line = _DetectFirstLastScan(pBitmap, TRUE); |
| 147 top_line = _DetectFirstLastScan(pBitmap, TRUE); | 148 int bottom_line = _DetectFirstLastScan(pBitmap, FALSE); |
| 148 bottom_line = _DetectFirstLastScan(pBitmap, FALSE); | |
| 149 if (top_line == 0 && bottom_line == pBitmap->GetHeight() - 1) { | 149 if (top_line == 0 && bottom_line == pBitmap->GetHeight() - 1) { |
| 150 FX_FLOAT top_y = image_matrix.d + image_matrix.f; | 150 FX_FLOAT top_y = image_matrix.d + image_matrix.f; |
| 151 FX_FLOAT bottom_y = image_matrix.f; | 151 FX_FLOAT bottom_y = image_matrix.f; |
| 152 FX_BOOL bFlipped = top_y > bottom_y; | 152 FX_BOOL bFlipped = top_y > bottom_y; |
| 153 if (bFlipped) { | 153 if (bFlipped) { |
| 154 FX_FLOAT temp = top_y; | 154 FX_FLOAT temp = top_y; |
| 155 top_y = bottom_y; | 155 top_y = bottom_y; |
| 156 bottom_y = temp; | 156 bottom_y = temp; |
| 157 } | 157 } |
| 158 pSize->AdjustBlue(top_y, bottom_y, top_line, bottom_line); | 158 pSize->AdjustBlue(top_y, bottom_y, top_line, bottom_line); |
| 159 pResBitmap = pBitmap->StretchTo( | 159 pResBitmap = pBitmap->StretchTo( |
| 160 (int)(FXSYS_round(image_matrix.a) * retinaScaleX), | 160 (int)(FXSYS_round(image_matrix.a) * retinaScaleX), |
| 161 (int)((bFlipped ? top_line - bottom_line : bottom_line - top_line) * | 161 (int)((bFlipped ? top_line - bottom_line : bottom_line - top_line) * |
| 162 retinaScaleY)); | 162 retinaScaleY)); |
| 163 top = top_line; | 163 top = top_line; |
| 164 if (image_matrix.a < 0) { | 164 if (image_matrix.a < 0) { |
| 165 image_matrix.Scale(retinaScaleX, retinaScaleY); | 165 image_matrix.Scale(retinaScaleX, retinaScaleY); |
| 166 left = FXSYS_round(image_matrix.e + image_matrix.a); | 166 left = FXSYS_round(image_matrix.e + image_matrix.a); |
| 167 } else { | 167 } else { |
| 168 left = FXSYS_round(image_matrix.e); | 168 left = FXSYS_round(image_matrix.e); |
| 169 } | 169 } |
| 170 } else { | |
| 171 } | 170 } |
| 172 } | 171 } |
| 173 if (!pResBitmap) { | 172 if (!pResBitmap) { |
| 174 image_matrix.Scale(retinaScaleX, retinaScaleY); | 173 image_matrix.Scale(retinaScaleX, retinaScaleY); |
| 175 pResBitmap = pBitmap->TransformTo(&image_matrix, left, top); | 174 pResBitmap = pBitmap->TransformTo(&image_matrix, left, top); |
| 176 } | 175 } |
| 177 if (!pResBitmap) { | 176 if (!pResBitmap) { |
| 178 return NULL; | 177 return NULL; |
| 179 } | 178 } |
| 180 CFX_GlyphBitmap* pGlyph = new CFX_GlyphBitmap; | 179 CFX_GlyphBitmap* pGlyph = new CFX_GlyphBitmap; |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, | 783 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, |
| 785 charpos.m_OriginY); | 784 charpos.m_OriginY); |
| 786 path.m_Path.New()->Append(pPath, &matrix); | 785 path.m_Path.New()->Append(pPath, &matrix); |
| 787 path.m_Matrix = *pTextMatrix; | 786 path.m_Matrix = *pTextMatrix; |
| 788 path.m_bStroke = bStroke; | 787 path.m_bStroke = bStroke; |
| 789 path.m_FillType = bFill ? FXFILL_WINDING : 0; | 788 path.m_FillType = bFill ? FXFILL_WINDING : 0; |
| 790 path.CalcBoundingBox(); | 789 path.CalcBoundingBox(); |
| 791 ProcessPath(&path, pObj2Device); | 790 ProcessPath(&path, pObj2Device); |
| 792 } | 791 } |
| 793 } | 792 } |
| OLD | NEW |