| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "android_webview/browser/hardware_renderer.h" | 5 #include "android_webview/browser/hardware_renderer.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/aw_gl_surface.h" | 7 #include "android_webview/browser/aw_gl_surface.h" |
| 8 #include "android_webview/browser/deferred_gpu_command_service.h" | 8 #include "android_webview/browser/deferred_gpu_command_service.h" |
| 9 #include "android_webview/browser/parent_output_surface.h" | 9 #include "android_webview/browser/parent_output_surface.h" |
| 10 #include "android_webview/browser/shared_renderer_state.h" | 10 #include "android_webview/browser/shared_renderer_state.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 SetFrameData(); | 213 SetFrameData(); |
| 214 if (shared_renderer_state_->ForceCommitOnRT()) { | 214 if (shared_renderer_state_->ForceCommitOnRT()) { |
| 215 CommitFrame(); | 215 CommitFrame(); |
| 216 SetFrameData(); | 216 SetFrameData(); |
| 217 } | 217 } |
| 218 | 218 |
| 219 gfx::Transform transform(gfx::Transform::kSkipInitialization); | 219 gfx::Transform transform(gfx::Transform::kSkipInitialization); |
| 220 transform.matrix().setColMajorf(draw_info->transform); | 220 transform.matrix().setColMajorf(draw_info->transform); |
| 221 transform.Translate(scroll_offset_.x(), scroll_offset_.y()); | 221 transform.Translate(scroll_offset_.x(), scroll_offset_.y()); |
| 222 | 222 |
| 223 viewport_.SetSize(draw_info->width, draw_info->height); |
| 223 // Need to post the new transform matrix back to child compositor | 224 // Need to post the new transform matrix back to child compositor |
| 224 // because there is no onDraw during a Render Thread animation, and child | 225 // because there is no onDraw during a Render Thread animation, and child |
| 225 // compositor might not have the tiles rasterized as the animation goes on. | 226 // compositor might not have the tiles rasterized as the animation goes on. |
| 226 ParentCompositorDrawConstraints draw_constraints( | 227 ParentCompositorDrawConstraints draw_constraints( |
| 227 draw_info->is_layer, transform, gfx::Rect(viewport_)); | 228 draw_info->is_layer, transform, gfx::Rect(viewport_)); |
| 228 | 229 |
| 229 draw_constraints_ = draw_constraints; | 230 draw_constraints_ = draw_constraints; |
| 230 shared_renderer_state_->PostExternalDrawConstraintsToChildCompositorOnRT( | 231 shared_renderer_state_->PostExternalDrawConstraintsToChildCompositorOnRT( |
| 231 draw_constraints); | 232 draw_constraints); |
| 232 | 233 |
| 233 if (!delegated_layer_.get()) | 234 if (!delegated_layer_.get()) |
| 234 return; | 235 return; |
| 235 | 236 |
| 236 viewport_.SetSize(draw_info->width, draw_info->height); | |
| 237 layer_tree_host_->SetViewportSize(viewport_); | 237 layer_tree_host_->SetViewportSize(viewport_); |
| 238 clip_.SetRect(draw_info->clip_left, | 238 clip_.SetRect(draw_info->clip_left, |
| 239 draw_info->clip_top, | 239 draw_info->clip_top, |
| 240 draw_info->clip_right - draw_info->clip_left, | 240 draw_info->clip_right - draw_info->clip_left, |
| 241 draw_info->clip_bottom - draw_info->clip_top); | 241 draw_info->clip_bottom - draw_info->clip_top); |
| 242 stencil_enabled_ = stencil_enabled; | 242 stencil_enabled_ = stencil_enabled; |
| 243 | 243 |
| 244 delegated_layer_->SetTransform(transform); | 244 delegated_layer_->SetTransform(transform); |
| 245 | 245 |
| 246 gl_surface_->SetBackingFrameBufferObject(framebuffer_binding_ext); | 246 gl_surface_->SetBackingFrameBufferObject(framebuffer_binding_ext); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 268 } | 268 } |
| 269 | 269 |
| 270 void HardwareRenderer::UnusedResourcesAreAvailable() { | 270 void HardwareRenderer::UnusedResourcesAreAvailable() { |
| 271 cc::ReturnedResourceArray returned_resources; | 271 cc::ReturnedResourceArray returned_resources; |
| 272 resource_collection_->TakeUnusedResourcesForChildCompositor( | 272 resource_collection_->TakeUnusedResourcesForChildCompositor( |
| 273 &returned_resources); | 273 &returned_resources); |
| 274 shared_renderer_state_->InsertReturnedResourcesOnRT(returned_resources); | 274 shared_renderer_state_->InsertReturnedResourcesOnRT(returned_resources); |
| 275 } | 275 } |
| 276 | 276 |
| 277 } // namespace android_webview | 277 } // namespace android_webview |
| OLD | NEW |