OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/printed_page.h" | 5 #include "printing/printed_page.h" |
6 | 6 |
7 namespace printing { | 7 namespace printing { |
8 | 8 |
9 PrintedPage::PrintedPage(int page_number, | 9 PrintedPage::PrintedPage(int page_number, |
10 Metafile* metafile, | 10 Metafile* metafile, |
11 const gfx::Size& page_size, | 11 const gfx::Size& page_size, |
12 const gfx::Rect& page_content_rect, | 12 const gfx::Rect& page_content_rect) |
13 double shrink_factor) | |
14 : page_number_(page_number), | 13 : page_number_(page_number), |
15 metafile_(metafile), | 14 metafile_(metafile), |
| 15 #if defined(OS_WIN) |
| 16 shrink_factor_(0.0f), |
| 17 #endif // OS_WIN |
16 page_size_(page_size), | 18 page_size_(page_size), |
17 page_content_rect_(page_content_rect), | 19 page_content_rect_(page_content_rect) { |
18 shrink_factor_(shrink_factor) { | |
19 } | 20 } |
20 | 21 |
21 PrintedPage::~PrintedPage() { | 22 PrintedPage::~PrintedPage() { |
22 } | 23 } |
23 | 24 |
24 const Metafile* PrintedPage::metafile() const { | 25 const Metafile* PrintedPage::metafile() const { |
25 return metafile_.get(); | 26 return metafile_.get(); |
26 } | 27 } |
27 | 28 |
28 void PrintedPage::GetCenteredPageContentRect( | 29 void PrintedPage::GetCenteredPageContentRect( |
29 const gfx::Size& paper_size, gfx::Rect* content_rect) const { | 30 const gfx::Size& paper_size, gfx::Rect* content_rect) const { |
30 *content_rect = page_content_rect(); | 31 *content_rect = page_content_rect(); |
31 if (paper_size.width() > page_size().width()) { | 32 if (paper_size.width() > page_size().width()) { |
32 int diff = paper_size.width() - page_size().width(); | 33 int diff = paper_size.width() - page_size().width(); |
33 content_rect->set_x(content_rect->x() + diff / 2); | 34 content_rect->set_x(content_rect->x() + diff / 2); |
34 } | 35 } |
35 if (paper_size.height() > page_size().height()) { | 36 if (paper_size.height() > page_size().height()) { |
36 int diff = paper_size.height() - page_size().height(); | 37 int diff = paper_size.height() - page_size().height(); |
37 content_rect->set_y(content_rect->y() + diff / 2); | 38 content_rect->set_y(content_rect->y() + diff / 2); |
38 } | 39 } |
39 } | 40 } |
40 | 41 |
41 } // namespace printing | 42 } // namespace printing |
OLD | NEW |