本文整理汇总了C++中cogl_handle_unref函数的典型用法代码示例。如果您正苦于以下问题:C++ cogl_handle_unref函数的具体用法?C++ cogl_handle_unref怎么用?C++ cogl_handle_unref使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cogl_handle_unref函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: clutter_shader_release
/**
* clutter_shader_release:
* @shader: a #ClutterShader
*
* Frees up any GL context resources held by the shader.
*
* Since: 0.6
*/
void
clutter_shader_release (ClutterShader *shader)
{
ClutterShaderPrivate *priv;
g_return_if_fail (CLUTTER_IS_SHADER (shader));
priv = shader->priv;
if (!priv->compiled)
return;
g_assert (priv->program != COGL_INVALID_HANDLE);
if (priv->vertex_is_glsl && priv->vertex_shader != COGL_INVALID_HANDLE)
cogl_handle_unref (priv->vertex_shader);
if (priv->fragment_is_glsl && priv->fragment_shader != COGL_INVALID_HANDLE)
cogl_handle_unref (priv->fragment_shader);
if (priv->program != COGL_INVALID_HANDLE)
cogl_handle_unref (priv->program);
priv->vertex_shader = COGL_INVALID_HANDLE;
priv->fragment_shader = COGL_INVALID_HANDLE;
priv->program = COGL_INVALID_HANDLE;
priv->compiled = FALSE;
g_object_notify (G_OBJECT (shader), "compiled");
}
开发者ID:gramozeka,项目名称:GSB-NEW,代码行数:38,代码来源:clutter-shader.c
示例2: test_cogl_backface_culling
void
test_cogl_backface_culling (TestUtilsGTestFixture *fixture,
void *data)
{
TestUtilsSharedState *shared_state = data;
TestState state;
CoglHandle tex;
state.fb = shared_state->fb;
state.width = cogl_framebuffer_get_width (shared_state->fb);
state.height = cogl_framebuffer_get_height (shared_state->fb);
state.offscreen = COGL_INVALID_HANDLE;
state.texture = make_texture ();
tex = cogl_texture_new_with_size (state.width, state.height,
COGL_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_ANY); /* internal fmt */
state.offscreen = cogl_offscreen_new_to_texture (tex);
state.offscreen_tex = tex;
paint (&state);
cogl_object_unref (state.offscreen);
cogl_handle_unref (state.offscreen_tex);
cogl_handle_unref (state.texture);
if (g_test_verbose ())
g_print ("OK\n");
}
开发者ID:collects,项目名称:cogl,代码行数:31,代码来源:test-backface-culling.c
示例3: _cogl_texture_pixmap_x11_free
static void
_cogl_texture_pixmap_x11_free (CoglTexturePixmapX11 *tex_pixmap)
{
set_damage_object_internal (tex_pixmap, 0, 0);
if (tex_pixmap->image)
XDestroyImage (tex_pixmap->image);
if (tex_pixmap->shm_info.shmid != -1)
{
XShmDetach (_cogl_xlib_get_display (), &tex_pixmap->shm_info);
shmdt (tex_pixmap->shm_info.shmaddr);
shmctl (tex_pixmap->shm_info.shmid, IPC_RMID, 0);
}
if (tex_pixmap->tex)
cogl_handle_unref (tex_pixmap->tex);
#ifdef COGL_HAS_GLX_SUPPORT
_cogl_texture_pixmap_x11_free_glx_pixmap (tex_pixmap);
if (tex_pixmap->glx_tex)
cogl_handle_unref (tex_pixmap->glx_tex);
#endif
/* Chain up */
_cogl_texture_free (COGL_TEXTURE (tex_pixmap));
}
开发者ID:nobled,项目名称:clutter,代码行数:28,代码来源:cogl-texture-pixmap-x11.c
示例4: clutter_shader_effect_clear
static inline void
clutter_shader_effect_clear (ClutterShaderEffect *self,
gboolean reset_uniforms)
{
ClutterShaderEffectPrivate *priv = self->priv;
if (priv->shader != COGL_INVALID_HANDLE && !priv->is_compiled)
cogl_handle_unref (priv->shader);
if (priv->program != COGL_INVALID_HANDLE)
{
cogl_handle_unref (priv->program);
priv->program = COGL_INVALID_HANDLE;
priv->shader = COGL_INVALID_HANDLE;
}
if (reset_uniforms && priv->uniforms != NULL)
{
g_hash_table_destroy (priv->uniforms);
priv->uniforms = NULL;
}
priv->actor = NULL;
priv->is_compiled = FALSE;
priv->source_set = FALSE;
}
开发者ID:nobled,项目名称:clutter,代码行数:27,代码来源:clutter-shader-effect.c
示例5: _cogl_blit_copy_tex_sub_image_begin
static gboolean
_cogl_blit_copy_tex_sub_image_begin (CoglBlitData *data)
{
CoglHandle fbo;
_COGL_GET_CONTEXT (ctx, FALSE);
/* This will only work if the target texture is a CoglTexture2D */
if (!cogl_is_texture_2d (data->dst_tex))
return FALSE;
fbo = _cogl_offscreen_new_to_texture_full
(data->src_tex, COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, 0 /* level */);
if (fbo == COGL_INVALID_HANDLE)
return FALSE;
if (!cogl_framebuffer_allocate (fbo, NULL))
{
cogl_handle_unref (fbo);
return FALSE;
}
cogl_push_framebuffer (fbo);
cogl_handle_unref (fbo);
return TRUE;
}
开发者ID:collects,项目名称:cogl,代码行数:28,代码来源:cogl-blit.c
示例6: _st_create_shadow_material_from_actor
CoglHandle
_st_create_shadow_material_from_actor (StShadow *shadow_spec,
ClutterActor *actor)
{
CoglHandle shadow_material = COGL_INVALID_HANDLE;
if (CLUTTER_IS_TEXTURE (actor))
{
CoglHandle texture;
texture = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (actor));
shadow_material = _st_create_shadow_material (shadow_spec, texture);
}
else
{
CoglHandle buffer, offscreen;
ClutterActorBox box;
CoglColor clear_color;
float width, height;
clutter_actor_get_allocation_box (actor, &box);
clutter_actor_box_get_size (&box, &width, &height);
if (width == 0 || height == 0)
return COGL_INVALID_HANDLE;
buffer = st_cogl_texture_new_with_size_wrapper (width, height,
COGL_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_ANY);
if (buffer == COGL_INVALID_HANDLE)
return COGL_INVALID_HANDLE;
offscreen = cogl_offscreen_new_to_texture (buffer);
if (offscreen == COGL_INVALID_HANDLE)
{
cogl_handle_unref (buffer);
return COGL_INVALID_HANDLE;
}
cogl_color_set_from_4ub (&clear_color, 0, 0, 0, 0);
cogl_push_framebuffer (offscreen);
cogl_clear (&clear_color, COGL_BUFFER_BIT_COLOR);
cogl_translate (-box.x1, -box.y1, 0);
cogl_ortho (0, width, height, 0, 0, 1.0);
clutter_actor_paint (actor);
cogl_pop_framebuffer ();
cogl_handle_unref (offscreen);
shadow_material = _st_create_shadow_material (shadow_spec, buffer);
cogl_handle_unref (buffer);
}
return shadow_material;
}
开发者ID:AlbertJP,项目名称:Cinnamon,代码行数:57,代码来源:st-private.c
示例7: st_background_effect_dispose
static void
st_background_effect_dispose (GObject *gobject)
{
StBackgroundEffect *self = ST_BACKGROUND_EFFECT (gobject);
if (self->pipeline0 != NULL)
{
cogl_object_unref (self->pipeline0);
self->pipeline0 = NULL;
}
if (self->pipeline1 != NULL)
{
cogl_object_unref (self->pipeline1);
self->pipeline1 = NULL;
}
if (self->pipeline2 != NULL)
{
cogl_object_unref (self->pipeline2);
self->pipeline2 = NULL;
}
if (self->pipeline3 != NULL)
{
cogl_object_unref (self->pipeline3);
self->pipeline3 = NULL;
}
if (self->pipeline4 != NULL)
{
cogl_object_unref (self->pipeline4);
self->pipeline4 = NULL;
}
if (self->bg_texture != NULL)
{
cogl_handle_unref (self->bg_texture);
self->bg_texture = NULL;
}
if (self->bg_sub_texture != NULL)
{
cogl_handle_unref (self->bg_sub_texture);
self->bg_sub_texture = NULL;
}
if (self->bg_bumpmap != NULL)
{
cogl_handle_unref (self->bg_bumpmap);
self->bg_bumpmap = NULL;
}
G_OBJECT_CLASS (st_background_effect_parent_class)->dispose (gobject);
}
开发者ID:2gud4u,项目名称:Cinnamon,代码行数:55,代码来源:st-background-effect.c
示例8: wayland_free_buffer
static void
wayland_free_buffer (ClutterStageWaylandWaylandBuffer *buffer)
{
cogl_handle_unref (buffer->tex);
wl_buffer_destroy (buffer->wayland_buffer);
cogl_handle_unref (buffer->offscreen);
if (buffer->type == BUFFER_TYPE_DRM)
wayland_free_drm_buffer(buffer);
else if (buffer->type == BUFFER_TYPE_SHM)
wayland_free_shm_buffer(buffer);
}
开发者ID:nobled,项目名称:clutter,代码行数:12,代码来源:clutter-stage-wayland.c
示例9: test_cogl_vertex_buffer_main
G_MODULE_EXPORT int
test_cogl_vertex_buffer_main (int argc, char *argv[])
{
TestState state;
ClutterActor *stage;
gfloat stage_w, stage_h;
gint dummy_width, dummy_height;
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Vertex Buffers");
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);
g_signal_connect (stage, "destroy", G_CALLBACK (stop_and_quit), &state);
clutter_actor_get_size (stage, &stage_w, &stage_h);
dummy_width = MESH_WIDTH * QUAD_WIDTH;
dummy_height = MESH_HEIGHT * QUAD_HEIGHT;
state.dummy = create_dummy_actor (dummy_width, dummy_height);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), state.dummy);
clutter_actor_set_position (state.dummy,
(stage_w / 2.0) - (dummy_width / 2.0),
(stage_h / 2.0) - (dummy_height / 2.0));
state.timeline = clutter_timeline_new (1000);
clutter_timeline_set_loop (state.timeline, TRUE);
state.frame_id = g_signal_connect (state.timeline,
"new-frame",
G_CALLBACK (frame_cb),
&state);
g_signal_connect (state.dummy, "paint", G_CALLBACK (on_paint), &state);
init_quad_mesh (&state);
clutter_actor_show_all (stage);
clutter_timeline_start (state.timeline);
clutter_main ();
cogl_handle_unref (state.buffer);
cogl_handle_unref (state.indices);
return 0;
}
开发者ID:GNOME,项目名称:mutter,代码行数:49,代码来源:test-cogl-vertex-buffer.c
示例10: _cogl_blit_framebuffer_begin
static gboolean
_cogl_blit_framebuffer_begin (CoglBlitData *data)
{
CoglHandle dst_fbo, src_fbo;
gboolean ret;
_COGL_GET_CONTEXT (ctx, FALSE);
/* We can only blit between FBOs if both textures are the same
format and the blit framebuffer extension is supported */
if ((cogl_texture_get_format (data->src_tex) & ~COGL_A_BIT) !=
(cogl_texture_get_format (data->dst_tex) & ~COGL_A_BIT) ||
!(ctx->private_feature_flags & COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT))
return FALSE;
dst_fbo = _cogl_offscreen_new_to_texture_full
(data->dst_tex, COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, 0 /* level */);
if (dst_fbo == COGL_INVALID_HANDLE)
ret = FALSE;
else
{
if (!cogl_framebuffer_allocate (dst_fbo, NULL))
ret = FALSE;
else
{
src_fbo = _cogl_offscreen_new_to_texture_full
(data->src_tex,
COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL,
0 /* level */);
if (src_fbo == COGL_INVALID_HANDLE)
ret = FALSE;
else
{
if (!cogl_framebuffer_allocate (src_fbo, NULL))
ret = FALSE;
else
_cogl_push_framebuffers (dst_fbo, src_fbo);
cogl_handle_unref (src_fbo);
}
}
cogl_handle_unref (dst_fbo);
}
return ret;
}
开发者ID:collects,项目名称:cogl,代码行数:49,代码来源:cogl-blit.c
示例11: mash_data_free_vbos
static void
mash_data_free_vbos (MashData *self){
MashDataPrivate *priv = self->priv;
if (priv->loaded_data.vertices_vbo){
cogl_handle_unref (priv->loaded_data.vertices_vbo);
priv->loaded_data.vertices_vbo = NULL;
}
if (priv->loaded_data.indices)
{
cogl_handle_unref (priv->loaded_data.indices);
priv->loaded_data.indices = NULL;
}
}
开发者ID:eliasbakken,项目名称:mash,代码行数:15,代码来源:mash-data.c
示例12: _st_create_shadow_material
CoglHandle
_st_create_shadow_material (StShadow *shadow_spec,
CoglHandle src_texture)
{
static CoglHandle shadow_material_template = COGL_INVALID_HANDLE;
CoglHandle material;
CoglHandle texture;
guchar *pixels_in, *pixels_out;
gint width_in, height_in, rowstride_in;
gint width_out, height_out, rowstride_out;
g_return_val_if_fail (shadow_spec != NULL, COGL_INVALID_HANDLE);
g_return_val_if_fail (src_texture != COGL_INVALID_HANDLE,
COGL_INVALID_HANDLE);
width_in = cogl_texture_get_width (src_texture);
height_in = cogl_texture_get_height (src_texture);
rowstride_in = (width_in + 3) & ~3;
pixels_in = g_malloc0 (rowstride_in * height_in);
cogl_texture_get_data (src_texture, COGL_PIXEL_FORMAT_A_8,
rowstride_in, pixels_in);
pixels_out = blur_pixels (pixels_in, width_in, height_in, rowstride_in,
shadow_spec->blur,
&width_out, &height_out, &rowstride_out);
g_free (pixels_in);
texture = cogl_texture_new_from_data (width_out,
height_out,
COGL_TEXTURE_NONE,
COGL_PIXEL_FORMAT_A_8,
COGL_PIXEL_FORMAT_A_8,
rowstride_out,
pixels_out);
g_free (pixels_out);
if (G_UNLIKELY (shadow_material_template == COGL_INVALID_HANDLE))
{
shadow_material_template = cogl_material_new ();
/* We set up the material to blend the shadow texture with the combine
* constant, but defer setting the latter until painting, so that we can
* take the actor's overall opacity into account. */
cogl_material_set_layer_combine (shadow_material_template, 0,
"RGBA = MODULATE (CONSTANT, TEXTURE[A])",
NULL);
}
material = cogl_material_copy (shadow_material_template);
cogl_material_set_layer (material, 0, texture);
cogl_handle_unref (texture);
return material;
}
开发者ID:PeterDaveHello,项目名称:deepin-gnome-shell,代码行数:60,代码来源:st-private.c
示例13: _cogl_texture_pixmap_x11_free
static void
_cogl_texture_pixmap_x11_free (CoglTexturePixmapX11 *tex_pixmap)
{
_COGL_GET_CONTEXT (ctxt, NO_RETVAL);
set_damage_object_internal (ctxt, tex_pixmap, 0, 0);
if (tex_pixmap->image)
XDestroyImage (tex_pixmap->image);
if (tex_pixmap->shm_info.shmid != -1)
{
XShmDetach (cogl_xlib_get_display (), &tex_pixmap->shm_info);
shmdt (tex_pixmap->shm_info.shmaddr);
shmctl (tex_pixmap->shm_info.shmid, IPC_RMID, 0);
}
if (tex_pixmap->tex)
cogl_handle_unref (tex_pixmap->tex);
if (tex_pixmap->winsys)
{
const CoglWinsysVtable *winsys =
_cogl_texture_pixmap_x11_get_winsys (tex_pixmap);
winsys->texture_pixmap_x11_free (tex_pixmap);
}
/* Chain up */
_cogl_texture_free (COGL_TEXTURE (tex_pixmap));
}
开发者ID:spatulasnout,项目名称:cogl,代码行数:30,代码来源:cogl-texture-pixmap-x11.c
示例14: aisleriot_slot_renderer_dispose
static void
aisleriot_slot_renderer_dispose (GObject *object)
{
AisleriotSlotRenderer *self = (AisleriotSlotRenderer *) object;
AisleriotSlotRendererPrivate *priv = self->priv;
aisleriot_slot_renderer_set_cache (self, NULL);
/* Get rid of any running animations */
aisleriot_slot_renderer_set_animations (self, 0, NULL, 0);
if (priv->timeline) {
g_object_unref (priv->timeline);
priv->timeline = NULL;
}
if (priv->material != COGL_INVALID_HANDLE) {
cogl_handle_unref (priv->material);
priv->material = COGL_INVALID_HANDLE;
}
aisleriot_slot_renderer_set_animation_layer (self, NULL);
G_OBJECT_CLASS (aisleriot_slot_renderer_parent_class)->dispose (object);
}
开发者ID:mfrasca,项目名称:aisleriot,代码行数:25,代码来源:slot-renderer.c
示例15: xfixes_cursor_reset_image
static void
xfixes_cursor_reset_image (ShellXFixesCursor *xfixes_cursor)
{
XFixesCursorImage *cursor_image;
CoglHandle sprite = COGL_INVALID_HANDLE;
if (!xfixes_cursor->have_xfixes)
return;
cursor_image = XFixesGetCursorImage (clutter_x11_get_default_display ());
sprite = cogl_texture_new_from_data (cursor_image->width,
cursor_image->height,
COGL_TEXTURE_NONE,
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
COGL_PIXEL_FORMAT_BGRA_8888_PRE,
#else
COGL_PIXEL_FORMAT_ARGB_8888_PRE,
#endif
COGL_PIXEL_FORMAT_ANY,
cursor_image->width * 4, /* stride */
(const guint8 *) cursor_image->pixels);
if (sprite != COGL_INVALID_HANDLE)
{
if (xfixes_cursor->cursor_sprite != NULL)
cogl_handle_unref (xfixes_cursor->cursor_sprite);
xfixes_cursor->cursor_sprite = sprite;
xfixes_cursor->cursor_hot_x = cursor_image->xhot;
xfixes_cursor->cursor_hot_y = cursor_image->yhot;
g_signal_emit (xfixes_cursor, signals[CURSOR_CHANGED], 0);
}
}
开发者ID:sjokkis,项目名称:gnome-shell,代码行数:32,代码来源:shell-xfixes-cursor.c
示例16: st_icon_update_shadow_material
static void
st_icon_update_shadow_material (StIcon *icon)
{
StIconPrivate *priv = icon->priv;
if (priv->shadow_material)
{
cogl_handle_unref (priv->shadow_material);
priv->shadow_material = COGL_INVALID_HANDLE;
}
if (priv->shadow_spec)
{
CoglHandle material;
gint width, height;
clutter_texture_get_base_size (CLUTTER_TEXTURE (priv->icon_texture),
&width, &height);
material = _st_create_shadow_material_from_actor (priv->shadow_spec,
priv->icon_texture);
priv->shadow_material = material;
priv->shadow_width = width;
priv->shadow_height = height;
}
}
开发者ID:fanpenggogo,项目名称:gnome-shel,代码行数:26,代码来源:st-icon.c
示例17: st_icon_style_changed
static void
st_icon_style_changed (StWidget *widget)
{
StIcon *self = ST_ICON (widget);
StThemeNode *theme_node = st_widget_get_theme_node (widget);
StIconPrivate *priv = self->priv;
if (priv->shadow_spec)
{
st_shadow_unref (priv->shadow_spec);
priv->shadow_spec = NULL;
}
if (priv->shadow_material)
{
cogl_handle_unref (priv->shadow_material);
priv->shadow_material = COGL_INVALID_HANDLE;
}
priv->shadow_spec = st_theme_node_get_shadow (theme_node, "icon-shadow");
if (priv->shadow_spec && priv->shadow_spec->inset)
{
g_warning ("The icon-shadow property does not support inset shadows");
st_shadow_unref (priv->shadow_spec);
priv->shadow_spec = NULL;
}
priv->theme_icon_size = (int)(0.5 + st_theme_node_get_length (theme_node, "icon-size"));
st_icon_update_icon_size (self);
st_icon_update (self);
}
开发者ID:fanpenggogo,项目名称:gnome-shel,代码行数:32,代码来源:st-icon.c
示例18: clutter_cairo_texture_create_surface
static cairo_surface_t *
clutter_cairo_texture_create_surface (ClutterCairoTexture *self,
guint width,
guint height)
{
cairo_surface_t *surface;
guint cairo_stride;
guint8 *cairo_data;
CoglHandle cogl_texture;
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
width,
height);
cairo_stride = cairo_image_surface_get_stride (surface);
cairo_data = cairo_image_surface_get_data (surface);
self->priv->surface_width = width;
self->priv->surface_height = height;
/* create a backing Cogl texture */
cogl_texture = cogl_texture_new_from_data (width, height,
COGL_TEXTURE_NONE,
CLUTTER_CAIRO_FORMAT_ARGB32,
COGL_PIXEL_FORMAT_ANY,
cairo_stride,
cairo_data);
clutter_texture_set_cogl_texture (CLUTTER_TEXTURE (self), cogl_texture);
cogl_handle_unref (cogl_texture);
return surface;
}
开发者ID:spatulasnout,项目名称:clutter,代码行数:32,代码来源:clutter-cairo-texture.c
示例19: mx_texture_frame_paint_texture
void
mx_texture_frame_paint_texture (CoglHandle texture,
guint8 opacity,
gfloat top,
gfloat right,
gfloat bottom,
gfloat left,
gfloat width,
gfloat height)
{
CoglHandle material;
/* setup the template material */
if (!template_material)
template_material = cogl_material_new ();
/* create the material and apply opacity */
material = cogl_material_copy (template_material);
mx_texture_frame_paint_texture_internal (material, texture,
opacity,
top, right,
bottom, left,
width, height);
cogl_handle_unref (material);
}
开发者ID:3v1n0,项目名称:mx,代码行数:27,代码来源:mx-texture-frame.c
示例20: pp_super_aa_paint
static void
pp_super_aa_paint (ClutterActor *actor)
{
CoglHandle texture;
gfloat width, height;
PPSuperAAPrivate *priv = PP_SUPER_AA (actor)->priv;
clutter_actor_get_size (actor, &width, &height);
texture = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (actor));
if (!texture ||
(cogl_texture_get_width (texture) != (guint)(width * priv->x_res)) ||
(cogl_texture_get_height (texture) != (guint)(height * priv->y_res)))
{
texture = cogl_texture_new_with_size ((guint)(width * priv->x_res),
(guint)(height * priv->y_res),
COGL_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_RGBA_8888_PRE);
clutter_texture_set_cogl_texture (CLUTTER_TEXTURE (actor), texture);
cogl_handle_unref (texture);
}
CLUTTER_ACTOR_CLASS (pp_super_aa_parent_class)->paint (actor);
}
开发者ID:GNOME,项目名称:pinpoint,代码行数:25,代码来源:pp-super-aa.c
注:本文中的cogl_handle_unref函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论