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/sys_utils.h" | 9 #include "base/android/sys_utils.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 | 976 |
977 SkBitmap bitmap; | 977 SkBitmap bitmap; |
978 bitmap.setConfig(config, | 978 bitmap.setConfig(config, |
979 dst_size_in_pixel.width(), | 979 dst_size_in_pixel.width(), |
980 dst_size_in_pixel.height()); | 980 dst_size_in_pixel.height()); |
981 bitmap.allocPixels(); | 981 bitmap.allocPixels(); |
982 SkCanvas canvas(bitmap); | 982 SkCanvas canvas(bitmap); |
983 canvas.scale( | 983 canvas.scale( |
984 (float)dst_size_in_pixel.width() / (float)src_subrect_in_pixel.width(), | 984 (float)dst_size_in_pixel.width() / (float)src_subrect_in_pixel.width(), |
985 (float)dst_size_in_pixel.height() / (float)src_subrect_in_pixel.height()); | 985 (float)dst_size_in_pixel.height() / (float)src_subrect_in_pixel.height()); |
986 compositor->DemandDrawSw(&canvas); | 986 cc::CompositorFrame frame; |
| 987 compositor->DemandDrawSw(&canvas, &frame); |
987 callback.Run(true, bitmap); | 988 callback.Run(true, bitmap); |
988 } | 989 } |
989 | 990 |
990 void RenderWidgetHostViewAndroid::OnFrameMetadataUpdated( | 991 void RenderWidgetHostViewAndroid::OnFrameMetadataUpdated( |
991 const cc::CompositorFrameMetadata& frame_metadata) { | 992 const cc::CompositorFrameMetadata& frame_metadata) { |
992 | 993 |
993 // Disable double tap zoom for pages that have a width=device-width or | 994 // Disable double tap zoom for pages that have a width=device-width or |
994 // narrower viewport (indicating that this is a mobile-optimized or responsive | 995 // narrower viewport (indicating that this is a mobile-optimized or responsive |
995 // web design, so text will be legible without zooming). Also disable | 996 // web design, so text will be legible without zooming). Also disable |
996 // double tap and pinch for pages that prevent zooming in or out. | 997 // double tap and pinch for pages that prevent zooming in or out. |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1455 results->availableRect = display.work_area(); | 1456 results->availableRect = display.work_area(); |
1456 results->deviceScaleFactor = display.device_scale_factor(); | 1457 results->deviceScaleFactor = display.device_scale_factor(); |
1457 results->orientationAngle = display.RotationAsDegree(); | 1458 results->orientationAngle = display.RotationAsDegree(); |
1458 gfx::DeviceDisplayInfo info; | 1459 gfx::DeviceDisplayInfo info; |
1459 results->depth = info.GetBitsPerPixel(); | 1460 results->depth = info.GetBitsPerPixel(); |
1460 results->depthPerComponent = info.GetBitsPerComponent(); | 1461 results->depthPerComponent = info.GetBitsPerComponent(); |
1461 results->isMonochrome = (results->depthPerComponent == 0); | 1462 results->isMonochrome = (results->depthPerComponent == 0); |
1462 } | 1463 } |
1463 | 1464 |
1464 } // namespace content | 1465 } // namespace content |
OLD | NEW |