GskTexture => GdkTexture

We want this thing to replace GdkPixbuf, so it has to live in GDK.
This commit is contained in:
Benjamin Otte 2017-11-02 21:39:00 +01:00
parent 8ba9ae6012
commit ca3c23662c
45 changed files with 327 additions and 332 deletions

View File

@ -805,6 +805,21 @@ gdk_event_get_type
gdk_owner_change_get_type
</SECTION>
<SECTION>
<FILE>GdkTexture</FILE>
gdk_texture_new_for_data
gdk_texture_new_for_surface
gdk_texture_new_for_pixbuf
gdk_texture_get_width
gdk_texture_get_height
gdk_texture_download
<SUBSECTION Standard>
GdkTexture
gdk_texture_get_type
GDK_TYPE_TEXTURE
GDK_IS_TEXTURE
</SECTION>
<SECTION>
<TITLE>Cursors</TITLE>
<FILE>cursors</FILE>

View File

@ -43,8 +43,8 @@ gsk_render_node_get_bounds
<SUBSECTION Nodes>
gsk_color_node_new
gsk_color_node_peek_color
gsk_texture_node_new
gsk_texture_node_get_texture
gdk_texture_node_new
gdk_texture_node_get_texture
gsk_linear_gradient_node_new
gsk_linear_gradient_node_peek_start
gsk_linear_gradient_node_peek_end
@ -130,21 +130,6 @@ GSK_SERIALIZATION_ERROR
GSK_TYPE_SERIALIZATION_ERROR
</SECTION>
<SECTION>
<FILE>GskTexture</FILE>
gsk_texture_new_for_data
gsk_texture_new_for_surface
gsk_texture_new_for_pixbuf
gsk_texture_get_width
gsk_texture_get_height
gsk_texture_download
<SUBSECTION Standard>
GskTexture
gsk_texture_get_type
GSK_TYPE_TEXTURE
GSK_IS_TEXTURE
</SECTION>
<SECTION>
<FILE>GskRoundedRect</FILE>
GskCorner

View File

@ -57,6 +57,7 @@
#include <gdk/gdkrgba.h>
#include <gdk/gdkseat.h>
#include <gdk/gdkselection.h>
#include <gdk/gdktexture.h>
#include <gdk/gdkthreads.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkvulkancontext.h>

View File

@ -1,4 +1,4 @@
/* GSK - The GTK Scene Kit
/* GDK - The GTK Scene Kit
*
* Copyright 2016 Benjamin Otte
*
@ -17,34 +17,31 @@
*/
/**
* SECTION:GskTexture
* @Title: GskTexture
* @Short_description: Pixel data uploaded to a #GskRenderer
* SECTION:GdkTexture
* @Title: GdkTexture
* @Short_description: Pixel data uploaded to a #GdkRenderer
*
* #GskTexture is the basic element used to refer to pixel data.
* #GdkTexture is the basic element used to refer to pixel data.
* It is primarily mean for pixel data that will not change over
* multiple frames, and will be used for a long time.
*
* You cannot get your pixel data back once you've uploaded it.
*
* #GskTexture is an immutable object: That means you cannot change
* #GdkTexture is an immutable object: That means you cannot change
* anything about it other than increasing the reference count via
* g_object_ref().
*/
#include "config.h"
#include "gsktextureprivate.h"
#include "gdktextureprivate.h"
#include "gskdebugprivate.h"
#include "gskrenderer.h"
#include "gdk/gdkinternals.h"
#include "gdkinternals.h"
/**
* GskTexture:
* GdkTexture:
*
* The `GskTexture` structure contains only private data.
* The `GdkTexture` structure contains only private data.
*
* Since: 3.90
*/
@ -59,27 +56,27 @@ enum {
static GParamSpec *properties[N_PROPS];
G_DEFINE_ABSTRACT_TYPE (GskTexture, gsk_texture, G_TYPE_OBJECT)
G_DEFINE_ABSTRACT_TYPE (GdkTexture, gdk_texture, G_TYPE_OBJECT)
#define GSK_TEXTURE_WARN_NOT_IMPLEMENTED_METHOD(obj,method) \
g_critical ("Texture of type '%s' does not implement GskTexture::" # method, G_OBJECT_TYPE_NAME (obj))
#define GDK_TEXTURE_WARN_NOT_IMPLEMENTED_METHOD(obj,method) \
g_critical ("Texture of type '%s' does not implement GdkTexture::" # method, G_OBJECT_TYPE_NAME (obj))
static void
gsk_texture_real_download (GskTexture *self,
gdk_texture_real_download (GdkTexture *self,
guchar *data,
gsize stride)
{
GSK_TEXTURE_WARN_NOT_IMPLEMENTED_METHOD (self, download);
GDK_TEXTURE_WARN_NOT_IMPLEMENTED_METHOD (self, download);
}
static cairo_surface_t *
gsk_texture_real_download_surface (GskTexture *texture)
gdk_texture_real_download_surface (GdkTexture *texture)
{
cairo_surface_t *surface;
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
texture->width, texture->height);
gsk_texture_download (texture,
gdk_texture_download (texture,
cairo_image_surface_get_data (surface),
cairo_image_surface_get_stride (surface));
cairo_surface_mark_dirty (surface);
@ -88,12 +85,12 @@ gsk_texture_real_download_surface (GskTexture *texture)
}
static void
gsk_texture_set_property (GObject *gobject,
gdk_texture_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GskTexture *self = GSK_TEXTURE (gobject);
GdkTexture *self = GDK_TEXTURE (gobject);
switch (prop_id)
{
@ -112,12 +109,12 @@ gsk_texture_set_property (GObject *gobject,
}
static void
gsk_texture_get_property (GObject *gobject,
gdk_texture_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GskTexture *self = GSK_TEXTURE (gobject);
GdkTexture *self = GDK_TEXTURE (gobject);
switch (prop_id)
{
@ -136,29 +133,29 @@ gsk_texture_get_property (GObject *gobject,
}
static void
gsk_texture_dispose (GObject *object)
gdk_texture_dispose (GObject *object)
{
GskTexture *self = GSK_TEXTURE (object);
GdkTexture *self = GDK_TEXTURE (object);
gsk_texture_clear_render_data (self);
gdk_texture_clear_render_data (self);
G_OBJECT_CLASS (gsk_texture_parent_class)->dispose (object);
G_OBJECT_CLASS (gdk_texture_parent_class)->dispose (object);
}
static void
gsk_texture_class_init (GskTextureClass *klass)
gdk_texture_class_init (GdkTextureClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
klass->download = gsk_texture_real_download;
klass->download_surface = gsk_texture_real_download_surface;
klass->download = gdk_texture_real_download;
klass->download_surface = gdk_texture_real_download_surface;
gobject_class->set_property = gsk_texture_set_property;
gobject_class->get_property = gsk_texture_get_property;
gobject_class->dispose = gsk_texture_dispose;
gobject_class->set_property = gdk_texture_set_property;
gobject_class->get_property = gdk_texture_get_property;
gobject_class->dispose = gdk_texture_dispose;
/**
* GskRenderer:width:
* GdkRenderer:width:
*
* The width of the texture.
*
@ -177,7 +174,7 @@ gsk_texture_class_init (GskTextureClass *klass)
G_PARAM_EXPLICIT_NOTIFY);
/**
* GskRenderer:height:
* GdkRenderer:height:
*
* The height of the texture.
*
@ -199,51 +196,51 @@ gsk_texture_class_init (GskTextureClass *klass)
}
static void
gsk_texture_init (GskTexture *self)
gdk_texture_init (GdkTexture *self)
{
}
/* GskCairoTexture */
/* GdkCairoTexture */
#define GSK_TYPE_CAIRO_TEXTURE (gsk_cairo_texture_get_type ())
#define GDK_TYPE_CAIRO_TEXTURE (gdk_cairo_texture_get_type ())
G_DECLARE_FINAL_TYPE (GskCairoTexture, gsk_cairo_texture, GSK, CAIRO_TEXTURE, GskTexture)
G_DECLARE_FINAL_TYPE (GdkCairoTexture, gdk_cairo_texture, GDK, CAIRO_TEXTURE, GdkTexture)
struct _GskCairoTexture {
GskTexture parent_instance;
struct _GdkCairoTexture {
GdkTexture parent_instance;
cairo_surface_t *surface;
};
struct _GskCairoTextureClass {
GskTextureClass parent_class;
struct _GdkCairoTextureClass {
GdkTextureClass parent_class;
};
G_DEFINE_TYPE (GskCairoTexture, gsk_cairo_texture, GSK_TYPE_TEXTURE)
G_DEFINE_TYPE (GdkCairoTexture, gdk_cairo_texture, GDK_TYPE_TEXTURE)
static void
gsk_cairo_texture_finalize (GObject *object)
gdk_cairo_texture_finalize (GObject *object)
{
GskCairoTexture *self = GSK_CAIRO_TEXTURE (object);
GdkCairoTexture *self = GDK_CAIRO_TEXTURE (object);
cairo_surface_destroy (self->surface);
G_OBJECT_CLASS (gsk_cairo_texture_parent_class)->finalize (object);
G_OBJECT_CLASS (gdk_cairo_texture_parent_class)->finalize (object);
}
static cairo_surface_t *
gsk_cairo_texture_download_surface (GskTexture *texture)
gdk_cairo_texture_download_surface (GdkTexture *texture)
{
GskCairoTexture *self = GSK_CAIRO_TEXTURE (texture);
GdkCairoTexture *self = GDK_CAIRO_TEXTURE (texture);
return cairo_surface_reference (self->surface);
}
static void
gsk_cairo_texture_download (GskTexture *texture,
gdk_cairo_texture_download (GdkTexture *texture,
guchar *data,
gsize stride)
{
GskCairoTexture *self = GSK_CAIRO_TEXTURE (texture);
GdkCairoTexture *self = GDK_CAIRO_TEXTURE (texture);
cairo_surface_t *surface;
cairo_t *cr;
@ -263,24 +260,24 @@ gsk_cairo_texture_download (GskTexture *texture,
}
static void
gsk_cairo_texture_class_init (GskCairoTextureClass *klass)
gdk_cairo_texture_class_init (GdkCairoTextureClass *klass)
{
GskTextureClass *texture_class = GSK_TEXTURE_CLASS (klass);
GdkTextureClass *texture_class = GDK_TEXTURE_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
texture_class->download = gsk_cairo_texture_download;
texture_class->download_surface = gsk_cairo_texture_download_surface;
texture_class->download = gdk_cairo_texture_download;
texture_class->download_surface = gdk_cairo_texture_download_surface;
gobject_class->finalize = gsk_cairo_texture_finalize;
gobject_class->finalize = gdk_cairo_texture_finalize;
}
static void
gsk_cairo_texture_init (GskCairoTexture *self)
gdk_cairo_texture_init (GdkCairoTexture *self)
{
}
/**
* gsk_texture_new_for_data:
* gdk_texture_new_for_data:
* @data: (array): the pixel data
* @width: the number of pixels in each row
* @height: the number of rows
@ -289,15 +286,15 @@ gsk_cairo_texture_init (GskCairoTexture *self)
* Creates a new texture object holding the given data.
* The data is assumed to be in CAIRO_FORMAT_ARGB32 format.
*
* Returns: a new #GskTexture
* Returns: a new #GdkTexture
*/
GskTexture *
gsk_texture_new_for_data (const guchar *data,
GdkTexture *
gdk_texture_new_for_data (const guchar *data,
int width,
int height,
int stride)
{
GskTexture *texture;
GdkTexture *texture;
cairo_surface_t *original, *copy;
cairo_t *cr;
@ -309,7 +306,7 @@ gsk_texture_new_for_data (const guchar *data,
cairo_paint (cr);
cairo_destroy (cr);
texture = gsk_texture_new_for_surface (copy);
texture = gdk_texture_new_for_surface (copy);
cairo_surface_destroy (copy);
cairo_surface_finish (original);
@ -319,65 +316,65 @@ gsk_texture_new_for_data (const guchar *data,
}
/**
* gsk_texture_new_for_surface:
* gdk_texture_new_for_surface:
* @surface: a cairo image surface
*
* Creates a new texture object representing the surface.
* @surface must be an image surface with format CAIRO_FORMAT_ARGB32.
*
* Returns: a new #GskTexture
* Returns: a new #GdkTexture
*/
GskTexture *
gsk_texture_new_for_surface (cairo_surface_t *surface)
GdkTexture *
gdk_texture_new_for_surface (cairo_surface_t *surface)
{
GskCairoTexture *texture;
GdkCairoTexture *texture;
g_return_val_if_fail (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_IMAGE, NULL);
texture = g_object_new (GSK_TYPE_CAIRO_TEXTURE,
texture = g_object_new (GDK_TYPE_CAIRO_TEXTURE,
"width", cairo_image_surface_get_width (surface),
"height", cairo_image_surface_get_height (surface),
NULL);
texture->surface = cairo_surface_reference (surface);
return (GskTexture *) texture;
return (GdkTexture *) texture;
}
/* GskPixbufTexture */
/* GdkPixbufTexture */
#define GSK_TYPE_PIXBUF_TEXTURE (gsk_pixbuf_texture_get_type ())
#define GDK_TYPE_PIXBUF_TEXTURE (gdk_pixbuf_texture_get_type ())
G_DECLARE_FINAL_TYPE (GskPixbufTexture, gsk_pixbuf_texture, GSK, PIXBUF_TEXTURE, GskTexture)
G_DECLARE_FINAL_TYPE (GdkPixbufTexture, gdk_pixbuf_texture, GDK, PIXBUF_TEXTURE, GdkTexture)
struct _GskPixbufTexture {
GskTexture parent_instance;
struct _GdkPixbufTexture {
GdkTexture parent_instance;
GdkPixbuf *pixbuf;
};
struct _GskPixbufTextureClass {
GskTextureClass parent_class;
struct _GdkPixbufTextureClass {
GdkTextureClass parent_class;
};
G_DEFINE_TYPE (GskPixbufTexture, gsk_pixbuf_texture, GSK_TYPE_TEXTURE)
G_DEFINE_TYPE (GdkPixbufTexture, gdk_pixbuf_texture, GDK_TYPE_TEXTURE)
static void
gsk_pixbuf_texture_finalize (GObject *object)
gdk_pixbuf_texture_finalize (GObject *object)
{
GskPixbufTexture *self = GSK_PIXBUF_TEXTURE (object);
GdkPixbufTexture *self = GDK_PIXBUF_TEXTURE (object);
g_object_unref (self->pixbuf);
G_OBJECT_CLASS (gsk_pixbuf_texture_parent_class)->finalize (object);
G_OBJECT_CLASS (gdk_pixbuf_texture_parent_class)->finalize (object);
}
static void
gsk_pixbuf_texture_download (GskTexture *texture,
gdk_pixbuf_texture_download (GdkTexture *texture,
guchar *data,
gsize stride)
{
GskPixbufTexture *self = GSK_PIXBUF_TEXTURE (texture);
GdkPixbufTexture *self = GDK_PIXBUF_TEXTURE (texture);
cairo_surface_t *surface;
surface = cairo_image_surface_create_for_data (data,
@ -390,100 +387,100 @@ gsk_pixbuf_texture_download (GskTexture *texture,
}
static cairo_surface_t *
gsk_pixbuf_texture_download_surface (GskTexture *texture)
gdk_pixbuf_texture_download_surface (GdkTexture *texture)
{
GskPixbufTexture *self = GSK_PIXBUF_TEXTURE (texture);
GdkPixbufTexture *self = GDK_PIXBUF_TEXTURE (texture);
return gdk_cairo_surface_create_from_pixbuf (self->pixbuf, 1, NULL);
}
static void
gsk_pixbuf_texture_class_init (GskPixbufTextureClass *klass)
gdk_pixbuf_texture_class_init (GdkPixbufTextureClass *klass)
{
GskTextureClass *texture_class = GSK_TEXTURE_CLASS (klass);
GdkTextureClass *texture_class = GDK_TEXTURE_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
texture_class->download = gsk_pixbuf_texture_download;
texture_class->download_surface = gsk_pixbuf_texture_download_surface;
texture_class->download = gdk_pixbuf_texture_download;
texture_class->download_surface = gdk_pixbuf_texture_download_surface;
gobject_class->finalize = gsk_pixbuf_texture_finalize;
gobject_class->finalize = gdk_pixbuf_texture_finalize;
}
static void
gsk_pixbuf_texture_init (GskPixbufTexture *self)
gdk_pixbuf_texture_init (GdkPixbufTexture *self)
{
}
/**
* gsk_texture_new_for_pixbuf:
* gdk_texture_new_for_pixbuf:
* @pixbuf: a #GdkPixbuf
*
* Creates a new texture object representing the GdkPixbuf.
*
* Returns: a new #GskTexture
* Returns: a new #GdkTexture
*/
GskTexture *
gsk_texture_new_for_pixbuf (GdkPixbuf *pixbuf)
GdkTexture *
gdk_texture_new_for_pixbuf (GdkPixbuf *pixbuf)
{
GskPixbufTexture *self;
GdkPixbufTexture *self;
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
self = g_object_new (GSK_TYPE_PIXBUF_TEXTURE,
self = g_object_new (GDK_TYPE_PIXBUF_TEXTURE,
"width", gdk_pixbuf_get_width (pixbuf),
"height", gdk_pixbuf_get_height (pixbuf),
NULL);
self->pixbuf = g_object_ref (pixbuf);
return GSK_TEXTURE (self);
return GDK_TEXTURE (self);
}
/**
* gsk_texture_get_width:
* @texture: a #GskTexture
* gdk_texture_get_width:
* @texture: a #GdkTexture
*
* Returns the width of @texture.
*
* Returns: the width of the #GskTexture
* Returns: the width of the #GdkTexture
*
* Since: 3.90
*/
int
gsk_texture_get_width (GskTexture *texture)
gdk_texture_get_width (GdkTexture *texture)
{
g_return_val_if_fail (GSK_IS_TEXTURE (texture), 0);
g_return_val_if_fail (GDK_IS_TEXTURE (texture), 0);
return texture->width;
}
/**
* gsk_texture_get_height:
* @texture: a #GskTexture
* gdk_texture_get_height:
* @texture: a #GdkTexture
*
* Returns the height of the @texture.
*
* Returns: the height of the #GskTexture
* Returns: the height of the #GdkTexture
*
* Since: 3.90
*/
int
gsk_texture_get_height (GskTexture *texture)
gdk_texture_get_height (GdkTexture *texture)
{
g_return_val_if_fail (GSK_IS_TEXTURE (texture), 0);
g_return_val_if_fail (GDK_IS_TEXTURE (texture), 0);
return texture->height;
}
cairo_surface_t *
gsk_texture_download_surface (GskTexture *texture)
gdk_texture_download_surface (GdkTexture *texture)
{
return GSK_TEXTURE_GET_CLASS (texture)->download_surface (texture);
return GDK_TEXTURE_GET_CLASS (texture)->download_surface (texture);
}
/**
* gsk_texture_download:
* @texture: a #GskTexture
* gdk_texture_download:
* @texture: a #GdkTexture
* @data: pointer to enough memory to be filled with the
* downloaded data of @texture
* @stride: rowstride in bytes
@ -499,28 +496,28 @@ gsk_texture_download_surface (GskTexture *texture)
* Downloading a texture into a Cairo image surface:
* |[<!-- language="C" -->
* surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
* gsk_texture_get_width (texture),
* gsk_texture_get_height (texture));
* gsk_texture_download (texture,
* gdk_texture_get_width (texture),
* gdk_texture_get_height (texture));
* gdk_texture_download (texture,
* cairo_image_surface_get_data (surface),
* cairo_image_surface_get_stride (surface));
* cairo_surface_mark_dirty (surface);
* ]|
**/
void
gsk_texture_download (GskTexture *texture,
gdk_texture_download (GdkTexture *texture,
guchar *data,
gsize stride)
{
g_return_if_fail (GSK_IS_TEXTURE (texture));
g_return_if_fail (GDK_IS_TEXTURE (texture));
g_return_if_fail (data != NULL);
g_return_if_fail (stride >= gsk_texture_get_width (texture) * 4);
g_return_if_fail (stride >= gdk_texture_get_width (texture) * 4);
return GSK_TEXTURE_GET_CLASS (texture)->download (texture, data, stride);
return GDK_TEXTURE_GET_CLASS (texture)->download (texture, data, stride);
}
gboolean
gsk_texture_set_render_data (GskTexture *self,
gdk_texture_set_render_data (GdkTexture *self,
gpointer key,
gpointer data,
GDestroyNotify notify)
@ -538,7 +535,7 @@ gsk_texture_set_render_data (GskTexture *self,
}
void
gsk_texture_clear_render_data (GskTexture *self)
gdk_texture_clear_render_data (GdkTexture *self)
{
if (self->render_notify)
self->render_notify (self->render_data);
@ -549,7 +546,7 @@ gsk_texture_clear_render_data (GskTexture *self)
}
gpointer
gsk_texture_get_render_data (GskTexture *self,
gdk_texture_get_render_data (GdkTexture *self,
gpointer key)
{
if (self->render_key != key)

View File

@ -16,48 +16,50 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GSK_TEXTURE_H__
#define __GSK_TEXTURE_H__
#ifndef __GDK_TEXTURE_H__
#define __GDK_TEXTURE_H__
#if !defined (__GSK_H_INSIDE__) && !defined (GSK_COMPILATION)
#error "Only <gsk/gsk.h> can be included directly."
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gsk/gsktypes.h>
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
G_BEGIN_DECLS
#define GSK_TYPE_TEXTURE (gsk_texture_get_type ())
#define GDK_TYPE_TEXTURE (gdk_texture_get_type ())
#define GSK_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSK_TYPE_TEXTURE, GskTexture))
#define GSK_IS_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSK_TYPE_TEXTURE))
#define GDK_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_TEXTURE, GdkTexture))
#define GDK_IS_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_TEXTURE))
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GskTexture, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkTexture, g_object_unref)
typedef struct _GskTextureClass GskTextureClass;
typedef struct _GdkTextureClass GdkTextureClass;
GDK_AVAILABLE_IN_3_90
GType gsk_texture_get_type (void) G_GNUC_CONST;
GType gdk_texture_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_3_90
GskTexture * gsk_texture_new_for_data (const guchar *data,
GdkTexture * gdk_texture_new_for_data (const guchar *data,
int width,
int height,
int stride);
GDK_AVAILABLE_IN_3_90
GskTexture * gsk_texture_new_for_pixbuf (GdkPixbuf *pixbuf);
GdkTexture * gdk_texture_new_for_pixbuf (GdkPixbuf *pixbuf);
GDK_AVAILABLE_IN_3_90
int gsk_texture_get_width (GskTexture *texture);
int gdk_texture_get_width (GdkTexture *texture);
GDK_AVAILABLE_IN_3_90
int gsk_texture_get_height (GskTexture *texture);
int gdk_texture_get_height (GdkTexture *texture);
GDK_AVAILABLE_IN_3_90
void gsk_texture_download (GskTexture *texture,
void gdk_texture_download (GdkTexture *texture,
guchar *data,
gsize stride);
G_END_DECLS
#endif /* __GSK_TEXTURE_H__ */
#endif /* __GDK_TEXTURE_H__ */

View File

@ -1,15 +1,15 @@
#ifndef __GSK_TEXTURE_PRIVATE_H__
#define __GSK_TEXTURE_PRIVATE_H__
#ifndef __GDK_TEXTURE_PRIVATE_H__
#define __GDK_TEXTURE_PRIVATE_H__
#include "gsktexture.h"
#include "gdktexture.h"
G_BEGIN_DECLS
#define GSK_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSK_TYPE_TEXTURE, GskTextureClass))
#define GSK_IS_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSK_TYPE_TEXTURE))
#define GSK_TEXTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSK_TYPE_TEXTURE, GskTextureClass))
#define GDK_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_TEXTURE, GdkTextureClass))
#define GDK_IS_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_TEXTURE))
#define GDK_TEXTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_TEXTURE, GdkTextureClass))
struct _GskTexture
struct _GdkTexture
{
GObject parent_instance;
@ -21,29 +21,29 @@ struct _GskTexture
GDestroyNotify render_notify;
};
struct _GskTextureClass {
struct _GdkTextureClass {
GObjectClass parent_class;
void (* download) (GskTexture *texture,
void (* download) (GdkTexture *texture,
guchar *data,
gsize stride);
cairo_surface_t * (* download_surface) (GskTexture *texture);
cairo_surface_t * (* download_surface) (GdkTexture *texture);
};
gpointer gsk_texture_new (const GskTextureClass *klass,
gpointer gdk_texture_new (const GdkTextureClass *klass,
int width,
int height);
GskTexture * gsk_texture_new_for_surface (cairo_surface_t *surface);
cairo_surface_t * gsk_texture_download_surface (GskTexture *texture);
GdkTexture * gdk_texture_new_for_surface (cairo_surface_t *surface);
cairo_surface_t * gdk_texture_download_surface (GdkTexture *texture);
gboolean gsk_texture_set_render_data (GskTexture *self,
gboolean gdk_texture_set_render_data (GdkTexture *self,
gpointer key,
gpointer data,
GDestroyNotify notify);
void gsk_texture_clear_render_data (GskTexture *self);
gpointer gsk_texture_get_render_data (GskTexture *self,
void gdk_texture_clear_render_data (GdkTexture *self);
gpointer gdk_texture_get_render_data (GdkTexture *self,
gpointer key);
G_END_DECLS
#endif /* __GSK_TEXTURE_PRIVATE_H__ */
#endif /* __GDK_TEXTURE_PRIVATE_H__ */

View File

@ -131,7 +131,7 @@ typedef struct _GdkAtom *GdkAtom;
/* Forward declarations of commonly used types */
typedef struct _GdkRGBA GdkRGBA;
typedef struct _GdkCursor GdkCursor;
typedef struct _GdkVisual GdkVisual;
typedef struct _GdkTexture GdkTexture;
typedef struct _GdkDevice GdkDevice;
typedef struct _GdkDragContext GdkDragContext;

View File

@ -32,6 +32,7 @@ gdk_public_sources = files([
'gdkseat.c',
'gdkseatdefault.c',
'gdkselection.c',
'gdktexture.c',
'gdkvulkancontext.c',
'gdkwindow.c',
'gdkwindowimpl.c',
@ -69,6 +70,7 @@ gdk_public_headers = files([
'gdkseat.h',
'gdkselection.h',
'gdkthreads.h',
'gdktexture.h',
'gdktypes.h',
'gdkvulkancontext.h',
'gdkwindow.h',

View File

@ -24,7 +24,6 @@
#include <gsk/gskrenderer.h>
#include <gsk/gskrendernode.h>
#include <gsk/gskroundedrect.h>
#include <gsk/gsktexture.h>
#include <gsk/gsktypes.h>
#include <gsk/gskenumtypes.h>

View File

@ -5,7 +5,7 @@
#include "gskdebugprivate.h"
#include "gskrendererprivate.h"
#include "gskrendernodeprivate.h"
#include "gsktextureprivate.h"
#include "gdk/gdktextureprivate.h"
#ifdef G_ENABLE_DEBUG
typedef struct {
@ -70,12 +70,12 @@ gsk_cairo_renderer_do_render (GskRenderer *renderer,
#endif
}
static GskTexture *
static GdkTexture *
gsk_cairo_renderer_render_texture (GskRenderer *renderer,
GskRenderNode *root,
const graphene_rect_t *viewport)
{
GskTexture *texture;
GdkTexture *texture;
cairo_surface_t *surface;
cairo_t *cr;
@ -88,7 +88,7 @@ gsk_cairo_renderer_render_texture (GskRenderer *renderer,
cairo_destroy (cr);
texture = gsk_texture_new_for_surface (surface);
texture = gdk_texture_new_for_surface (surface);
cairo_surface_destroy (surface);
return texture;

View File

@ -31,7 +31,7 @@
* @GSK_LINEAR_GRADIENT_NODE: A node drawing a linear gradient
* @GSK_REPEATING_LINEAR_GRADIENT_NODE: A node drawing a repeating linear gradient
* @GSK_BORDER_NODE: A node stroking a border around an area
* @GSK_TEXTURE_NODE: A node drawing a #GskTexture
* @GDK_TEXTURE_NODE: A node drawing a #GdkTexture
* @GSK_INSET_SHADOW_NODE: A node drawing an inset shadow
* @GSK_OUTSET_SHADOW_NODE: A node drawing an outset shadow
* @GSK_TRANSFORM_NODE: A node that renders its child after applying a matrix transform
@ -58,7 +58,7 @@ typedef enum {
GSK_LINEAR_GRADIENT_NODE,
GSK_REPEATING_LINEAR_GRADIENT_NODE,
GSK_BORDER_NODE,
GSK_TEXTURE_NODE,
GDK_TEXTURE_NODE,
GSK_INSET_SHADOW_NODE,
GSK_OUTSET_SHADOW_NODE,
GSK_TRANSFORM_NODE,

View File

@ -3,7 +3,7 @@
#include "gskgldriverprivate.h"
#include "gskdebugprivate.h"
#include "gsktextureprivate.h"
#include "gdk/gdktextureprivate.h"
#include <gdk/gdk.h>
#include <epoxy/gl.h>
@ -15,7 +15,7 @@ typedef struct {
GLuint min_filter;
GLuint mag_filter;
GArray *fbos;
GskTexture *user;
GdkTexture *user;
gboolean in_use : 1;
} Texture;
@ -78,7 +78,7 @@ texture_free (gpointer data)
Texture *t = data;
if (t->user)
gsk_texture_clear_render_data (t->user);
gdk_texture_clear_render_data (t->user);
g_clear_pointer (&t->fbos, g_array_unref);
glDeleteTextures (1, &t->texture_id);
@ -439,7 +439,7 @@ gsk_gl_driver_release_texture (gpointer data)
int
gsk_gl_driver_get_texture_for_texture (GskGLDriver *driver,
GskTexture *texture,
GdkTexture *texture,
int min_filter,
int mag_filter)
{
@ -447,9 +447,9 @@ gsk_gl_driver_get_texture_for_texture (GskGLDriver *driver,
cairo_surface_t *surface;
g_return_val_if_fail (GSK_IS_GL_DRIVER (driver), -1);
g_return_val_if_fail (GSK_IS_TEXTURE (texture), -1);
g_return_val_if_fail (GDK_IS_TEXTURE (texture), -1);
t = gsk_texture_get_render_data (texture, driver);
t = gdk_texture_get_render_data (texture, driver);
if (t)
{
@ -457,12 +457,12 @@ gsk_gl_driver_get_texture_for_texture (GskGLDriver *driver,
return t->texture_id;
}
t = create_texture (driver, gsk_texture_get_width (texture), gsk_texture_get_height (texture));
t = create_texture (driver, gdk_texture_get_width (texture), gdk_texture_get_height (texture));
if (gsk_texture_set_render_data (texture, driver, t, gsk_gl_driver_release_texture))
if (gdk_texture_set_render_data (texture, driver, t, gsk_gl_driver_release_texture))
t->user = texture;
surface = gsk_texture_download_surface (texture);
surface = gdk_texture_download_surface (texture);
gsk_gl_driver_bind_source_texture (driver, t->texture_id);
gsk_gl_driver_init_texture_with_surface (driver,
t->texture_id,

View File

@ -5,8 +5,6 @@
#include <gdk/gdk.h>
#include <graphene.h>
#include <gsk/gsktexture.h>
G_BEGIN_DECLS
#define GSK_TYPE_GL_DRIVER (gsk_gl_driver_get_type ())
@ -26,7 +24,7 @@ void gsk_gl_driver_begin_frame (GskGLDriver *driver
void gsk_gl_driver_end_frame (GskGLDriver *driver);
int gsk_gl_driver_get_texture_for_texture (GskGLDriver *driver,
GskTexture *texture,
GdkTexture *texture,
int min_filter,
int mag_filter);
int gsk_gl_driver_create_texture (GskGLDriver *driver,

View File

@ -10,7 +10,7 @@
#include "gskrendererprivate.h"
#include "gskrendernodeprivate.h"
#include "gskshaderbuilderprivate.h"
#include "gsktextureprivate.h"
#include "gdk/gdktextureprivate.h"
#include "gskprivate.h"
@ -798,9 +798,9 @@ gsk_gl_renderer_add_render_item (GskGLRenderer *self,
switch (gsk_render_node_get_node_type (node))
{
case GSK_TEXTURE_NODE:
case GDK_TEXTURE_NODE:
{
GskTexture *texture = gsk_texture_node_get_texture (node);
GdkTexture *texture = gdk_texture_node_get_texture (node);
int gl_min_filter = GL_NEAREST, gl_mag_filter = GL_NEAREST;
get_gl_scaling_filters (node, &gl_min_filter, &gl_mag_filter);
@ -1167,13 +1167,13 @@ gsk_gl_renderer_do_render (GskRenderer *renderer,
#endif
}
static GskTexture *
static GdkTexture *
gsk_gl_renderer_render_texture (GskRenderer *renderer,
GskRenderNode *root,
const graphene_rect_t *viewport)
{
GskGLRenderer *self = GSK_GL_RENDERER (renderer);
GskTexture *texture;
GdkTexture *texture;
cairo_surface_t *surface;
cairo_t *cr;
@ -1203,7 +1203,7 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
viewport->size.height);
cairo_destroy (cr);
texture = gsk_texture_new_for_surface (surface);
texture = gdk_texture_new_for_surface (surface);
cairo_surface_destroy (surface);
return texture;

View File

@ -42,7 +42,6 @@
#include "gskglrendererprivate.h"
#include "gskprofilerprivate.h"
#include "gskrendernodeprivate.h"
#include "gsktexture.h"
#include "gskenumtypes.h"
@ -110,7 +109,7 @@ gsk_renderer_real_unrealize (GskRenderer *self)
GSK_RENDERER_WARN_NOT_IMPLEMENTED_METHOD (self, unrealize);
}
static GskTexture *
static GdkTexture *
gsk_renderer_real_render_texture (GskRenderer *self,
GskRenderNode *root,
const graphene_rect_t *viewport)
@ -555,7 +554,7 @@ gsk_renderer_unrealize (GskRenderer *renderer)
* @viewport: (allow-none): the section to draw or %NULL to use @root's bounds
*
* Renders the scene graph, described by a tree of #GskRenderNode instances,
* to a #GskTexture.
* to a #GdkTexture.
*
* The @renderer will acquire a reference on the #GskRenderNode tree while
* the rendering is in progress, and will make the tree immutable.
@ -563,18 +562,18 @@ gsk_renderer_unrealize (GskRenderer *renderer)
* If you want to apply any transformations to @root, you should put it into a
* transform node and pass that node instead.
*
* Returns: (transfer full): a #GskTexture with the rendered contents of @root.
* Returns: (transfer full): a #GdkTexture with the rendered contents of @root.
*
* Since: 3.90
*/
GskTexture *
GdkTexture *
gsk_renderer_render_texture (GskRenderer *renderer,
GskRenderNode *root,
const graphene_rect_t *viewport)
{
GskRendererPrivate *priv = gsk_renderer_get_instance_private (renderer);
graphene_rect_t real_viewport;
GskTexture *texture;
GdkTexture *texture;
g_return_val_if_fail (GSK_IS_RENDERER (renderer), NULL);
g_return_val_if_fail (priv->is_realized, NULL);

View File

@ -61,7 +61,7 @@ GDK_AVAILABLE_IN_3_90
void gsk_renderer_unrealize (GskRenderer *renderer);
GDK_AVAILABLE_IN_3_90
GskTexture * gsk_renderer_render_texture (GskRenderer *renderer,
GdkTexture * gsk_renderer_render_texture (GskRenderer *renderer,
GskRenderNode *root,
const graphene_rect_t *viewport);

View File

@ -42,7 +42,7 @@ struct _GskRendererClass
GError **error);
void (* unrealize) (GskRenderer *renderer);
GskTexture * (* render_texture) (GskRenderer *renderer,
GdkTexture * (* render_texture) (GskRenderer *renderer,
GskRenderNode *root,
const graphene_rect_t *viewport);
GdkDrawingContext * (* begin_draw_frame) (GskRenderer *renderer,

View File

@ -42,7 +42,6 @@
#include "gskdebugprivate.h"
#include "gskrendererprivate.h"
#include "gsktexture.h"
#include <graphene-gobject.h>

View File

@ -101,10 +101,10 @@ GDK_AVAILABLE_IN_3_94
const GdkRGBA * gsk_color_node_peek_color (GskRenderNode *node);
GDK_AVAILABLE_IN_3_90
GskRenderNode * gsk_texture_node_new (GskTexture *texture,
GskRenderNode * gdk_texture_node_new (GdkTexture *texture,
const graphene_rect_t *bounds);
GDK_AVAILABLE_IN_3_94
GskTexture * gsk_texture_node_get_texture (GskRenderNode *node);
GdkTexture * gdk_texture_node_get_texture (GskRenderNode *node);
GDK_AVAILABLE_IN_3_90
GskRenderNode * gsk_linear_gradient_node_new (const graphene_rect_t *bounds,

View File

@ -24,7 +24,7 @@
#include "gskdebugprivate.h"
#include "gskrendererprivate.h"
#include "gskroundedrectprivate.h"
#include "gsktextureprivate.h"
#include "gdk/gdktextureprivate.h"
static gboolean
check_variant_type (GVariant *variant,
@ -655,40 +655,40 @@ gsk_border_node_new (const GskRoundedRect *outline,
return &self->render_node;
}
/*** GSK_TEXTURE_NODE ***/
/*** GDK_TEXTURE_NODE ***/
typedef struct _GskTextureNode GskTextureNode;
typedef struct _GdkTextureNode GdkTextureNode;
struct _GskTextureNode
struct _GdkTextureNode
{
GskRenderNode render_node;
GskTexture *texture;
GdkTexture *texture;
};
static void
gsk_texture_node_finalize (GskRenderNode *node)
gdk_texture_node_finalize (GskRenderNode *node)
{
GskTextureNode *self = (GskTextureNode *) node;
GdkTextureNode *self = (GdkTextureNode *) node;
g_object_unref (self->texture);
}
static void
gsk_texture_node_draw (GskRenderNode *node,
gdk_texture_node_draw (GskRenderNode *node,
cairo_t *cr)
{
GskTextureNode *self = (GskTextureNode *) node;
GdkTextureNode *self = (GdkTextureNode *) node;
cairo_surface_t *surface;
surface = gsk_texture_download_surface (self->texture);
surface = gdk_texture_download_surface (self->texture);
cairo_save (cr);
cairo_translate (cr, node->bounds.origin.x, node->bounds.origin.y);
cairo_scale (cr,
node->bounds.size.width / gsk_texture_get_width (self->texture),
node->bounds.size.height / gsk_texture_get_height (self->texture));
node->bounds.size.width / gdk_texture_get_width (self->texture),
node->bounds.size.height / gdk_texture_get_height (self->texture));
cairo_set_source_surface (cr, surface, 0, 0);
cairo_paint (cr);
@ -698,28 +698,28 @@ gsk_texture_node_draw (GskRenderNode *node,
cairo_surface_destroy (surface);
}
#define GSK_TEXTURE_NODE_VARIANT_TYPE "(dddduuau)"
#define GDK_TEXTURE_NODE_VARIANT_TYPE "(dddduuau)"
static GVariant *
gsk_texture_node_serialize (GskRenderNode *node)
gdk_texture_node_serialize (GskRenderNode *node)
{
GskTextureNode *self = (GskTextureNode *) node;
GdkTextureNode *self = (GdkTextureNode *) node;
cairo_surface_t *surface;
GVariant *result;
surface = gsk_texture_download_surface (self->texture);
surface = gdk_texture_download_surface (self->texture);
g_assert (cairo_image_surface_get_width (surface) * 4 == cairo_image_surface_get_stride (surface));
result = g_variant_new ("(dddduu@au)",
(double) node->bounds.origin.x, (double) node->bounds.origin.y,
(double) node->bounds.size.width, (double) node->bounds.size.height,
(guint32) gsk_texture_get_width (self->texture),
(guint32) gsk_texture_get_height (self->texture),
(guint32) gdk_texture_get_width (self->texture),
(guint32) gdk_texture_get_height (self->texture),
g_variant_new_fixed_array (G_VARIANT_TYPE ("u"),
cairo_image_surface_get_data (surface),
gsk_texture_get_width (self->texture)
* gsk_texture_get_height (self->texture),
gdk_texture_get_width (self->texture)
* gdk_texture_get_height (self->texture),
sizeof (guint32)));
cairo_surface_destroy (surface);
@ -728,17 +728,17 @@ gsk_texture_node_serialize (GskRenderNode *node)
}
static GskRenderNode *
gsk_texture_node_deserialize (GVariant *variant,
gdk_texture_node_deserialize (GVariant *variant,
GError **error)
{
GskRenderNode *node;
GskTexture *texture;
GdkTexture *texture;
double bounds[4];
guint32 width, height;
GVariant *pixel_variant;
gsize n_pixels;
if (!check_variant_type (variant, GSK_TEXTURE_NODE_VARIANT_TYPE, error))
if (!check_variant_type (variant, GDK_TEXTURE_NODE_VARIANT_TYPE, error))
return NULL;
g_variant_get (variant, "(dddduu@au)",
@ -746,40 +746,40 @@ gsk_texture_node_deserialize (GVariant *variant,
&width, &height, &pixel_variant);
/* XXX: Make this work without copying the data */
texture = gsk_texture_new_for_data (g_variant_get_fixed_array (pixel_variant, &n_pixels, sizeof (guint32)),
texture = gdk_texture_new_for_data (g_variant_get_fixed_array (pixel_variant, &n_pixels, sizeof (guint32)),
width, height, width * 4);
g_variant_unref (pixel_variant);
node = gsk_texture_node_new (texture, &GRAPHENE_RECT_INIT(bounds[0], bounds[1], bounds[2], bounds[3]));
node = gdk_texture_node_new (texture, &GRAPHENE_RECT_INIT(bounds[0], bounds[1], bounds[2], bounds[3]));
g_object_unref (texture);
return node;
}
static const GskRenderNodeClass GSK_TEXTURE_NODE_CLASS = {
GSK_TEXTURE_NODE,
sizeof (GskTextureNode),
"GskTextureNode",
gsk_texture_node_finalize,
gsk_texture_node_draw,
gsk_texture_node_serialize,
gsk_texture_node_deserialize
static const GskRenderNodeClass GDK_TEXTURE_NODE_CLASS = {
GDK_TEXTURE_NODE,
sizeof (GdkTextureNode),
"GdkTextureNode",
gdk_texture_node_finalize,
gdk_texture_node_draw,
gdk_texture_node_serialize,
gdk_texture_node_deserialize
};
GskTexture *
gsk_texture_node_get_texture (GskRenderNode *node)
GdkTexture *
gdk_texture_node_get_texture (GskRenderNode *node)
{
GskTextureNode *self = (GskTextureNode *) node;
GdkTextureNode *self = (GdkTextureNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_TEXTURE_NODE), 0);
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GDK_TEXTURE_NODE), 0);
return self->texture;
}
/**
* gsk_texture_node_new:
* @texture: the #GskTexture
* gdk_texture_node_new:
* @texture: the #GdkTexture
* @bounds: the rectangle to render the texture into
*
* Creates a #GskRenderNode that will render the given
@ -790,15 +790,15 @@ gsk_texture_node_get_texture (GskRenderNode *node)
* Since: 3.90
*/
GskRenderNode *
gsk_texture_node_new (GskTexture *texture,
gdk_texture_node_new (GdkTexture *texture,
const graphene_rect_t *bounds)
{
GskTextureNode *self;
GdkTextureNode *self;
g_return_val_if_fail (GSK_IS_TEXTURE (texture), NULL);
g_return_val_if_fail (GDK_IS_TEXTURE (texture), NULL);
g_return_val_if_fail (bounds != NULL, NULL);
self = (GskTextureNode *) gsk_render_node_new (&GSK_TEXTURE_NODE_CLASS, 0);
self = (GdkTextureNode *) gsk_render_node_new (&GDK_TEXTURE_NODE_CLASS, 0);
self->texture = g_object_ref (texture);
graphene_rect_init_from_rect (&self->render_node.bounds, bounds);
@ -4448,7 +4448,7 @@ static const GskRenderNodeClass *klasses[] = {
[GSK_LINEAR_GRADIENT_NODE] = &GSK_LINEAR_GRADIENT_NODE_CLASS,
[GSK_REPEATING_LINEAR_GRADIENT_NODE] = &GSK_REPEATING_LINEAR_GRADIENT_NODE_CLASS,
[GSK_BORDER_NODE] = &GSK_BORDER_NODE_CLASS,
[GSK_TEXTURE_NODE] = &GSK_TEXTURE_NODE_CLASS,
[GDK_TEXTURE_NODE] = &GDK_TEXTURE_NODE_CLASS,
[GSK_INSET_SHADOW_NODE] = &GSK_INSET_SHADOW_NODE_CLASS,
[GSK_OUTSET_SHADOW_NODE] = &GSK_OUTSET_SHADOW_NODE_CLASS,
[GSK_TRANSFORM_NODE] = &GSK_TRANSFORM_NODE_CLASS,

View File

@ -27,6 +27,6 @@
#include <gsk/gskenums.h>
typedef struct _GskRenderer GskRenderer;
typedef struct _GskTexture GskTexture;
typedef struct _GdkTexture GdkTexture;
#endif /* __GSK_TYPES_H__ */

View File

@ -627,12 +627,12 @@ gsk_vulkan_image_new_for_texture (GdkVulkanContext *context,
return self;
}
GskTexture *
GdkTexture *
gsk_vulkan_image_download (GskVulkanImage *self,
GskVulkanUploader *uploader)
{
GskVulkanBuffer *buffer;
GskTexture *texture;
GdkTexture *texture;
guchar *mem;
gsk_vulkan_uploader_add_image_barrier (uploader,
@ -671,7 +671,7 @@ gsk_vulkan_image_download (GskVulkanImage *self,
GSK_VK_CHECK (vkQueueWaitIdle, gdk_vulkan_context_get_queue (self->vulkan));
mem = gsk_vulkan_buffer_map (buffer);
texture = gsk_texture_new_for_data (mem, self->width, self->height, self->width * 4);
texture = gdk_texture_new_for_data (mem, self->width, self->height, self->width * 4);
gsk_vulkan_buffer_unmap (buffer);
gsk_vulkan_buffer_free (buffer);

View File

@ -3,7 +3,6 @@
#include <gdk/gdk.h>
#include "gsk/gsktexture.h"
#include "gsk/gskvulkancommandpoolprivate.h"
G_BEGIN_DECLS
@ -55,7 +54,7 @@ GskVulkanImage * gsk_vulkan_image_new_for_texture (GdkVulk
gsize width,
gsize height);
GskTexture * gsk_vulkan_image_download (GskVulkanImage *self,
GdkTexture * gsk_vulkan_image_download (GskVulkanImage *self,
GskVulkanUploader *uploader);
gsize gsk_vulkan_image_get_width (GskVulkanImage *self);

View File

@ -629,7 +629,7 @@ gsk_vulkan_render_draw (GskVulkanRender *self)
}
}
GskTexture *
GdkTexture *
gsk_vulkan_render_download_target (GskVulkanRender *self)
{
gsk_vulkan_uploader_reset (self->uploader);

View File

@ -6,19 +6,20 @@
#include "gskprivate.h"
#include "gskrendererprivate.h"
#include "gskrendernodeprivate.h"
#include "gsktextureprivate.h"
#include "gskvulkanbufferprivate.h"
#include "gskvulkanimageprivate.h"
#include "gskvulkanpipelineprivate.h"
#include "gskvulkanrenderprivate.h"
#include "gskvulkanglyphcacheprivate.h"
#include "gdk/gdktextureprivate.h"
#include <graphene.h>
typedef struct _GskVulkanTextureData GskVulkanTextureData;
struct _GskVulkanTextureData {
GskTexture *texture;
GdkTexture *texture;
GskVulkanImage *image;
GskVulkanRenderer *renderer;
};
@ -144,7 +145,7 @@ gsk_vulkan_renderer_unrealize (GskRenderer *renderer)
GskVulkanTextureData *data = l->data;
data->renderer = NULL;
gsk_texture_clear_render_data (data->texture);
gdk_texture_clear_render_data (data->texture);
}
g_clear_pointer (&self->textures, (GDestroyNotify) g_slist_free);
@ -158,7 +159,7 @@ gsk_vulkan_renderer_unrealize (GskRenderer *renderer)
g_clear_object (&self->vulkan);
}
static GskTexture *
static GdkTexture *
gsk_vulkan_renderer_render_texture (GskRenderer *renderer,
GskRenderNode *root,
const graphene_rect_t *viewport)
@ -166,7 +167,7 @@ gsk_vulkan_renderer_render_texture (GskRenderer *renderer,
GskVulkanRenderer *self = GSK_VULKAN_RENDERER (renderer);
GskVulkanRender *render;
GskVulkanImage *image;
GskTexture *texture;
GdkTexture *texture;
#ifdef G_ENABLE_DEBUG
GskProfiler *profiler;
gint64 cpu_time;
@ -310,18 +311,18 @@ gsk_vulkan_renderer_clear_texture (gpointer p)
GskVulkanImage *
gsk_vulkan_renderer_ref_texture_image (GskVulkanRenderer *self,
GskTexture *texture,
GdkTexture *texture,
GskVulkanUploader *uploader)
{
GskVulkanTextureData *data;
cairo_surface_t *surface;
GskVulkanImage *image;
data = gsk_texture_get_render_data (texture, self);
data = gdk_texture_get_render_data (texture, self);
if (data)
return g_object_ref (data->image);
surface = gsk_texture_download_surface (texture);
surface = gdk_texture_download_surface (texture);
image = gsk_vulkan_image_new_from_data (uploader,
cairo_image_surface_get_data (surface),
cairo_image_surface_get_width (surface),
@ -334,7 +335,7 @@ gsk_vulkan_renderer_ref_texture_image (GskVulkanRenderer *self,
data->texture = texture;
data->renderer = self;
if (gsk_texture_set_render_data (texture, self, data, gsk_vulkan_renderer_clear_texture))
if (gdk_texture_set_render_data (texture, self, data, gsk_vulkan_renderer_clear_texture))
{
g_object_ref (data->image);
self->textures = g_slist_prepend (self->textures, data);

View File

@ -22,7 +22,7 @@ typedef struct _GskVulkanRendererClass GskVulkanRendererClass;
GType gsk_vulkan_renderer_get_type (void) G_GNUC_CONST;
GskVulkanImage * gsk_vulkan_renderer_ref_texture_image (GskVulkanRenderer *self,
GskTexture *texture,
GdkTexture *texture,
GskVulkanUploader *uploader);
typedef struct

View File

@ -442,7 +442,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
return;
}
case GSK_TEXTURE_NODE:
case GDK_TEXTURE_NODE:
if (gsk_vulkan_clip_contains_rect (&constants->clip, &node->bounds))
pipeline_type = GSK_VULKAN_PIPELINE_TEXTURE;
else if (constants->clip.type == GSK_VULKAN_CLIP_RECT)
@ -678,11 +678,11 @@ gsk_vulkan_render_pass_get_node_as_texture (GskVulkanRenderPass *self,
switch ((guint) gsk_render_node_get_node_type (node))
{
case GSK_TEXTURE_NODE:
case GDK_TEXTURE_NODE:
if (graphene_rect_equal (bounds, &node->bounds))
{
result = gsk_vulkan_renderer_ref_texture_image (GSK_VULKAN_RENDERER (gsk_vulkan_render_get_renderer (render)),
gsk_texture_node_get_texture (node),
gdk_texture_node_get_texture (node),
uploader);
gsk_vulkan_render_add_cleanup_image (render, result);
*tex_rect = GRAPHENE_RECT_INIT(0, 0, 1, 1);
@ -938,7 +938,7 @@ gsk_vulkan_render_pass_upload (GskVulkanRenderPass *self,
case GSK_VULKAN_OP_TEXTURE:
{
op->render.source = gsk_vulkan_renderer_ref_texture_image (GSK_VULKAN_RENDERER (gsk_vulkan_render_get_renderer (render)),
gsk_texture_node_get_texture (op->render.node),
gdk_texture_node_get_texture (op->render.node),
uploader);
op->render.source_rect = GRAPHENE_RECT_INIT(0, 0, 1, 1);
gsk_vulkan_render_add_cleanup_image (render, op->render.source);

View File

@ -85,7 +85,7 @@ void gsk_vulkan_render_draw (GskVulk
void gsk_vulkan_render_submit (GskVulkanRender *self);
GskTexture * gsk_vulkan_render_download_target (GskVulkanRender *self);
GdkTexture * gsk_vulkan_render_download_target (GskVulkanRender *self);
VkFramebuffer gsk_vulkan_render_get_framebuffer (GskVulkanRender *self,
GskVulkanImage *image);

View File

@ -17,8 +17,7 @@ gsk_public_sources = files([
'gskrenderer.c',
'gskrendernode.c',
'gskrendernodeimpl.c',
'gskroundedrect.c',
'gsktexture.c',
'gskroundedrect.c'
])
gsk_private_sources = files([
@ -38,7 +37,6 @@ gsk_public_headers = files([
'gskrenderer.h',
'gskrendernode.h',
'gskroundedrect.h',
'gsktexture.h',
'gsktypes.h',
])

View File

@ -46,7 +46,7 @@ gtk_css_image_icon_theme_snapshot (GtkCssImage *image,
double height)
{
GtkCssImageIconTheme *icon_theme = GTK_CSS_IMAGE_ICON_THEME (image);
GskTexture *texture;
GdkTexture *texture;
double texture_width, texture_height;
gint size;
@ -90,7 +90,7 @@ gtk_css_image_icon_theme_snapshot (GtkCssImage *image,
return;
}
texture = gsk_texture_new_for_pixbuf (pixbuf);
texture = gdk_texture_new_for_pixbuf (pixbuf);
g_clear_object (&icon_theme->cached_texture);
icon_theme->cached_size = size;
@ -100,8 +100,8 @@ gtk_css_image_icon_theme_snapshot (GtkCssImage *image,
g_object_unref (icon_info);
}
texture_width = (double) gsk_texture_get_width (texture) / icon_theme->scale;
texture_height = (double) gsk_texture_get_height (texture) / icon_theme->scale;
texture_width = (double) gdk_texture_get_width (texture) / icon_theme->scale;
texture_height = (double) gdk_texture_get_height (texture) / icon_theme->scale;
gtk_snapshot_append_texture (snapshot,
texture,

View File

@ -48,7 +48,7 @@ struct _GtkCssImageIconTheme
char *name;
int cached_size;
GskTexture *cached_texture;
GdkTexture *cached_texture;
};
struct _GtkCssImageIconThemeClass

View File

@ -31,7 +31,7 @@ gtk_css_image_surface_get_width (GtkCssImage *image)
if (surface->texture == NULL)
return 0;
return gsk_texture_get_width (surface->texture);
return gdk_texture_get_width (surface->texture);
}
static int
@ -42,7 +42,7 @@ gtk_css_image_surface_get_height (GtkCssImage *image)
if (surface->texture == NULL)
return 0;
return gsk_texture_get_height (surface->texture);
return gdk_texture_get_height (surface->texture);
}
static void
@ -60,8 +60,8 @@ gtk_css_image_surface_snapshot (GtkCssImage *image,
surface->texture,
&GRAPHENE_RECT_INIT (0, 0, width, height),
"Surface Image %dx%d",
gsk_texture_get_width (surface->texture),
gsk_texture_get_height (surface->texture));
gdk_texture_get_width (surface->texture),
gdk_texture_get_height (surface->texture));
}
static void
@ -101,7 +101,7 @@ _gtk_css_image_surface_init (GtkCssImageSurface *image_surface)
}
GtkCssImage *
gtk_css_image_surface_new (GskTexture *texture)
gtk_css_image_surface_new (GdkTexture *texture)
{
GtkCssImage *image;
@ -117,11 +117,11 @@ GtkCssImage *
gtk_css_image_surface_new_for_pixbuf (GdkPixbuf *pixbuf)
{
GtkCssImage *image;
GskTexture *texture;
GdkTexture *texture;
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
texture = gsk_texture_new_for_pixbuf (pixbuf);
texture = gdk_texture_new_for_pixbuf (pixbuf);
image = gtk_css_image_surface_new (texture);
g_object_unref (texture);

View File

@ -38,7 +38,7 @@ struct _GtkCssImageSurface
{
GtkCssImage parent;
GskTexture *texture; /* the texture we render */
GdkTexture *texture; /* the texture we render */
};
struct _GtkCssImageSurfaceClass
@ -48,7 +48,7 @@ struct _GtkCssImageSurfaceClass
GType _gtk_css_image_surface_get_type (void) G_GNUC_CONST;
GtkCssImage * gtk_css_image_surface_new (GskTexture *texture);
GtkCssImage * gtk_css_image_surface_new (GdkTexture *texture);
GtkCssImage * gtk_css_image_surface_new_for_pixbuf (GdkPixbuf *pixbuf);
G_END_DECLS

View File

@ -371,7 +371,7 @@ gtk_icon_helper_ensure_surface (GtkIconHelper *self)
self->rendered_surface = gtk_icon_helper_load_surface (self, scale);
}
static GskTexture *
static GdkTexture *
find_cached_texture (GtkIconHelper *self)
{
GtkIconTheme *icon_theme;
@ -382,7 +382,7 @@ find_cached_texture (GtkIconHelper *self)
int scale;
GIcon *gicon;
GtkIconInfo *info;
GskTexture *texture;
GdkTexture *texture;
style = gtk_css_node_get_style (self->node);
dir = gtk_widget_get_direction (self->owner);
@ -464,7 +464,7 @@ gtk_icon_helper_ensure_texture (GtkIconHelper *self)
map = cairo_surface_map_to_image (self->rendered_surface,
&(GdkRectangle) { 0, 0, width * scale, height * scale});
self->texture = gsk_texture_new_for_data (cairo_image_surface_get_data (map),
self->texture = gdk_texture_new_for_data (cairo_image_surface_get_data (map),
width * scale,
height * scale,
cairo_image_surface_get_stride (map));
@ -653,7 +653,7 @@ gtk_icon_helper_snapshot (GtkIconHelper *self,
GtkSnapshot *snapshot)
{
GtkCssStyle *style;
GskTexture *texture;
GdkTexture *texture;
graphene_matrix_t matrix;
graphene_vec4_t offset;

View File

@ -46,7 +46,7 @@ struct _GtkIconHelper
GtkWidget *owner;
GtkCssNode *node;
cairo_surface_t *rendered_surface;
GskTexture *texture;
GdkTexture *texture;
};
void gtk_icon_helper_init (GtkIconHelper *self,

View File

@ -225,7 +225,7 @@ struct _GtkIconInfo
*/
GdkPixbuf *pixbuf;
GdkPixbuf *proxy_pixbuf;
GskTexture *texture;
GdkTexture *texture;
GError *load_error;
gdouble unscaled_scale;
gdouble scale;
@ -4014,7 +4014,7 @@ gtk_icon_info_load_icon (GtkIconInfo *icon_info,
*
* Since: 3.94
*/
GskTexture *
GdkTexture *
gtk_icon_info_load_texture (GtkIconInfo *icon_info)
{
if (!icon_info->texture)
@ -4022,7 +4022,7 @@ gtk_icon_info_load_texture (GtkIconInfo *icon_info)
GdkPixbuf *pixbuf;
pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
icon_info->texture = gsk_texture_new_for_pixbuf (pixbuf);
icon_info->texture = gdk_texture_new_for_pixbuf (pixbuf);
g_object_unref (pixbuf);
g_object_add_weak_pointer (G_OBJECT (icon_info->texture), (void **)&icon_info->texture);

View File

@ -295,7 +295,7 @@ cairo_surface_t * gtk_icon_info_load_surface (GtkIconInfo *icon_info
GdkWindow *for_window,
GError **error);
GDK_AVAILABLE_IN_3_94
GskTexture * gtk_icon_info_load_texture (GtkIconInfo *icon_info);
GdkTexture * gtk_icon_info_load_texture (GtkIconInfo *icon_info);
GDK_AVAILABLE_IN_3_8
void gtk_icon_info_load_icon_async (GtkIconInfo *icon_info,

View File

@ -266,7 +266,7 @@ gtk_css_style_render_icon_get_extents (GtkCssStyle *style,
void
gtk_css_style_snapshot_icon_texture (GtkCssStyle *style,
GtkSnapshot *snapshot,
GskTexture *texture,
GdkTexture *texture,
double texture_scale,
graphene_matrix_t *color_matrix,
graphene_vec4_t * color_offset)
@ -279,14 +279,14 @@ gtk_css_style_snapshot_icon_texture (GtkCssStyle *style,
g_return_if_fail (GTK_IS_CSS_STYLE (style));
g_return_if_fail (snapshot != NULL);
g_return_if_fail (GSK_IS_TEXTURE (texture));
g_return_if_fail (GDK_IS_TEXTURE (texture));
g_return_if_fail (texture_scale > 0);
shadows_value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_SHADOW);
transform_value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_TRANSFORM);
filter_value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_FILTER);
width = gsk_texture_get_width (texture) / texture_scale;
height = gsk_texture_get_height (texture) / texture_scale;
width = gdk_texture_get_width (texture) / texture_scale;
height = gdk_texture_get_height (texture) / texture_scale;
if (!gtk_css_transform_value_get_matrix (transform_value, &transform_matrix))
return;
@ -316,7 +316,7 @@ gtk_css_style_snapshot_icon_texture (GtkCssStyle *style,
gtk_snapshot_push_transform (snapshot, &m1, "Icon Transform");
graphene_rect_init (&bounds, 0, 0, gsk_texture_get_width (texture), gsk_texture_get_height (texture));
graphene_rect_init (&bounds, 0, 0, gdk_texture_get_width (texture), gdk_texture_get_height (texture));
gtk_snapshot_append_texture (snapshot, texture, &bounds, "Icon");
gtk_snapshot_pop (snapshot);

View File

@ -49,7 +49,7 @@ void gtk_css_style_render_icon_surface (GtkCssStyle *style,
double y);
void gtk_css_style_snapshot_icon_texture (GtkCssStyle *style,
GtkSnapshot *snapshot,
GskTexture *texture,
GdkTexture *texture,
double texture_scale,
graphene_matrix_t * color_matrix,
graphene_vec4_t * color_offset);

View File

@ -1216,7 +1216,7 @@ gtk_snapshot_append_cairo (GtkSnapshot *snapshot,
/**
* gtk_snapshot_append_texture:
* @snapshot: a #GtkSnapshot
* @texture: the #GskTexture to render
* @texture: the #GdkTexture to render
* @bounds: the bounds for the new node
* @name: (transfer none): a printf() style format string for the name for the new node
* @...: arguments to insert into the format string
@ -1226,7 +1226,7 @@ gtk_snapshot_append_cairo (GtkSnapshot *snapshot,
**/
void
gtk_snapshot_append_texture (GtkSnapshot *snapshot,
GskTexture *texture,
GdkTexture *texture,
const graphene_rect_t *bounds,
const char *name,
...)
@ -1236,11 +1236,11 @@ gtk_snapshot_append_texture (GtkSnapshot *snapshot,
graphene_rect_t real_bounds;
g_return_if_fail (snapshot != NULL);
g_return_if_fail (GSK_IS_TEXTURE (texture));
g_return_if_fail (GDK_IS_TEXTURE (texture));
g_return_if_fail (bounds != NULL);
graphene_rect_offset_r (bounds, current_state->translate_x, current_state->translate_y, &real_bounds);
node = gsk_texture_node_new (texture, &real_bounds);
node = gdk_texture_node_new (texture, &real_bounds);
if (name && snapshot->record_names)
{
@ -1502,9 +1502,9 @@ gtk_snapshot_render_icon (GtkSnapshot *snapshot,
gdouble x,
gdouble y)
{
GskTexture *texture;
GdkTexture *texture;
texture = gsk_texture_new_for_pixbuf (pixbuf);
texture = gdk_texture_new_for_pixbuf (pixbuf);
gtk_snapshot_offset (snapshot, x, y);
gtk_css_style_snapshot_icon_texture (gtk_style_context_lookup_style (context),
snapshot,

View File

@ -116,7 +116,7 @@ cairo_t * gtk_snapshot_append_cairo (GtkSnapshot
...) G_GNUC_PRINTF(3, 4);
GDK_AVAILABLE_IN_3_90
void gtk_snapshot_append_texture (GtkSnapshot *snapshot,
GskTexture *texture,
GdkTexture *texture,
const graphene_rect_t *bounds,
const char *name,
...) G_GNUC_PRINTF (4, 5);

View File

@ -524,7 +524,7 @@ append_node (GtkTreeModelRenderNode *nodemodel,
case GSK_CAIRO_NODE:
case GSK_TEXT_NODE:
case GSK_TEXTURE_NODE:
case GDK_TEXTURE_NODE:
case GSK_COLOR_NODE:
case GSK_LINEAR_GRADIENT_NODE:
case GSK_REPEATING_LINEAR_GRADIENT_NODE:

View File

@ -32,9 +32,9 @@
#include <gtk/gtktreeview.h>
#include <gsk/gskrendererprivate.h>
#include <gsk/gskrendernodeprivate.h>
#include <gsk/gsktextureprivate.h>
#include <gsk/gskroundedrectprivate.h>
#include <gdk/gdktextureprivate.h>
#include "gtk/gtkdebug.h"
#include "gtktreemodelrendernode.h"
@ -161,7 +161,7 @@ node_type_name (GskRenderNodeType type)
return "Repeating Linear Gradient";
case GSK_BORDER_NODE:
return "Border";
case GSK_TEXTURE_NODE:
case GDK_TEXTURE_NODE:
return "Texture";
case GSK_INSET_SHADOW_NODE:
return "Inset Shadow";
@ -304,20 +304,20 @@ populate_render_node_properties (GtkListStore *store,
switch (gsk_render_node_get_node_type (node))
{
case GSK_TEXTURE_NODE:
case GDK_TEXTURE_NODE:
case GSK_CAIRO_NODE:
{
const char *text;
cairo_surface_t *surface;
gboolean show_inline;
if (gsk_render_node_get_node_type (node) == GSK_TEXTURE_NODE)
if (gsk_render_node_get_node_type (node) == GDK_TEXTURE_NODE)
{
GskTexture *texture;
GdkTexture *texture;
text = "Texture";
texture = gsk_texture_node_get_texture (node);
surface = gsk_texture_download_surface (texture);
texture = gdk_texture_node_get_texture (node);
surface = gdk_texture_download_surface (texture);
}
else
{

View File

@ -115,7 +115,7 @@ main(int argc, char **argv)
{
GskRenderer *renderer;
GdkWindow *window;
GskTexture *texture = NULL;
GdkTexture *texture = NULL;
window = gdk_window_new_toplevel (gdk_display_get_default(), 0, 10 , 10);
renderer = gsk_renderer_new_for_window (window);
@ -132,9 +132,9 @@ main(int argc, char **argv)
}
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
gsk_texture_get_width (texture),
gsk_texture_get_height (texture));
gsk_texture_download (texture,
gdk_texture_get_width (texture),
gdk_texture_get_height (texture));
gdk_texture_download (texture,
cairo_image_surface_get_data (surface),
cairo_image_surface_get_stride (surface));
cairo_surface_mark_dirty (surface);

View File

@ -521,7 +521,7 @@ load_node_file (GFile *file, gboolean generate)
GskRenderNode *node;
GskRenderer *renderer;
GdkWindow *window;
GskTexture *texture = NULL;
GdkTexture *texture = NULL;
cairo_surface_t *surface;
char *png_file;
cairo_surface_t *ref_surface;
@ -554,9 +554,9 @@ load_node_file (GFile *file, gboolean generate)
texture = gsk_renderer_render_texture (renderer, node, NULL);
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
gsk_texture_get_width (texture),
gsk_texture_get_height (texture));
gsk_texture_download (texture,
gdk_texture_get_width (texture),
gdk_texture_get_height (texture));
gdk_texture_download (texture,
cairo_image_surface_get_data (surface),
cairo_image_surface_get_stride (surface));
cairo_surface_mark_dirty (surface);