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

Side by Side Diff: printing/print_settings.h

Issue 2795453002: Use DPI from Print Preview on Windows, handle non square (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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 #ifndef PRINTING_PRINT_SETTINGS_H_ 5 #ifndef PRINTING_PRINT_SETTINGS_H_
6 #define PRINTING_PRINT_SETTINGS_H_ 6 #define PRINTING_PRINT_SETTINGS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 void set_dpi(int dpi) { dpi_ = dpi; } 102 void set_dpi(int dpi) { dpi_ = dpi; }
103 int dpi() const { return dpi_; } 103 int dpi() const { return dpi_; }
104 104
105 void set_scale_factor(double scale_factor) { scale_factor_ = scale_factor; } 105 void set_scale_factor(double scale_factor) { scale_factor_ = scale_factor; }
106 double scale_factor() const { return scale_factor_; } 106 double scale_factor() const { return scale_factor_; }
107 107
108 void set_rasterize_pdf(bool rasterize_pdf) { rasterize_pdf_ = rasterize_pdf; } 108 void set_rasterize_pdf(bool rasterize_pdf) { rasterize_pdf_ = rasterize_pdf; }
109 bool rasterize_pdf() const { return rasterize_pdf_; } 109 bool rasterize_pdf() const { return rasterize_pdf_; }
110 110
111 void set_desired_dpi(int dpi_horizontal, int dpi_vertical) {
112 #if defined(OS_WIN)
113 desired_dpi_[0] = dpi_horizontal;
114 desired_dpi_[1] = dpi_vertical;
115 #endif
116 }
117
111 void set_supports_alpha_blend(bool supports_alpha_blend) { 118 void set_supports_alpha_blend(bool supports_alpha_blend) {
112 supports_alpha_blend_ = supports_alpha_blend; 119 supports_alpha_blend_ = supports_alpha_blend;
113 } 120 }
114 bool supports_alpha_blend() const { return supports_alpha_blend_; } 121 bool supports_alpha_blend() const { return supports_alpha_blend_; }
115 122
116 int device_units_per_inch() const { 123 int device_units_per_inch() const {
117 #if defined(OS_MACOSX) 124 #if defined(OS_MACOSX)
118 return 72; 125 return 72;
119 #else // defined(OS_MACOSX) 126 #else // defined(OS_MACOSX)
120 return dpi(); 127 return dpi();
(...skipping 29 matching lines...) Expand all
150 157
151 void set_color(ColorModel color) { color_ = color; } 158 void set_color(ColorModel color) { color_ = color; }
152 ColorModel color() const { return color_; } 159 ColorModel color() const { return color_; }
153 160
154 void set_copies(int copies) { copies_ = copies; } 161 void set_copies(int copies) { copies_ = copies; }
155 int copies() const { return copies_; } 162 int copies() const { return copies_; }
156 163
157 void set_duplex_mode(DuplexMode duplex_mode) { duplex_mode_ = duplex_mode; } 164 void set_duplex_mode(DuplexMode duplex_mode) { duplex_mode_ = duplex_mode; }
158 DuplexMode duplex_mode() const { return duplex_mode_; } 165 DuplexMode duplex_mode() const { return duplex_mode_; }
159 166
160 int desired_dpi() const { return desired_dpi_; } 167 int desired_dpi_horizontal() const { return desired_dpi_[0]; }
168 int desired_dpi_vertical() const { return desired_dpi_[1]; }
161 169
162 #if defined(OS_WIN) 170 #if defined(OS_WIN)
163 void set_print_text_with_gdi(bool use_gdi) { print_text_with_gdi_ = use_gdi; } 171 void set_print_text_with_gdi(bool use_gdi) { print_text_with_gdi_ = use_gdi; }
164 bool print_text_with_gdi() const { return print_text_with_gdi_; } 172 bool print_text_with_gdi() const { return print_text_with_gdi_; }
165 173
166 void set_printer_type(PrinterType type) { printer_type_ = type; } 174 void set_printer_type(PrinterType type) { printer_type_ = type; }
167 bool printer_is_xps() const { return printer_type_ == PrinterType::TYPE_XPS;} 175 bool printer_is_xps() const { return printer_type_ == PrinterType::TYPE_XPS;}
168 bool printer_is_ps2() const { 176 bool printer_is_ps2() const {
169 return printer_type_ == PrinterType::TYPE_POSTSCRIPT_LEVEL2; 177 return printer_type_ == PrinterType::TYPE_POSTSCRIPT_LEVEL2;
170 } 178 }
171 bool printer_is_ps3() const { 179 bool printer_is_ps3() const {
172 return printer_type_ == PrinterType::TYPE_POSTSCRIPT_LEVEL3; 180 return printer_type_ == PrinterType::TYPE_POSTSCRIPT_LEVEL3;
173 } 181 }
174 #endif 182 #endif
175 183
176 // Cookie generator. It is used to initialize PrintedDocument with its 184 // Cookie generator. It is used to initialize PrintedDocument with its
177 // associated PrintSettings, to be sure that each generated PrintedPage is 185 // associated PrintSettings, to be sure that each generated PrintedPage is
178 // correctly associated with its corresponding PrintedDocument. 186 // correctly associated with its corresponding PrintedDocument.
179 static int NewCookie(); 187 static int NewCookie();
180 188
181 private: 189 private:
182 // Multi-page printing. Each PageRange describes a from-to page combination. 190 // Multi-page printing. Each PageRange describes a from-to page combination.
183 // This permits printing selected pages only. 191 // This permits printing selected pages only.
184 PageRanges ranges_; 192 PageRanges ranges_;
185 193
186 // Desired visible dots per inch rendering for output. Printing should be 194 // Desired visible dots per inch rendering for output. Printing should be
Lei Zhang 2017/03/31 22:21:13 Observation: From what I can tell, this was only u
rbpotter 2017/04/01 00:08:02 Removed it.
Lei Zhang 2017/03/31 22:21:13 Observation: Now it's being repurposed for somethi
rbpotter 2017/04/01 00:08:01 I think just using DPI is working. I added some fu
187 // scaled to ScreenDpi/dpix*desired_dpi. 195 // scaled to ScreenDpi/dpix*desired_dpi.
188 int desired_dpi_; 196 int desired_dpi_[2];
189 197
190 // Indicates if the user only wants to print the current selection. 198 // Indicates if the user only wants to print the current selection.
191 bool selection_only_; 199 bool selection_only_;
192 200
193 // Indicates what kind of margins should be applied to the printable area. 201 // Indicates what kind of margins should be applied to the printable area.
194 MarginType margin_type_; 202 MarginType margin_type_;
195 203
196 // Strings to be printed as headers and footers if requested by the user. 204 // Strings to be printed as headers and footers if requested by the user.
197 base::string16 title_; 205 base::string16 title_;
198 base::string16 url_; 206 base::string16 url_;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 PrinterType printer_type_; 254 PrinterType printer_type_;
247 #endif 255 #endif
248 256
249 // If margin type is custom, this is what was requested. 257 // If margin type is custom, this is what was requested.
250 PageMargins requested_custom_margins_in_points_; 258 PageMargins requested_custom_margins_in_points_;
251 }; 259 };
252 260
253 } // namespace printing 261 } // namespace printing
254 262
255 #endif // PRINTING_PRINT_SETTINGS_H_ 263 #endif // PRINTING_PRINT_SETTINGS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698