Chromium Code Reviews| Index: compositor/xrender/xrender_visitor.h |
| diff --git a/compositor/xrender/xrender_visitor.h b/compositor/xrender/xrender_visitor.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2de7905f693b0eb50ad99324b8b3998f5da1de8a |
| --- /dev/null |
| +++ b/compositor/xrender/xrender_visitor.h |
| @@ -0,0 +1,83 @@ |
| +// Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef WINDOW_MANAGER_COMPOSITOR_XRENDER_XRENDER_VISITOR_H_ |
| +#define WINDOW_MANAGER_COMPOSITOR_XRENDER_XRENDER_VISITOR_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/logging.h" |
| +#include "base/scoped_ptr.h" |
| +#include "window_manager/compositor/compositor.h" |
| +#include "window_manager/compositor/real_compositor.h" |
| +#include "window_manager/compositor/texture_data.h" |
| +#include "window_manager/x11/x_connection.h" |
| + |
| +namespace window_manager { |
| + |
| +class ImageContainer; |
| + |
| +// This class visits an actor tree and draws it using the XRender extension. |
| +class XRenderDrawVisitor : virtual public RealCompositor::ActorVisitor { |
| + public: |
| + XRenderDrawVisitor(RealCompositor* compositor, |
| + Compositor::StageActor* stage); |
|
Daniel Erat
2011/04/04 21:16:35
not your fault (the gl and gles implementations do
|
| + virtual ~XRenderDrawVisitor(); |
| + |
| + XConnection* xconn() { return xconn_; } |
| + void set_has_fullscreen_actor(bool has_fullscreen_actor) { |
| + has_fullscreen_actor_ = has_fullscreen_actor; |
| + } |
| + void set_damaged_region(Rect damaged_region) { |
|
Daniel Erat
2011/04/04 21:16:35
nit: s/Rect/const Rect&/ (i'm cleaning this up in
|
| + damaged_region_ = damaged_region; |
| + } |
| + |
| + void BindImage(const ImageContainer* container, |
| + RealCompositor::ImageActor* actor); |
| + |
| + virtual void VisitActor(RealCompositor::Actor* actor) {} |
| + virtual void VisitStage(RealCompositor::StageActor* actor); |
| + virtual void VisitContainer(RealCompositor::ContainerActor* actor); |
| + virtual void VisitImage(RealCompositor::ImageActor* actor); |
| + virtual void VisitTexturePixmap(RealCompositor::TexturePixmapActor* actor); |
| + virtual void VisitQuad(RealCompositor::QuadActor* actor); |
| + |
| + private: |
| + // So it can get access to the config data. |
| + friend class XRenderPixmapData; |
| + |
| + XWindow root_window; |
|
Daniel Erat
2011/04/04 21:16:35
add trailing underscore
|
| + XConnection::WindowGeometry root_geometry; |
|
Daniel Erat
2011/04/04 21:16:35
add trailing underscore
|
| + |
| + XPicture back_picture_; |
|
Daniel Erat
2011/04/04 21:16:35
these should still have comments with brief descri
|
| + XPixmap back_pixmap_; |
| + |
| + XPicture stage_picture_; |
| + |
| + // The visitor should not change settings in the compositor while visiting |
| + // actors throughout the drawing process because the compositor may decide |
| + // to skip drawing frames as an optimization. |
| + RealCompositor* compositor_; // Not owned. |
| + XConnection* xconn_; // Not owned. |
| + RealCompositor::StageActor* stage_; // Not owned. |
| + |
| + // This is the cumulative opacity of all the ancestors of the |
| + // currently visited node. It is recalculated each time we enter or |
| + // leave a container node. |
| + float ancestor_opacity_; |
| + |
| + // The rectangular region of the screen that is damaged in the frame. |
| + // This information allows the draw visitor to perform partial updates. |
| + Rect damaged_region_; |
| + |
| + // This is used to indicate whether the entire screen will be covered by an |
| + // actor so we can optimize by not clearing the back buffer. |
| + bool has_fullscreen_actor_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(XRenderDrawVisitor); |
| +}; |
| + |
| +} // namespace window_manager |
| + |
| +#endif // WINDOW_MANAGER_COMPOSITOR_XRENDER_XRENDER_VISITOR_H_ |