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

Side by Side Diff: core/src/fxge/win32/fx_win32_print.cpp

Issue 1727793002: Remove FXSYS_Div. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master 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
« no previous file with comments | « core/src/fxge/win32/fx_win32_gdipext.cpp ('k') | third_party/agg23/agg_clip_liang_barsky.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/include/fxge/fx_ge.h" 7 #include "core/include/fxge/fx_ge.h"
8 8
9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ 9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
10 10
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 pSrc->GetFormat() == FXDIB_1bppCmyk); 142 pSrc->GetFormat() == FXDIB_1bppCmyk);
143 CFX_DIBExtractor src_bitmap(pSrc); 143 CFX_DIBExtractor src_bitmap(pSrc);
144 CFX_DIBitmap* pSrcBitmap = src_bitmap; 144 CFX_DIBitmap* pSrcBitmap = src_bitmap;
145 if (!pSrcBitmap) { 145 if (!pSrcBitmap) {
146 return NULL; 146 return NULL;
147 } 147 }
148 int src_width = pSrcBitmap->GetWidth(), src_height = pSrcBitmap->GetHeight(); 148 int src_width = pSrcBitmap->GetWidth(), src_height = pSrcBitmap->GetHeight();
149 uint8_t* src_buf = pSrcBitmap->GetBuffer(); 149 uint8_t* src_buf = pSrcBitmap->GetBuffer();
150 FX_DWORD src_pitch = pSrcBitmap->GetPitch(); 150 FX_DWORD src_pitch = pSrcBitmap->GetPitch();
151 FX_FLOAT dest_area = pDestMatrix->GetUnitArea(); 151 FX_FLOAT dest_area = pDestMatrix->GetUnitArea();
152 FX_FLOAT area_scale = 152 FX_FLOAT area_scale = ((FX_FLOAT)(src_width * src_height)) / dest_area;
153 FXSYS_Div((FX_FLOAT)(src_width * src_height), dest_area);
154 FX_FLOAT size_scale = FXSYS_sqrt(area_scale); 153 FX_FLOAT size_scale = FXSYS_sqrt(area_scale);
155 CFX_Matrix adjusted_matrix(*pDestMatrix); 154 CFX_Matrix adjusted_matrix(*pDestMatrix);
156 adjusted_matrix.Scale(size_scale, size_scale); 155 adjusted_matrix.Scale(size_scale, size_scale);
157 CFX_FloatRect result_rect_f = adjusted_matrix.GetUnitRect(); 156 CFX_FloatRect result_rect_f = adjusted_matrix.GetUnitRect();
158 FX_RECT result_rect = result_rect_f.GetOutterRect(); 157 FX_RECT result_rect = result_rect_f.GetOutterRect();
159 CFX_Matrix src2result; 158 CFX_Matrix src2result;
160 src2result.e = adjusted_matrix.c + adjusted_matrix.e; 159 src2result.e = adjusted_matrix.c + adjusted_matrix.e;
161 src2result.f = adjusted_matrix.d + adjusted_matrix.f; 160 src2result.f = adjusted_matrix.d + adjusted_matrix.f;
162 src2result.a = adjusted_matrix.a / pSrcBitmap->GetWidth(); 161 src2result.a = adjusted_matrix.a / pSrcBitmap->GetWidth();
163 src2result.b = adjusted_matrix.b / pSrcBitmap->GetWidth(); 162 src2result.b = adjusted_matrix.b / pSrcBitmap->GetWidth();
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 CFX_FontCache* pCache, 464 CFX_FontCache* pCache,
466 const CFX_Matrix* pObject2Device, 465 const CFX_Matrix* pObject2Device,
467 FX_FLOAT font_size, 466 FX_FLOAT font_size,
468 FX_DWORD color, 467 FX_DWORD color,
469 int alpha_flag, 468 int alpha_flag,
470 void* pIccTransform) { 469 void* pIccTransform) {
471 return m_PSRenderer.DrawText(nChars, pCharPos, pFont, pCache, pObject2Device, 470 return m_PSRenderer.DrawText(nChars, pCharPos, pFont, pCache, pObject2Device,
472 font_size, color, alpha_flag, pIccTransform); 471 font_size, color, alpha_flag, pIccTransform);
473 } 472 }
474 #endif 473 #endif
OLDNEW
« no previous file with comments | « core/src/fxge/win32/fx_win32_gdipext.cpp ('k') | third_party/agg23/agg_clip_liang_barsky.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698