| 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/output/compositor_frame_sink.h" | 15 #include "cc/output/compositor_frame_sink.h" |
| 16 #include "cc/quads/render_pass.h" | 16 #include "cc/quads/render_pass.h" |
| 17 #include "cc/quads/shared_quad_state.h" | 17 #include "cc/quads/shared_quad_state.h" |
| 18 #include "cc/quads/solid_color_draw_quad.h" | 18 #include "cc/quads/solid_color_draw_quad.h" |
| 19 #include "cc/quads/texture_draw_quad.h" | 19 #include "cc/quads/texture_draw_quad.h" |
| 20 #include "cc/resources/single_release_callback.h" | 20 #include "cc/resources/single_release_callback.h" |
| 21 #include "cc/surfaces/sequence_surface_reference_factory.h" | 21 #include "cc/surfaces/sequence_surface_reference_factory.h" |
| 22 #include "cc/surfaces/surface.h" | 22 #include "cc/surfaces/surface.h" |
| 23 #include "cc/surfaces/surface_manager.h" | 23 #include "cc/surfaces/surface_manager.h" |
| 24 #include "components/exo/buffer.h" | 24 #include "components/exo/buffer.h" |
| 25 #include "components/exo/pointer.h" | 25 #include "components/exo/pointer.h" |
| 26 #include "components/exo/surface_delegate.h" | 26 #include "components/exo/surface_delegate.h" |
| 27 #include "components/exo/surface_observer.h" | 27 #include "components/exo/surface_observer.h" |
| 28 #include "third_party/khronos/GLES2/gl2.h" | 28 #include "third_party/khronos/GLES2/gl2.h" |
| 29 #include "ui/aura/client/aura_constants.h" |
| 29 #include "ui/aura/env.h" | 30 #include "ui/aura/env.h" |
| 30 #include "ui/aura/window_delegate.h" | 31 #include "ui/aura/window_delegate.h" |
| 31 #include "ui/aura/window_targeter.h" | 32 #include "ui/aura/window_targeter.h" |
| 32 #include "ui/base/class_property.h" | 33 #include "ui/base/class_property.h" |
| 33 #include "ui/base/cursor/cursor.h" | 34 #include "ui/base/cursor/cursor.h" |
| 34 #include "ui/base/hit_test.h" | 35 #include "ui/base/hit_test.h" |
| 35 #include "ui/compositor/layer.h" | 36 #include "ui/compositor/layer.h" |
| 36 #include "ui/events/event.h" | 37 #include "ui/events/event.h" |
| 37 #include "ui/gfx/buffer_format_util.h" | 38 #include "ui/gfx/buffer_format_util.h" |
| 38 #include "ui/gfx/geometry/safe_integer_conversions.h" | 39 #include "ui/gfx/geometry/safe_integer_conversions.h" |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 active_frame_callbacks_.pop_front(); | 628 active_frame_callbacks_.pop_front(); |
| 628 } | 629 } |
| 629 return true; | 630 return true; |
| 630 } | 631 } |
| 631 | 632 |
| 632 void Surface::CheckIfSurfaceHierarchyNeedsCommitToNewSurfaces() { | 633 void Surface::CheckIfSurfaceHierarchyNeedsCommitToNewSurfaces() { |
| 633 if (HasLayerHierarchyChanged()) | 634 if (HasLayerHierarchyChanged()) |
| 634 SetSurfaceHierarchyNeedsCommitToNewSurfaces(); | 635 SetSurfaceHierarchyNeedsCommitToNewSurfaces(); |
| 635 } | 636 } |
| 636 | 637 |
| 638 void Surface::SetStylusOnly() { |
| 639 window_->SetProperty(aura::client::kStylusOnlyKey, true); |
| 640 } |
| 641 |
| 637 //////////////////////////////////////////////////////////////////////////////// | 642 //////////////////////////////////////////////////////////////////////////////// |
| 638 // ui::ContextFactoryObserver overrides: | 643 // ui::ContextFactoryObserver overrides: |
| 639 | 644 |
| 640 void Surface::OnLostResources() { | 645 void Surface::OnLostResources() { |
| 641 if (!window_->GetSurfaceId().is_valid()) | 646 if (!window_->GetSurfaceId().is_valid()) |
| 642 return; | 647 return; |
| 643 UpdateResource(false); | 648 UpdateResource(false); |
| 644 UpdateSurface(true); | 649 UpdateSurface(true); |
| 645 } | 650 } |
| 646 | 651 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 render_pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>(); | 860 render_pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>(); |
| 856 solid_quad->SetNew(quad_state, quad_rect, quad_rect, SK_ColorBLACK, false); | 861 solid_quad->SetNew(quad_state, quad_rect, quad_rect, SK_ColorBLACK, false); |
| 857 } | 862 } |
| 858 | 863 |
| 859 frame.render_pass_list.push_back(std::move(render_pass)); | 864 frame.render_pass_list.push_back(std::move(render_pass)); |
| 860 compositor_frame_sink_holder_->GetCompositorFrameSink() | 865 compositor_frame_sink_holder_->GetCompositorFrameSink() |
| 861 ->SubmitCompositorFrame(std::move(frame)); | 866 ->SubmitCompositorFrame(std::move(frame)); |
| 862 } | 867 } |
| 863 | 868 |
| 864 } // namespace exo | 869 } // namespace exo |
| OLD | NEW |