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 750173002: Move dip utils to gfx/geometry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missed android change Created 6 years 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 "base/android/build_info.h" 9 #include "base/android/build_info.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 #include "third_party/khronos/GLES2/gl2ext.h" 67 #include "third_party/khronos/GLES2/gl2ext.h"
68 #include "third_party/skia/include/core/SkCanvas.h" 68 #include "third_party/skia/include/core/SkCanvas.h"
69 #include "ui/base/android/window_android.h" 69 #include "ui/base/android/window_android.h"
70 #include "ui/base/android/window_android_compositor.h" 70 #include "ui/base/android/window_android_compositor.h"
71 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" 71 #include "ui/events/gesture_detection/gesture_provider_config_helper.h"
72 #include "ui/events/gesture_detection/motion_event.h" 72 #include "ui/events/gesture_detection/motion_event.h"
73 #include "ui/gfx/android/device_display_info.h" 73 #include "ui/gfx/android/device_display_info.h"
74 #include "ui/gfx/android/java_bitmap.h" 74 #include "ui/gfx/android/java_bitmap.h"
75 #include "ui/gfx/android/view_configuration.h" 75 #include "ui/gfx/android/view_configuration.h"
76 #include "ui/gfx/display.h" 76 #include "ui/gfx/display.h"
77 #include "ui/gfx/geometry/dip_util.h"
77 #include "ui/gfx/screen.h" 78 #include "ui/gfx/screen.h"
78 #include "ui/gfx/size_conversions.h" 79 #include "ui/gfx/size_conversions.h"
79 80
80 namespace content { 81 namespace content {
81 82
82 namespace { 83 namespace {
83 84
84 const int kUndefinedOutputSurfaceId = -1; 85 const int kUndefinedOutputSurfaceId = -1;
85 86
86 // Used to accomodate finite precision when comparing scaled viewport and 87 // Used to accomodate finite precision when comparing scaled viewport and
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 } 785 }
785 base::TimeTicks start_time = base::TimeTicks::Now(); 786 base::TimeTicks start_time = base::TimeTicks::Now();
786 if (!using_synchronous_compositor_ && !IsSurfaceAvailableForCopy()) { 787 if (!using_synchronous_compositor_ && !IsSurfaceAvailableForCopy()) {
787 callback.Run(SkBitmap(), READBACK_NOT_SUPPORTED); 788 callback.Run(SkBitmap(), READBACK_NOT_SUPPORTED);
788 return; 789 return;
789 } 790 }
790 const gfx::Display& display = 791 const gfx::Display& display =
791 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); 792 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
792 float device_scale_factor = display.device_scale_factor(); 793 float device_scale_factor = display.device_scale_factor();
793 gfx::Size dst_size_in_pixel = 794 gfx::Size dst_size_in_pixel =
794 ConvertRectToPixel(device_scale_factor, gfx::Rect(dst_size)).size(); 795 gfx::ConvertRectToPixel(device_scale_factor, gfx::Rect(dst_size)).size();
795 gfx::Rect src_subrect_in_pixel = 796 gfx::Rect src_subrect_in_pixel =
796 ConvertRectToPixel(device_scale_factor, src_subrect); 797 gfx::ConvertRectToPixel(device_scale_factor, src_subrect);
797 798
798 if (using_synchronous_compositor_) { 799 if (using_synchronous_compositor_) {
799 SynchronousCopyContents(src_subrect_in_pixel, dst_size_in_pixel, callback, 800 SynchronousCopyContents(src_subrect_in_pixel, dst_size_in_pixel, callback,
800 color_type); 801 color_type);
801 UMA_HISTOGRAM_TIMES("Compositing.CopyFromSurfaceTimeSynchronous", 802 UMA_HISTOGRAM_TIMES("Compositing.CopyFromSurfaceTimeSynchronous",
802 base::TimeTicks::Now() - start_time); 803 base::TimeTicks::Now() - start_time);
803 return; 804 return;
804 } 805 }
805 806
806 scoped_ptr<cc::CopyOutputRequest> request; 807 scoped_ptr<cc::CopyOutputRequest> request;
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1745 results->orientationAngle = display.RotationAsDegree(); 1746 results->orientationAngle = display.RotationAsDegree();
1746 results->orientationType = 1747 results->orientationType =
1747 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); 1748 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display);
1748 gfx::DeviceDisplayInfo info; 1749 gfx::DeviceDisplayInfo info;
1749 results->depth = info.GetBitsPerPixel(); 1750 results->depth = info.GetBitsPerPixel();
1750 results->depthPerComponent = info.GetBitsPerComponent(); 1751 results->depthPerComponent = info.GetBitsPerComponent();
1751 results->isMonochrome = (results->depthPerComponent == 0); 1752 results->isMonochrome = (results->depthPerComponent == 0);
1752 } 1753 }
1753 1754
1754 } // namespace content 1755 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/dip_util.cc ('k') | content/browser/renderer_host/render_widget_host_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698