OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/printing/pwg_raster_converter.h" | 5 #include "chrome/browser/printing/pwg_raster_converter.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 cloud_devices::printer::DpiCapability dpis; | 294 cloud_devices::printer::DpiCapability dpis; |
295 if (dpis.LoadFrom(printer_capabilities)) | 295 if (dpis.LoadFrom(printer_capabilities)) |
296 dpi = std::max(dpis.GetDefault().horizontal, dpis.GetDefault().vertical); | 296 dpi = std::max(dpis.GetDefault().horizontal, dpis.GetDefault().vertical); |
297 | 297 |
298 const double scale = static_cast<double>(dpi) / kPointsPerInch; | 298 const double scale = static_cast<double>(dpi) / kPointsPerInch; |
299 | 299 |
300 // Make vertical rectangle to optimize streaming to printer. Fix orientation | 300 // Make vertical rectangle to optimize streaming to printer. Fix orientation |
301 // by autorotate. | 301 // by autorotate. |
302 gfx::Rect area(std::min(page_size.width(), page_size.height()) * scale, | 302 gfx::Rect area(std::min(page_size.width(), page_size.height()) * scale, |
303 std::max(page_size.width(), page_size.height()) * scale); | 303 std::max(page_size.width(), page_size.height()) * scale); |
304 return PdfRenderSettings(area, dpi, true /* autorotate */); | 304 return PdfRenderSettings(area, dpi, /*autorotate=*/true, |
| 305 PdfRenderSettings::Mode::NORMAL); |
305 } | 306 } |
306 | 307 |
307 // static | 308 // static |
308 PwgRasterSettings PWGRasterConverter::GetBitmapSettings( | 309 PwgRasterSettings PWGRasterConverter::GetBitmapSettings( |
309 const cloud_devices::CloudDeviceDescription& printer_capabilities, | 310 const cloud_devices::CloudDeviceDescription& printer_capabilities, |
310 const cloud_devices::CloudDeviceDescription& ticket) { | 311 const cloud_devices::CloudDeviceDescription& ticket) { |
311 cloud_devices::printer::DuplexTicketItem duplex_item; | 312 cloud_devices::printer::DuplexTicketItem duplex_item; |
312 cloud_devices::printer::DuplexType duplex_value = | 313 cloud_devices::printer::DuplexType duplex_value = |
313 cloud_devices::printer::NO_DUPLEX; | 314 cloud_devices::printer::NO_DUPLEX; |
314 if (duplex_item.LoadFrom(ticket)) | 315 if (duplex_item.LoadFrom(ticket)) |
(...skipping 24 matching lines...) Expand all Loading... |
339 result.odd_page_transform = TRANSFORM_FLIP_HORIZONTAL; | 340 result.odd_page_transform = TRANSFORM_FLIP_HORIZONTAL; |
340 break; | 341 break; |
341 } | 342 } |
342 | 343 |
343 result.rotate_all_pages = raster_capability.value().rotate_all_pages; | 344 result.rotate_all_pages = raster_capability.value().rotate_all_pages; |
344 result.reverse_page_order = raster_capability.value().reverse_order_streaming; | 345 result.reverse_page_order = raster_capability.value().reverse_order_streaming; |
345 return result; | 346 return result; |
346 } | 347 } |
347 | 348 |
348 } // namespace printing | 349 } // namespace printing |
OLD | NEW |