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

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

Issue 11418217: Add skia::RefPtr class to wrap ref counted classes from Skia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit+rebase Created 8 years 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 gfx::Rect canvas_area = 116 gfx::Rect canvas_area =
117 params.display_header_footer ? gfx::Rect(*page_size) : content_area; 117 params.display_header_footer ? gfx::Rect(*page_size) : content_area;
118 118
119 { 119 {
120 SkDevice* device = metafile->StartPageForVectorCanvas( 120 SkDevice* device = metafile->StartPageForVectorCanvas(
121 *page_size, canvas_area, scale_factor); 121 *page_size, canvas_area, scale_factor);
122 if (!device) 122 if (!device)
123 return; 123 return;
124 124
125 SkRefPtr<skia::VectorCanvas> canvas = new skia::VectorCanvas(device); 125 skia::RefPtr<skia::VectorCanvas> canvas =
126 canvas->unref(); // SkRefPtr and new both took a reference. 126 skia::AdoptRef(new skia::VectorCanvas(device));
127 WebKit::WebCanvas* canvas_ptr = canvas.get(); 127 WebKit::WebCanvas* canvas_ptr = canvas.get();
128 printing::MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile); 128 printing::MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile);
129 skia::SetIsDraftMode(*canvas, is_print_ready_metafile_sent_); 129 skia::SetIsDraftMode(*canvas, is_print_ready_metafile_sent_);
130 skia::SetIsPreviewMetafile(*canvas, is_preview); 130 skia::SetIsPreviewMetafile(*canvas, is_preview);
131 131
132 if (print_pages_params_->params.display_header_footer) { 132 if (print_pages_params_->params.display_header_footer) {
133 PrintHeaderAndFooter(canvas_ptr, page_number + 1, 133 PrintHeaderAndFooter(canvas_ptr, page_number + 1,
134 print_preview_context_.total_page_count(), 134 print_preview_context_.total_page_count(),
135 scale_factor, page_layout_in_points, 135 scale_factor, page_layout_in_points,
136 *header_footer_info_, params); 136 *header_footer_info_, params);
137 } 137 }
138 RenderPageContent(frame, page_number, canvas_area, content_area, 138 RenderPageContent(frame, page_number, canvas_area, content_area,
139 scale_factor, canvas_ptr); 139 scale_factor, canvas_ptr);
140 } 140 }
141 141
142 // Done printing. Close the device context to retrieve the compiled metafile. 142 // Done printing. Close the device context to retrieve the compiled metafile.
143 metafile->FinishPage(); 143 metafile->FinishPage();
144 } 144 }
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