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_document.h" | 5 #include "printing/printed_document.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "printing/page_number.h" | 10 #include "printing/page_number.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 const printing::PageSetup& page_setup( | 92 const printing::PageSetup& page_setup( |
93 immutable_.settings_.page_setup_device_units()); | 93 immutable_.settings_.page_setup_device_units()); |
94 gfx::Rect content_area; | 94 gfx::Rect content_area; |
95 page.GetCenteredPageContentRect(page_setup.physical_size(), &content_area); | 95 page.GetCenteredPageContentRect(page_setup.physical_size(), &content_area); |
96 | 96 |
97 // Save the state to make sure the context this function call does not modify | 97 // Save the state to make sure the context this function call does not modify |
98 // the device context. | 98 // the device context. |
99 int saved_state = SaveDC(context); | 99 int saved_state = SaveDC(context); |
100 DCHECK_NE(saved_state, 0); | 100 DCHECK_NE(saved_state, 0); |
101 skia::PlatformDevice::InitializeDC(context); | 101 skia::InitializeDC(context); |
102 { | 102 { |
103 // Save the state (again) to apply the necessary world transformation. | 103 // Save the state (again) to apply the necessary world transformation. |
104 int saved_state = SaveDC(context); | 104 int saved_state = SaveDC(context); |
105 DCHECK_NE(saved_state, 0); | 105 DCHECK_NE(saved_state, 0); |
106 | 106 |
107 // Setup the matrix to translate and scale to the right place. Take in | 107 // Setup the matrix to translate and scale to the right place. Take in |
108 // account the actual shrinking factor. | 108 // account the actual shrinking factor. |
109 // Note that the printing output is relative to printable area of the page. | 109 // Note that the printing output is relative to printable area of the page. |
110 // That is 0,0 is offset by PHYSICALOFFSETX/Y from the page. | 110 // That is 0,0 is offset by PHYSICALOFFSETX/Y from the page. |
111 SimpleModifyWorldTransform( | 111 SimpleModifyWorldTransform( |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 DCHECK(result == SIMPLEREGION || result == COMPLEXREGION); | 182 DCHECK(result == SIMPLEREGION || result == COMPLEXREGION); |
183 TextOut(context, | 183 TextOut(context, |
184 bounds.x(), bounds.y(), | 184 bounds.x(), bounds.y(), |
185 text.c_str(), | 185 text.c_str(), |
186 static_cast<int>(text.size())); | 186 static_cast<int>(text.size())); |
187 int res = RestoreDC(context, saved_state); | 187 int res = RestoreDC(context, saved_state); |
188 DCHECK_NE(res, 0); | 188 DCHECK_NE(res, 0); |
189 } | 189 } |
190 | 190 |
191 } // namespace printing | 191 } // namespace printing |
OLD | NEW |