Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: core/fpdfapi/fpdf_render/fpdf_render_text.cpp

Issue 1801383002: Re-enable several MSVC warnings (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address more comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 &&
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 = _DetectFirstLastScan(pBitmap, TRUE);
142 top_line = _DetectFirstLastScan(pBitmap, TRUE); 143 int bottom_line = _DetectFirstLastScan(pBitmap, FALSE);
143 bottom_line = _DetectFirstLastScan(pBitmap, FALSE);
144 if (top_line == 0 && bottom_line == pBitmap->GetHeight() - 1) { 144 if (top_line == 0 && bottom_line == pBitmap->GetHeight() - 1) {
145 FX_FLOAT top_y = image_matrix.d + image_matrix.f; 145 FX_FLOAT top_y = image_matrix.d + image_matrix.f;
146 FX_FLOAT bottom_y = image_matrix.f; 146 FX_FLOAT bottom_y = image_matrix.f;
147 FX_BOOL bFlipped = top_y > bottom_y; 147 FX_BOOL bFlipped = top_y > bottom_y;
148 if (bFlipped) { 148 if (bFlipped) {
149 FX_FLOAT temp = top_y; 149 FX_FLOAT temp = top_y;
150 top_y = bottom_y; 150 top_y = bottom_y;
151 bottom_y = temp; 151 bottom_y = temp;
152 } 152 }
153 pSize->AdjustBlue(top_y, bottom_y, top_line, bottom_line); 153 pSize->AdjustBlue(top_y, bottom_y, top_line, bottom_line);
154 pResBitmap = pBitmap->StretchTo( 154 pResBitmap = pBitmap->StretchTo(
155 (int)(FXSYS_round(image_matrix.a) * retinaScaleX), 155 (int)(FXSYS_round(image_matrix.a) * retinaScaleX),
156 (int)((bFlipped ? top_line - bottom_line : bottom_line - top_line) * 156 (int)((bFlipped ? top_line - bottom_line : bottom_line - top_line) *
157 retinaScaleY)); 157 retinaScaleY));
158 top = top_line; 158 top = top_line;
159 if (image_matrix.a < 0) { 159 if (image_matrix.a < 0) {
160 image_matrix.Scale(retinaScaleX, retinaScaleY); 160 image_matrix.Scale(retinaScaleX, retinaScaleY);
161 left = FXSYS_round(image_matrix.e + image_matrix.a); 161 left = FXSYS_round(image_matrix.e + image_matrix.a);
162 } else { 162 } else {
163 left = FXSYS_round(image_matrix.e); 163 left = FXSYS_round(image_matrix.e);
164 } 164 }
165 } else {
166 } 165 }
167 } 166 }
168 if (!pResBitmap) { 167 if (!pResBitmap) {
169 image_matrix.Scale(retinaScaleX, retinaScaleY); 168 image_matrix.Scale(retinaScaleX, retinaScaleY);
170 pResBitmap = pBitmap->TransformTo(&image_matrix, left, top); 169 pResBitmap = pBitmap->TransformTo(&image_matrix, left, top);
171 } 170 }
172 if (!pResBitmap) { 171 if (!pResBitmap) {
173 return NULL; 172 return NULL;
174 } 173 }
175 CFX_GlyphBitmap* pGlyph = new CFX_GlyphBitmap; 174 CFX_GlyphBitmap* pGlyph = new CFX_GlyphBitmap;
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, 778 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX,
780 charpos.m_OriginY); 779 charpos.m_OriginY);
781 path.m_Path.New()->Append(pPath, &matrix); 780 path.m_Path.New()->Append(pPath, &matrix);
782 path.m_Matrix = *pTextMatrix; 781 path.m_Matrix = *pTextMatrix;
783 path.m_bStroke = bStroke; 782 path.m_bStroke = bStroke;
784 path.m_FillType = bFill ? FXFILL_WINDING : 0; 783 path.m_FillType = bFill ? FXFILL_WINDING : 0;
785 path.CalcBoundingBox(); 784 path.CalcBoundingBox();
786 ProcessPath(&path, pObj2Device); 785 ProcessPath(&path, pObj2Device);
787 } 786 }
788 } 787 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698