| 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 "content/renderer/gpu/gpu_benchmarking_extension.h" | 5 #include "content/renderer/gpu/gpu_benchmarking_extension.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/base64.h" | 12 #include "base/base64.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
| 18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 19 #include "cc/layers/layer.h" | 19 #include "cc/layers/layer.h" |
| 20 #include "cc/paint/paint_canvas.h" | 20 #include "cc/paint/skia_paint_canvas.h" |
| 21 #include "cc/trees/layer_tree_host.h" | 21 #include "cc/trees/layer_tree_host.h" |
| 22 #include "content/common/child_process_messages.h" | 22 #include "content/common/child_process_messages.h" |
| 23 #include "content/common/input/synthetic_gesture_params.h" | 23 #include "content/common/input/synthetic_gesture_params.h" |
| 24 #include "content/common/input/synthetic_pinch_gesture_params.h" | 24 #include "content/common/input/synthetic_pinch_gesture_params.h" |
| 25 #include "content/common/input/synthetic_pointer_action_list_params.h" | 25 #include "content/common/input/synthetic_pointer_action_list_params.h" |
| 26 #include "content/common/input/synthetic_pointer_action_params.h" | 26 #include "content/common/input/synthetic_pointer_action_params.h" |
| 27 #include "content/common/input/synthetic_smooth_drag_gesture_params.h" | 27 #include "content/common/input/synthetic_smooth_drag_gesture_params.h" |
| 28 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" | 28 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" |
| 29 #include "content/common/input/synthetic_tap_gesture_params.h" | 29 #include "content/common/input/synthetic_tap_gesture_params.h" |
| 30 #include "content/public/child/v8_value_converter.h" | 30 #include "content/public/child/v8_value_converter.h" |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 const float kPageHeight = 792.0f; // 11 inch | 475 const float kPageHeight = 792.0f; // 11 inch |
| 476 const float kMarginTop = 29.0f; // 0.40 inch | 476 const float kMarginTop = 29.0f; // 0.40 inch |
| 477 const float kMarginLeft = 29.0f; // 0.40 inch | 477 const float kMarginLeft = 29.0f; // 0.40 inch |
| 478 const int kContentWidth = 555; // 7.71 inch | 478 const int kContentWidth = 555; // 7.71 inch |
| 479 const int kContentHeight = 735; // 10.21 inch | 479 const int kContentHeight = 735; // 10.21 inch |
| 480 blink::WebPrintParams params(blink::WebSize(kContentWidth, kContentHeight)); | 480 blink::WebPrintParams params(blink::WebSize(kContentWidth, kContentHeight)); |
| 481 params.printerDPI = 300; | 481 params.printerDPI = 300; |
| 482 int page_count = frame->printBegin(params); | 482 int page_count = frame->printBegin(params); |
| 483 for (int i = 0; i < page_count; ++i) { | 483 for (int i = 0; i < page_count; ++i) { |
| 484 SkCanvas* sk_canvas = doc->beginPage(kPageWidth, kPageHeight); | 484 SkCanvas* sk_canvas = doc->beginPage(kPageWidth, kPageHeight); |
| 485 cc::PaintCanvas canvas(sk_canvas); | 485 cc::SkiaPaintCanvas canvas(sk_canvas); |
| 486 cc::PaintCanvasAutoRestore auto_restore(&canvas, true); | 486 cc::PaintCanvasAutoRestore auto_restore(&canvas, true); |
| 487 canvas.translate(kMarginLeft, kMarginTop); | 487 canvas.translate(kMarginLeft, kMarginTop); |
| 488 | 488 |
| 489 #if defined(OS_WIN) || defined(OS_MACOSX) | 489 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 490 float page_shrink = frame->getPrintPageShrink(i); | 490 float page_shrink = frame->getPrintPageShrink(i); |
| 491 DCHECK(page_shrink > 0); | 491 DCHECK(page_shrink > 0); |
| 492 canvas.scale(page_shrink, page_shrink); | 492 canvas.scale(page_shrink, page_shrink); |
| 493 #endif | 493 #endif |
| 494 | 494 |
| 495 frame->printPage(i, &canvas); | 495 frame->printPage(i, &canvas); |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 &gpu_driver_bug_workarounds))) { | 1137 &gpu_driver_bug_workarounds))) { |
| 1138 return; | 1138 return; |
| 1139 } | 1139 } |
| 1140 | 1140 |
| 1141 v8::Local<v8::Value> result; | 1141 v8::Local<v8::Value> result; |
| 1142 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) | 1142 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) |
| 1143 args->Return(result); | 1143 args->Return(result); |
| 1144 } | 1144 } |
| 1145 | 1145 |
| 1146 } // namespace content | 1146 } // namespace content |
| OLD | NEW |