| 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/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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 } | 412 } |
| 413 gfx::Size bounds = layer_->bounds(); | 413 gfx::Size bounds = layer_->bounds(); |
| 414 if (src_subrect.IsEmpty()) | 414 if (src_subrect.IsEmpty()) |
| 415 src_subrect = gfx::Rect(bounds); | 415 src_subrect = gfx::Rect(bounds); |
| 416 DCHECK_LE(src_subrect.width() + src_subrect.x(), bounds.width()); | 416 DCHECK_LE(src_subrect.width() + src_subrect.x(), bounds.width()); |
| 417 DCHECK_LE(src_subrect.height() + src_subrect.y(), bounds.height()); | 417 DCHECK_LE(src_subrect.height() + src_subrect.y(), bounds.height()); |
| 418 const gfx::Display& display = | 418 const gfx::Display& display = |
| 419 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); | 419 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); |
| 420 float device_scale_factor = display.device_scale_factor(); | 420 float device_scale_factor = display.device_scale_factor(); |
| 421 DCHECK_GT(device_scale_factor, 0); | 421 DCHECK_GT(device_scale_factor, 0); |
| 422 gfx::Size dst_size(gfx::ToCeiledSize( | 422 gfx::Size dst_size( |
| 423 gfx::ScaleSize(src_subrect.size(), scale / device_scale_factor))); | 423 gfx::ScaleToCeiledSize(src_subrect.size(), scale / device_scale_factor)); |
| 424 src_subrect = gfx::ConvertRectToDIP(device_scale_factor, src_subrect); | 424 src_subrect = gfx::ConvertRectToDIP(device_scale_factor, src_subrect); |
| 425 | 425 |
| 426 CopyFromCompositingSurface(src_subrect, dst_size, result_callback, | 426 CopyFromCompositingSurface(src_subrect, dst_size, result_callback, |
| 427 preferred_color_type); | 427 preferred_color_type); |
| 428 } | 428 } |
| 429 | 429 |
| 430 scoped_refptr<cc::Layer> RenderWidgetHostViewAndroid::CreateDelegatedLayer() | 430 scoped_refptr<cc::Layer> RenderWidgetHostViewAndroid::CreateDelegatedLayer() |
| 431 const { | 431 const { |
| 432 scoped_refptr<cc::Layer> delegated_layer; | 432 scoped_refptr<cc::Layer> delegated_layer; |
| 433 if (!surface_id_.is_null()) { | 433 if (!surface_id_.is_null()) { |
| (...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2011 results->orientationAngle = display.RotationAsDegree(); | 2011 results->orientationAngle = display.RotationAsDegree(); |
| 2012 results->orientationType = | 2012 results->orientationType = |
| 2013 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2013 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 2014 gfx::DeviceDisplayInfo info; | 2014 gfx::DeviceDisplayInfo info; |
| 2015 results->depth = info.GetBitsPerPixel(); | 2015 results->depth = info.GetBitsPerPixel(); |
| 2016 results->depthPerComponent = info.GetBitsPerComponent(); | 2016 results->depthPerComponent = info.GetBitsPerComponent(); |
| 2017 results->isMonochrome = (results->depthPerComponent == 0); | 2017 results->isMonochrome = (results->depthPerComponent == 0); |
| 2018 } | 2018 } |
| 2019 | 2019 |
| 2020 } // namespace content | 2020 } // namespace content |
| OLD | NEW |