[mutter] cogl/offscreen: Move struct to C file
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] cogl/offscreen: Move struct to C file
- Date: Sat, 30 Jan 2021 09:39:49 +0000 (UTC)
commit 58eb1e87bf61ffac794a771b63fb1340a3d28907
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Sun Oct 18 22:08:42 2020 +0200
cogl/offscreen: Move struct to C file
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
cogl/cogl/cogl-journal.c | 3 ++-
cogl/cogl/cogl-offscreen-private.h | 16 +++---------
cogl/cogl/cogl-offscreen.c | 19 ++++++++++++++
cogl/cogl/driver/gl/cogl-framebuffer-gl.c | 42 +++++++++++++++++--------------
4 files changed, 47 insertions(+), 33 deletions(-)
---
diff --git a/cogl/cogl/cogl-journal.c b/cogl/cogl/cogl-journal.c
index f9acfb18fa..41652ddd7d 100644
--- a/cogl/cogl/cogl-journal.c
+++ b/cogl/cogl/cogl-journal.c
@@ -1636,8 +1636,9 @@ _cogl_journal_log_quad (CoglJournal *journal,
if (COGL_IS_OFFSCREEN (framebuffer))
{
CoglOffscreen *offscreen = COGL_OFFSCREEN (framebuffer);
+ CoglTexture *texture = cogl_offscreen_get_texture (offscreen);
- _cogl_texture_2d_externally_modified (offscreen->texture);
+ _cogl_texture_2d_externally_modified (texture);
}
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SYNC_PRIMITIVE)))
diff --git a/cogl/cogl/cogl-offscreen-private.h b/cogl/cogl/cogl-offscreen-private.h
index ae2f55bd89..c88fc85350 100644
--- a/cogl/cogl/cogl-offscreen-private.h
+++ b/cogl/cogl/cogl-offscreen-private.h
@@ -44,19 +44,6 @@ typedef enum
COGL_OFFSCREEN_ALLOCATE_FLAG_STENCIL = 1 << 2,
} CoglOffscreenAllocateFlags;
-struct _CoglOffscreen
-{
- CoglFramebuffer parent;
-
- CoglTexture *texture;
- int texture_level;
-
- /* FIXME: _cogl_offscreen_new_with_texture_full should be made to use
- * fb->config to configure if we want a depth or stencil buffer so
- * we can get rid of these flags */
- CoglOffscreenFlags create_flags;
-};
-
/*
* _cogl_offscreen_new_with_texture_full:
* @texture: A #CoglTexture pointer
@@ -75,4 +62,7 @@ _cogl_offscreen_new_with_texture_full (CoglTexture *texture,
CoglOffscreenFlags create_flags,
int level);
+int
+cogl_offscreen_get_texture_level (CoglOffscreen *offscreen);
+
#endif /* COGL_OFFSCREEN_PRIVATE_H */
diff --git a/cogl/cogl/cogl-offscreen.c b/cogl/cogl/cogl-offscreen.c
index c48f30d91d..bc4ecf0dfe 100644
--- a/cogl/cogl/cogl-offscreen.c
+++ b/cogl/cogl/cogl-offscreen.c
@@ -32,6 +32,19 @@
#include "cogl-offscreen-private.h"
#include "cogl-texture-private.h"
+struct _CoglOffscreen
+{
+ CoglFramebuffer parent;
+
+ CoglTexture *texture;
+ int texture_level;
+
+ /* FIXME: _cogl_offscreen_new_with_texture_full should be made to use
+ * fb->config to configure if we want a depth or stencil buffer so
+ * we can get rid of these flags */
+ CoglOffscreenFlags create_flags;
+};
+
G_DEFINE_TYPE (CoglOffscreen, cogl_offscreen,
COGL_TYPE_FRAMEBUFFER)
@@ -77,6 +90,12 @@ cogl_offscreen_get_texture (CoglOffscreen *offscreen)
return offscreen->texture;
}
+int
+cogl_offscreen_get_texture_level (CoglOffscreen *offscreen)
+{
+ return offscreen->texture_level;
+}
+
static gboolean
cogl_offscreen_allocate (CoglFramebuffer *framebuffer,
GError **error)
diff --git a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c
index bfe2d40bb2..4ac0ae7c40 100644
--- a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c
+++ b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c
@@ -645,15 +645,19 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
CoglGlFramebufferPrivate *priv;
CoglGlFbo *gl_fbo;
const CoglFramebufferConfig *config;
+ CoglTexture *texture;
+ int texture_level;
int level_width;
int level_height;
- g_return_val_if_fail (offscreen->texture_level <
- _cogl_texture_get_n_levels (offscreen->texture),
+ texture = cogl_offscreen_get_texture (offscreen);
+ texture_level = cogl_offscreen_get_texture_level (offscreen);
+
+ g_return_val_if_fail (texture_level < _cogl_texture_get_n_levels (texture),
FALSE);
- _cogl_texture_get_level_size (offscreen->texture,
- offscreen->texture_level,
+ _cogl_texture_get_level_size (texture,
+ texture_level,
&level_width,
&level_height,
NULL);
@@ -668,7 +672,7 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
* the texture is actually used for rendering according to the filters set on
* the corresponding CoglPipeline.
*/
- _cogl_texture_gl_flush_legacy_texobj_filters (offscreen->texture,
+ _cogl_texture_gl_flush_legacy_texobj_filters (texture,
GL_NEAREST, GL_NEAREST);
config = cogl_framebuffer_get_config (framebuffer);
@@ -679,8 +683,8 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
if (((flags & COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL) &&
try_creating_fbo (ctx,
- offscreen->texture,
- offscreen->texture_level,
+ texture,
+ texture_level,
level_width,
level_height,
config,
@@ -689,8 +693,8 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
(ctx->have_last_offscreen_allocate_flags &&
try_creating_fbo (ctx,
- offscreen->texture,
- offscreen->texture_level,
+ texture,
+ texture_level,
level_width,
level_height,
config,
@@ -705,8 +709,8 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
_cogl_has_private_feature
(ctx, COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL)) &&
try_creating_fbo (ctx,
- offscreen->texture,
- offscreen->texture_level,
+ texture,
+ texture_level,
level_width,
level_height,
config,
@@ -714,8 +718,8 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
gl_fbo)) ||
try_creating_fbo (ctx,
- offscreen->texture,
- offscreen->texture_level,
+ texture,
+ texture_level,
level_width,
level_height,
config,
@@ -724,8 +728,8 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
gl_fbo) ||
try_creating_fbo (ctx,
- offscreen->texture,
- offscreen->texture_level,
+ texture,
+ texture_level,
level_width,
level_height,
config,
@@ -733,8 +737,8 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
gl_fbo) ||
try_creating_fbo (ctx,
- offscreen->texture,
- offscreen->texture_level,
+ texture,
+ texture_level,
level_width,
level_height,
config,
@@ -742,8 +746,8 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
gl_fbo) ||
try_creating_fbo (ctx,
- offscreen->texture,
- offscreen->texture_level,
+ texture,
+ texture_level,
level_width,
level_height,
config,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]