| 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> | 
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 468   const float kPageHeight = 792.0f;  // 11 inch | 468   const float kPageHeight = 792.0f;  // 11 inch | 
| 469   const float kMarginTop = 29.0f;    // 0.40 inch | 469   const float kMarginTop = 29.0f;    // 0.40 inch | 
| 470   const float kMarginLeft = 29.0f;   // 0.40 inch | 470   const float kMarginLeft = 29.0f;   // 0.40 inch | 
| 471   const int kContentWidth = 555;     // 7.71 inch | 471   const int kContentWidth = 555;     // 7.71 inch | 
| 472   const int kContentHeight = 735;    // 10.21 inch | 472   const int kContentHeight = 735;    // 10.21 inch | 
| 473   blink::WebPrintParams params(blink::WebSize(kContentWidth, kContentHeight)); | 473   blink::WebPrintParams params(blink::WebSize(kContentWidth, kContentHeight)); | 
| 474   params.printerDPI = 300; | 474   params.printerDPI = 300; | 
| 475   int page_count = frame->printBegin(params); | 475   int page_count = frame->printBegin(params); | 
| 476   for (int i = 0; i < page_count; ++i) { | 476   for (int i = 0; i < page_count; ++i) { | 
| 477     SkCanvas* sk_canvas = doc->beginPage(kPageWidth, kPageHeight); | 477     SkCanvas* sk_canvas = doc->beginPage(kPageWidth, kPageHeight); | 
| 478     cc::PaintCanvas canvas(sk_canvas); | 478     cc::PaintCanvasPassThrough canvas(sk_canvas); | 
| 479     cc::PaintCanvasAutoRestore auto_restore(&canvas, true); | 479     cc::PaintCanvasAutoRestore auto_restore(&canvas, true); | 
| 480     canvas.translate(kMarginLeft, kMarginTop); | 480     canvas.translate(kMarginLeft, kMarginTop); | 
| 481 | 481 | 
| 482 #if defined(OS_WIN) || defined(OS_MACOSX) | 482 #if defined(OS_WIN) || defined(OS_MACOSX) | 
| 483     float page_shrink = frame->getPrintPageShrink(i); | 483     float page_shrink = frame->getPrintPageShrink(i); | 
| 484     DCHECK(page_shrink > 0); | 484     DCHECK(page_shrink > 0); | 
| 485     canvas.scale(page_shrink, page_shrink); | 485     canvas.scale(page_shrink, page_shrink); | 
| 486 #endif | 486 #endif | 
| 487 | 487 | 
| 488     frame->printPage(i, &canvas); | 488     frame->printPage(i, &canvas); | 
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1100           &gpu_driver_bug_workarounds))) { | 1100           &gpu_driver_bug_workarounds))) { | 
| 1101     return; | 1101     return; | 
| 1102   } | 1102   } | 
| 1103 | 1103 | 
| 1104   v8::Local<v8::Value> result; | 1104   v8::Local<v8::Value> result; | 
| 1105   if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) | 1105   if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) | 
| 1106     args->Return(result); | 1106     args->Return(result); | 
| 1107 } | 1107 } | 
| 1108 | 1108 | 
| 1109 }  // namespace content | 1109 }  // namespace content | 
| OLD | NEW | 
|---|