diff options
Diffstat (limited to 'util/fbcompose/XRenderPlugin.hh')
-rw-r--r-- | util/fbcompose/XRenderPlugin.hh | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/util/fbcompose/XRenderPlugin.hh b/util/fbcompose/XRenderPlugin.hh new file mode 100644 index 0000000..ffd1a3e --- /dev/null +++ b/util/fbcompose/XRenderPlugin.hh | |||
@@ -0,0 +1,124 @@ | |||
1 | /** XRenderPlugin.hh file for the fluxbox compositor. */ | ||
2 | |||
3 | // Copyright (c) 2011 Gediminas Liktaras (gliktaras at gmail dot com) | ||
4 | // | ||
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy | ||
6 | // of this software and associated documentation files (the "Software"), to deal | ||
7 | // in the Software without restriction, including without limitation the rights | ||
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
9 | // copies of the Software, and to permit persons to whom the Software is | ||
10 | // furnished to do so, subject to the following conditions: | ||
11 | // | ||
12 | // The above copyright notice and this permission notice shall be included in | ||
13 | // all copies or substantial portions of the Software. | ||
14 | // | ||
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
21 | // THE SOFTWARE. | ||
22 | |||
23 | |||
24 | #ifndef FBCOMPOSITOR_XRENDERPLUGIN_HH | ||
25 | #define FBCOMPOSITOR_XRENDERPLUGIN_HH | ||
26 | |||
27 | #include "BasePlugin.hh" | ||
28 | #include "Enumerations.hh" | ||
29 | #include "Exceptions.hh" | ||
30 | #include "XRenderResources.hh" | ||
31 | |||
32 | #include "FbTk/FbString.hh" | ||
33 | |||
34 | #include <X11/Xlib.h> | ||
35 | #include <X11/extensions/Xrender.h> | ||
36 | |||
37 | #include <vector> | ||
38 | |||
39 | |||
40 | namespace FbCompositor { | ||
41 | |||
42 | class BasePlugin; | ||
43 | class BaseScreen; | ||
44 | class InitException; | ||
45 | class XRenderScreen; | ||
46 | class XRenderWindow; | ||
47 | class RenderingException; | ||
48 | |||
49 | |||
50 | //--- SUPPORTING STRUCTURES AND CLASSES ------------------------------------ | ||
51 | |||
52 | /** | ||
53 | * A rendering job. | ||
54 | */ | ||
55 | struct XRenderRenderingJob { | ||
56 | int operation; ///< Compositing operation to use. | ||
57 | XRenderPicturePtr source_picture; ///< Picture to render. | ||
58 | XRenderPicturePtr mask_picture; ///< Mask picture to use. | ||
59 | int source_x; ///< X offset on the source picture. | ||
60 | int source_y; ///< Y offset on the source picture. | ||
61 | int mask_x; ///< X offset on the mask picture. | ||
62 | int mask_y; ///< Y offset on the mask picture. | ||
63 | int destination_x; ///< X offset on the destination picture. | ||
64 | int destination_y; ///< Y offset on the destination picture. | ||
65 | int width; ///< Width of the picture to render. | ||
66 | int height; ///< Height of the picture to render. | ||
67 | }; | ||
68 | |||
69 | |||
70 | //--- XRENDER PLUGIN BASE CLASS -------------------------------------------- | ||
71 | |||
72 | /** | ||
73 | * Plugin for XRender renderer. | ||
74 | */ | ||
75 | class XRenderPlugin : public BasePlugin { | ||
76 | public : | ||
77 | //--- CONSTRUCTORS AND DESTRUCTORS ------------------------------------- | ||
78 | |||
79 | /** Constructor. */ | ||
80 | XRenderPlugin(const BaseScreen &screen, const std::vector<FbTk::FbString> &args); | ||
81 | |||
82 | /** Destructor. */ | ||
83 | virtual ~XRenderPlugin(); | ||
84 | |||
85 | |||
86 | //--- ACCESSORS -------------------------------------------------------- | ||
87 | |||
88 | /** \returns the screen object, cast into the correct class. */ | ||
89 | const XRenderScreen &xrenderScreen() const; | ||
90 | |||
91 | |||
92 | //--- RENDERING ACTIONS ------------------------------------------------ | ||
93 | |||
94 | /** Rectangles that the plugin wishes to damage. */ | ||
95 | virtual const std::vector<XRectangle> &damagedAreas(); | ||
96 | |||
97 | |||
98 | /** Post background rendering actions and jobs. */ | ||
99 | virtual const std::vector<XRenderRenderingJob> &postBackgroundRenderingActions(); | ||
100 | |||
101 | |||
102 | /** Pre window rendering actions and jobs. */ | ||
103 | virtual const std::vector<XRenderRenderingJob> &preWindowRenderingActions(const XRenderWindow &window); | ||
104 | |||
105 | /** Window rendering job initialization. */ | ||
106 | virtual void windowRenderingJobInit(const XRenderWindow &window, XRenderRenderingJob &job); | ||
107 | |||
108 | /** Post window rendering actions and jobs. */ | ||
109 | virtual const std::vector<XRenderRenderingJob> &postWindowRenderingActions(const XRenderWindow &window); | ||
110 | |||
111 | |||
112 | /** Reconfigure rectangle rendering job initialization. */ | ||
113 | virtual void recRectRenderingJobInit(XRectangle &rect_return, GC gc); | ||
114 | |||
115 | |||
116 | /** Extra rendering actions and jobs. */ | ||
117 | virtual const std::vector<XRenderRenderingJob> &extraRenderingActions(); | ||
118 | |||
119 | /** Post extra rendering actions. */ | ||
120 | virtual void postExtraRenderingActions(); | ||
121 | }; | ||
122 | } | ||
123 | |||
124 | #endif // FBCOMPOSITOR_XRENDERPLUGIN_HH | ||