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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "android_webview/browser/aw_gl_surface.h" | 9 #include "android_webview/browser/aw_gl_surface.h" |
10 #include "android_webview/browser/aw_render_thread_context_provider.h" | 10 #include "android_webview/browser/aw_render_thread_context_provider.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 bool size_changed = frame_size != frame_size_; | 164 bool size_changed = frame_size != frame_size_; |
165 frame_size_ = frame_size; | 165 frame_size_ = frame_size; |
166 if (child_id_.is_null() || size_changed) { | 166 if (child_id_.is_null() || size_changed) { |
167 if (!child_id_.is_null()) | 167 if (!child_id_.is_null()) |
168 surface_factory_->Destroy(child_id_); | 168 surface_factory_->Destroy(child_id_); |
169 child_id_ = surface_id_allocator_->GenerateId(); | 169 child_id_ = surface_id_allocator_->GenerateId(); |
170 surface_factory_->Create(child_id_); | 170 surface_factory_->Create(child_id_); |
171 } | 171 } |
172 | 172 |
173 surface_factory_->SubmitCompositorFrame(child_id_, | 173 surface_factory_->SubmitCompositorFrame(child_id_, |
174 std::move(child_compositor_frame), | 174 std::move(*child_compositor_frame), |
175 cc::SurfaceFactory::DrawCallback()); | 175 cc::SurfaceFactory::DrawCallback()); |
176 } | 176 } |
177 | 177 |
178 gfx::Transform transform(gfx::Transform::kSkipInitialization); | 178 gfx::Transform transform(gfx::Transform::kSkipInitialization); |
179 transform.matrix().setColMajorf(draw_info->transform); | 179 transform.matrix().setColMajorf(draw_info->transform); |
180 transform.Translate(scroll_offset_.x(), scroll_offset_.y()); | 180 transform.Translate(scroll_offset_.x(), scroll_offset_.y()); |
181 | 181 |
182 gfx::Size viewport(draw_info->width, draw_info->height); | 182 gfx::Size viewport(draw_info->width, draw_info->height); |
183 // Need to post the new transform matrix back to child compositor | 183 // Need to post the new transform matrix back to child compositor |
184 // because there is no onDraw during a Render Thread animation, and child | 184 // because there is no onDraw during a Render Thread animation, and child |
(...skipping 26 matching lines...) Expand all Loading... |
211 quad_state->opacity = 1.f; | 211 quad_state->opacity = 1.f; |
212 | 212 |
213 cc::SurfaceDrawQuad* surface_quad = | 213 cc::SurfaceDrawQuad* surface_quad = |
214 render_pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); | 214 render_pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); |
215 surface_quad->SetNew(quad_state, gfx::Rect(quad_state->quad_layer_bounds), | 215 surface_quad->SetNew(quad_state, gfx::Rect(quad_state->quad_layer_bounds), |
216 gfx::Rect(quad_state->quad_layer_bounds), child_id_); | 216 gfx::Rect(quad_state->quad_layer_bounds), child_id_); |
217 | 217 |
218 std::unique_ptr<cc::DelegatedFrameData> delegated_frame( | 218 std::unique_ptr<cc::DelegatedFrameData> delegated_frame( |
219 new cc::DelegatedFrameData); | 219 new cc::DelegatedFrameData); |
220 delegated_frame->render_pass_list.push_back(std::move(render_pass)); | 220 delegated_frame->render_pass_list.push_back(std::move(render_pass)); |
221 std::unique_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); | 221 cc::CompositorFrame frame; |
222 frame->delegated_frame_data = std::move(delegated_frame); | 222 frame.delegated_frame_data = std::move(delegated_frame); |
223 | 223 |
224 if (root_id_.is_null()) { | 224 if (root_id_.is_null()) { |
225 root_id_ = surface_id_allocator_->GenerateId(); | 225 root_id_ = surface_id_allocator_->GenerateId(); |
226 surface_factory_->Create(root_id_); | 226 surface_factory_->Create(root_id_); |
227 display_->SetSurfaceId(root_id_, 1.f); | 227 display_->SetSurfaceId(root_id_, 1.f); |
228 } | 228 } |
229 surface_factory_->SubmitCompositorFrame(root_id_, std::move(frame), | 229 surface_factory_->SubmitCompositorFrame(root_id_, std::move(frame), |
230 cc::SurfaceFactory::DrawCallback()); | 230 cc::SurfaceFactory::DrawCallback()); |
231 | 231 |
232 display_->Resize(viewport); | 232 display_->Resize(viewport); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 const cc::ReturnedResourceArray& resources, | 272 const cc::ReturnedResourceArray& resources, |
273 const CompositorID& compositor_id, | 273 const CompositorID& compositor_id, |
274 uint32_t output_surface_id) { | 274 uint32_t output_surface_id) { |
275 if (output_surface_id != last_committed_output_surface_id_) | 275 if (output_surface_id != last_committed_output_surface_id_) |
276 return; | 276 return; |
277 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id, | 277 render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id, |
278 output_surface_id); | 278 output_surface_id); |
279 } | 279 } |
280 | 280 |
281 } // namespace android_webview | 281 } // namespace android_webview |
OLD | NEW |