mutter/src/compositor/mutter-shaped-texture.h
Owen W. Taylor 83f8bfd2ca Reduce overpaint in the window group
When we are painting a stack of 5-10 maximized windows, the
standard bottom-to-top method of drawing every actor results
in a tremendous amount of overdraw and can easily max out
the available memory bandwidth on a low-end* graphics chipset.
It's even worse if window textures are being accessed over
the AGP bus.

When we have opaque windows, we can go ahead and compute visibility
ourselves (in classic X-server fashion) and use that information to
restrict drawing obscured actors.

* Add MutterWindowGroup - a ClutterGroup subclass with logic
  for figuring out obscured regions.

* Add mutter_window_get_obscured_region() to get the region
  obscured by that window.

* Add mutter_shaped_texture_set_clip_region() to hint
  a clip region to the painting code; this is set based on
  the computed visible region of MutterWindowGroup.

* Add tidy_texture_frame_set_needs_paint() to hint that the
  paint can be skipped entirely; this is used when we detect
  that the window shadow is entirely obscured.

http://bugzilla.gnome.org/show_bug.cgi?id=587344
2009-07-09 16:56:01 +01:00

102 lines
3.4 KiB
C

/*
* shaped texture
*
* An actor to draw a texture clipped to a list of rectangles
*
* Authored By Neil Roberts <neil@linux.intel.com>
*
* Copyright (C) 2008 Intel Corporation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef __MUTTER_SHAPED_TEXTURE_H__
#define __MUTTER_SHAPED_TEXTURE_H__
#include <clutter/clutter.h>
#ifdef HAVE_GLX_TEXTURE_PIXMAP
#include <clutter/glx/clutter-glx.h>
#endif /* HAVE_GLX_TEXTURE_PIXMAP */
#include <gdk/gdkregion.h>
G_BEGIN_DECLS
#define MUTTER_TYPE_SHAPED_TEXTURE \
(mutter_shaped_texture_get_type())
#define MUTTER_SHAPED_TEXTURE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
MUTTER_TYPE_SHAPED_TEXTURE, \
MutterShapedTexture))
#define MUTTER_SHAPED_TEXTURE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
MUTTER_TYPE_SHAPED_TEXTURE, \
MutterShapedTextureClass))
#define MUTTER_IS_SHAPED_TEXTURE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
MUTTER_TYPE_SHAPED_TEXTURE))
#define MUTTER_IS_SHAPED_TEXTURE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
MUTTER_TYPE_SHAPED_TEXTURE))
#define MUTTER_SHAPED_TEXTURE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
MUTTER_TYPE_SHAPED_TEXTURE, \
MutterShapedTextureClass))
typedef struct _MutterShapedTexture MutterShapedTexture;
typedef struct _MutterShapedTextureClass MutterShapedTextureClass;
typedef struct _MutterShapedTexturePrivate MutterShapedTexturePrivate;
struct _MutterShapedTextureClass
{
#ifdef HAVE_GLX_TEXTURE_PIXMAP
ClutterGLXTexturePixmapClass parent_class;
#else
ClutterX11TexturePixmapClass parent_class;
#endif
};
struct _MutterShapedTexture
{
#ifdef HAVE_GLX_TEXTURE_PIXMAP
ClutterGLXTexturePixmap parent;
#else
ClutterX11TexturePixmap parent;
#endif
MutterShapedTexturePrivate *priv;
};
GType mutter_shaped_texture_get_type (void) G_GNUC_CONST;
ClutterActor *mutter_shaped_texture_new (void);
void mutter_shaped_texture_clear_rectangles (MutterShapedTexture *stex);
void mutter_shaped_texture_add_rectangle (MutterShapedTexture *stex,
const XRectangle *rect);
void mutter_shaped_texture_add_rectangles (MutterShapedTexture *stex,
size_t num_rects,
const XRectangle *rects);
/* Assumes ownership of clip_region */
void mutter_shaped_texture_set_clip_region (MutterShapedTexture *stex,
GdkRegion *clip_region);
G_END_DECLS
#endif /* __MUTTER_SHAPED_TEXTURE_H__ */