Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Unified Diff: printing/print_settings.h

Issue 2795453002: Use DPI from Print Preview on Windows, handle non square (Closed)
Patch Set: Address comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « printing/print_job_constants.cc ('k') | printing/print_settings.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/print_settings.h
diff --git a/printing/print_settings.h b/printing/print_settings.h
index 592b7b9edf0557e4a828d0d1fc51528ad56026c5..21587378c6a08e1676f7736ce17c5fbefe9cb81f 100644
--- a/printing/print_settings.h
+++ b/printing/print_settings.h
@@ -5,6 +5,7 @@
#ifndef PRINTING_PRINT_SETTINGS_H_
#define PRINTING_PRINT_SETTINGS_H_
+#include <algorithm>
#include <string>
#include "base/strings/string16.h"
@@ -98,8 +99,17 @@ class PRINTING_EXPORT PrintSettings {
}
const base::string16& device_name() const { return device_name_; }
- void set_dpi(int dpi) { dpi_ = dpi; }
- int dpi() const { return dpi_; }
+ void set_dpi(int dpi) {
+ dpi_[0] = dpi;
+ dpi_[1] = dpi;
+ }
+ void set_dpi_xy(int dpi_horizontal, int dpi_vertical) {
+ dpi_[0] = dpi_horizontal;
+ dpi_[1] = dpi_vertical;
+ }
+ int dpi() const { return std::min(dpi_[0], dpi_[1]); }
+ int dpi_horizontal() const { return dpi_[0]; }
+ int dpi_vertical() const { return dpi_[1]; }
void set_scale_factor(double scale_factor) { scale_factor_ = scale_factor; }
double scale_factor() const { return scale_factor_; }
@@ -180,10 +190,6 @@ class PRINTING_EXPORT PrintSettings {
// This permits printing selected pages only.
PageRanges ranges_;
- // Desired visible dots per inch rendering for output. Printing should be
- // scaled to ScreenDpi/dpix*desired_dpi.
- int desired_dpi_;
-
// Indicates if the user only wants to print the current selection.
bool selection_only_;
@@ -221,8 +227,10 @@ class PRINTING_EXPORT PrintSettings {
// Page setup in device units.
PageSetup page_setup_device_units_;
- // Printer's device effective dots per inch in both axis.
- int dpi_;
+ // Printer's device effective dots per inch in both axes. The two values will
+ // generally be identical. However, on Windows, there are a few rare printers
+ // that support resolutions with different DPI in different dimensions.
+ int dpi_[2];
// Scale factor
double scale_factor_;
« no previous file with comments | « printing/print_job_constants.cc ('k') | printing/print_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698