| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/print_settings_initializer_gtk.h" | 5 #include "printing/print_settings_initializer_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 #include <gtk/gtkprinter.h> | 8 #include <gtk/gtkprinter.h> |
| 9 | 9 |
| 10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // TODO(jhawkins) Remove this hack when the Linux printing refactoring | 55 // TODO(jhawkins) Remove this hack when the Linux printing refactoring |
| 56 // finishes. | 56 // finishes. |
| 57 dpi = kPixelsPerInch; | 57 dpi = kPixelsPerInch; |
| 58 double page_width_in_pixel = 8.5 * dpi; | 58 double page_width_in_pixel = 8.5 * dpi; |
| 59 double page_height_in_pixel = 11.0 * dpi; | 59 double page_height_in_pixel = 11.0 * dpi; |
| 60 physical_size_device_units.SetSize( | 60 physical_size_device_units.SetSize( |
| 61 static_cast<int>(page_width_in_pixel), | 61 static_cast<int>(page_width_in_pixel), |
| 62 static_cast<int>(page_height_in_pixel)); | 62 static_cast<int>(page_height_in_pixel)); |
| 63 printable_area_device_units.SetRect( | 63 printable_area_device_units.SetRect( |
| 64 static_cast<int>( | 64 static_cast<int>( |
| 65 NativeMetafile::kLeftMarginInInch * printing::kPixelsPerInch), | 65 NativeMetafile::kLeftMarginInInch * dpi), |
| 66 static_cast<int>( | 66 static_cast<int>( |
| 67 NativeMetafile::kTopMarginInInch * printing::kPixelsPerInch), | 67 NativeMetafile::kTopMarginInInch * dpi), |
| 68 page_width_in_pixel, | 68 page_width_in_pixel - |
| 69 page_height_in_pixel); | 69 (NativeMetafile::kLeftMarginInInch + |
| 70 NativeMetafile::kRightMarginInInch) * dpi, |
| 71 page_height_in_pixel - |
| 72 (NativeMetafile::kTopMarginInInch + |
| 73 NativeMetafile::kBottomMarginInInch) * dpi); |
| 70 } | 74 } |
| 71 | 75 |
| 72 print_settings->set_dpi(dpi); | 76 print_settings->set_dpi(dpi); |
| 73 print_settings->SetPrinterPrintableArea(physical_size_device_units, | 77 print_settings->SetPrinterPrintableArea(physical_size_device_units, |
| 74 printable_area_device_units, | 78 printable_area_device_units, |
| 75 dpi); | 79 dpi); |
| 76 } | 80 } |
| 77 | 81 |
| 78 } // namespace printing | 82 } // namespace printing |
| OLD | NEW |