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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 1927463002: Rename gfx::Display/Screen to display::Display/Screen in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 "content/browser/renderer_host/render_widget_host_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 #include "gpu/command_buffer/client/gles2_interface.h" 73 #include "gpu/command_buffer/client/gles2_interface.h"
74 #include "gpu/config/gpu_driver_bug_workaround_type.h" 74 #include "gpu/config/gpu_driver_bug_workaround_type.h"
75 #include "ipc/ipc_message_macros.h" 75 #include "ipc/ipc_message_macros.h"
76 #include "ipc/ipc_message_start.h" 76 #include "ipc/ipc_message_start.h"
77 #include "skia/ext/image_operations.h" 77 #include "skia/ext/image_operations.h"
78 #include "third_party/khronos/GLES2/gl2.h" 78 #include "third_party/khronos/GLES2/gl2.h"
79 #include "third_party/khronos/GLES2/gl2ext.h" 79 #include "third_party/khronos/GLES2/gl2ext.h"
80 #include "third_party/skia/include/core/SkCanvas.h" 80 #include "third_party/skia/include/core/SkCanvas.h"
81 #include "ui/android/window_android.h" 81 #include "ui/android/window_android.h"
82 #include "ui/android/window_android_compositor.h" 82 #include "ui/android/window_android_compositor.h"
83 #include "ui/display/display.h"
84 #include "ui/display/screen.h"
83 #include "ui/events/blink/blink_event_util.h" 85 #include "ui/events/blink/blink_event_util.h"
84 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" 86 #include "ui/events/gesture_detection/gesture_provider_config_helper.h"
85 #include "ui/events/gesture_detection/motion_event.h" 87 #include "ui/events/gesture_detection/motion_event.h"
86 #include "ui/gfx/android/device_display_info.h" 88 #include "ui/gfx/android/device_display_info.h"
87 #include "ui/gfx/android/java_bitmap.h" 89 #include "ui/gfx/android/java_bitmap.h"
88 #include "ui/gfx/android/view_configuration.h" 90 #include "ui/gfx/android/view_configuration.h"
89 #include "ui/gfx/display.h"
90 #include "ui/gfx/geometry/dip_util.h" 91 #include "ui/gfx/geometry/dip_util.h"
91 #include "ui/gfx/geometry/size_conversions.h" 92 #include "ui/gfx/geometry/size_conversions.h"
92 #include "ui/gfx/screen.h"
93 #include "ui/touch_selection/touch_selection_controller.h" 93 #include "ui/touch_selection/touch_selection_controller.h"
94 94
95 namespace content { 95 namespace content {
96 96
97 namespace { 97 namespace {
98 98
99 void SatisfyCallback(cc::SurfaceManager* manager, 99 void SatisfyCallback(cc::SurfaceManager* manager,
100 cc::SurfaceSequence sequence) { 100 cc::SurfaceSequence sequence) {
101 std::vector<uint32_t> sequences; 101 std::vector<uint32_t> sequences;
102 sequences.push_back(sequence.sequence); 102 sequences.push_back(sequence.sequence);
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 const ReadbackRequestCallback& result_callback) { 414 const ReadbackRequestCallback& result_callback) {
415 if (!host_ || host_->is_hidden() || !IsSurfaceAvailableForCopy()) { 415 if (!host_ || host_->is_hidden() || !IsSurfaceAvailableForCopy()) {
416 result_callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE); 416 result_callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE);
417 return; 417 return;
418 } 418 }
419 gfx::Size bounds = layer_->bounds(); 419 gfx::Size bounds = layer_->bounds();
420 if (src_subrect.IsEmpty()) 420 if (src_subrect.IsEmpty())
421 src_subrect = gfx::Rect(bounds); 421 src_subrect = gfx::Rect(bounds);
422 DCHECK_LE(src_subrect.width() + src_subrect.x(), bounds.width()); 422 DCHECK_LE(src_subrect.width() + src_subrect.x(), bounds.width());
423 DCHECK_LE(src_subrect.height() + src_subrect.y(), bounds.height()); 423 DCHECK_LE(src_subrect.height() + src_subrect.y(), bounds.height());
424 const gfx::Display& display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); 424 const display::Display& display =
425 display::Screen::GetScreen()->GetPrimaryDisplay();
425 float device_scale_factor = display.device_scale_factor(); 426 float device_scale_factor = display.device_scale_factor();
426 DCHECK_GT(device_scale_factor, 0); 427 DCHECK_GT(device_scale_factor, 0);
427 gfx::Size dst_size( 428 gfx::Size dst_size(
428 gfx::ScaleToCeiledSize(src_subrect.size(), scale / device_scale_factor)); 429 gfx::ScaleToCeiledSize(src_subrect.size(), scale / device_scale_factor));
429 src_subrect = gfx::ConvertRectToDIP(device_scale_factor, src_subrect); 430 src_subrect = gfx::ConvertRectToDIP(device_scale_factor, src_subrect);
430 431
431 CopyFromCompositingSurface(src_subrect, dst_size, result_callback, 432 CopyFromCompositingSurface(src_subrect, dst_size, result_callback,
432 preferred_color_type); 433 preferred_color_type);
433 } 434 }
434 435
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::CopyFromCompositingSurface"); 875 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::CopyFromCompositingSurface");
875 if (!host_ || host_->is_hidden()) { 876 if (!host_ || host_->is_hidden()) {
876 callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE); 877 callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE);
877 return; 878 return;
878 } 879 }
879 base::TimeTicks start_time = base::TimeTicks::Now(); 880 base::TimeTicks start_time = base::TimeTicks::Now();
880 if (!IsSurfaceAvailableForCopy()) { 881 if (!IsSurfaceAvailableForCopy()) {
881 callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE); 882 callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE);
882 return; 883 return;
883 } 884 }
884 const gfx::Display& display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); 885 const display::Display& display =
886 display::Screen::GetScreen()->GetPrimaryDisplay();
885 float device_scale_factor = display.device_scale_factor(); 887 float device_scale_factor = display.device_scale_factor();
886 gfx::Size dst_size_in_pixel = 888 gfx::Size dst_size_in_pixel =
887 gfx::ConvertRectToPixel(device_scale_factor, gfx::Rect(dst_size)).size(); 889 gfx::ConvertRectToPixel(device_scale_factor, gfx::Rect(dst_size)).size();
888 gfx::Rect src_subrect_in_pixel = 890 gfx::Rect src_subrect_in_pixel =
889 gfx::ConvertRectToPixel(device_scale_factor, src_subrect); 891 gfx::ConvertRectToPixel(device_scale_factor, src_subrect);
890 892
891 if (!using_browser_compositor_) { 893 if (!using_browser_compositor_) {
892 SynchronousCopyContents(src_subrect_in_pixel, dst_size_in_pixel, callback, 894 SynchronousCopyContents(src_subrect_in_pixel, dst_size_in_pixel, callback,
893 preferred_color_type); 895 preferred_color_type);
894 UMA_HISTOGRAM_TIMES("Compositing.CopyFromSurfaceTimeSynchronous", 896 UMA_HISTOGRAM_TIMES("Compositing.CopyFromSurfaceTimeSynchronous",
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after
2005 // context menu depending on the targetted content. 2007 // context menu depending on the targetted content.
2006 blink::WebGestureEvent long_press = WebGestureEventBuilder::Build( 2008 blink::WebGestureEvent long_press = WebGestureEventBuilder::Build(
2007 blink::WebInputEvent::GestureLongPress, 2009 blink::WebInputEvent::GestureLongPress,
2008 (time - base::TimeTicks()).InSecondsF(), x, y); 2010 (time - base::TimeTicks()).InSecondsF(), x, y);
2009 SendGestureEvent(long_press); 2011 SendGestureEvent(long_press);
2010 } 2012 }
2011 2013
2012 // static 2014 // static
2013 void RenderWidgetHostViewBase::GetDefaultScreenInfo( 2015 void RenderWidgetHostViewBase::GetDefaultScreenInfo(
2014 blink::WebScreenInfo* results) { 2016 blink::WebScreenInfo* results) {
2015 const gfx::Display& display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); 2017 const display::Display& display =
2018 display::Screen::GetScreen()->GetPrimaryDisplay();
2016 results->rect = display.bounds(); 2019 results->rect = display.bounds();
2017 // TODO(husky): Remove any system controls from availableRect. 2020 // TODO(husky): Remove any system controls from availableRect.
2018 results->availableRect = display.work_area(); 2021 results->availableRect = display.work_area();
2019 results->deviceScaleFactor = display.device_scale_factor(); 2022 results->deviceScaleFactor = display.device_scale_factor();
2020 results->orientationAngle = display.RotationAsDegree(); 2023 results->orientationAngle = display.RotationAsDegree();
2021 results->orientationType = 2024 results->orientationType =
2022 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); 2025 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display);
2023 gfx::DeviceDisplayInfo info; 2026 gfx::DeviceDisplayInfo info;
2024 results->depth = info.GetBitsPerPixel(); 2027 results->depth = info.GetBitsPerPixel();
2025 results->depthPerComponent = info.GetBitsPerComponent(); 2028 results->depthPerComponent = info.GetBitsPerComponent();
2026 results->isMonochrome = (results->depthPerComponent == 0); 2029 results->isMonochrome = (results->depthPerComponent == 0);
2027 } 2030 }
2028 2031
2029 } // namespace content 2032 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698