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

Side by Side Diff: chrome/renderer/print_web_view_helper_mac.mm

Issue 7582014: Remove metafile casts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
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 "chrome/renderer/print_web_view_helper.h" 5 #include "chrome/renderer/print_web_view_helper.h"
6 6
7 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/scoped_nsautorelease_pool.h" 10 #include "base/mac/scoped_nsautorelease_pool.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 base::TimeTicks begin_time = base::TimeTicks::Now(); 83 base::TimeTicks begin_time = base::TimeTicks::Now();
84 RenderPage(printParams.page_size, content_area, scale_factor, page_number, 84 RenderPage(printParams.page_size, content_area, scale_factor, page_number,
85 print_preview_context_.frame(), initial_render_metafile); 85 print_preview_context_.frame(), initial_render_metafile);
86 print_preview_context_.RenderedPreviewPage( 86 print_preview_context_.RenderedPreviewPage(
87 base::TimeTicks::Now() - begin_time); 87 base::TimeTicks::Now() - begin_time);
88 88
89 if (print_preview_context_.IsModifiable()) { 89 if (print_preview_context_.IsModifiable()) {
90 #if defined(USE_SKIA) 90 #if defined(USE_SKIA)
91 DCHECK(!draft_metafile.get()); 91 DCHECK(!draft_metafile.get());
92 draft_metafile.reset(reinterpret_cast<printing::PreviewMetafile*>( 92 draft_metafile.reset(
93 print_preview_context_.metafile())->GetMetafileForCurrentPage()); 93 print_preview_context_.metafile()->GetMetafileForCurrentPage());
94 #else 94 #else
95 draft_metafile->FinishDocument(); 95 draft_metafile->FinishDocument();
96 96
97 // With CG, we rendered into a new metafile so we could get it as a draft 97 // With CG, we rendered into a new metafile so we could get it as a draft
98 // document. Now we need to add it to complete document. But the document 98 // document. Now we need to add it to complete document. But the document
99 // has already been scaled and adjusted for margins, so do a 1:1 drawing. 99 // has already been scaled and adjusted for margins, so do a 1:1 drawing.
100 printing::Metafile* complete_metafile = print_preview_context_.metafile(); 100 printing::Metafile* complete_metafile = print_preview_context_.metafile();
101 bool success = complete_metafile->StartPage( 101 bool success = complete_metafile->StartPage(
102 printParams.page_size, gfx::Rect(printParams.page_size), 1.0); 102 printParams.page_size, gfx::Rect(printParams.page_size), 1.0);
103 DCHECK(success); 103 DCHECK(success);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 base::mac::ScopedNSAutoreleasePool pool; 146 base::mac::ScopedNSAutoreleasePool pool;
147 CGContextRef cgContext = metafile->context(); 147 CGContextRef cgContext = metafile->context();
148 CGContextRef canvasPtr = cgContext; 148 CGContextRef canvasPtr = cgContext;
149 #endif 149 #endif
150 frame->printPage(page_number, canvasPtr); 150 frame->printPage(page_number, canvasPtr);
151 } 151 }
152 152
153 // Done printing. Close the device context to retrieve the compiled metafile. 153 // Done printing. Close the device context to retrieve the compiled metafile.
154 metafile->FinishPage(); 154 metafile->FinishPage();
155 } 155 }
OLDNEW
« no previous file with comments | « chrome/renderer/print_web_view_helper_linux.cc ('k') | chrome/renderer/print_web_view_helper_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698