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

Side by Side Diff: components/printing/renderer/print_web_view_helper.cc

Issue 821703005: Remove calls to deprecated SkPDFDevice and SkPDFDocuemnt. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update for new skstream semantics Created 5 years, 11 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
« no previous file with comments | « no previous file | printing/pdf_metafile_skia.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/printing/renderer/print_web_view_helper.h" 5 #include "components/printing/renderer/print_web_view_helper.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 #endif // defined(ENABLE_PRINT_PREVIEW) 500 #endif // defined(ENABLE_PRINT_PREVIEW)
501 501
502 // static - Not anonymous so that platform implementations can use it. 502 // static - Not anonymous so that platform implementations can use it.
503 float PrintWebViewHelper::RenderPageContent(blink::WebFrame* frame, 503 float PrintWebViewHelper::RenderPageContent(blink::WebFrame* frame,
504 int page_number, 504 int page_number,
505 const gfx::Rect& canvas_area, 505 const gfx::Rect& canvas_area,
506 const gfx::Rect& content_area, 506 const gfx::Rect& content_area,
507 double scale_factor, 507 double scale_factor,
508 blink::WebCanvas* canvas) { 508 blink::WebCanvas* canvas) {
509 SkAutoCanvasRestore auto_restore(canvas, true); 509 SkAutoCanvasRestore auto_restore(canvas, true);
510 if (content_area != canvas_area) { 510 canvas->translate((content_area.x() - canvas_area.x()) / scale_factor,
511 canvas->translate((content_area.x() - canvas_area.x()) / scale_factor, 511 (content_area.y() - canvas_area.y()) / scale_factor);
512 (content_area.y() - canvas_area.y()) / scale_factor);
513 SkRect clip_rect(
514 SkRect::MakeXYWH(content_area.origin().x() / scale_factor,
515 content_area.origin().y() / scale_factor,
516 content_area.size().width() / scale_factor,
517 content_area.size().height() / scale_factor));
518 SkIRect clip_int_rect;
519 clip_rect.roundOut(&clip_int_rect);
520 SkRegion clip_region(clip_int_rect);
521 canvas->setClipRegion(clip_region);
522 }
523 return frame->printPage(page_number, canvas); 512 return frame->printPage(page_number, canvas);
524 } 513 }
525 514
526 // Class that calls the Begin and End print functions on the frame and changes 515 // Class that calls the Begin and End print functions on the frame and changes
527 // the size of the view temporarily to support full page printing.. 516 // the size of the view temporarily to support full page printing..
528 class PrepareFrameAndViewForPrint : public blink::WebViewClient, 517 class PrepareFrameAndViewForPrint : public blink::WebViewClient,
529 public blink::WebFrameClient { 518 public blink::WebFrameClient {
530 public: 519 public:
531 PrepareFrameAndViewForPrint(const PrintMsg_Print_Params& params, 520 PrepareFrameAndViewForPrint(const PrintMsg_Print_Params& params,
532 blink::WebLocalFrame* frame, 521 blink::WebLocalFrame* frame,
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after
2043 blink::WebConsoleMessage::LevelWarning, message)); 2032 blink::WebConsoleMessage::LevelWarning, message));
2044 return false; 2033 return false;
2045 } 2034 }
2046 2035
2047 void PrintWebViewHelper::ScriptingThrottler::Reset() { 2036 void PrintWebViewHelper::ScriptingThrottler::Reset() {
2048 // Reset counter on successful print. 2037 // Reset counter on successful print.
2049 count_ = 0; 2038 count_ = 0;
2050 } 2039 }
2051 2040
2052 } // namespace printing 2041 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | printing/pdf_metafile_skia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698