OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/surface.h" | 5 #include "components/exo/surface.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
14 #include "base/trace_event/trace_event_argument.h" | 14 #include "base/trace_event/trace_event_argument.h" |
15 #include "cc/quads/render_pass.h" | 15 #include "cc/quads/render_pass.h" |
16 #include "cc/quads/shared_quad_state.h" | 16 #include "cc/quads/shared_quad_state.h" |
17 #include "cc/quads/solid_color_draw_quad.h" | 17 #include "cc/quads/solid_color_draw_quad.h" |
18 #include "cc/quads/texture_draw_quad.h" | 18 #include "cc/quads/texture_draw_quad.h" |
19 #include "cc/resources/single_release_callback.h" | 19 #include "cc/resources/single_release_callback.h" |
20 #include "cc/surfaces/surface.h" | 20 #include "cc/surfaces/surface.h" |
21 #include "cc/surfaces/surface_factory.h" | 21 #include "cc/surfaces/surface_factory.h" |
22 #include "cc/surfaces/surface_id_allocator.h" | 22 #include "cc/surfaces/surface_id_allocator.h" |
| 23 #include "cc/surfaces/surface_info.h" |
23 #include "cc/surfaces/surface_manager.h" | 24 #include "cc/surfaces/surface_manager.h" |
24 #include "components/exo/buffer.h" | 25 #include "components/exo/buffer.h" |
25 #include "components/exo/surface_delegate.h" | 26 #include "components/exo/surface_delegate.h" |
26 #include "components/exo/surface_observer.h" | 27 #include "components/exo/surface_observer.h" |
27 #include "third_party/khronos/GLES2/gl2.h" | 28 #include "third_party/khronos/GLES2/gl2.h" |
28 #include "ui/aura/env.h" | 29 #include "ui/aura/env.h" |
29 #include "ui/aura/window_delegate.h" | 30 #include "ui/aura/window_delegate.h" |
30 #include "ui/aura/window_property.h" | 31 #include "ui/aura/window_property.h" |
31 #include "ui/aura/window_targeter.h" | 32 #include "ui/aura/window_targeter.h" |
32 #include "ui/base/cursor/cursor.h" | 33 #include "ui/base/cursor/cursor.h" |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 } | 491 } |
491 | 492 |
492 if (old_local_frame_id != local_frame_id_) { | 493 if (old_local_frame_id != local_frame_id_) { |
493 float contents_surface_to_layer_scale = 1.0; | 494 float contents_surface_to_layer_scale = 1.0; |
494 // The bounds must be updated before switching to the new surface, because | 495 // The bounds must be updated before switching to the new surface, because |
495 // the layer may be mirrored, in which case a surface change causes the | 496 // the layer may be mirrored, in which case a surface change causes the |
496 // mirror layer to update its surface using the latest bounds. | 497 // mirror layer to update its surface using the latest bounds. |
497 window_->layer()->SetBounds( | 498 window_->layer()->SetBounds( |
498 gfx::Rect(window_->layer()->bounds().origin(), content_size_)); | 499 gfx::Rect(window_->layer()->bounds().origin(), content_size_)); |
499 window_->layer()->SetShowSurface( | 500 window_->layer()->SetShowSurface( |
500 cc::SurfaceId(factory_owner_->frame_sink_id_, local_frame_id_), | 501 cc::SurfaceInfo( |
| 502 cc::SurfaceId(factory_owner_->frame_sink_id_, local_frame_id_), |
| 503 contents_surface_to_layer_scale, content_size_), |
501 base::Bind(&SatisfyCallback, base::Unretained(surface_manager_)), | 504 base::Bind(&SatisfyCallback, base::Unretained(surface_manager_)), |
502 base::Bind(&RequireCallback, base::Unretained(surface_manager_)), | 505 base::Bind(&RequireCallback, base::Unretained(surface_manager_)), |
503 content_size_, contents_surface_to_layer_scale, content_size_); | 506 content_size_); |
504 window_->layer()->SetFillsBoundsOpaquely( | 507 window_->layer()->SetFillsBoundsOpaquely( |
505 state_.blend_mode == SkXfermode::kSrc_Mode || | 508 state_.blend_mode == SkXfermode::kSrc_Mode || |
506 state_.opaque_region.contains( | 509 state_.opaque_region.contains( |
507 gfx::RectToSkIRect(gfx::Rect(content_size_)))); | 510 gfx::RectToSkIRect(gfx::Rect(content_size_)))); |
508 } | 511 } |
509 | 512 |
510 // Reset damage. | 513 // Reset damage. |
511 pending_damage_.setEmpty(); | 514 pending_damage_.setEmpty(); |
512 | 515 |
513 DCHECK(!current_resource_.id || | 516 DCHECK(!current_resource_.id || |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 | 884 |
882 int64_t Surface::GetPropertyInternal(const void* key, | 885 int64_t Surface::GetPropertyInternal(const void* key, |
883 int64_t default_value) const { | 886 int64_t default_value) const { |
884 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); | 887 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); |
885 if (iter == prop_map_.end()) | 888 if (iter == prop_map_.end()) |
886 return default_value; | 889 return default_value; |
887 return iter->second.value; | 890 return iter->second.value; |
888 } | 891 } |
889 | 892 |
890 } // namespace exo | 893 } // namespace exo |
OLD | NEW |