| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/compositor/mus_browser_compositor_output_surface.h" | 5 #include "content/browser/compositor/mus_browser_compositor_output_surface.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
| 10 #include "cc/output/output_surface_frame.h" | 10 #include "cc/output/output_surface_frame.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 MusBrowserCompositorOutputSurface::~MusBrowserCompositorOutputSurface() {} | 65 MusBrowserCompositorOutputSurface::~MusBrowserCompositorOutputSurface() {} |
| 66 | 66 |
| 67 void MusBrowserCompositorOutputSurface::SwapBuffers( | 67 void MusBrowserCompositorOutputSurface::SwapBuffers( |
| 68 cc::OutputSurfaceFrame frame) { | 68 cc::OutputSurfaceFrame frame) { |
| 69 const gfx::Rect bounds = ui_window_ ? gfx::Rect(ui_window_->bounds().size()) | 69 const gfx::Rect bounds = ui_window_ ? gfx::Rect(ui_window_->bounds().size()) |
| 70 : gfx::Rect(window_->bounds().size()); | 70 : gfx::Rect(window_->bounds().size()); |
| 71 cc::CompositorFrame ui_frame; | 71 cc::CompositorFrame ui_frame; |
| 72 ui_frame.metadata.latency_info = std::move(frame.latency_info); | 72 ui_frame.metadata.latency_info = std::move(frame.latency_info); |
| 73 // Reset latency_info to known empty state after moving contents. | 73 // Reset latency_info to known empty state after moving contents. |
| 74 frame.latency_info.clear(); | 74 frame.latency_info.clear(); |
| 75 ui_frame.delegated_frame_data = base::MakeUnique<cc::DelegatedFrameData>(); |
| 75 const cc::RenderPassId render_pass_id(1, 1); | 76 const cc::RenderPassId render_pass_id(1, 1); |
| 76 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); | 77 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); |
| 77 const bool has_transparent_background = true; | 78 const bool has_transparent_background = true; |
| 78 pass->SetAll(render_pass_id, bounds, bounds, gfx::Transform(), | 79 pass->SetAll(render_pass_id, bounds, bounds, gfx::Transform(), |
| 79 has_transparent_background); | 80 has_transparent_background); |
| 80 // The SharedQuadState is owned by the SharedQuadStateList | 81 // The SharedQuadState is owned by the SharedQuadStateList |
| 81 // shared_quad_state_list. | 82 // shared_quad_state_list. |
| 82 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); | 83 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); |
| 83 sqs->SetAll(gfx::Transform(), bounds.size(), bounds, bounds, | 84 sqs->SetAll(gfx::Transform(), bounds.size(), bounds, bounds, |
| 84 false /* is_clipped */, 1.f /* opacity */, SkXfermode::kSrc_Mode, | 85 false /* is_clipped */, 1.f /* opacity */, SkXfermode::kSrc_Mode, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 105 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); | 106 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); |
| 106 gl->ShallowFlushCHROMIUM(); | 107 gl->ShallowFlushCHROMIUM(); |
| 107 gpu::SyncToken sync_token; | 108 gpu::SyncToken sync_token; |
| 108 gl->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); | 109 gl->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); |
| 109 | 110 |
| 110 resource.mailbox_holder = | 111 resource.mailbox_holder = |
| 111 gpu::MailboxHolder(mailbox, sync_token, GL_TEXTURE_2D); | 112 gpu::MailboxHolder(mailbox, sync_token, GL_TEXTURE_2D); |
| 112 resource.read_lock_fences_enabled = false; | 113 resource.read_lock_fences_enabled = false; |
| 113 resource.is_software = false; | 114 resource.is_software = false; |
| 114 resource.is_overlay_candidate = false; | 115 resource.is_overlay_candidate = false; |
| 115 ui_frame.resource_list.push_back(std::move(resource)); | 116 ui_frame.delegated_frame_data->resource_list.push_back(std::move(resource)); |
| 116 | 117 |
| 117 const bool needs_blending = true; | 118 const bool needs_blending = true; |
| 118 const bool premultiplied_alpha = true; | 119 const bool premultiplied_alpha = true; |
| 119 const gfx::PointF uv_top_left(0.f, 0.f); | 120 const gfx::PointF uv_top_left(0.f, 0.f); |
| 120 const gfx::PointF uv_bottom_right(1.f, 1.f); | 121 const gfx::PointF uv_bottom_right(1.f, 1.f); |
| 121 const uint32_t background_color = 0x00000000; | 122 const uint32_t background_color = 0x00000000; |
| 122 const float vertex_opacity[4] = {1.f, 1.f, 1.f, 1.f}; | 123 const float vertex_opacity[4] = {1.f, 1.f, 1.f, 1.f}; |
| 123 const bool y_flipped = true; | 124 const bool y_flipped = true; |
| 124 const bool nearest_neighbor = false; | 125 const bool nearest_neighbor = false; |
| 125 const bool secure_output_only = false; | 126 const bool secure_output_only = false; |
| 126 | 127 |
| 127 cc::TextureDrawQuad* quad = | 128 cc::TextureDrawQuad* quad = |
| 128 pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>(); | 129 pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>(); |
| 129 quad->SetAll(sqs, rect, rect, rect, needs_blending, resource.id, gfx::Size(), | 130 quad->SetAll(sqs, rect, rect, rect, needs_blending, resource.id, gfx::Size(), |
| 130 premultiplied_alpha, uv_top_left, uv_bottom_right, | 131 premultiplied_alpha, uv_top_left, uv_bottom_right, |
| 131 background_color, vertex_opacity, y_flipped, nearest_neighbor, | 132 background_color, vertex_opacity, y_flipped, nearest_neighbor, |
| 132 secure_output_only); | 133 secure_output_only); |
| 133 | 134 |
| 134 ui_frame.render_pass_list.push_back(std::move(pass)); | 135 ui_frame.delegated_frame_data->render_pass_list.push_back(std::move(pass)); |
| 135 | 136 |
| 136 // TODO(mfomitchev): Remove ui_compositor_frame_sink_ once we complete the | 137 // TODO(mfomitchev): Remove ui_compositor_frame_sink_ once we complete the |
| 137 // switch to Aura-Mus. | 138 // switch to Aura-Mus. |
| 138 if (ui_compositor_frame_sink_) | 139 if (ui_compositor_frame_sink_) |
| 139 ui_compositor_frame_sink_->SubmitCompositorFrame(std::move(ui_frame)); | 140 ui_compositor_frame_sink_->SubmitCompositorFrame(std::move(ui_frame)); |
| 140 else | 141 else |
| 141 compositor_frame_sink_->SubmitCompositorFrame(std::move(ui_frame)); | 142 compositor_frame_sink_->SubmitCompositorFrame(std::move(ui_frame)); |
| 142 return; | 143 return; |
| 143 } | 144 } |
| 144 | 145 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 201 |
| 201 const gpu::Mailbox& MusBrowserCompositorOutputSurface::GetMailboxFromResourceId( | 202 const gpu::Mailbox& MusBrowserCompositorOutputSurface::GetMailboxFromResourceId( |
| 202 uint32_t id) { | 203 uint32_t id) { |
| 203 DCHECK_LT(id, mailboxes_.size()); | 204 DCHECK_LT(id, mailboxes_.size()); |
| 204 DCHECK(std::find(free_resource_ids_.begin(), free_resource_ids_.end(), id) == | 205 DCHECK(std::find(free_resource_ids_.begin(), free_resource_ids_.end(), id) == |
| 205 free_resource_ids_.end()); | 206 free_resource_ids_.end()); |
| 206 return mailboxes_[id]; | 207 return mailboxes_[id]; |
| 207 } | 208 } |
| 208 | 209 |
| 209 } // namespace content | 210 } // namespace content |
| OLD | NEW |