OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "gfx/font.h" | 9 #include "gfx/font.h" |
10 #include "printing/page_number.h" | 10 #include "printing/page_number.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 void PrintedDocument::RenderPrintedPage( | 41 void PrintedDocument::RenderPrintedPage( |
42 const PrintedPage& page, gfx::NativeDrawingContext context) const { | 42 const PrintedPage& page, gfx::NativeDrawingContext context) const { |
43 #ifndef NDEBUG | 43 #ifndef NDEBUG |
44 { | 44 { |
45 // Make sure the page is from our list. | 45 // Make sure the page is from our list. |
46 AutoLock lock(lock_); | 46 AutoLock lock(lock_); |
47 DCHECK(&page == mutable_.pages_.find(page.page_number() - 1)->second.get()); | 47 DCHECK(&page == mutable_.pages_.find(page.page_number() - 1)->second.get()); |
48 } | 48 } |
49 #endif | 49 #endif |
50 | 50 |
| 51 DCHECK(context); |
| 52 |
51 const printing::PageSetup& page_setup( | 53 const printing::PageSetup& page_setup( |
52 immutable_.settings_.page_setup_device_units()); | 54 immutable_.settings_.page_setup_device_units()); |
53 gfx::Rect content_area; | 55 gfx::Rect content_area; |
54 page.GetCenteredPageContentRect(page_setup.physical_size(), &content_area); | 56 page.GetCenteredPageContentRect(page_setup.physical_size(), &content_area); |
55 | 57 |
56 // Save the state to make sure the context this function call does not modify | 58 // Save the state to make sure the context this function call does not modify |
57 // the device context. | 59 // the device context. |
58 int saved_state = SaveDC(context); | 60 int saved_state = SaveDC(context); |
59 DCHECK_NE(saved_state, 0); | 61 DCHECK_NE(saved_state, 0); |
60 skia::PlatformDevice::InitializeDC(context); | 62 skia::PlatformDevice::InitializeDC(context); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 font); | 136 font); |
135 PrintHeaderFooter(context, page, PageOverlays::CENTER, PageOverlays::BOTTOM, | 137 PrintHeaderFooter(context, page, PageOverlays::CENTER, PageOverlays::BOTTOM, |
136 font); | 138 font); |
137 PrintHeaderFooter(context, page, PageOverlays::RIGHT, PageOverlays::BOTTOM, | 139 PrintHeaderFooter(context, page, PageOverlays::RIGHT, PageOverlays::BOTTOM, |
138 font); | 140 font); |
139 int res = RestoreDC(context, saved_state); | 141 int res = RestoreDC(context, saved_state); |
140 DCHECK_NE(res, 0); | 142 DCHECK_NE(res, 0); |
141 } | 143 } |
142 | 144 |
143 } // namespace printing | 145 } // namespace printing |
OLD | NEW |