mirror of
https://github.com/brl/mutter.git
synced 2025-02-18 14:14:10 +00:00
cogl: Port Journal away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
This commit is contained in:
parent
82ca43c3b6
commit
686081077a
@ -346,7 +346,7 @@ cogl_framebuffer_dispose (GObject *object)
|
|||||||
g_clear_pointer (&priv->clip_stack, _cogl_clip_stack_unref);
|
g_clear_pointer (&priv->clip_stack, _cogl_clip_stack_unref);
|
||||||
g_clear_object (&priv->modelview_stack);
|
g_clear_object (&priv->modelview_stack);
|
||||||
g_clear_object (&priv->projection_stack);
|
g_clear_object (&priv->projection_stack);
|
||||||
g_clear_pointer (&priv->journal, _cogl_journal_free);
|
g_clear_object (&priv->journal);
|
||||||
|
|
||||||
ctx->framebuffers = g_list_remove (ctx->framebuffers, framebuffer);
|
ctx->framebuffers = g_list_remove (ctx->framebuffers, framebuffer);
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cogl/cogl-texture.h"
|
#include "cogl/cogl-texture.h"
|
||||||
#include "cogl/cogl-object-private.h"
|
|
||||||
#include "cogl/cogl-clip-stack.h"
|
#include "cogl/cogl-clip-stack.h"
|
||||||
#include "cogl/cogl-fence-private.h"
|
#include "cogl/cogl-fence-private.h"
|
||||||
|
|
||||||
@ -39,6 +38,8 @@
|
|||||||
|
|
||||||
typedef struct _CoglJournal
|
typedef struct _CoglJournal
|
||||||
{
|
{
|
||||||
|
GObject parent_instance;
|
||||||
|
|
||||||
/* A pointer the framebuffer that is using this journal. This is
|
/* A pointer the framebuffer that is using this journal. This is
|
||||||
only valid when the journal is not empty. It *does* take a
|
only valid when the journal is not empty. It *does* take a
|
||||||
reference on the framebuffer. Although this creates a circular
|
reference on the framebuffer. Although this creates a circular
|
||||||
@ -67,6 +68,15 @@ typedef struct _CoglJournal
|
|||||||
|
|
||||||
} CoglJournal;
|
} CoglJournal;
|
||||||
|
|
||||||
|
#define COGL_TYPE_JOURNAL (cogl_journal_get_type ())
|
||||||
|
|
||||||
|
COGL_EXPORT
|
||||||
|
G_DECLARE_FINAL_TYPE (CoglJournal,
|
||||||
|
cogl_journal,
|
||||||
|
COGL,
|
||||||
|
JOURNAL,
|
||||||
|
GObject)
|
||||||
|
|
||||||
/* To improve batching of geometry when submitting vertices to OpenGL we
|
/* To improve batching of geometry when submitting vertices to OpenGL we
|
||||||
* log the texture rectangles we want to draw to a journal, so when we
|
* log the texture rectangles we want to draw to a journal, so when we
|
||||||
* later flush the journal we aim to batch data, and gl draw calls. */
|
* later flush the journal we aim to batch data, and gl draw calls. */
|
||||||
@ -85,9 +95,6 @@ typedef struct _CoglJournalEntry
|
|||||||
CoglJournal *
|
CoglJournal *
|
||||||
_cogl_journal_new (CoglFramebuffer *framebuffer);
|
_cogl_journal_new (CoglFramebuffer *framebuffer);
|
||||||
|
|
||||||
void
|
|
||||||
_cogl_journal_free (CoglJournal *journal);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_journal_log_quad (CoglJournal *journal,
|
_cogl_journal_log_quad (CoglJournal *journal,
|
||||||
const float *position,
|
const float *position,
|
||||||
@ -116,6 +123,3 @@ _cogl_journal_try_read_pixel (CoglJournal *journal,
|
|||||||
int y,
|
int y,
|
||||||
CoglBitmap *bitmap,
|
CoglBitmap *bitmap,
|
||||||
gboolean *found_intersection);
|
gboolean *found_intersection);
|
||||||
|
|
||||||
gboolean
|
|
||||||
_cogl_is_journal (void *object);
|
|
||||||
|
@ -122,9 +122,12 @@ typedef void (*CoglJournalBatchCallback) (CoglJournalEntry *start,
|
|||||||
typedef gboolean (*CoglJournalBatchTest) (CoglJournalEntry *entry0,
|
typedef gboolean (*CoglJournalBatchTest) (CoglJournalEntry *entry0,
|
||||||
CoglJournalEntry *entry1);
|
CoglJournalEntry *entry1);
|
||||||
|
|
||||||
void
|
G_DEFINE_TYPE (CoglJournal, cogl_journal, G_TYPE_OBJECT);
|
||||||
_cogl_journal_free (CoglJournal *journal)
|
|
||||||
|
static void
|
||||||
|
cogl_journal_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
|
CoglJournal *journal = COGL_JOURNAL (object);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (journal->entries)
|
if (journal->entries)
|
||||||
@ -136,13 +139,26 @@ _cogl_journal_free (CoglJournal *journal)
|
|||||||
if (journal->vbo_pool[i])
|
if (journal->vbo_pool[i])
|
||||||
cogl_object_unref (journal->vbo_pool[i]);
|
cogl_object_unref (journal->vbo_pool[i]);
|
||||||
|
|
||||||
g_free (journal);
|
G_OBJECT_CLASS (cogl_journal_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cogl_journal_init (CoglJournal *journal)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cogl_journal_class_init (CoglJournalClass *class)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||||
|
|
||||||
|
object_class->dispose = cogl_journal_dispose;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglJournal *
|
CoglJournal *
|
||||||
_cogl_journal_new (CoglFramebuffer *framebuffer)
|
_cogl_journal_new (CoglFramebuffer *framebuffer)
|
||||||
{
|
{
|
||||||
CoglJournal *journal = g_new0 (CoglJournal, 1);
|
CoglJournal *journal = g_object_new (COGL_TYPE_JOURNAL, NULL);
|
||||||
|
|
||||||
journal->framebuffer = framebuffer;
|
journal->framebuffer = framebuffer;
|
||||||
journal->entries = g_array_new (FALSE, FALSE, sizeof (CoglJournalEntry));
|
journal->entries = g_array_new (FALSE, FALSE, sizeof (CoglJournalEntry));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user