1
0
Fork 0

cogl: Move PrimitiveTexture functions to Texture

Since the move to GObject for CoglTexture, CoglPrimitiveTexture was
removed. So drop remaining of that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3885>
This commit is contained in:
Bilal Elmoussaoui 2024-07-15 21:24:20 +02:00
parent 2ae3012fd5
commit f5c376e860
12 changed files with 32 additions and 116 deletions

View file

@ -333,7 +333,7 @@ create_offscreen_framebuffer (ClutterStageView *view,
format = cogl_framebuffer_get_internal_format (priv->framebuffer);
cogl_context = cogl_framebuffer_get_context (priv->framebuffer);
texture = cogl_texture_2d_new_with_format (cogl_context, width, height, format);
cogl_primitive_texture_set_auto_mipmap (texture, FALSE);
cogl_texture_set_auto_mipmap (texture, FALSE);
if (!cogl_texture_allocate (texture, error))
{

View file

@ -1,49 +0,0 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2012 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
* Authors:
* Neil Roberts <neil@linux.intel.com>
*/
#include "config.h"
#include "cogl/cogl-primitive-texture.h"
#include "cogl/cogl-texture-private.h"
void
cogl_primitive_texture_set_auto_mipmap (CoglTexture *texture,
gboolean value)
{
g_return_if_fail (COGL_IS_TEXTURE (texture) &&
texture->is_primitive);
g_assert (COGL_TEXTURE_GET_CLASS (texture)->set_auto_mipmap != NULL);
COGL_TEXTURE_GET_CLASS (texture)->set_auto_mipmap (texture, value);
}

View file

@ -1,57 +0,0 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2012 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
*/
#pragma once
#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION)
#error "Only <cogl/cogl.h> can be included directly."
#endif
#include "cogl/cogl-texture.h"
G_BEGIN_DECLS
/**
* cogl_primitive_texture_set_auto_mipmap:
* @primitive_texture: A #CoglPrimitiveTexture
* @value: The new value for whether to auto mipmap
*
* Sets whether the texture will automatically update the smaller
* mipmap levels after any part of level 0 is updated. The update will
* only occur whenever the texture is used for drawing with a texture
* filter that requires the lower mipmap levels. An application should
* disable this if it wants to upload its own data for the other
* levels. By default auto mipmapping is enabled.
*/
COGL_EXPORT void
cogl_primitive_texture_set_auto_mipmap (CoglTexture *primitive_texture,
gboolean value);
G_END_DECLS

View file

@ -47,7 +47,6 @@
#include "cogl/cogl-context-private.h"
#include "cogl/cogl-spans.h"
#include "cogl/cogl-journal-private.h"
#include "cogl/cogl-primitive-texture.h"
#include "cogl/driver/gl/cogl-texture-gl-private.h"
#include <string.h>

View file

@ -54,7 +54,6 @@
#include "cogl/cogl-offscreen-private.h"
#include "cogl/cogl-framebuffer-private.h"
#include "cogl/cogl-sub-texture.h"
#include "cogl/cogl-primitive-texture.h"
#include <string.h>
#include <stdlib.h>
@ -1286,3 +1285,15 @@ cogl_texture_set_max_level_set (CoglTexture *texture,
{
texture->max_level_set = max_level_set;
}
void
cogl_texture_set_auto_mipmap (CoglTexture *texture,
gboolean value)
{
g_return_if_fail (COGL_IS_TEXTURE (texture) &&
texture->is_primitive);
g_assert (COGL_TEXTURE_GET_CLASS (texture)->set_auto_mipmap != NULL);
COGL_TEXTURE_GET_CLASS (texture)->set_auto_mipmap (texture, value);
}

View file

@ -455,4 +455,19 @@ cogl_texture_allocate (CoglTexture *texture,
COGL_EXPORT gboolean
cogl_texture_is_get_data_supported (CoglTexture *texture);
/**
* cogl_texture_set_auto_mipmap:
* @texture: A #CoglTexture
* @value: The new value for whether to auto mipmap
*
* Sets whether the texture will automatically update the smaller
* mipmap levels after any part of level 0 is updated. The update will
* only occur whenever the texture is used for drawing with a texture
* filter that requires the lower mipmap levels. An application should
* disable this if it wants to upload its own data for the other
* levels. By default auto mipmapping is enabled.
*/
COGL_EXPORT void
cogl_texture_set_auto_mipmap (CoglTexture *texture,
gboolean value);
G_END_DECLS

View file

@ -71,7 +71,6 @@
#include "cogl/cogl-sub-texture.h"
#include "cogl/cogl-atlas-texture.h"
#include "cogl/cogl-meta-texture.h"
#include "cogl/cogl-primitive-texture.h"
#include "cogl/cogl-enum-types.h"
#include "cogl/cogl-index-buffer.h"
#include "cogl/cogl-attribute-buffer.h"

View file

@ -47,7 +47,6 @@ cogl_headers = [
'cogl-pixel-buffer.h',
'cogl-poll.h',
'cogl-primitive.h',
'cogl-primitive-texture.h',
'cogl-renderer.h',
'cogl-scanout.h',
'cogl-snippet.h',
@ -247,7 +246,6 @@ cogl_sources = [
'cogl-poll-private.h',
'cogl-poll.c',
'cogl-primitive-private.h',
'cogl-primitive-texture.c',
'cogl-primitive.c',
'cogl-primitives-private.h',
'cogl-primitives.c',

View file

@ -341,7 +341,7 @@ draw_cursor_sprite_via_offscreen (MetaScreenCastStreamSrc *src,
bitmap_texture = cogl_texture_2d_new_with_size (cogl_context,
bitmap_width, bitmap_height);
cogl_primitive_texture_set_auto_mipmap (bitmap_texture, FALSE);
cogl_texture_set_auto_mipmap (bitmap_texture, FALSE);
if (!cogl_texture_allocate (bitmap_texture, error))
{
g_object_unref (bitmap_texture);

View file

@ -1253,7 +1253,7 @@ meta_renderer_native_create_offscreen (MetaRendererNative *renderer_native,
view_width, view_height,
format);
}
cogl_primitive_texture_set_auto_mipmap (tex, FALSE);
cogl_texture_set_auto_mipmap (tex, FALSE);
if (!cogl_texture_allocate (tex, error))
{

View file

@ -1594,7 +1594,7 @@ create_framebuffer_from_window_actor (MetaWindowActor *self,
if (!texture)
return NULL;
cogl_primitive_texture_set_auto_mipmap (texture, FALSE);
cogl_texture_set_auto_mipmap (texture, FALSE);
offscreen = cogl_offscreen_new_with_texture (texture);
framebuffer = COGL_FRAMEBUFFER (offscreen);

View file

@ -193,7 +193,7 @@ set_auto_mipmap_cb (CoglTexture *sub_texture,
const float *meta_coords,
void *user_data)
{
cogl_primitive_texture_set_auto_mipmap (sub_texture, FALSE);
cogl_texture_set_auto_mipmap (sub_texture, FALSE);
}
CoglTexture *