| OLD | NEW |
| 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/printing/print_web_view_helper.h" | 5 #include "chrome/renderer/printing/print_web_view_helper.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 static_cast<int>(page_layout_in_points.content_height * | 164 static_cast<int>(page_layout_in_points.content_height * |
| 165 params.max_shrink)); | 165 params.max_shrink)); |
| 166 } | 166 } |
| 167 | 167 |
| 168 float webkit_page_shrink_factor = frame->getPrintPageShrink(page_number); | 168 float webkit_page_shrink_factor = frame->getPrintPageShrink(page_number); |
| 169 float scale_factor = css_scale_factor * webkit_page_shrink_factor; | 169 float scale_factor = css_scale_factor * webkit_page_shrink_factor; |
| 170 | 170 |
| 171 gfx::Rect canvas_area = | 171 gfx::Rect canvas_area = |
| 172 params.display_header_footer ? gfx::Rect(page_size) : content_area; | 172 params.display_header_footer ? gfx::Rect(page_size) : content_area; |
| 173 | 173 |
| 174 SkDevice* device = metafile->StartPageForVectorCanvas( | 174 SkBaseDevice* device = metafile->StartPageForVectorCanvas( |
| 175 page_size, canvas_area, scale_factor); | 175 page_size, canvas_area, scale_factor); |
| 176 DCHECK(device); | 176 DCHECK(device); |
| 177 // The printPage method may take a reference to the canvas we pass down, so it | 177 // The printPage method may take a reference to the canvas we pass down, so it |
| 178 // can't be a stack object. | 178 // can't be a stack object. |
| 179 skia::RefPtr<skia::VectorCanvas> canvas = | 179 skia::RefPtr<skia::VectorCanvas> canvas = |
| 180 skia::AdoptRef(new skia::VectorCanvas(device)); | 180 skia::AdoptRef(new skia::VectorCanvas(device)); |
| 181 | 181 |
| 182 if (is_preview) { | 182 if (is_preview) { |
| 183 MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile); | 183 MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile); |
| 184 skia::SetIsDraftMode(*canvas, is_print_ready_metafile_sent_); | 184 skia::SetIsDraftMode(*canvas, is_print_ready_metafile_sent_); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 } | 240 } |
| 241 shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), shared_mem_handle); | 241 shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), shared_mem_handle); |
| 242 shared_buf.Unmap(); | 242 shared_buf.Unmap(); |
| 243 | 243 |
| 244 Send(new PrintHostMsg_DuplicateSection(routing_id(), *shared_mem_handle, | 244 Send(new PrintHostMsg_DuplicateSection(routing_id(), *shared_mem_handle, |
| 245 shared_mem_handle)); | 245 shared_mem_handle)); |
| 246 return true; | 246 return true; |
| 247 } | 247 } |
| 248 | 248 |
| 249 } // namespace printing | 249 } // namespace printing |
| OLD | NEW |