printing compiles on windows, but is explosively wrong

This commit is contained in:
Jeremy Apthorp 2018-07-31 16:15:53 -07:00 committed by Aleksei Kuzmin
parent 64e79ce2b1
commit d80ee5153a
3 changed files with 13 additions and 2 deletions

View file

@ -26,8 +26,8 @@
#include "chrome/common/chrome_utility_printing_messages.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_data.h"
#include "content/public/browser/utility_process_host.h"
#include "content/public/browser/utility_process_host_client.h"
#include "content/browser/utility_process_host.h"
#include "content/browser/utility_process_host_client.h"
#include "printing/emf_win.h"
#include "printing/pdf_render_settings.h"
#include "ui/base/l10n/l10n_util.h"
@ -421,6 +421,7 @@ PdfConverterUtilityProcessHostClient::~PdfConverterUtilityProcessHostClient() {}
void PdfConverterUtilityProcessHostClient::Start(
const scoped_refptr<base::RefCountedMemory>& data,
const PdfConverter::StartCallback& start_callback) {
CHECK(false) << "Printing doesn't work yet.";
if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
@ -435,9 +436,12 @@ void PdfConverterUtilityProcessHostClient::Start(
// NOTE: This process _must_ be sandboxed, otherwise the pdf dll will load
// gdiplus.dll, change how rendering happens, and not be able to correctly
// generate when sent to a metafile DC.
/*
utility_process_host_ = content::UtilityProcessHost::Create(
this, base::ThreadTaskRunnerHandle::Get())
->AsWeakPtr();
*/
utility_process_host_ = nullptr;
utility_process_host_->SetName(GetName());
base::PostTaskAndReplyWithResult(
@ -546,7 +550,11 @@ void PdfConverterUtilityProcessHostClient::OnProcessLaunchFailed(
bool PdfConverterUtilityProcessHostClient::Send(IPC::Message* msg) {
if (utility_process_host_)
#if 1
CHECK(false) << "Printing is broken.";
#else
return utility_process_host_->Send(msg);
#endif
delete msg;
return false;
}

View file

@ -265,6 +265,7 @@ void PrintJob::StartPdfToEmfConversion(
const int kPrinterDpi = settings().dpi();
PdfRenderSettings settings(
content_area, gfx::Point(0, 0), gfx::Size(kPrinterDpi, kPrinterDpi), /*autorotate=*/true,
settings_.color() == COLOR,
print_text_with_gdi ? PdfRenderSettings::Mode::GDI_TEXT
: PdfRenderSettings::Mode::NORMAL);
pdf_conversion_state_->Start(
@ -313,6 +314,7 @@ void PrintJob::StartPdfToPostScriptConversion(
const int kPrinterDpi = settings().dpi();
PdfRenderSettings settings(
content_area, physical_offsets, gfx::Size(kPrinterDpi, kPrinterDpi), true /* autorotate? */,
settings_.color() == COLOR,
ps_level2 ? PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2
: PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3);
pdf_conversion_state_->Start(

View file

@ -161,6 +161,7 @@ bool PrintingHandlerWin::RenderPdfPageToMetafile(int page_number,
pdf_rendering_settings_.area.y() - offset_y,
pdf_rendering_settings_.area.width(),
pdf_rendering_settings_.area.height(), true, false, true, true,
pdf_rendering_settings_.use_color,
pdf_rendering_settings_.autorotate)) {
return false;
}