| 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 <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // This is for an offscreen context, so we don't need the default framebuffer | 158 // This is for an offscreen context, so we don't need the default framebuffer |
| 159 // to have alpha, stencil, depth, antialiasing. | 159 // to have alpha, stencil, depth, antialiasing. |
| 160 gpu::gles2::ContextCreationAttribHelper attributes; | 160 gpu::gles2::ContextCreationAttribHelper attributes; |
| 161 attributes.alpha_size = -1; | 161 attributes.alpha_size = -1; |
| 162 attributes.stencil_size = 0; | 162 attributes.stencil_size = 0; |
| 163 attributes.depth_size = 0; | 163 attributes.depth_size = 0; |
| 164 attributes.samples = 0; | 164 attributes.samples = 0; |
| 165 attributes.sample_buffers = 0; | 165 attributes.sample_buffers = 0; |
| 166 attributes.bind_generates_resource = false; | 166 attributes.bind_generates_resource = false; |
| 167 | 167 |
| 168 static const size_t kBytesPerPixel = 4; | 168 constexpr size_t kBytesPerPixel = 4; |
| 169 gfx::DeviceDisplayInfo display_info; | 169 size_t full_screen_texture_size_in_bytes = |
| 170 size_t full_screen_texture_size_in_bytes = display_info.GetDisplayHeight() * | 170 gfx::DeviceDisplayInfo().GetDisplayHeight() * |
| 171 display_info.GetDisplayWidth() * | 171 gfx::DeviceDisplayInfo().GetDisplayWidth() * kBytesPerPixel; |
| 172 kBytesPerPixel; | 172 |
| 173 gpu::SharedMemoryLimits limits; | 173 gpu::SharedMemoryLimits limits; |
| 174 limits.command_buffer_size = 64 * 1024; | 174 // The GLHelper context doesn't do a lot of stuff, so we don't expect it to |
| 175 limits.start_transfer_buffer_size = 64 * 1024; | 175 // need a lot of space for commands. |
| 176 limits.min_transfer_buffer_size = 64 * 1024; | 176 limits.command_buffer_size = 1024; |
| 177 limits.max_transfer_buffer_size = std::min( | 177 // The transfer buffer is used for shaders among other things, so give some |
| 178 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize); | 178 // reasonable but small limit. |
| 179 limits.start_transfer_buffer_size = 4 * 1024; |
| 180 limits.min_transfer_buffer_size = 4 * 1024; |
| 181 limits.max_transfer_buffer_size = full_screen_texture_size_in_bytes; |
| 182 // This context is used for doing async readbacks, so allow at least a full |
| 183 // screen readback to be mapped. |
| 184 limits.mapped_memory_reclaim_limit = full_screen_texture_size_in_bytes; |
| 179 | 185 |
| 180 bool share_resources = false; | 186 bool share_resources = false; |
| 181 bool automatic_flushes = false; | 187 bool automatic_flushes = false; |
| 182 GURL url("chrome://gpu/RenderWidgetHostViewAndroid"); | 188 GURL url("chrome://gpu/RenderWidgetHostViewAndroid"); |
| 183 | 189 |
| 184 std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> context( | 190 std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> context( |
| 185 new WebGraphicsContext3DCommandBufferImpl( | 191 new WebGraphicsContext3DCommandBufferImpl( |
| 186 gpu::kNullSurfaceHandle, // offscreen | 192 gpu::kNullSurfaceHandle, // offscreen |
| 187 url, gpu_channel_host.get(), attributes, gfx::PreferIntegratedGpu, | 193 url, gpu_channel_host.get(), attributes, gfx::PreferIntegratedGpu, |
| 188 share_resources, automatic_flushes, nullptr)); | 194 share_resources, automatic_flushes, nullptr)); |
| (...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2014 results->orientationAngle = display.RotationAsDegree(); | 2020 results->orientationAngle = display.RotationAsDegree(); |
| 2015 results->orientationType = | 2021 results->orientationType = |
| 2016 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2022 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 2017 gfx::DeviceDisplayInfo info; | 2023 gfx::DeviceDisplayInfo info; |
| 2018 results->depth = info.GetBitsPerPixel(); | 2024 results->depth = info.GetBitsPerPixel(); |
| 2019 results->depthPerComponent = info.GetBitsPerComponent(); | 2025 results->depthPerComponent = info.GetBitsPerComponent(); |
| 2020 results->isMonochrome = (results->depthPerComponent == 0); | 2026 results->isMonochrome = (results->depthPerComponent == 0); |
| 2021 } | 2027 } |
| 2022 | 2028 |
| 2023 } // namespace content | 2029 } // namespace content |
| OLD | NEW |