gnome-shell/src/st/st-private.h
Neil Roberts d66e7dd49e st-theme-node-drawing: Don't create lots of one-shot materials
A few places in st-theme-node-drawing create one-shot material, paint
with it and then free it. This is suboptimal with current Cogl because
it will end up compiling an ARBfp program just for that single paint
and then it will throw it away when the material is destroyed.

There is a new function in st-private.c called
_st_create_texture_material. This creates a simple material for a
texture based on a common parent material that points to a dummy
texture. Any materials created with this function are likely to be
able to share the same program unless the material is further modified
to contain a different number of layers. It would be possible to use
cogl_set_source_texture for this instead except that it's not possible
to modify the material's color in that case so we couldn't render the
texture with opacity.

The corner textures are now stored as a handle to a material that
references the texture rather than storing the texure directly. There
is also a separate border_material member which always points to
border_texture as the only layer.

https://bugzilla.gnome.org/show_bug.cgi?id=633340
2010-10-28 20:02:41 +01:00

89 lines
3.4 KiB
C

/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* st-private.h: Private declarations
*
* Copyright 2007 OpenedHand
* Copyright 2009 Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU Lesser General Public License,
* version 2.1, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
* Boston, MA 02111-1307, USA.
*
*/
#ifndef __ST_PRIVATE_H__
#define __ST_PRIVATE_H__
#include <glib.h>
#include "st-widget.h"
#include "st-bin.h"
#include "st-shadow.h"
G_BEGIN_DECLS
#define I_(str) (g_intern_static_string ((str)))
#define ST_PARAM_READABLE \
(G_PARAM_READABLE | \
G_PARAM_STATIC_NICK | G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB)
#define ST_PARAM_READWRITE \
(G_PARAM_READABLE | G_PARAM_WRITABLE | \
G_PARAM_STATIC_NICK | G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB)
G_END_DECLS
ClutterActor *_st_widget_get_dnd_clone (StWidget *widget);
void _st_get_align_factors (StWidget *widget,
StAlign x_align,
StAlign y_align,
gdouble *x_align_out,
gdouble *y_align_out);
void _st_actor_get_preferred_width (ClutterActor *actor,
gfloat for_height,
gboolean y_fill,
gfloat *min_width_p,
gfloat *natural_width_p);
void _st_actor_get_preferred_height (ClutterActor *actor,
gfloat for_width,
gboolean x_fill,
gfloat *min_height_p,
gfloat *natural_height_p);
void _st_allocate_fill (StWidget *parent,
ClutterActor *child,
ClutterActorBox *childbox,
StAlign x_align,
StAlign y_align,
gboolean x_fill,
gboolean y_fill);
void _st_set_text_from_style (ClutterText *text,
StThemeNode *theme_node);
CoglHandle _st_create_texture_material (CoglHandle src_texture);
/* Helper for widgets which need to draw additional shadows */
CoglHandle _st_create_shadow_material (StShadow *shadow_spec,
CoglHandle src_texture);
CoglHandle _st_create_shadow_material_from_actor (StShadow *shadow_spec,
ClutterActor *actor);
void _st_paint_shadow_with_opacity (StShadow *shadow_spec,
CoglHandle shadow_material,
ClutterActorBox *box,
guint8 paint_opacity);
#endif /* __ST_PRIVATE_H__ */