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

Side by Side Diff: chrome/browser/printing/print_preview_pdf_generated_browsertest.cc

Issue 2640033005: Substitute boolean GDI printing for a mode type (Closed)
Patch Set: Fix nits Created 3 years, 11 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 | « chrome/browser/printing/print_job.cc ('k') | chrome/browser/printing/pwg_raster_converter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <fstream> 8 #include <fstream>
9 #include <iostream> 9 #include <iostream>
10 #include <iterator> 10 #include <iterator>
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 // The image will be rotated if |width_in_pixels| is greater than 363 // The image will be rotated if |width_in_pixels| is greater than
364 // |height_in_pixels|. This is because the page will be rotated to fit 364 // |height_in_pixels|. This is because the page will be rotated to fit
365 // within a piece of paper. Therefore, |width_in_pixels| and 365 // within a piece of paper. Therefore, |width_in_pixels| and
366 // |height_in_pixels| have to be swapped or else they won't reflect the 366 // |height_in_pixels| have to be swapped or else they won't reflect the
367 // dimensions of the rotated page. 367 // dimensions of the rotated page.
368 if (width_in_pixels > height_in_pixels) 368 if (width_in_pixels > height_in_pixels)
369 std::swap(width_in_pixels, height_in_pixels); 369 std::swap(width_in_pixels, height_in_pixels);
370 370
371 total_height_in_pixels += height_in_pixels; 371 total_height_in_pixels += height_in_pixels;
372 gfx::Rect rect(width_in_pixels, height_in_pixels); 372 gfx::Rect rect(width_in_pixels, height_in_pixels);
373 PdfRenderSettings settings(rect, kDpi, true); 373 PdfRenderSettings settings(rect, kDpi, true,
374 PdfRenderSettings::Mode::NORMAL);
374 375
375 int int_max = std::numeric_limits<int>::max(); 376 int int_max = std::numeric_limits<int>::max();
376 if (settings.area.width() > int_max / kColorChannels || 377 if (settings.area.width() > int_max / kColorChannels ||
377 settings.area.height() > 378 settings.area.height() >
378 int_max / (kColorChannels * settings.area.width())) { 379 int_max / (kColorChannels * settings.area.width())) {
379 FAIL() << "The dimensions of the image are too large." 380 FAIL() << "The dimensions of the image are too large."
380 << "Decrease the DPI or the dimensions of the image."; 381 << "Decrease the DPI or the dimensions of the image.";
381 } 382 }
382 383
383 std::vector<uint8_t> page_bitmap_data(kColorChannels * 384 std::vector<uint8_t> page_bitmap_data(kColorChannels *
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 // waiting for this message and start waiting for the image data. 631 // waiting for this message and start waiting for the image data.
631 std::cout << "#EOF\n"; 632 std::cout << "#EOF\n";
632 std::cout.flush(); 633 std::cout.flush();
633 634
634 SendPng(); 635 SendPng();
635 Reset(); 636 Reset();
636 } 637 }
637 } 638 }
638 639
639 } // namespace printing 640 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_job.cc ('k') | chrome/browser/printing/pwg_raster_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698