[gtk+/wip/ebassi/gsk-layer] gsk: Add GskLayer
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/ebassi/gsk-layer] gsk: Add GskLayer
- Date: Mon, 4 Jul 2016 22:30:02 +0000 (UTC)
commit 1d859a45ef3d13403b934fe76a05cce31b705c54
Author: Emmanuele Bassi <ebassi gnome org>
Date: Mon Jul 4 16:57:49 2016 +0100
gsk: Add GskLayer
After GskRenderer and GskRenderNode, this commit adds the higher level
scene graph API of GSK.
GskLayer is a 2D layer in 3D space, which can be manipulated like a
widget would, but without the history; unlike GskRenderNode, a scene
graph of GskLayer instances is meant to be kept around.
gsk/Makefile.am | 2 +
gsk/gsk.h | 6 +++-
gsk/gsklayer.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++
gsk/gsklayer.h | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 133 insertions(+), 2 deletions(-)
---
diff --git a/gsk/Makefile.am b/gsk/Makefile.am
index 7edabe3..a859685 100644
--- a/gsk/Makefile.am
+++ b/gsk/Makefile.am
@@ -29,6 +29,7 @@ lib_LTLIBRARIES =
gsk_public_source_h = \
gskenums.h \
+ gsklayer.h \
gskrenderer.h \
gskrendernode.h \
gskrendernodeiter.h \
@@ -53,6 +54,7 @@ gsk_source_c = \
gskcairorenderer.c \
gskdebug.c \
gskglrenderer.c \
+ gsklayer.c \
gskrenderer.c \
gskrendernode.c \
gskrendernodeiter.c \
diff --git a/gsk/gsk.h b/gsk/gsk.h
index 01c4569..cab9ac8 100644
--- a/gsk/gsk.h
+++ b/gsk/gsk.h
@@ -20,13 +20,15 @@
#define __GSK_H_INSIDE__
+#include <gsk/gsktypes.h>
#include <gsk/gskenums.h>
+#include <gsk/gskenumtypes.h>
+
#include <gsk/gskrenderer.h>
#include <gsk/gskrendernode.h>
#include <gsk/gskrendernodeiter.h>
-#include <gsk/gsktypes.h>
-#include <gsk/gskenumtypes.h>
+#include <gsk/gsklayer.h>
#undef __GSK_H_INSIDE__
diff --git a/gsk/gsklayer.c b/gsk/gsklayer.c
new file mode 100644
index 0000000..ffc9fb0
--- /dev/null
+++ b/gsk/gsklayer.c
@@ -0,0 +1,59 @@
+#include "config.h"
+
+#include "gsklayer.h"
+
+#include <gdk/gdk.h>
+
+#include "gskenumtypes.h"
+#include "gskdebugprivate.h"
+
+typedef struct {
+ GskLayer *parent;
+
+ GskLayer *first_child;
+ GskLayer *last_child;
+ GskLayer *prev_sibling;
+ GskLayer *next_sibling;
+
+ int n_children;
+
+ gint64 age;
+
+ graphene_rect_t bounds;
+ graphene_point_t anchor;
+
+ graphene_matrix_t transform;
+ graphene_matrix_t child_transform;
+
+ gboolean transform_set : 1;
+ gboolean child_transform_set : 1;
+ gboolean is_hidden : 1;
+ gboolean is_opaque : 1;
+} GskLayerPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (GskLayer, gsk_layer, G_TYPE_INITIALLY_UNOWNED)
+
+static void
+gsk_layer_class_init (GskLayerClass *klass)
+{
+}
+
+static void
+gsk_layer_init (GskLayer *self)
+{
+}
+
+/**
+ * gsk_layer_new:
+ *
+ * Creates a new #GskLayer.
+ *
+ * Returns: (transfer full): the newly created #GskLayer
+ *
+ * Since: 3.22
+ */
+GskLayer *
+gsk_layer_new (void)
+{
+ return g_object_new (GSK_TYPE_LAYER, NULL);
+}
diff --git a/gsk/gsklayer.h b/gsk/gsklayer.h
new file mode 100644
index 0000000..839a840
--- /dev/null
+++ b/gsk/gsklayer.h
@@ -0,0 +1,68 @@
+/* GSK - The GTK Scene Kit
+ *
+ * Copyright 2016 Endless
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that 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 library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GSK_LAYER_H__
+#define __GSK_LAYER_H__
+
+#if !defined (__GSK_H_INSIDE__) && !defined (GSK_COMPILATION)
+#error "Only <gsk/gsk.h> can be included directly."
+#endif
+
+#include <gsk/gsktypes.h>
+#include <gsk/gskrenderer.h>
+
+G_BEGIN_DECLS
+
+#define GSK_TYPE_LAYER gsk_layer_get_type()
+
+GDK_AVAILABLE_IN_3_22
+G_DECLARE_DERIVABLE_TYPE (GskLayer, gsk_layer, GSK, LAYER, GInitiallyUnowned)
+
+struct _GskLayerClass
+{
+ /*< private >*/
+ GInitiallyUnowned parent_instance;
+
+ /*< public >*/
+
+ /* vfuncs */
+ GskRenderNode *(* get_render_node) (GskLayer *layer,
+ GskRenderer *renderer);
+
+ void (* queue_resize) (GskLayer *layer,
+ GskLayer *origin);
+ void (* queue_redraw) (GskLayer *layer,
+ GskLayer *origin);
+
+ /* signals */
+ void (* child_added) (GskLayer *layer,
+ GskLayer *child);
+ void (* child_removed) (GskLayer *layer,
+ GskLayer *child);
+ void (* destroy) (GskLayer *layer);
+
+
+ /*< private >*/
+ gpointer _padding[16];
+};
+
+GskLayer * gsk_layer_new (void);
+
+G_END_DECLS
+
+#endif /* __GSK_LAYER_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]