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 #include "window_manager/compositor/compositor.h" | 5 #include "window_manager/compositor/compositor.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include <gflags/gflags.h> | 11 #include <gflags/gflags.h> |
12 | 12 |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
15 #include "window_manager/callback.h" | 15 #include "window_manager/callback.h" |
16 #if defined(COMPOSITOR_OPENGL) | 16 #if defined(COMPOSITOR_OPENGL) |
17 #include "window_manager/compositor/gl/opengl_visitor.h" | 17 #include "window_manager/compositor/gl/opengl_visitor.h" |
18 #elif defined(COMPOSITOR_OPENGLES) | 18 #elif defined(COMPOSITOR_OPENGLES) |
19 #include "window_manager/compositor/gles/opengles_visitor.h" | 19 #include "window_manager/compositor/gles/opengles_visitor.h" |
| 20 #elif defined(COMPOSITOR_XRENDER) |
| 21 #include "window_manager/compositor/xrender/xrender_visitor.h" |
20 #endif | 22 #endif |
21 #include "window_manager/compositor/layer_visitor.h" | 23 #include "window_manager/compositor/layer_visitor.h" |
22 #include "window_manager/event_loop.h" | 24 #include "window_manager/event_loop.h" |
23 #include "window_manager/image_container.h" | 25 #include "window_manager/image_container.h" |
24 #include "window_manager/profiler.h" | 26 #include "window_manager/profiler.h" |
25 #include "window_manager/util.h" | 27 #include "window_manager/util.h" |
26 #include "window_manager/x11/x_connection.h" | 28 #include "window_manager/x11/x_connection.h" |
27 | 29 |
28 DEFINE_bool(compositor_display_debug_needle, false, | 30 DEFINE_bool(compositor_display_debug_needle, false, |
29 "Specify this to turn on a debugging aid for seeing when " | 31 "Specify this to turn on a debugging aid for seeing when " |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 0, width(), height(), 0, | 699 0, width(), height(), 0, |
698 -kProjectedDepthMin, -kProjectedDepthMax); | 700 -kProjectedDepthMin, -kProjectedDepthMax); |
699 } | 701 } |
700 | 702 |
701 bool RealCompositor::StageActor::using_passthrough_projection() const { | 703 bool RealCompositor::StageActor::using_passthrough_projection() const { |
702 return true; | 704 return true; |
703 } | 705 } |
704 | 706 |
705 | 707 |
706 RealCompositor::RealCompositor(EventLoop* event_loop, | 708 RealCompositor::RealCompositor(EventLoop* event_loop, |
707 XConnection* xconn, | 709 XConnection* xconn |
708 #if defined(COMPOSITOR_OPENGL) | 710 #if defined(COMPOSITOR_OPENGL) |
709 GLInterface* gl_interface | 711 ,GLInterface* gl_interface |
710 #elif defined(COMPOSITOR_OPENGLES) | 712 #elif defined(COMPOSITOR_OPENGLES) |
711 Gles2Interface* gl_interface | 713 ,Gles2Interface* gl_interface |
712 #endif | 714 #endif |
713 ) | 715 ) |
714 : event_loop_(event_loop), | 716 : event_loop_(event_loop), |
715 x_conn_(xconn), | 717 x_conn_(xconn), |
716 dirty_(true), | 718 dirty_(true), |
717 partially_dirty_(false), | 719 partially_dirty_(false), |
718 num_animations_(0), | 720 num_animations_(0), |
719 actor_count_(0), | 721 actor_count_(0), |
720 draw_timeout_id_(-1), | 722 draw_timeout_id_(-1), |
721 draw_timeout_enabled_(false), | 723 draw_timeout_enabled_(false), |
(...skipping 14 matching lines...) Expand all Loading... |
736 new RealCompositor::StageActor(this, | 738 new RealCompositor::StageActor(this, |
737 window, | 739 window, |
738 geometry.bounds.width, | 740 geometry.bounds.width, |
739 geometry.bounds.height)); | 741 geometry.bounds.height)); |
740 | 742 |
741 draw_visitor_.reset( | 743 draw_visitor_.reset( |
742 #if defined(COMPOSITOR_OPENGL) | 744 #if defined(COMPOSITOR_OPENGL) |
743 new OpenGlDrawVisitor(gl_interface, this, default_stage_.get()) | 745 new OpenGlDrawVisitor(gl_interface, this, default_stage_.get()) |
744 #elif defined(COMPOSITOR_OPENGLES) | 746 #elif defined(COMPOSITOR_OPENGLES) |
745 new OpenGlesDrawVisitor(gl_interface, this, default_stage_.get()) | 747 new OpenGlesDrawVisitor(gl_interface, this, default_stage_.get()) |
| 748 #elif defined(COMPOSITOR_XRENDER) |
| 749 new XRenderDrawVisitor(this, default_stage_.get()) |
746 #endif | 750 #endif |
747 ); | 751 ); |
748 | 752 |
749 #if defined(COMPOSITOR_OPENGL) | 753 #if defined(COMPOSITOR_OPENGL) |
750 if (!gl_interface->HasTextureFromPixmapExtension()) | 754 if (!gl_interface->HasTextureFromPixmapExtension()) |
751 texture_pixmap_actor_uses_fast_path_ = false; | 755 texture_pixmap_actor_uses_fast_path_ = false; |
752 #endif | 756 #endif |
753 | 757 |
754 draw_timeout_id_ = event_loop_->AddTimeout( | 758 draw_timeout_id_ = event_loop_->AddTimeout( |
755 NewPermanentCallback(this, &RealCompositor::Draw), 0, | 759 NewPermanentCallback(this, &RealCompositor::Draw), 0, |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 } | 928 } |
925 | 929 |
926 void RealCompositor::DisableDrawTimeout() { | 930 void RealCompositor::DisableDrawTimeout() { |
927 if (draw_timeout_enabled_) { | 931 if (draw_timeout_enabled_) { |
928 event_loop_->SuspendTimeout(draw_timeout_id_); | 932 event_loop_->SuspendTimeout(draw_timeout_id_); |
929 draw_timeout_enabled_ = false; | 933 draw_timeout_enabled_ = false; |
930 } | 934 } |
931 } | 935 } |
932 | 936 |
933 } // namespace window_manager | 937 } // namespace window_manager |
OLD | NEW |