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_COMPOSITOR_XRENDER_XRENDER_VISITOR_H_ | |
| 6 #define WINDOW_MANAGER_COMPOSITOR_XRENDER_XRENDER_VISITOR_H_ | |
| 7 | |
| 8 #include <vector> | |
|
Daniel Erat
2011/04/05 01:35:06
delete this; you're not using it
marcheu
2011/04/05 02:07:42
Done.
| |
| 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 the XRender extension. | |
| 22 class XRenderDrawVisitor : virtual public RealCompositor::ActorVisitor { | |
| 23 public: | |
| 24 XRenderDrawVisitor(RealCompositor* compositor, | |
| 25 Compositor::StageActor* stage); | |
| 26 virtual ~XRenderDrawVisitor(); | |
| 27 | |
| 28 void set_has_fullscreen_actor(bool has_fullscreen_actor) { | |
| 29 has_fullscreen_actor_ = has_fullscreen_actor; | |
| 30 } | |
| 31 void set_damaged_region(Rect damaged_region) { | |
| 32 damaged_region_ = damaged_region; | |
| 33 } | |
| 34 | |
| 35 void BindImage(const ImageContainer* container, | |
| 36 RealCompositor::ImageActor* actor); | |
| 37 | |
| 38 virtual void VisitActor(RealCompositor::Actor* actor) {} | |
| 39 virtual void VisitStage(RealCompositor::StageActor* actor); | |
| 40 virtual void VisitContainer(RealCompositor::ContainerActor* actor); | |
| 41 virtual void VisitImage(RealCompositor::ImageActor* actor); | |
| 42 virtual void VisitTexturePixmap(RealCompositor::TexturePixmapActor* actor); | |
| 43 virtual void VisitQuad(RealCompositor::QuadActor* actor); | |
| 44 | |
| 45 private: | |
| 46 // So it can get access to the config data. | |
| 47 friend class XRenderPixmapData; | |
| 48 | |
| 49 virtual bool FreeXResources(); | |
| 50 virtual bool AllocateXResources(Compositor::StageActor* stage); | |
| 51 | |
| 52 XWindow root_window_; | |
| 53 XConnection::WindowGeometry root_geometry_; | |
| 54 | |
| 55 XPicture back_picture_; | |
|
Daniel Erat
2011/04/05 01:35:06
third time i've asked: please add a comment descri
marcheu
2011/04/05 02:07:42
Done.
| |
| 56 XPixmap back_pixmap_; | |
| 57 | |
| 58 XPicture stage_picture_; | |
| 59 | |
| 60 // The visitor should not change settings in the compositor while visiting | |
| 61 // actors throughout the drawing process because the compositor may decide | |
| 62 // to skip drawing frames as an optimization. | |
| 63 RealCompositor* compositor_; // Not owned. | |
| 64 XConnection* xconn_; // Not owned. | |
| 65 RealCompositor::StageActor* stage_; // Not owned. | |
| 66 | |
| 67 // This is the cumulative opacity of all the ancestors of the | |
| 68 // currently visited node. It is recalculated each time we enter or | |
| 69 // leave a container node. | |
| 70 float ancestor_opacity_; | |
| 71 | |
| 72 // The rectangular region of the screen that is damaged in the frame. | |
| 73 // This information allows the draw visitor to perform partial updates. | |
| 74 Rect damaged_region_; | |
| 75 | |
| 76 // This is used to indicate whether the entire screen will be covered by an | |
| 77 // actor so we can optimize by not clearing the back buffer. | |
| 78 bool has_fullscreen_actor_; | |
| 79 | |
| 80 DISALLOW_COPY_AND_ASSIGN(XRenderDrawVisitor); | |
| 81 }; | |
| 82 | |
| 83 } // namespace window_manager | |
| 84 | |
| 85 #endif // WINDOW_MANAGER_COMPOSITOR_XRENDER_XRENDER_VISITOR_H_ | |
| OLD | NEW |