[gtk/wip/otte/nodeeditor2: 49/55] gsk: Export Cairo renderer



commit 4aa662015305c0971354a48a1ff61cfbee19a10a
Author: Benjamin Otte <otte redhat com>
Date:   Wed May 1 23:58:57 2019 +0200

    gsk: Export Cairo renderer

 docs/reference/gsk/gsk4-sections.txt |  4 ++-
 gsk/gsk.h                            |  2 ++
 gsk/gskcairorenderer.c               | 42 ++++++++++++++++++++++++++++++-
 gsk/gskcairorenderer.h               | 48 ++++++++++++++++++++++++++++++++++++
 gsk/gskcairorendererprivate.h        | 24 ------------------
 gsk/gskrenderer.c                    |  2 +-
 gsk/meson.build                      |  3 ++-
 7 files changed, 97 insertions(+), 28 deletions(-)
---
diff --git a/docs/reference/gsk/gsk4-sections.txt b/docs/reference/gsk/gsk4-sections.txt
index ea27a54f02..21f50cdc45 100644
--- a/docs/reference/gsk/gsk4-sections.txt
+++ b/docs/reference/gsk/gsk4-sections.txt
@@ -1,12 +1,14 @@
 <SECTION>
 <FILE>GskRenderer</FILE>
-gsk_renderer_new_for_surface
 gsk_renderer_get_surface
 gsk_renderer_realize
 gsk_renderer_unrealize
 gsk_renderer_is_realized
 gsk_renderer_render
 gsk_renderer_render_texture
+<SUBSECTION>
+gsk_renderer_new_for_surface
+gsk_cairo_renderer_new
 <SUBSECTION Standard>
 GSK_IS_RENDERER
 GSK_RENDERER
diff --git a/gsk/gsk.h b/gsk/gsk.h
index 88f312c210..523b24c81a 100644
--- a/gsk/gsk.h
+++ b/gsk/gsk.h
@@ -26,6 +26,8 @@
 #include <gsk/gskroundedrect.h>
 #include <gsk/gsktransform.h>
 
+#include <gsk/gskcairorenderer.h>
+
 #include <gsk/gsktypes.h>
 #include <gsk/gskenumtypes.h>
 
diff --git a/gsk/gskcairorenderer.c b/gsk/gskcairorenderer.c
index 3d37e838cb..074b54b97f 100644
--- a/gsk/gskcairorenderer.c
+++ b/gsk/gskcairorenderer.c
@@ -1,6 +1,26 @@
+/*
+ * Copyright © 2016  Endless 
+ *             2018  Benjamin Otte
+ *
+ * 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.1 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/>.
+ *
+ * Authors: Benjamin Otte <otte gnome org>
+ */
+
 #include "config.h"
 
-#include "gskcairorendererprivate.h"
+#include "gskcairorenderer.h"
 
 #include "gskdebugprivate.h"
 #include "gskrendererprivate.h"
@@ -159,3 +179,23 @@ gsk_cairo_renderer_init (GskCairoRenderer *self)
   self->profile_timers.cpu_time = gsk_profiler_add_timer (profiler, "cpu-time", "CPU time", FALSE, TRUE);
 #endif
 }
+
+/**
+ * gsk_cairo_renderer_new:
+ *
+ * Creates a new Cairo renderer.
+ *
+ * The Cairo renderer is the fallback renderer drawing in ways similar
+ * to how GTK 3 drew its content. Its primary use is as comparison tool.
+ *
+ * The Cairo renderer is incomplete. It cannot render 3D transformed
+ * content and will instead render an error marker. Its usage should be
+ * avoided.
+ *
+ * Returns: a new Cairo renderer.
+ **/
+GskRenderer *
+gsk_cairo_renderer_new (void)
+{
+  return g_object_new (GSK_TYPE_CAIRO_RENDERER, NULL);
+}
diff --git a/gsk/gskcairorenderer.h b/gsk/gskcairorenderer.h
new file mode 100644
index 0000000000..047bd69555
--- /dev/null
+++ b/gsk/gskcairorenderer.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright © 2016  Endless 
+ *             2018  Benjamin Otte
+ *
+ * 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.1 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/>.
+ *
+ * Authors: Benjamin Otte <otte gnome org>
+ */
+
+#ifndef __GSK_CAIRO_RENDERER_H__
+#define __GSK_CAIRO_RENDERER_H__
+
+#include <cairo.h>
+#include <gsk/gskrenderer.h>
+
+G_BEGIN_DECLS
+
+#define GSK_TYPE_CAIRO_RENDERER (gsk_cairo_renderer_get_type ())
+
+#define GSK_CAIRO_RENDERER(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSK_TYPE_CAIRO_RENDERER, 
GskCairoRenderer))
+#define GSK_IS_CAIRO_RENDERER(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSK_TYPE_CAIRO_RENDERER))
+#define GSK_CAIRO_RENDERER_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), GSK_TYPE_CAIRO_RENDERER, 
GskCairoRendererClass))
+#define GSK_IS_CAIRO_RENDERER_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), GSK_TYPE_CAIRO_RENDERER))
+#define GSK_CAIRO_RENDERER_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), GSK_TYPE_CAIRO_RENDERER, 
GskCairoRendererClass))
+
+typedef struct _GskCairoRenderer                GskCairoRenderer;
+typedef struct _GskCairoRendererClass           GskCairoRendererClass;
+
+GDK_AVAILABLE_IN_ALL
+GType                   gsk_cairo_renderer_get_type             (void) G_GNUC_CONST;
+
+GDK_AVAILABLE_IN_ALL
+GskRenderer *           gsk_cairo_renderer_new                  (void);
+
+G_END_DECLS
+
+#endif /* __GSK_CAIRO_RENDERER_H__ */
diff --git a/gsk/gskrenderer.c b/gsk/gskrenderer.c
index 0fdfbc63e7..8f202d96ea 100644
--- a/gsk/gskrenderer.c
+++ b/gsk/gskrenderer.c
@@ -36,7 +36,7 @@
 
 #include "gskrendererprivate.h"
 
-#include "gskcairorendererprivate.h"
+#include "gskcairorenderer.h"
 #include "gskdebugprivate.h"
 #include "gl/gskglrendererprivate.h"
 #include "gskprofilerprivate.h"
diff --git a/gsk/meson.build b/gsk/meson.build
index 73806fea27..d05d1d8292 100644
--- a/gsk/meson.build
+++ b/gsk/meson.build
@@ -22,6 +22,7 @@ gsk_private_gl_shaders = [
 
 gsk_public_sources = files([
   'gskdiff.c',
+  'gskcairorenderer.c',
   'gskrenderer.c',
   'gskrendernode.c',
   'gskrendernodeimpl.c',
@@ -31,7 +32,6 @@ gsk_public_sources = files([
 
 gsk_private_sources = files([
   'gskcairoblur.c',
-  'gskcairorenderer.c',
   'gskdebug.c',
   'gskprivate.c',
   'gskprofiler.c',
@@ -48,6 +48,7 @@ gsk_private_sources = files([
 ])
 
 gsk_public_headers = files([
+  'gskcairorenderer.h',
   'gskenums.h',
   'gskrenderer.h',
   'gskrendernode.h',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]