OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium 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 #include "chrome/service/cloud_print/print_system.h" | 5 #include "chrome/service/cloud_print/print_system.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 int offset_x = ::GetDeviceCaps(printer_dc_.Get(), PHYSICALOFFSETX); | 332 int offset_x = ::GetDeviceCaps(printer_dc_.Get(), PHYSICALOFFSETX); |
333 int offset_y = ::GetDeviceCaps(printer_dc_.Get(), PHYSICALOFFSETY); | 333 int offset_y = ::GetDeviceCaps(printer_dc_.Get(), PHYSICALOFFSETY); |
334 XFORM xform = {0}; | 334 XFORM xform = {0}; |
335 xform.eDx = static_cast<float>(-offset_x); | 335 xform.eDx = static_cast<float>(-offset_x); |
336 xform.eDy = static_cast<float>(-offset_y); | 336 xform.eDy = static_cast<float>(-offset_y); |
337 xform.eM11 = xform.eM22 = 1.0f / scale_factor; | 337 xform.eM11 = xform.eM22 = 1.0f / scale_factor; |
338 SetWorldTransform(printer_dc_.Get(), &xform); | 338 SetWorldTransform(printer_dc_.Get(), &xform); |
339 } | 339 } |
340 | 340 |
341 // ServiceUtilityProcessHost::Client implementation. | 341 // ServiceUtilityProcessHost::Client implementation. |
342 void OnRenderPDFPagesToMetafilePageDone( | 342 bool OnRenderPDFPagesToMetafilePageDone(const std::vector<char>& emf_data, |
343 float scale_factor, | 343 float scale_factor) override { |
344 const printing::MetafilePlayer& emf) override { | 344 printing::Emf emf; |
| 345 if (!emf.InitFromData(emf_data.data(), emf_data.size())) { |
| 346 return false; |
| 347 } |
345 PreparePageDCForPrinting(printer_dc_.Get(), scale_factor); | 348 PreparePageDCForPrinting(printer_dc_.Get(), scale_factor); |
346 ::StartPage(printer_dc_.Get()); | 349 ::StartPage(printer_dc_.Get()); |
347 emf.SafePlayback(printer_dc_.Get()); | 350 emf.SafePlayback(printer_dc_.Get()); |
348 ::EndPage(printer_dc_.Get()); | 351 ::EndPage(printer_dc_.Get()); |
| 352 return true; |
349 } | 353 } |
350 | 354 |
351 // ServiceUtilityProcessHost::Client implementation. | 355 // ServiceUtilityProcessHost::Client implementation. |
352 void OnRenderPDFPagesToMetafileDone(bool success) override { | 356 void OnRenderPDFPagesToMetafileDone(bool success) override { |
353 PrintJobDone(success); | 357 PrintJobDone(success); |
354 } | 358 } |
355 | 359 |
356 void OnChildDied() override { PrintJobDone(false); } | 360 void OnChildDied() override { PrintJobDone(false); } |
357 | 361 |
358 // base::win::ObjectWatcher::Delegate implementation. | 362 // base::win::ObjectWatcher::Delegate implementation. |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 } | 838 } |
835 | 839 |
836 } // namespace | 840 } // namespace |
837 | 841 |
838 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( | 842 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( |
839 const base::DictionaryValue* print_system_settings) { | 843 const base::DictionaryValue* print_system_settings) { |
840 return new PrintSystemWin; | 844 return new PrintSystemWin; |
841 } | 845 } |
842 | 846 |
843 } // namespace cloud_print | 847 } // namespace cloud_print |
OLD | NEW |