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

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

Issue 2428383006: Decouple VR Shell DPR and CSS size from Physical Displays. (Closed)
Patch Set: Fix load-bearing debugging code ;) Created 4 years, 1 month 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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 if (!host_ || host_->is_hidden() || !IsSurfaceAvailableForCopy()) { 549 if (!host_ || host_->is_hidden() || !IsSurfaceAvailableForCopy()) {
550 result_callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE); 550 result_callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE);
551 return; 551 return;
552 } 552 }
553 gfx::Size bounds = current_surface_size_; 553 gfx::Size bounds = current_surface_size_;
554 if (src_subrect.IsEmpty()) 554 if (src_subrect.IsEmpty())
555 src_subrect = gfx::Rect(bounds); 555 src_subrect = gfx::Rect(bounds);
556 DCHECK_LE(src_subrect.width() + src_subrect.x(), bounds.width()); 556 DCHECK_LE(src_subrect.width() + src_subrect.x(), bounds.width());
557 DCHECK_LE(src_subrect.height() + src_subrect.y(), bounds.height()); 557 DCHECK_LE(src_subrect.height() + src_subrect.y(), bounds.height());
558 const display::Display& display = 558 const display::Display& display =
559 display::Screen::GetScreen()->GetPrimaryDisplay(); 559 display::Screen::GetScreen()->GetDisplayNearestWindow(GetNativeView());
560 float device_scale_factor = display.device_scale_factor(); 560 float device_scale_factor = display.device_scale_factor();
561 DCHECK_GT(device_scale_factor, 0); 561 DCHECK_GT(device_scale_factor, 0);
562 gfx::Size dst_size( 562 gfx::Size dst_size(
563 gfx::ScaleToCeiledSize(src_subrect.size(), scale / device_scale_factor)); 563 gfx::ScaleToCeiledSize(src_subrect.size(), scale / device_scale_factor));
564 src_subrect = gfx::ConvertRectToDIP(device_scale_factor, src_subrect); 564 src_subrect = gfx::ConvertRectToDIP(device_scale_factor, src_subrect);
565 565
566 CopyFromCompositingSurface(src_subrect, dst_size, result_callback, 566 CopyFromCompositingSurface(src_subrect, dst_size, result_callback,
567 preferred_color_type); 567 preferred_color_type);
568 } 568 }
569 569
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE); 982 callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE);
983 return; 983 return;
984 } 984 }
985 if (!content_view_core_ || !(content_view_core_->GetWindowAndroid())) { 985 if (!content_view_core_ || !(content_view_core_->GetWindowAndroid())) {
986 callback.Run(SkBitmap(), READBACK_FAILED); 986 callback.Run(SkBitmap(), READBACK_FAILED);
987 return; 987 return;
988 } 988 }
989 989
990 base::TimeTicks start_time = base::TimeTicks::Now(); 990 base::TimeTicks start_time = base::TimeTicks::Now();
991 const display::Display& display = 991 const display::Display& display =
992 display::Screen::GetScreen()->GetPrimaryDisplay(); 992 display::Screen::GetScreen()->GetDisplayNearestWindow(GetNativeView());
993 float device_scale_factor = display.device_scale_factor(); 993 float device_scale_factor = display.device_scale_factor();
994 gfx::Size dst_size_in_pixel = 994 gfx::Size dst_size_in_pixel =
995 gfx::ConvertRectToPixel(device_scale_factor, gfx::Rect(dst_size)).size(); 995 gfx::ConvertRectToPixel(device_scale_factor, gfx::Rect(dst_size)).size();
996 gfx::Rect src_subrect_in_pixel = 996 gfx::Rect src_subrect_in_pixel =
997 gfx::ConvertRectToPixel(device_scale_factor, src_subrect); 997 gfx::ConvertRectToPixel(device_scale_factor, src_subrect);
998 998
999 if (!using_browser_compositor_) { 999 if (!using_browser_compositor_) {
1000 SynchronousCopyContents(src_subrect_in_pixel, dst_size_in_pixel, callback, 1000 SynchronousCopyContents(src_subrect_in_pixel, dst_size_in_pixel, callback,
1001 preferred_color_type); 1001 preferred_color_type);
1002 UMA_HISTOGRAM_TIMES("Compositing.CopyFromSurfaceTimeSynchronous", 1002 UMA_HISTOGRAM_TIMES("Compositing.CopyFromSurfaceTimeSynchronous",
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
1990 case ui::MotionEvent::ACTION_UP: 1990 case ui::MotionEvent::ACTION_UP:
1991 case ui::MotionEvent::ACTION_POINTER_UP: 1991 case ui::MotionEvent::ACTION_POINTER_UP:
1992 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", 1992 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED",
1993 delta.InMicroseconds(), 1, 1000000, 50); 1993 delta.InMicroseconds(), 1, 1000000, 50);
1994 default: 1994 default:
1995 return; 1995 return;
1996 } 1996 }
1997 } 1997 }
1998 1998
1999 } // namespace content 1999 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698