| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 #ifndef WINDOW_MANAGER_COMPOSITOR_REAL_COMPOSITOR_H_ | 5 #ifndef WINDOW_MANAGER_COMPOSITOR_REAL_COMPOSITOR_H_ |
| 6 #define WINDOW_MANAGER_COMPOSITOR_REAL_COMPOSITOR_H_ | 6 #define WINDOW_MANAGER_COMPOSITOR_REAL_COMPOSITOR_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <tr1/memory> | 12 #include <tr1/memory> |
| 13 #include <tr1/unordered_set> | 13 #include <tr1/unordered_set> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include <gtest/gtest_prod.h> // for FRIEND_TEST() macro | 16 #include <gtest/gtest_prod.h> // for FRIEND_TEST() macro |
| 17 | 17 |
| 18 #include "base/hash_tables.h" | 18 #include "base/hash_tables.h" |
| 19 #include "base/logging.h" | 19 #include "base/logging.h" |
| 20 #include "base/scoped_ptr.h" | 20 #include "base/scoped_ptr.h" |
| 21 #include "base/time.h" | 21 #include "base/time.h" |
| 22 #include "window_manager/compositor/animation.h" | 22 #include "window_manager/compositor/animation.h" |
| 23 #include "window_manager/compositor/compositor.h" | 23 #include "window_manager/compositor/compositor.h" |
| 24 #include "window_manager/math_types.h" | 24 #include "window_manager/math_types.h" |
| 25 #include "window_manager/x11/x_types.h" | 25 #include "window_manager/x11/x_types.h" |
| 26 | 26 |
| 27 #if !(defined(COMPOSITOR_OPENGL) || defined(COMPOSITOR_OPENGLES)) | 27 #if !(defined(COMPOSITOR_OPENGL) || \ |
| 28 #error COMPOSITOR_OPENGL or COMPOSITOR_OPENGLES must be defined | 28 defined(COMPOSITOR_OPENGLES) || \ |
| 29 defined(COMPOSITOR_XRENDER)) |
| 30 #error COMPOSITOR_OPENGL, COMPOSITOR_OPENGLES or\ |
| 31 COMPOSITOR_XRENDER must be defined |
| 29 #endif | 32 #endif |
| 30 | 33 |
| 31 namespace window_manager { | 34 namespace window_manager { |
| 32 | 35 |
| 33 class EventLoop; | 36 class EventLoop; |
| 34 class Gles2Interface; | 37 class Gles2Interface; |
| 35 class GLInterface; | 38 class GLInterface; |
| 36 class OpenGlDrawVisitor; | 39 class OpenGlDrawVisitor; |
| 37 class OpenGlesDrawVisitor; | 40 class OpenGlesDrawVisitor; |
| 38 class TextureData; | 41 class TextureData; |
| 39 class XConnection; | 42 class XConnection; |
| 43 class XRenderDrawVisitor; |
| 40 | 44 |
| 41 class RealCompositor : public Compositor { | 45 class RealCompositor : public Compositor { |
| 42 public: | 46 public: |
| 43 class Actor; | 47 class Actor; |
| 44 class ColoredBoxActor; | 48 class ColoredBoxActor; |
| 45 class ContainerActor; | 49 class ContainerActor; |
| 46 class ImageActor; | 50 class ImageActor; |
| 47 class QuadActor; | 51 class QuadActor; |
| 48 class StageActor; | 52 class StageActor; |
| 49 class TexturePixmapActor; | 53 class TexturePixmapActor; |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 | 588 |
| 585 // Has the stage been resized? This gets set by SetSizeImpl() and | 589 // Has the stage been resized? This gets set by SetSizeImpl() and |
| 586 // then checked and reset by the visitor after it resizes the viewport. | 590 // then checked and reset by the visitor after it resizes the viewport. |
| 587 bool was_resized_; | 591 bool was_resized_; |
| 588 | 592 |
| 589 Compositor::Color stage_color_; | 593 Compositor::Color stage_color_; |
| 590 DISALLOW_COPY_AND_ASSIGN(StageActor); | 594 DISALLOW_COPY_AND_ASSIGN(StageActor); |
| 591 }; | 595 }; |
| 592 | 596 |
| 593 RealCompositor(EventLoop* event_loop, | 597 RealCompositor(EventLoop* event_loop, |
| 594 XConnection* x_conn, | 598 XConnection* x_conn |
| 595 #if defined(COMPOSITOR_OPENGL) | 599 #if defined(COMPOSITOR_OPENGL) |
| 596 GLInterface* gl_interface | 600 ,GLInterface* gl_interface |
| 597 #elif defined(COMPOSITOR_OPENGLES) | 601 #elif defined(COMPOSITOR_OPENGLES) |
| 598 Gles2Interface* gl_interface | 602 ,Gles2Interface* gl_interface |
| 599 #endif | 603 #endif |
| 600 ); | 604 ); |
| 601 ~RealCompositor(); | 605 ~RealCompositor(); |
| 602 | 606 |
| 603 // Begin Compositor methods. | 607 // Begin Compositor methods. |
| 604 virtual void RegisterCompositionChangeListener( | 608 virtual void RegisterCompositionChangeListener( |
| 605 CompositionChangeListener* listener); | 609 CompositionChangeListener* listener); |
| 606 virtual void UnregisterCompositionChangeListener( | 610 virtual void UnregisterCompositionChangeListener( |
| 607 CompositionChangeListener* listener); | 611 CompositionChangeListener* listener); |
| 608 virtual bool TexturePixmapActorUsesFastPath() { | 612 virtual bool TexturePixmapActorUsesFastPath() { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 624 virtual void Draw(); | 628 virtual void Draw(); |
| 625 // End Compositor methods | 629 // End Compositor methods |
| 626 | 630 |
| 627 XConnection* x_conn() { return x_conn_; } | 631 XConnection* x_conn() { return x_conn_; } |
| 628 // TODO: These are just here so that ImageActor::SetImageData() can | 632 // TODO: These are just here so that ImageActor::SetImageData() can |
| 629 // update its texture. Find a better way to expose this. | 633 // update its texture. Find a better way to expose this. |
| 630 #if defined(COMPOSITOR_OPENGL) | 634 #if defined(COMPOSITOR_OPENGL) |
| 631 OpenGlDrawVisitor* draw_visitor() { return draw_visitor_.get(); } | 635 OpenGlDrawVisitor* draw_visitor() { return draw_visitor_.get(); } |
| 632 #elif defined(COMPOSITOR_OPENGLES) | 636 #elif defined(COMPOSITOR_OPENGLES) |
| 633 OpenGlesDrawVisitor* draw_visitor() { return draw_visitor_.get(); } | 637 OpenGlesDrawVisitor* draw_visitor() { return draw_visitor_.get(); } |
| 638 #elif defined(COMPOSITOR_XRENDER) |
| 639 XRenderDrawVisitor* draw_visitor() { return draw_visitor_.get(); } |
| 634 #endif | 640 #endif |
| 635 int actor_count() { return actor_count_; } | 641 int actor_count() { return actor_count_; } |
| 636 bool dirty() const { return dirty_; } | 642 bool dirty() const { return dirty_; } |
| 637 bool using_visibility_groups() const { | 643 bool using_visibility_groups() const { |
| 638 return !active_visibility_groups_.empty(); | 644 return !active_visibility_groups_.empty(); |
| 639 } | 645 } |
| 640 const std::tr1::unordered_set<int>& active_visibility_groups() const { | 646 const std::tr1::unordered_set<int>& active_visibility_groups() const { |
| 641 return active_visibility_groups_; | 647 return active_visibility_groups_; |
| 642 } | 648 } |
| 643 | 649 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 | 702 |
| 697 // This is the count of actors in the tree as of the last time | 703 // This is the count of actors in the tree as of the last time |
| 698 // Update was called. It is used to compute the depth delta for | 704 // Update was called. It is used to compute the depth delta for |
| 699 // layer depth calculations. | 705 // layer depth calculations. |
| 700 int32 actor_count_; | 706 int32 actor_count_; |
| 701 | 707 |
| 702 #if defined(COMPOSITOR_OPENGL) | 708 #if defined(COMPOSITOR_OPENGL) |
| 703 scoped_ptr<OpenGlDrawVisitor> draw_visitor_; | 709 scoped_ptr<OpenGlDrawVisitor> draw_visitor_; |
| 704 #elif defined(COMPOSITOR_OPENGLES) | 710 #elif defined(COMPOSITOR_OPENGLES) |
| 705 scoped_ptr<OpenGlesDrawVisitor> draw_visitor_; | 711 scoped_ptr<OpenGlesDrawVisitor> draw_visitor_; |
| 712 #elif defined(COMPOSITOR_XRENDER) |
| 713 scoped_ptr<XRenderDrawVisitor> draw_visitor_; |
| 706 #endif | 714 #endif |
| 707 | 715 |
| 708 // Time that we last drew the scene. | 716 // Time that we last drew the scene. |
| 709 base::TimeTicks last_draw_time_; | 717 base::TimeTicks last_draw_time_; |
| 710 | 718 |
| 711 // ID of the event loop timeout used to invoke Draw(). | 719 // ID of the event loop timeout used to invoke Draw(). |
| 712 int draw_timeout_id_; | 720 int draw_timeout_id_; |
| 713 | 721 |
| 714 // Is the drawing timeout currently enabled? | 722 // Is the drawing timeout currently enabled? |
| 715 bool draw_timeout_enabled_; | 723 bool draw_timeout_enabled_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 731 // actors changes. Listener objects aren't owned by us. | 739 // actors changes. Listener objects aren't owned by us. |
| 732 std::tr1::unordered_set<CompositionChangeListener*> | 740 std::tr1::unordered_set<CompositionChangeListener*> |
| 733 composition_change_listeners_; | 741 composition_change_listeners_; |
| 734 | 742 |
| 735 DISALLOW_COPY_AND_ASSIGN(RealCompositor); | 743 DISALLOW_COPY_AND_ASSIGN(RealCompositor); |
| 736 }; | 744 }; |
| 737 | 745 |
| 738 } // namespace window_manager | 746 } // namespace window_manager |
| 739 | 747 |
| 740 #endif // WINDOW_MANAGER_COMPOSITOR_REAL_COMPOSITOR_H_ | 748 #endif // WINDOW_MANAGER_COMPOSITOR_REAL_COMPOSITOR_H_ |
| OLD | NEW |