Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #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.
| |
| 6 #define WINDOW_MANAGER_XRENDER_XRENDER_VISITOR_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/logging.h" | |
| 11 #include "base/scoped_ptr.h" | |
| 12 #include "window_manager/compositor/compositor.h" | |
| 13 #include "window_manager/compositor/real_compositor.h" | |
| 14 #include "window_manager/compositor/texture_data.h" | |
| 15 #include "window_manager/x11/x_connection.h" | |
| 16 | |
| 17 namespace window_manager { | |
| 18 | |
| 19 class ImageContainer; | |
| 20 | |
| 21 // 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.
| |
| 22 class XRenderDrawVisitor : virtual public RealCompositor::ActorVisitor { | |
| 23 public: | |
| 24 XRenderDrawVisitor(RealCompositor* compositor, | |
| 25 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.
| |
| 26 virtual ~XRenderDrawVisitor(); | |
| 27 | |
| 28 XConnection* xconn() { return xconn_; } | |
| 29 void set_has_fullscreen_actor(bool has_fullscreen_actor) { | |
| 30 has_fullscreen_actor_ = has_fullscreen_actor; | |
| 31 } | |
| 32 void set_damaged_region(Rect damaged_region) { | |
| 33 damaged_region_ = damaged_region; | |
| 34 } | |
| 35 | |
| 36 void BindImage(const ImageContainer* container, | |
| 37 RealCompositor::ImageActor* actor); | |
| 38 | |
| 39 virtual void VisitActor(RealCompositor::Actor* actor) {} | |
| 40 virtual void VisitStage(RealCompositor::StageActor* actor); | |
| 41 virtual void VisitContainer(RealCompositor::ContainerActor* actor); | |
| 42 virtual void VisitImage(RealCompositor::ImageActor* actor); | |
| 43 virtual void VisitTexturePixmap(RealCompositor::TexturePixmapActor* actor); | |
| 44 virtual void VisitQuad(RealCompositor::QuadActor* actor); | |
| 45 | |
| 46 private: | |
| 47 XWindow root_window; | |
| 48 XConnection::WindowGeometry root_geometry; | |
| 49 | |
| 50 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.
| |
| 51 XPixmap backPixmap; | |
| 52 | |
| 53 XPicture stagePicture; | |
| 54 | |
| 55 // So it can get access to the config data. | |
| 56 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.
| |
| 57 | |
| 58 // Finds an appropriate framebuffer configurations for the current | |
| 59 // 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...
| |
| 60 void FindFramebufferConfigurations(); | |
| 61 | |
| 62 // The visitor should not change settings in the compositor while visiting | |
| 63 // actors throughout the drawing process because the compositor may decide | |
| 64 // to skip drawing frames as an optimization. | |
| 65 RealCompositor* compositor_; // Not owned. | |
| 66 XConnection* xconn_; // Not owned. | |
| 67 RealCompositor::StageActor* stage_; // Not owned. | |
| 68 | |
| 69 // This is the cumulative opacity of all the ancestors of the | |
| 70 // currently visited node. It is recalculated each time we enter or | |
| 71 // leave a container node. | |
| 72 float ancestor_opacity_; | |
| 73 | |
| 74 // 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.
| |
| 75 // debugging needle. | |
| 76 int num_frames_drawn_; | |
| 77 | |
| 78 // The rectangular region of the screen that is damaged in the frame. | |
| 79 // This information allows the draw visitor to perform partial updates. | |
| 80 Rect damaged_region_; | |
| 81 | |
| 82 // This is used to indicate whether the entire screen will be covered by an | |
| 83 // 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.
| |
| 84 bool has_fullscreen_actor_; | |
| 85 | |
| 86 DISALLOW_COPY_AND_ASSIGN(XRenderDrawVisitor); | |
| 87 }; | |
| 88 | |
| 89 } // namespace window_manager | |
| 90 | |
| 91 #endif // WINDOW_MANAGER_XRENDER_XRENDER_VISITOR_H_ | |
| OLD | NEW |