gsk: Export Cairo renderer

This commit is contained in:
Benjamin Otte 2019-05-01 23:58:57 +02:00
parent da5b99f807
commit 559ae8b326
7 changed files with 97 additions and 28 deletions

View File

@ -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

View File

@ -26,6 +26,8 @@
#include <gsk/gskroundedrect.h>
#include <gsk/gsktransform.h>
#include <gsk/gskcairorenderer.h>
#include <gsk/gsktypes.h>
#include <gsk/gskenumtypes.h>

View File

@ -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);
}

48
gsk/gskcairorenderer.h Normal file
View File

@ -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__ */

View File

@ -1,24 +0,0 @@
#ifndef __GSK_CAIRO_RENDERER_PRIVATE_H__
#define __GSK_CAIRO_RENDERER_PRIVATE_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;
GType gsk_cairo_renderer_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GSK_CAIRO_RENDERER_PRIVATE_H__ */

View File

@ -36,7 +36,7 @@
#include "gskrendererprivate.h"
#include "gskcairorendererprivate.h"
#include "gskcairorenderer.h"
#include "gskdebugprivate.h"
#include "gl/gskglrendererprivate.h"
#include "gskprofilerprivate.h"

View File

@ -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',