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

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 10387022: A better fix for scaling issue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « printing/printing.gyp ('k') | no next file » | 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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/linked_ptr.h" 10 #include "base/memory/linked_ptr.h"
(...skipping 20 matching lines...) Expand all
31 #include "ppapi/shared_impl/ppb_input_event_shared.h" 31 #include "ppapi/shared_impl/ppb_input_event_shared.h"
32 #include "ppapi/shared_impl/ppb_url_util_shared.h" 32 #include "ppapi/shared_impl/ppb_url_util_shared.h"
33 #include "ppapi/shared_impl/ppb_view_shared.h" 33 #include "ppapi/shared_impl/ppb_view_shared.h"
34 #include "ppapi/shared_impl/ppp_instance_combined.h" 34 #include "ppapi/shared_impl/ppp_instance_combined.h"
35 #include "ppapi/shared_impl/resource.h" 35 #include "ppapi/shared_impl/resource.h"
36 #include "ppapi/shared_impl/scoped_pp_resource.h" 36 #include "ppapi/shared_impl/scoped_pp_resource.h"
37 #include "ppapi/shared_impl/time_conversion.h" 37 #include "ppapi/shared_impl/time_conversion.h"
38 #include "ppapi/shared_impl/var.h" 38 #include "ppapi/shared_impl/var.h"
39 #include "ppapi/thunk/enter.h" 39 #include "ppapi/thunk/enter.h"
40 #include "ppapi/thunk/ppb_buffer_api.h" 40 #include "ppapi/thunk/ppb_buffer_api.h"
41 #include "printing/custom_scaling.h"
42 #include "printing/units.h" 41 #include "printing/units.h"
43 #include "third_party/skia/include/core/SkCanvas.h" 42 #include "third_party/skia/include/core/SkCanvas.h"
44 #include "third_party/skia/include/core/SkRect.h" 43 #include "third_party/skia/include/core/SkRect.h"
45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli ne.h" 45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli ne.h"
47 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" 46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
48 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 47 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" 48 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
51 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGamepads. h" 50 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGamepads. h"
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1478 // original coordinates and we'll be able to print in full resolution. 1477 // original coordinates and we'll be able to print in full resolution.
1479 // Before playback we'll need to counter the scaling up that will happen 1478 // Before playback we'll need to counter the scaling up that will happen
1480 // in the browser (printed_document_win.cc). 1479 // in the browser (printed_document_win.cc).
1481 double dynamic_scale = gfx::CalculatePageScale(dc, size_in_pixels.width(), 1480 double dynamic_scale = gfx::CalculatePageScale(dc, size_in_pixels.width(),
1482 size_in_pixels.height()); 1481 size_in_pixels.height());
1483 double page_scale = static_cast<double>(printing::kPointsPerInch) / 1482 double page_scale = static_cast<double>(printing::kPointsPerInch) /
1484 static_cast<double>(current_print_settings_.dpi); 1483 static_cast<double>(current_print_settings_.dpi);
1485 1484
1486 if (dynamic_scale < page_scale) { 1485 if (dynamic_scale < page_scale) {
1487 page_scale = dynamic_scale; 1486 page_scale = dynamic_scale;
1488 printing::SetCustomPrintingPageScale(page_scale); 1487 printing::MetafileSkiaWrapper::SetCustomScaleOnCanvas(*canvas,
1488 page_scale);
1489 } 1489 }
1490 1490
1491 gfx::ScaleDC(dc, page_scale); 1491 gfx::ScaleDC(dc, page_scale);
1492 1492
1493 ret = render_proc(static_cast<unsigned char*>(mapper.data()), mapper.size(), 1493 ret = render_proc(static_cast<unsigned char*>(mapper.data()), mapper.size(),
1494 0, dc, current_print_settings_.dpi, 1494 0, dc, current_print_settings_.dpi,
1495 current_print_settings_.dpi, 0, 0, size_in_pixels.width(), 1495 current_print_settings_.dpi, 0, 0, size_in_pixels.width(),
1496 size_in_pixels.height(), true, false, true, true, true); 1496 size_in_pixels.height(), true, false, true, true, true);
1497 skia::EndPlatformPaint(canvas); 1497 skia::EndPlatformPaint(canvas);
1498 } 1498 }
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
2071 screen_size_for_fullscreen_ = gfx::Size(); 2071 screen_size_for_fullscreen_ = gfx::Size();
2072 WebElement element = container_->element(); 2072 WebElement element = container_->element();
2073 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2073 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2074 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2074 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2075 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2075 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2076 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2076 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2077 } 2077 }
2078 2078
2079 } // namespace ppapi 2079 } // namespace ppapi
2080 } // namespace webkit 2080 } // namespace webkit
OLDNEW
« no previous file with comments | « printing/printing.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698