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

Side by Side Diff: printing/printed_document_win.cc

Issue 3475021: Printing: Push checking of |context| one level lower, as the different (Closed)
Patch Set: Created 10 years, 2 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
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698