2
* Copyright © 2006 Novell, Inc.
4
* Permission to use, copy, modify, distribute, and sell this software
5
* and its documentation for any purpose is hereby granted without
6
* fee, provided that the above copyright notice appear in all copies
7
* and that both that copyright notice and this permission notice
8
* appear in supporting documentation, and that the name of
9
* Novell, Inc. not be used in advertising or publicity pertaining to
10
* distribution of the software without specific, written prior permission.
11
* Novell, Inc. makes no representations about the suitability of this
12
* software for any purpose. It is provided "as is" without express or
15
* NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17
* NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23
* Author: David Reveman <davidr@novell.com>
29
#include <cairo/cairo-xlib.h>
30
#include <librsvg/rsvg.h>
31
#include <librsvg/rsvg-cairo.h>
33
#include <X11/Xatom.h>
34
#include <X11/extensions/shape.h>
36
#include <core/core.h>
37
#include <core/privatehandler.h>
38
#include <composite/composite.h>
39
#include <opengl/opengl.h>
40
#include <decoration.h>
45
#define SVG_OPTION_SET 0
46
#define SVG_OPTION_NUM 1
48
#define SVG_SCREEN(s) SvgScreen *ss = SvgScreen::get (s)
49
#define SVG_WINDOW(w) SvgWindow *sw = SvgWindow::get (w)
52
public ScreenInterface,
53
public PrivateHandler<SvgScreen, CompScreen>
56
SvgScreen (CompScreen *screen);
59
CompOption::Vector & getOptions ();
60
bool setOption (const char *name, CompOption::Value &value);
62
bool fileToImage (CompString &path, CompSize &size,
63
int &stride, void *&data);
64
void handleCompizEvent (const char *plugin, const char *event,
65
CompOption::Vector &options);
70
CompOption::Vector opt;
72
bool readSvgToImage (const char *file, CompSize &size, void *& data);
76
public WindowInterface,
77
public GLWindowInterface,
78
public PrivateHandler<SvgWindow, CompWindow>
81
SvgWindow (CompWindow *window);
84
bool glDraw (const GLMatrix &transform, GLFragment::Attrib &fragment,
85
const CompRegion ®ion, unsigned int mask);
86
void moveNotify (int dx, int dy, bool immediate);
87
void resizeNotify (int dx, int dy, int dwidth, int dheight);
89
void setSvg (CompString &data, decor_point_t p[2]);
97
RsvgDimensionData dimension;
101
GLTexture::List textures;
102
GLTexture::MatrixList matrices;
111
SvgTexture texture[2];
125
void updateSvgMatrix ();
126
void updateSvgContext ();
128
void renderSvg (SvgSource *source, SvgTexture &texture, CompSize size,
129
float x1, float y1, float x2, float y2);
130
bool initTexture (SvgSource *source, SvgTexture &texture, CompSize size);
131
void finiTexture (SvgTexture &texture);
134
class SvgPluginVTable :
135
public CompPlugin::VTableForScreenAndWindow<SvgScreen, SvgWindow>
142
PLUGIN_OPTION_HELPER (SvgScreen);