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..f5636ec0b7087da0ebdbab131943c78e75657f65 |
| --- /dev/null |
| +++ b/compositor/xrender/xrender_visitor.h |
| @@ -0,0 +1,91 @@ |
| +// 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_XRENDER_XRENDER_VISITOR_H_ |
|
Daniel Erat
2011/04/02 14:54:36
this should be WINDOW_MANAGER_COMPOSITOR_XRENDER_X
marcheu
2011/04/04 19:55:58
Done.
|
| +#define WINDOW_MANAGER_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 OpenGL. |
|
Daniel Erat
2011/04/02 14:54:36
s/OpenGL/the X Render extension/
marcheu
2011/04/04 19:55:58
Done.
|
| +class XRenderDrawVisitor : virtual public RealCompositor::ActorVisitor { |
| + public: |
| + XRenderDrawVisitor(RealCompositor* compositor, |
| + Compositor::StageActor* stage); |
|
Daniel Erat
2011/04/02 14:54:36
nit: should be indented one more space
marcheu
2011/04/04 19:55:58
Done.
|
| + 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) { |
| + 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: |
| + XWindow root_window; |
| + XConnection::WindowGeometry root_geometry; |
| + |
| + XPicture backPicture; |
|
Daniel Erat
2011/04/02 14:54:36
these should be named back_picture_, back_pixmap_,
marcheu
2011/04/04 19:55:58
Done.
|
| + XPixmap backPixmap; |
| + |
| + XPicture stagePicture; |
| + |
| + // So it can get access to the config data. |
| + friend class XRenderPixmapData; |
|
Daniel Erat
2011/04/02 14:54:36
move this to the top of the private section
marcheu
2011/04/04 19:55:58
Done.
|
| + |
| + // Finds an appropriate framebuffer configurations for the current |
| + // display. Sets framebuffer_config_rgba_ and framebuffer_config_rgb_. |
|
Daniel Erat
2011/04/02 14:54:36
nit: put pipes around variable references in comme
marcheu
2011/04/04 19:55:58
Or delete the whole thing since it's useless...
|
| + void FindFramebufferConfigurations(); |
| + |
| + // 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_; |
| + |
| + // This keeps track of the number of frames drawn so we can draw the |
|
Daniel Erat
2011/04/02 14:54:36
update this comment; you don't draw a debugging ne
marcheu
2011/04/04 19:55:58
Done.
|
| + // debugging needle. |
| + int num_frames_drawn_; |
| + |
| + // 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 COLOR_BUFFER_BIT. |
|
Daniel Erat
2011/04/02 14:54:36
update this comment so it doesn't refer to GL
marcheu
2011/04/04 19:55:58
Done.
|
| + bool has_fullscreen_actor_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(XRenderDrawVisitor); |
| +}; |
| + |
| +} // namespace window_manager |
| + |
| +#endif // WINDOW_MANAGER_XRENDER_XRENDER_VISITOR_H_ |