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