| 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 "services/ui/ws/frame_generator.h" | 5 #include "services/ui/ws/frame_generator.h" |
| 6 | 6 |
| 7 #include "base/containers/adapters.h" | 7 #include "base/containers/adapters.h" |
| 8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
| 9 #include "cc/quads/render_pass.h" | 9 #include "cc/quads/render_pass.h" |
| 10 #include "cc/quads/render_pass_draw_quad.h" | 10 #include "cc/quads/render_pass_draw_quad.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 cc::CompositorFrame frame; | 158 cc::CompositorFrame frame; |
| 159 frame.render_pass_list.push_back(std::move(render_pass)); | 159 frame.render_pass_list.push_back(std::move(render_pass)); |
| 160 if (delegate_->IsInHighContrastMode()) { | 160 if (delegate_->IsInHighContrastMode()) { |
| 161 std::unique_ptr<cc::RenderPass> invert_pass = cc::RenderPass::Create(); | 161 std::unique_ptr<cc::RenderPass> invert_pass = cc::RenderPass::Create(); |
| 162 invert_pass->SetNew(cc::RenderPassId(2, 0), output_rect, output_rect, | 162 invert_pass->SetNew(cc::RenderPassId(2, 0), output_rect, output_rect, |
| 163 gfx::Transform()); | 163 gfx::Transform()); |
| 164 cc::SharedQuadState* shared_state = | 164 cc::SharedQuadState* shared_state = |
| 165 invert_pass->CreateAndAppendSharedQuadState(); | 165 invert_pass->CreateAndAppendSharedQuadState(); |
| 166 shared_state->SetAll(gfx::Transform(), output_rect.size(), output_rect, | 166 shared_state->SetAll(gfx::Transform(), output_rect.size(), output_rect, |
| 167 output_rect, false, 1.f, SkXfermode::kSrcOver_Mode, 0); | 167 output_rect, false, 1.f, SkBlendMode::kSrcOver, 0); |
| 168 auto* quad = invert_pass->CreateAndAppendDrawQuad<cc::RenderPassDrawQuad>(); | 168 auto* quad = invert_pass->CreateAndAppendDrawQuad<cc::RenderPassDrawQuad>(); |
| 169 cc::FilterOperations filters; | 169 cc::FilterOperations filters; |
| 170 filters.Append(cc::FilterOperation::CreateInvertFilter(1.f)); | 170 filters.Append(cc::FilterOperation::CreateInvertFilter(1.f)); |
| 171 quad->SetNew(shared_state, output_rect, output_rect, render_pass_id, | 171 quad->SetNew(shared_state, output_rect, output_rect, render_pass_id, |
| 172 0 /* mask_resource_id */, gfx::Vector2dF() /* mask_uv_scale */, | 172 0 /* mask_resource_id */, gfx::Vector2dF() /* mask_uv_scale */, |
| 173 gfx::Size() /* mask_texture_size */, filters, | 173 gfx::Size() /* mask_texture_size */, filters, |
| 174 gfx::Vector2dF() /* filters_scale */, | 174 gfx::Vector2dF() /* filters_scale */, |
| 175 gfx::PointF() /* filters_origin */, | 175 gfx::PointF() /* filters_origin */, |
| 176 cc::FilterOperations() /* background_filters */); | 176 cc::FilterOperations() /* background_filters */); |
| 177 frame.render_pass_list.push_back(std::move(invert_pass)); | 177 frame.render_pass_list.push_back(std::move(invert_pass)); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 if (default_surface_id.is_valid()) { | 214 if (default_surface_id.is_valid()) { |
| 215 gfx::Transform quad_to_target_transform; | 215 gfx::Transform quad_to_target_transform; |
| 216 quad_to_target_transform.Translate(absolute_bounds.x(), | 216 quad_to_target_transform.Translate(absolute_bounds.x(), |
| 217 absolute_bounds.y()); | 217 absolute_bounds.y()); |
| 218 | 218 |
| 219 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); | 219 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); |
| 220 | 220 |
| 221 const gfx::Rect bounds_at_origin(window->bounds().size()); | 221 const gfx::Rect bounds_at_origin(window->bounds().size()); |
| 222 // TODO(fsamuel): These clipping and visible rects are incorrect. They need | 222 // TODO(fsamuel): These clipping and visible rects are incorrect. They need |
| 223 // to be populated from CompositorFrame structs. | 223 // to be populated from CompositorFrame structs. |
| 224 sqs->SetAll(quad_to_target_transform, | 224 sqs->SetAll( |
| 225 bounds_at_origin.size() /* layer_bounds */, | 225 quad_to_target_transform, bounds_at_origin.size() /* layer_bounds */, |
| 226 bounds_at_origin /* visible_layer_bounds */, | 226 bounds_at_origin /* visible_layer_bounds */, |
| 227 bounds_at_origin /* clip_rect */, false /* is_clipped */, | 227 bounds_at_origin /* clip_rect */, false /* is_clipped */, |
| 228 combined_opacity, SkXfermode::kSrcOver_Mode, | 228 combined_opacity, SkBlendMode::kSrcOver, 0 /* sorting-context_id */); |
| 229 0 /* sorting-context_id */); | |
| 230 auto* quad = pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); | 229 auto* quad = pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); |
| 231 quad->SetAll(sqs, bounds_at_origin /* rect */, | 230 quad->SetAll(sqs, bounds_at_origin /* rect */, |
| 232 gfx::Rect() /* opaque_rect */, | 231 gfx::Rect() /* opaque_rect */, |
| 233 bounds_at_origin /* visible_rect */, true /* needs_blending*/, | 232 bounds_at_origin /* visible_rect */, true /* needs_blending*/, |
| 234 default_surface_id); | 233 default_surface_id); |
| 235 } | 234 } |
| 236 if (underlay_surface_id.is_valid()) { | 235 if (underlay_surface_id.is_valid()) { |
| 237 const gfx::Rect underlay_absolute_bounds = | 236 const gfx::Rect underlay_absolute_bounds = |
| 238 absolute_bounds - window->underlay_offset(); | 237 absolute_bounds - window->underlay_offset(); |
| 239 gfx::Transform quad_to_target_transform; | 238 gfx::Transform quad_to_target_transform; |
| 240 quad_to_target_transform.Translate(underlay_absolute_bounds.x(), | 239 quad_to_target_transform.Translate(underlay_absolute_bounds.x(), |
| 241 underlay_absolute_bounds.y()); | 240 underlay_absolute_bounds.y()); |
| 242 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); | 241 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); |
| 243 const gfx::Rect bounds_at_origin( | 242 const gfx::Rect bounds_at_origin( |
| 244 window->compositor_frame_sink_manager()->GetLatestFrameSize( | 243 window->compositor_frame_sink_manager()->GetLatestFrameSize( |
| 245 mojom::CompositorFrameSinkType::UNDERLAY)); | 244 mojom::CompositorFrameSinkType::UNDERLAY)); |
| 246 sqs->SetAll(quad_to_target_transform, | 245 sqs->SetAll( |
| 247 bounds_at_origin.size() /* layer_bounds */, | 246 quad_to_target_transform, bounds_at_origin.size() /* layer_bounds */, |
| 248 bounds_at_origin /* visible_layer_bounds */, | 247 bounds_at_origin /* visible_layer_bounds */, |
| 249 bounds_at_origin /* clip_rect */, false /* is_clipped */, | 248 bounds_at_origin /* clip_rect */, false /* is_clipped */, |
| 250 combined_opacity, SkXfermode::kSrcOver_Mode, | 249 combined_opacity, SkBlendMode::kSrcOver, 0 /* sorting-context_id */); |
| 251 0 /* sorting-context_id */); | |
| 252 | 250 |
| 253 auto* quad = pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); | 251 auto* quad = pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); |
| 254 quad->SetAll(sqs, bounds_at_origin /* rect */, | 252 quad->SetAll(sqs, bounds_at_origin /* rect */, |
| 255 gfx::Rect() /* opaque_rect */, | 253 gfx::Rect() /* opaque_rect */, |
| 256 bounds_at_origin /* visible_rect */, true /* needs_blending*/, | 254 bounds_at_origin /* visible_rect */, true /* needs_blending*/, |
| 257 underlay_surface_id); | 255 underlay_surface_id); |
| 258 } | 256 } |
| 259 } | 257 } |
| 260 | 258 |
| 261 cc::SurfaceId FrameGenerator::FindParentSurfaceId(ServerWindow* window) { | 259 cc::SurfaceId FrameGenerator::FindParentSurfaceId(ServerWindow* window) { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 cc::SurfaceId underlay_surface_id = | 374 cc::SurfaceId underlay_surface_id = |
| 377 window->compositor_frame_sink_manager()->GetLatestSurfaceId( | 375 window->compositor_frame_sink_manager()->GetLatestSurfaceId( |
| 378 mojom::CompositorFrameSinkType::UNDERLAY); | 376 mojom::CompositorFrameSinkType::UNDERLAY); |
| 379 if (underlay_surface_id.is_valid()) | 377 if (underlay_surface_id.is_valid()) |
| 380 RemoveFrameSinkReference(underlay_surface_id.frame_sink_id()); | 378 RemoveFrameSinkReference(underlay_surface_id.frame_sink_id()); |
| 381 } | 379 } |
| 382 | 380 |
| 383 } // namespace ws | 381 } // namespace ws |
| 384 | 382 |
| 385 } // namespace ui | 383 } // namespace ui |
| OLD | NEW |