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

Side by Side Diff: printing/printing_context_win.cc

Issue 2795453002: Use DPI from Print Preview on Windows, handle non square (Closed)
Patch Set: Address comments 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
« no previous file with comments | « printing/print_settings_initializer_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "printing/printing_context_win.h" 5 #include "printing/printing_context_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 dev_mode->dmDuplex = DMDUP_SIMPLEX; 181 dev_mode->dmDuplex = DMDUP_SIMPLEX;
182 break; 182 break;
183 default: // UNKNOWN_DUPLEX_MODE 183 default: // UNKNOWN_DUPLEX_MODE
184 break; 184 break;
185 } 185 }
186 186
187 dev_mode->dmFields |= DM_ORIENTATION; 187 dev_mode->dmFields |= DM_ORIENTATION;
188 dev_mode->dmOrientation = settings_.landscape() ? DMORIENT_LANDSCAPE : 188 dev_mode->dmOrientation = settings_.landscape() ? DMORIENT_LANDSCAPE :
189 DMORIENT_PORTRAIT; 189 DMORIENT_PORTRAIT;
190 190
191 if (settings_.dpi_horizontal() > 0) {
192 dev_mode->dmPrintQuality = settings_.dpi_horizontal();
193 dev_mode->dmFields |= DM_PRINTQUALITY;
194 }
195 if (settings_.dpi_vertical() > 0) {
196 dev_mode->dmYResolution = settings_.dpi_vertical();
197 dev_mode->dmFields |= DM_YRESOLUTION;
198 }
199
191 const PrintSettings::RequestedMedia& requested_media = 200 const PrintSettings::RequestedMedia& requested_media =
192 settings_.requested_media(); 201 settings_.requested_media();
193 static const int kFromUm = 100; // Windows uses 0.1mm. 202 static const int kFromUm = 100; // Windows uses 0.1mm.
194 int width = requested_media.size_microns.width() / kFromUm; 203 int width = requested_media.size_microns.width() / kFromUm;
195 int height = requested_media.size_microns.height() / kFromUm; 204 int height = requested_media.size_microns.height() / kFromUm;
196 unsigned id = 0; 205 unsigned id = 0;
197 if (base::StringToUint(requested_media.vendor_id, &id) && id) { 206 if (base::StringToUint(requested_media.vendor_id, &id) && id) {
198 dev_mode->dmFields |= DM_PAPERSIZE; 207 dev_mode->dmFields |= DM_PAPERSIZE;
199 dev_mode->dmPaperSize = static_cast<short>(id); 208 dev_mode->dmPaperSize = static_cast<short>(id);
200 } else if (width > 0 && height > 0) { 209 } else if (width > 0 && height > 0) {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 if (view && view->GetHost()) 373 if (view && view->GetHost())
365 window = view->GetHost()->GetAcceleratedWidget(); 374 window = view->GetHost()->GetAcceleratedWidget();
366 if (!window) { 375 if (!window) {
367 // TODO(maruel): b/1214347 Get the right browser window instead. 376 // TODO(maruel): b/1214347 Get the right browser window instead.
368 return GetDesktopWindow(); 377 return GetDesktopWindow();
369 } 378 }
370 return window; 379 return window;
371 } 380 }
372 381
373 } // namespace printing 382 } // namespace printing
OLDNEW
« no previous file with comments | « printing/print_settings_initializer_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698