OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "printing/printing_context_win.h" | 5 #include "printing/printing_context_win.h" |
6 | 6 |
7 #include <winspool.h> | 7 #include <winspool.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
11 #include "base/i18n/file_util_icu.h" | 11 #include "base/i18n/file_util_icu.h" |
12 #include "base/i18n/time_formatting.h" | 12 #include "base/i18n/time_formatting.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "printing/print_job_constants.h" | 17 #include "printing/print_job_constants.h" |
18 #include "printing/print_settings_initializer_win.h" | 18 #include "printing/print_settings_initializer_win.h" |
19 #include "printing/printed_document.h" | 19 #include "printing/printed_document.h" |
20 #include "skia/ext/platform_device_win.h" | 20 #include "skia/ext/platform_device.h" |
21 | 21 |
22 using base::Time; | 22 using base::Time; |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 // Retrieves the printer's PRINTER_INFO_* structure. | 26 // Retrieves the printer's PRINTER_INFO_* structure. |
27 // Output |level| can be 9 (user-default), 8 (admin-default), or 2 | 27 // Output |level| can be 9 (user-default), 8 (admin-default), or 2 |
28 // (printer-default). | 28 // (printer-default). |
29 // |devmode| is a pointer points to the start of DEVMODE structure in | 29 // |devmode| is a pointer points to the start of DEVMODE structure in |
30 // |buffer|. | 30 // |buffer|. |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 // abort_printing_ = true; | 542 // abort_printing_ = true; |
543 } | 543 } |
544 return true; | 544 return true; |
545 } | 545 } |
546 | 546 |
547 bool PrintingContextWin::InitializeSettings(const DEVMODE& dev_mode, | 547 bool PrintingContextWin::InitializeSettings(const DEVMODE& dev_mode, |
548 const std::wstring& new_device_name, | 548 const std::wstring& new_device_name, |
549 const PRINTPAGERANGE* ranges, | 549 const PRINTPAGERANGE* ranges, |
550 int number_ranges, | 550 int number_ranges, |
551 bool selection_only) { | 551 bool selection_only) { |
552 skia::PlatformDevice::InitializeDC(context_); | 552 skia::InitializeDC(context_); |
553 DCHECK(GetDeviceCaps(context_, CLIPCAPS)); | 553 DCHECK(GetDeviceCaps(context_, CLIPCAPS)); |
554 DCHECK(GetDeviceCaps(context_, RASTERCAPS) & RC_STRETCHDIB); | 554 DCHECK(GetDeviceCaps(context_, RASTERCAPS) & RC_STRETCHDIB); |
555 DCHECK(GetDeviceCaps(context_, RASTERCAPS) & RC_BITMAP64); | 555 DCHECK(GetDeviceCaps(context_, RASTERCAPS) & RC_BITMAP64); |
556 // Some printers don't advertise these. | 556 // Some printers don't advertise these. |
557 // DCHECK(GetDeviceCaps(context_, RASTERCAPS) & RC_SCALING); | 557 // DCHECK(GetDeviceCaps(context_, RASTERCAPS) & RC_SCALING); |
558 // DCHECK(GetDeviceCaps(context_, SHADEBLENDCAPS) & SB_CONST_ALPHA); | 558 // DCHECK(GetDeviceCaps(context_, SHADEBLENDCAPS) & SB_CONST_ALPHA); |
559 // DCHECK(GetDeviceCaps(context_, SHADEBLENDCAPS) & SB_PIXEL_ALPHA); | 559 // DCHECK(GetDeviceCaps(context_, SHADEBLENDCAPS) & SB_PIXEL_ALPHA); |
560 | 560 |
561 // StretchDIBits() support is needed for printing. | 561 // StretchDIBits() support is needed for printing. |
562 if (!(GetDeviceCaps(context_, RASTERCAPS) & RC_STRETCHDIB) || | 562 if (!(GetDeviceCaps(context_, RASTERCAPS) & RC_STRETCHDIB) || |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 if (buf_size) { | 754 if (buf_size) { |
755 buffer->reset(new uint8[buf_size]); | 755 buffer->reset(new uint8[buf_size]); |
756 memset(buffer->get(), 0, buf_size); | 756 memset(buffer->get(), 0, buf_size); |
757 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { | 757 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { |
758 buffer->reset(); | 758 buffer->reset(); |
759 } | 759 } |
760 } | 760 } |
761 } | 761 } |
762 | 762 |
763 } // namespace printing | 763 } // namespace printing |
OLD | NEW |