From 46a6291e7b4e7c7367daf4e5fb1a33537f776813 Mon Sep 17 00:00:00 2001 From: pkasting Date: Thu, 9 Oct 2014 14:30:00 -0700 Subject: Change PDF scaling factor from double to float. This ultimate consumers of this want a float anyway, so changing to be a float all the way through is less misleading. This also avoids some "value possibly truncated" warnings (currently disabled) on MSVC. This also removes a couple of scale-related functions in metafile_skia_wrapper.* that seem to be entirely unused. BUG=none TEST=none Review URL: https://codereview.chromium.org/641923002 Cr-Commit-Position: refs/heads/master@{#298980} --- chrome/service/cloud_print/print_system_win.cc | 6 +++--- chrome/service/service_utility_process_host.cc | 4 ++-- chrome/service/service_utility_process_host.h | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'chrome/service') diff --git a/chrome/service/cloud_print/print_system_win.cc b/chrome/service/cloud_print/print_system_win.cc index ca2045d7..4f9ea50 100644 --- a/chrome/service/cloud_print/print_system_win.cc +++ b/chrome/service/cloud_print/print_system_win.cc @@ -321,7 +321,7 @@ class JobSpoolerWin : public PrintSystem::JobSpooler { return true; } - void PreparePageDCForPrinting(HDC, double scale_factor) { + void PreparePageDCForPrinting(HDC, float scale_factor) { SetGraphicsMode(printer_dc_.Get(), GM_ADVANCED); // Setup the matrix to translate and scale to the right place. Take in // account the scale factor. @@ -332,13 +332,13 @@ class JobSpoolerWin : public PrintSystem::JobSpooler { XFORM xform = {0}; xform.eDx = static_cast(-offset_x); xform.eDy = static_cast(-offset_y); - xform.eM11 = xform.eM22 = 1.0 / scale_factor; + xform.eM11 = xform.eM22 = 1.0f / scale_factor; SetWorldTransform(printer_dc_.Get(), &xform); } // ServiceUtilityProcessHost::Client implementation. virtual void OnRenderPDFPagesToMetafilePageDone( - double scale_factor, + float scale_factor, const printing::MetafilePlayer& emf) override { PreparePageDCForPrinting(printer_dc_.Get(), scale_factor); ::StartPage(printer_dc_.Get()); diff --git a/chrome/service/service_utility_process_host.cc b/chrome/service/service_utility_process_host.cc index 5ce45c0..f08a3bd 100644 --- a/chrome/service/service_utility_process_host.cc +++ b/chrome/service/service_utility_process_host.cc @@ -317,7 +317,7 @@ void ServiceUtilityProcessHost::OnRenderPDFPagesToMetafilesPageCount( void ServiceUtilityProcessHost::OnRenderPDFPagesToMetafilesPageDone( bool success, - double scale_factor) { + float scale_factor) { DCHECK(waiting_for_reply_); if (!pdf_to_emf_state_ || !success) return OnPDFToEmfFinished(false); @@ -408,7 +408,7 @@ void ServiceUtilityProcessHost::OnGetPrinterSemanticCapsAndDefaultsFailed( printing::PrinterSemanticCapsAndDefaults())); } -bool ServiceUtilityProcessHost::Client::MetafileAvailable(double scale_factor, +bool ServiceUtilityProcessHost::Client::MetafileAvailable(float scale_factor, base::File file) { file.Seek(base::File::FROM_BEGIN, 0); int64 size = file.GetLength(); diff --git a/chrome/service/service_utility_process_host.h b/chrome/service/service_utility_process_host.h index f15bb01..6b320aa 100644 --- a/chrome/service/service_utility_process_host.h +++ b/chrome/service/service_utility_process_host.h @@ -49,7 +49,7 @@ class ServiceUtilityProcessHost : public content::ChildProcessHostDelegate { virtual void OnChildDied() {} virtual void OnRenderPDFPagesToMetafilePageDone( - double scale_factor, + float scale_factor, const printing::MetafilePlayer& emf) {} // Called when at all pages in the PDF has been rendered. @@ -78,7 +78,7 @@ class ServiceUtilityProcessHost : public content::ChildProcessHostDelegate { // Invoked when a metafile file is ready. // Returns true if metafile successfully loaded from |file|. - bool MetafileAvailable(double scale_factor, base::File file); + bool MetafileAvailable(float scale_factor, base::File file); DISALLOW_COPY_AND_ASSIGN(Client); }; @@ -131,7 +131,7 @@ class ServiceUtilityProcessHost : public content::ChildProcessHostDelegate { // Messages handlers: void OnRenderPDFPagesToMetafilesPageCount(int page_count); - void OnRenderPDFPagesToMetafilesPageDone(bool success, double scale_factor); + void OnRenderPDFPagesToMetafilesPageDone(bool success, float scale_factor); void OnGetPrinterCapsAndDefaultsSucceeded( const std::string& printer_name, const printing::PrinterCapsAndDefaults& caps_and_defaults); -- cgit v1.1