mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
transform: Move to GSK
The renaming of the prefix makes this a large patch.
This commit is contained in:
parent
20f7588a84
commit
0e1a50366a
@ -18,6 +18,7 @@
|
||||
<title>API Reference</title>
|
||||
<xi:include href="xml/GskRenderer.xml" />
|
||||
<xi:include href="xml/GskRenderNode.xml" />
|
||||
<xi:include href="xml/GskTransform.xml" />
|
||||
</reference>
|
||||
|
||||
<index id="api-index-full">
|
||||
|
@ -144,3 +144,36 @@ gsk_rounded_rect_contains_point
|
||||
gsk_rounded_rect_contains_rect
|
||||
gsk_rounded_rect_intersects_rect
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>GskTransform</FILE>
|
||||
<TITLE>3D transformations</TITLE>
|
||||
GskTransformType
|
||||
GskTransform
|
||||
gsk_transform_ref
|
||||
gsk_transform_unref
|
||||
<SUBSECTION>
|
||||
gsk_transform_print
|
||||
gsk_transform_to_string
|
||||
gsk_transform_to_matrix
|
||||
<SUBSECTION>
|
||||
gsk_transform_identity
|
||||
gsk_transform_transform
|
||||
gsk_transform_matrix
|
||||
gsk_transform_translate
|
||||
gsk_transform_translate_3d
|
||||
gsk_transform_rotate
|
||||
gsk_transform_rotate_3d
|
||||
gsk_transform_scale
|
||||
gsk_transform_scale_3d
|
||||
<SUBSECTION>
|
||||
gsk_transform_equal
|
||||
<SUBSECTION>
|
||||
gsk_transform_get_transform_type
|
||||
gsk_transform_get_next
|
||||
<SUBSECTION Private>
|
||||
GSK_TYPE_TRANSFORM
|
||||
gsk_transform_get_type
|
||||
gsk_transform_new
|
||||
</SECTION>
|
||||
|
||||
|
@ -345,7 +345,6 @@
|
||||
<xi:include href="xml/gtkselection.xml" />
|
||||
<xi:include href="xml/gtktesting.xml" />
|
||||
<xi:include href="xml/filesystem.xml" />
|
||||
<xi:include href="xml/gtktransform.xml" />
|
||||
</part>
|
||||
|
||||
<part id="theming">
|
||||
|
@ -5867,38 +5867,6 @@ gtk_mount_operation_get_type
|
||||
GtkMountOperationPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtktransform</FILE>
|
||||
<TITLE>3D transformations</TITLE>
|
||||
GtkTransformType
|
||||
GtkTransform
|
||||
gtk_transform_ref
|
||||
gtk_transform_unref
|
||||
<SUBSECTION>
|
||||
gtk_transform_print
|
||||
gtk_transform_to_string
|
||||
gtk_transform_to_matrix
|
||||
<SUBSECTION>
|
||||
gtk_transform_identity
|
||||
gtk_transform_transform
|
||||
gtk_transform_matrix
|
||||
gtk_transform_translate
|
||||
gtk_transform_translate_3d
|
||||
gtk_transform_rotate
|
||||
gtk_transform_rotate_3d
|
||||
gtk_transform_scale
|
||||
gtk_transform_scale_3d
|
||||
<SUBSECTION>
|
||||
gtk_transform_equal
|
||||
<SUBSECTION>
|
||||
gtk_transform_get_transform_type
|
||||
gtk_transform_get_next
|
||||
<SUBSECTION Private>
|
||||
GTK_TYPE_TRANSFORM
|
||||
gdk_transform_get_type
|
||||
gtk_transform_new
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkorientable</FILE>
|
||||
<TITLE>Orientable</TITLE>
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <gsk/gskrenderer.h>
|
||||
#include <gsk/gskrendernode.h>
|
||||
#include <gsk/gskroundedrect.h>
|
||||
#include <gsk/gsktransform.h>
|
||||
|
||||
#include <gsk/gsktypes.h>
|
||||
#include <gsk/gskenumtypes.h>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -18,87 +18,86 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __GTK_TRANSFORM_H__
|
||||
#define __GTK_TRANSFORM_H__
|
||||
#ifndef __GSK_TRANSFORM_H__
|
||||
#define __GSK_TRANSFORM_H__
|
||||
|
||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#if !defined (__GSK_H_INSIDE__) && !defined (GSK_COMPILATION)
|
||||
#error "Only <gsk/gsk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <graphene.h>
|
||||
#include <gtk/gtktypes.h>
|
||||
#include <gsk/gsktypes.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_MATRIX (gtk_transform_get_type ())
|
||||
#define GSK_TYPE_TRANSFORM (gsk_transform_get_type ())
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_TRANSFORM_TYPE_IDENTITY,
|
||||
GTK_TRANSFORM_TYPE_TRANSFORM,
|
||||
GTK_TRANSFORM_TYPE_TRANSLATE,
|
||||
GTK_TRANSFORM_TYPE_ROTATE,
|
||||
GTK_TRANSFORM_TYPE_SCALE
|
||||
} GtkTransformType;
|
||||
GSK_TRANSFORM_TYPE_IDENTITY,
|
||||
GSK_TRANSFORM_TYPE_TRANSFORM,
|
||||
GSK_TRANSFORM_TYPE_TRANSLATE,
|
||||
GSK_TRANSFORM_TYPE_ROTATE,
|
||||
GSK_TRANSFORM_TYPE_SCALE
|
||||
} GskTransformType;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_transform_get_type (void) G_GNUC_CONST;
|
||||
GType gsk_transform_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkTransform * gtk_transform_ref (GtkTransform *self);
|
||||
GskTransform * gsk_transform_ref (GskTransform *self);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_transform_unref (GtkTransform *self);
|
||||
void gsk_transform_unref (GskTransform *self);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_transform_print (GtkTransform *self,
|
||||
void gsk_transform_print (GskTransform *self,
|
||||
GString *string);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
char * gtk_transform_to_string (GtkTransform *self);
|
||||
char * gsk_transform_to_string (GskTransform *self);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_transform_to_matrix (GtkTransform *self,
|
||||
void gsk_transform_to_matrix (GskTransform *self,
|
||||
graphene_matrix_t *out_matrix);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_transform_equal (GtkTransform *first,
|
||||
GtkTransform *second) G_GNUC_PURE;
|
||||
gboolean gsk_transform_equal (GskTransform *first,
|
||||
GskTransform *second) G_GNUC_PURE;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkTransform * gtk_transform_new (void);
|
||||
GskTransform * gsk_transform_new (void);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkTransform * gtk_transform_identity (GtkTransform *next);
|
||||
GskTransform * gsk_transform_identity (GskTransform *next);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkTransform * gtk_transform_transform (GtkTransform *next,
|
||||
GtkTransform *other);
|
||||
GskTransform * gsk_transform_transform (GskTransform *next,
|
||||
GskTransform *other);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkTransform * gtk_transform_matrix (GtkTransform *next,
|
||||
GskTransform * gsk_transform_matrix (GskTransform *next,
|
||||
const graphene_matrix_t *matrix);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkTransform * gtk_transform_translate (GtkTransform *next,
|
||||
GskTransform * gsk_transform_translate (GskTransform *next,
|
||||
const graphene_point_t *point);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkTransform * gtk_transform_translate_3d (GtkTransform *next,
|
||||
GskTransform * gsk_transform_translate_3d (GskTransform *next,
|
||||
const graphene_point3d_t *point);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkTransform * gtk_transform_rotate (GtkTransform *next,
|
||||
GskTransform * gsk_transform_rotate (GskTransform *next,
|
||||
float angle);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkTransform * gtk_transform_rotate_3d (GtkTransform *next,
|
||||
GskTransform * gsk_transform_rotate_3d (GskTransform *next,
|
||||
float angle,
|
||||
const graphene_vec3_t *axis);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkTransform * gtk_transform_scale (GtkTransform *next,
|
||||
GskTransform * gsk_transform_scale (GskTransform *next,
|
||||
float factor_x,
|
||||
float factor_y);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkTransform * gtk_transform_scale_3d (GtkTransform *next,
|
||||
GskTransform * gsk_transform_scale_3d (GskTransform *next,
|
||||
float factor_x,
|
||||
float factor_y,
|
||||
float factor_z);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkTransformType gtk_transform_get_transform_type (GtkTransform *self) G_GNUC_PURE;
|
||||
GskTransformType gsk_transform_get_transform_type (GskTransform *self) G_GNUC_PURE;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkTransform * gtk_transform_get_next (GtkTransform *self) G_GNUC_PURE;
|
||||
GskTransform * gsk_transform_get_next (GskTransform *self) G_GNUC_PURE;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_TRANSFORM_H__ */
|
||||
#endif /* __GSK_TRANSFORM_H__ */
|
@ -18,29 +18,29 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __GTK_TRANSFORM_PRIVATE_H__
|
||||
#define __GTK_TRANSFORM_PRIVATE_H__
|
||||
#ifndef __GSK_TRANSFORM_PRIVATE_H__
|
||||
#define __GSK_TRANSFORM_PRIVATE_H__
|
||||
|
||||
#include "gtktransform.h"
|
||||
#include "gsktransform.h"
|
||||
|
||||
#include <gsk/gsk.h>
|
||||
#include "gsk/gskrendernodeprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GskMatrixCategory gtk_transform_categorize (GtkTransform *self);
|
||||
GskMatrixCategory gsk_transform_categorize (GskTransform *self);
|
||||
|
||||
gboolean gtk_transform_to_affine (GtkTransform *self,
|
||||
gboolean gsk_transform_to_affine (GskTransform *self,
|
||||
float *scale_x,
|
||||
float *scale_y,
|
||||
float *dx,
|
||||
float *dy) G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
GtkTransform * gtk_transform_matrix_with_category (GtkTransform *next,
|
||||
GskTransform * gsk_transform_matrix_with_category (GskTransform *next,
|
||||
const graphene_matrix_t*matrix,
|
||||
GskMatrixCategory category);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_TRANSFORM_PRIVATE_H__ */
|
||||
#endif /* __GSK_TRANSFORM_PRIVATE_H__ */
|
||||
|
@ -27,5 +27,6 @@
|
||||
#include <gsk/gskenums.h>
|
||||
|
||||
typedef struct _GskRenderer GskRenderer;
|
||||
typedef struct _GskTransform GskTransform;
|
||||
|
||||
#endif /* __GSK_TYPES_H__ */
|
||||
|
@ -24,7 +24,8 @@ gsk_public_sources = files([
|
||||
'gskrenderer.c',
|
||||
'gskrendernode.c',
|
||||
'gskrendernodeimpl.c',
|
||||
'gskroundedrect.c'
|
||||
'gskroundedrect.c',
|
||||
'gsktransform.c',
|
||||
])
|
||||
|
||||
gsk_private_sources = files([
|
||||
@ -49,6 +50,7 @@ gsk_public_headers = files([
|
||||
'gskrenderer.h',
|
||||
'gskrendernode.h',
|
||||
'gskroundedrect.h',
|
||||
'gsktransform.h',
|
||||
'gsktypes.h',
|
||||
'gsk-autocleanup.h'
|
||||
])
|
||||
|
@ -228,7 +228,6 @@
|
||||
#include <gtk/gtktoolshell.h>
|
||||
#include <gtk/gtktooltip.h>
|
||||
#include <gtk/gtktestutils.h>
|
||||
#include <gtk/gtktransform.h>
|
||||
#include <gtk/gtktreednd.h>
|
||||
#include <gtk/gtktreelistmodel.h>
|
||||
#include <gtk/gtktreemodel.h>
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "gtkcssnumbervalueprivate.h"
|
||||
#include "gtktransform.h"
|
||||
#include "gsktransform.h"
|
||||
|
||||
typedef union _GtkCssTransform GtkCssTransform;
|
||||
|
||||
@ -161,19 +161,19 @@ gtk_css_transform_init_identity (GtkCssTransform *transform,
|
||||
transform->type = type;
|
||||
}
|
||||
|
||||
static GtkTransform *
|
||||
static GskTransform *
|
||||
gtk_css_transform_apply (const GtkCssTransform *transform,
|
||||
GtkTransform *next)
|
||||
GskTransform *next)
|
||||
{
|
||||
graphene_matrix_t skew;
|
||||
|
||||
switch (transform->type)
|
||||
{
|
||||
case GTK_CSS_TRANSFORM_MATRIX:
|
||||
return gtk_transform_matrix (next, &transform->matrix.matrix);
|
||||
return gsk_transform_matrix (next, &transform->matrix.matrix);
|
||||
|
||||
case GTK_CSS_TRANSFORM_TRANSLATE:
|
||||
return gtk_transform_translate_3d (next,
|
||||
return gsk_transform_translate_3d (next,
|
||||
&GRAPHENE_POINT3D_INIT (
|
||||
_gtk_css_number_value_get (transform->translate.x, 100),
|
||||
_gtk_css_number_value_get (transform->translate.y, 100),
|
||||
@ -188,13 +188,13 @@ gtk_css_transform_apply (const GtkCssTransform *transform,
|
||||
_gtk_css_number_value_get (transform->rotate.x, 1),
|
||||
_gtk_css_number_value_get (transform->rotate.y, 1),
|
||||
_gtk_css_number_value_get (transform->rotate.z, 1));
|
||||
return gtk_transform_rotate_3d (next,
|
||||
return gsk_transform_rotate_3d (next,
|
||||
_gtk_css_number_value_get (transform->rotate.angle, 100),
|
||||
&axis);
|
||||
}
|
||||
|
||||
case GTK_CSS_TRANSFORM_SCALE:
|
||||
return gtk_transform_scale_3d (next,
|
||||
return gsk_transform_scale_3d (next,
|
||||
_gtk_css_number_value_get (transform->scale.x, 1),
|
||||
_gtk_css_number_value_get (transform->scale.y, 1),
|
||||
_gtk_css_number_value_get (transform->scale.z, 1));
|
||||
@ -203,19 +203,19 @@ gtk_css_transform_apply (const GtkCssTransform *transform,
|
||||
graphene_matrix_init_skew (&skew,
|
||||
_gtk_css_number_value_get (transform->skew.x, 100) / 180.0f * G_PI,
|
||||
_gtk_css_number_value_get (transform->skew.y, 100) / 180.0f * G_PI);
|
||||
return gtk_transform_matrix (next, &skew);
|
||||
return gsk_transform_matrix (next, &skew);
|
||||
|
||||
case GTK_CSS_TRANSFORM_SKEW_X:
|
||||
graphene_matrix_init_skew (&skew,
|
||||
_gtk_css_number_value_get (transform->skew_x.skew, 100) / 180.0f * G_PI,
|
||||
0);
|
||||
return gtk_transform_matrix (next, &skew);
|
||||
return gsk_transform_matrix (next, &skew);
|
||||
|
||||
case GTK_CSS_TRANSFORM_SKEW_Y:
|
||||
graphene_matrix_init_skew (&skew,
|
||||
0,
|
||||
_gtk_css_number_value_get (transform->skew_y.skew, 100) / 180.0f * G_PI);
|
||||
return gtk_transform_matrix (next, &skew);
|
||||
return gsk_transform_matrix (next, &skew);
|
||||
|
||||
case GTK_CSS_TRANSFORM_NONE:
|
||||
default:
|
||||
@ -225,10 +225,10 @@ gtk_css_transform_apply (const GtkCssTransform *transform,
|
||||
}
|
||||
|
||||
/* NB: The returned matrix may be invalid */
|
||||
static GtkTransform *
|
||||
static GskTransform *
|
||||
gtk_css_transform_value_compute_transform (const GtkCssValue *value)
|
||||
{
|
||||
GtkTransform *transform;
|
||||
GskTransform *transform;
|
||||
guint i;
|
||||
|
||||
transform = NULL;
|
||||
@ -512,16 +512,16 @@ gtk_css_value_transform_transition (GtkCssValue *start,
|
||||
{
|
||||
if (start->transforms[i].type != end->transforms[i].type)
|
||||
{
|
||||
GtkTransform *transform;
|
||||
GskTransform *transform;
|
||||
graphene_matrix_t start_matrix, end_matrix;
|
||||
|
||||
transform = gtk_css_transform_value_compute_transform (start);
|
||||
gtk_transform_to_matrix (transform, &start_matrix);
|
||||
gtk_transform_unref (transform);
|
||||
gsk_transform_to_matrix (transform, &start_matrix);
|
||||
gsk_transform_unref (transform);
|
||||
|
||||
transform = gtk_css_transform_value_compute_transform (end);
|
||||
gtk_transform_to_matrix (transform, &end_matrix);
|
||||
gtk_transform_unref (transform);
|
||||
gsk_transform_to_matrix (transform, &end_matrix);
|
||||
gsk_transform_unref (transform);
|
||||
|
||||
result = gtk_css_transform_value_alloc (1);
|
||||
result->transforms[0].type = GTK_CSS_TRANSFORM_MATRIX;
|
||||
@ -1098,7 +1098,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
|
||||
return value;
|
||||
}
|
||||
|
||||
GtkTransform *
|
||||
GskTransform *
|
||||
gtk_css_transform_value_get_transform (const GtkCssValue *transform)
|
||||
{
|
||||
g_return_val_if_fail (transform->class == >K_CSS_VALUE_TRANSFORM, FALSE);
|
||||
|
@ -28,7 +28,7 @@ G_BEGIN_DECLS
|
||||
GtkCssValue * _gtk_css_transform_value_new_none (void);
|
||||
GtkCssValue * _gtk_css_transform_value_parse (GtkCssParser *parser);
|
||||
|
||||
GtkTransform * gtk_css_transform_value_get_transform (const GtkCssValue *transform);
|
||||
GskTransform * gtk_css_transform_value_get_transform (const GtkCssValue *transform);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "gtkcsstransformvalueprivate.h"
|
||||
#include "gtkiconthemeprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtktransform.h"
|
||||
#include "gsktransform.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@ -41,7 +41,7 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style,
|
||||
GtkCssImageBuiltinType builtin_type)
|
||||
{
|
||||
const GtkCssValue *shadows_value, *transform_value, *filter_value;
|
||||
GtkTransform *transform;
|
||||
GskTransform *transform;
|
||||
GtkCssImage *image;
|
||||
gboolean has_shadow;
|
||||
|
||||
@ -92,7 +92,7 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style,
|
||||
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
gtk_transform_unref (transform);
|
||||
gsk_transform_unref (transform);
|
||||
}
|
||||
|
||||
void
|
||||
@ -104,7 +104,7 @@ gtk_css_style_snapshot_icon_paintable (GtkCssStyle *style,
|
||||
gboolean recolor)
|
||||
{
|
||||
const GtkCssValue *shadows_value, *transform_value, *filter_value;
|
||||
GtkTransform *transform;
|
||||
GskTransform *transform;
|
||||
gboolean has_shadow;
|
||||
|
||||
g_return_if_fail (GTK_IS_CSS_STYLE (style));
|
||||
@ -172,5 +172,5 @@ gtk_css_style_snapshot_icon_paintable (GtkCssStyle *style,
|
||||
transparent:
|
||||
gtk_css_filter_value_pop_snapshot (filter_value, snapshot);
|
||||
|
||||
gtk_transform_unref (transform);
|
||||
gsk_transform_unref (transform);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "gtkrendericonprivate.h"
|
||||
#include "gtkrendernodepaintableprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtktransformprivate.h"
|
||||
#include "gsktransformprivate.h"
|
||||
|
||||
#include "gsk/gskrendernodeprivate.h"
|
||||
|
||||
@ -109,7 +109,7 @@ gtk_snapshot_collect_default (GtkSnapshot *snapshot,
|
||||
|
||||
static GtkSnapshotState *
|
||||
gtk_snapshot_push_state (GtkSnapshot *snapshot,
|
||||
GtkTransform *transform,
|
||||
GskTransform *transform,
|
||||
GtkSnapshotCollectFunc collect_func)
|
||||
{
|
||||
const gsize n_states = snapshot->state_stack->len;
|
||||
@ -118,7 +118,7 @@ gtk_snapshot_push_state (GtkSnapshot *snapshot,
|
||||
g_array_set_size (snapshot->state_stack, n_states + 1);
|
||||
state = &g_array_index (snapshot->state_stack, GtkSnapshotState, n_states);
|
||||
|
||||
state->transform = gtk_transform_ref (transform);
|
||||
state->transform = gsk_transform_ref (transform);
|
||||
state->collect_func = collect_func;
|
||||
state->start_node_index = snapshot->nodes->len;
|
||||
state->n_nodes = 0;
|
||||
@ -145,7 +145,7 @@ gtk_snapshot_get_previous_state (const GtkSnapshot *snapshot)
|
||||
static void
|
||||
gtk_snapshot_state_clear (GtkSnapshotState *state)
|
||||
{
|
||||
gtk_transform_unref (state->transform);
|
||||
gsk_transform_unref (state->transform);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -268,8 +268,8 @@ gtk_snapshot_autopush_transform (GtkSnapshot *snapshot)
|
||||
|
||||
previous_state = gtk_snapshot_get_previous_state (snapshot);
|
||||
|
||||
gtk_transform_to_matrix (previous_state->transform, &state->data.transform.transform);
|
||||
state->data.transform.category = gtk_transform_categorize (previous_state->transform);
|
||||
gsk_transform_to_matrix (previous_state->transform, &state->data.transform.transform);
|
||||
state->data.transform.category = gsk_transform_categorize (previous_state->transform);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -584,7 +584,7 @@ gtk_snapshot_ensure_affine (GtkSnapshot *snapshot,
|
||||
{
|
||||
const GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot);
|
||||
|
||||
if (gtk_transform_to_affine (current_state->transform, scale_x, scale_y, dx, dy))
|
||||
if (gsk_transform_to_affine (current_state->transform, scale_x, scale_y, dx, dy))
|
||||
return;
|
||||
|
||||
gtk_snapshot_autopush_transform (snapshot);
|
||||
@ -601,7 +601,7 @@ gtk_snapshot_ensure_translate (GtkSnapshot *snapshot,
|
||||
const GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot);
|
||||
float scale_x, scale_y;
|
||||
|
||||
if (gtk_transform_to_affine (current_state->transform, &scale_x, &scale_y, dx, dy) &&
|
||||
if (gsk_transform_to_affine (current_state->transform, &scale_x, &scale_y, dx, dy) &&
|
||||
scale_x == 1.0f && scale_y == 1.0f)
|
||||
return;
|
||||
|
||||
@ -1244,14 +1244,14 @@ gtk_snapshot_restore (GtkSnapshot *snapshot)
|
||||
**/
|
||||
void
|
||||
gtk_snapshot_transform (GtkSnapshot *snapshot,
|
||||
GtkTransform *transform)
|
||||
GskTransform *transform)
|
||||
{
|
||||
GtkSnapshotState *state;
|
||||
|
||||
g_return_if_fail (GTK_IS_SNAPSHOT (snapshot));
|
||||
|
||||
state = gtk_snapshot_get_current_state (snapshot);
|
||||
state->transform = gtk_transform_transform (state->transform, transform);
|
||||
state->transform = gsk_transform_transform (state->transform, transform);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1271,7 +1271,7 @@ gtk_snapshot_transform_matrix (GtkSnapshot *snapshot,
|
||||
g_return_if_fail (matrix != NULL);
|
||||
|
||||
state = gtk_snapshot_get_current_state (snapshot);
|
||||
state->transform = gtk_transform_matrix (state->transform, matrix);
|
||||
state->transform = gsk_transform_matrix (state->transform, matrix);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1285,7 +1285,7 @@ gtk_snapshot_transform_matrix_with_category (GtkSnapshot *snapshot,
|
||||
g_return_if_fail (matrix != NULL);
|
||||
|
||||
state = gtk_snapshot_get_current_state (snapshot);
|
||||
state->transform = gtk_transform_matrix_with_category (state->transform, matrix, category);
|
||||
state->transform = gsk_transform_matrix_with_category (state->transform, matrix, category);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1305,7 +1305,7 @@ gtk_snapshot_translate (GtkSnapshot *snapshot,
|
||||
g_return_if_fail (point != NULL);
|
||||
|
||||
state = gtk_snapshot_get_current_state (snapshot);
|
||||
state->transform = gtk_transform_translate (state->transform, point);
|
||||
state->transform = gsk_transform_translate (state->transform, point);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1325,7 +1325,7 @@ gtk_snapshot_translate_3d (GtkSnapshot *snapshot,
|
||||
g_return_if_fail (point != NULL);
|
||||
|
||||
state = gtk_snapshot_get_current_state (snapshot);
|
||||
state->transform = gtk_transform_translate_3d (state->transform, point);
|
||||
state->transform = gsk_transform_translate_3d (state->transform, point);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1345,7 +1345,7 @@ gtk_snapshot_rotate (GtkSnapshot *snapshot,
|
||||
g_return_if_fail (GTK_IS_SNAPSHOT (snapshot));
|
||||
|
||||
state = gtk_snapshot_get_current_state (snapshot);
|
||||
state->transform = gtk_transform_rotate (state->transform, angle);
|
||||
state->transform = gsk_transform_rotate (state->transform, angle);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1356,7 +1356,7 @@ gtk_snapshot_rotate (GtkSnapshot *snapshot,
|
||||
*
|
||||
* Rotates @snapshot's coordinate system by @angle degrees around @axis.
|
||||
*
|
||||
* For a rotation in 2D space, use gtk_transform_rotate().
|
||||
* For a rotation in 2D space, use gsk_transform_rotate().
|
||||
*/
|
||||
void
|
||||
gtk_snapshot_rotate_3d (GtkSnapshot *snapshot,
|
||||
@ -1369,7 +1369,7 @@ gtk_snapshot_rotate_3d (GtkSnapshot *snapshot,
|
||||
g_return_if_fail (axis != NULL);
|
||||
|
||||
state = gtk_snapshot_get_current_state (snapshot);
|
||||
state->transform = gtk_transform_rotate_3d (state->transform, angle, axis);
|
||||
state->transform = gsk_transform_rotate_3d (state->transform, angle, axis);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1393,7 +1393,7 @@ gtk_snapshot_scale (GtkSnapshot *snapshot,
|
||||
g_return_if_fail (GTK_IS_SNAPSHOT (snapshot));
|
||||
|
||||
state = gtk_snapshot_get_current_state (snapshot);
|
||||
state->transform = gtk_transform_scale (state->transform, factor_x, factor_y);
|
||||
state->transform = gsk_transform_scale (state->transform, factor_x, factor_y);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1416,7 +1416,7 @@ gtk_snapshot_scale_3d (GtkSnapshot *snapshot,
|
||||
g_return_if_fail (GTK_IS_SNAPSHOT (snapshot));
|
||||
|
||||
state = gtk_snapshot_get_current_state (snapshot);
|
||||
state->transform = gtk_transform_scale_3d (state->transform, factor_x, factor_y, factor_z);
|
||||
state->transform = gsk_transform_scale_3d (state->transform, factor_x, factor_y, factor_z);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -107,7 +107,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gtk_snapshot_restore (GtkSnapshot *snapshot);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_snapshot_transform (GtkSnapshot *snapshot,
|
||||
GtkTransform *transform);
|
||||
GskTransform *transform);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_snapshot_transform_matrix (GtkSnapshot *snapshot,
|
||||
const graphene_matrix_t*matrix);
|
||||
|
@ -35,7 +35,7 @@ struct _GtkSnapshotState {
|
||||
guint start_node_index;
|
||||
guint n_nodes;
|
||||
|
||||
GtkTransform * transform;
|
||||
GskTransform * transform;
|
||||
|
||||
GtkSnapshotCollectFunc collect_func;
|
||||
union {
|
||||
|
@ -45,7 +45,6 @@ typedef struct _GtkSettings GtkSettings;
|
||||
typedef GdkSnapshot GtkSnapshot;
|
||||
typedef struct _GtkStyleContext GtkStyleContext;
|
||||
typedef struct _GtkTooltip GtkTooltip;
|
||||
typedef struct _GtkTransform GtkTransform;
|
||||
typedef struct _GtkWidget GtkWidget;
|
||||
typedef struct _GtkWidgetPath GtkWidgetPath;
|
||||
typedef struct _GtkWindow GtkWindow;
|
||||
|
@ -62,7 +62,7 @@
|
||||
#include "gtksnapshotprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtktooltipprivate.h"
|
||||
#include "gtktransformprivate.h"
|
||||
#include "gsktransformprivate.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkversion.h"
|
||||
#include "gtkwidgetpaintableprivate.h"
|
||||
@ -4136,10 +4136,10 @@ gtk_widget_size_allocate (GtkWidget *widget,
|
||||
const GtkAllocation *allocation,
|
||||
int baseline)
|
||||
{
|
||||
GtkTransform *transform;
|
||||
GskTransform *transform;
|
||||
|
||||
if (allocation->x || allocation->y)
|
||||
transform = gtk_transform_translate (NULL, &GRAPHENE_POINT_INIT (allocation->x, allocation->y));
|
||||
transform = gsk_transform_translate (NULL, &GRAPHENE_POINT_INIT (allocation->x, allocation->y));
|
||||
else
|
||||
transform = NULL;
|
||||
|
||||
@ -4149,7 +4149,7 @@ gtk_widget_size_allocate (GtkWidget *widget,
|
||||
baseline,
|
||||
transform);
|
||||
|
||||
gtk_transform_unref (transform);
|
||||
gsk_transform_unref (transform);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4174,7 +4174,7 @@ gtk_widget_allocate (GtkWidget *widget,
|
||||
int width,
|
||||
int height,
|
||||
int baseline,
|
||||
GtkTransform *transform)
|
||||
GskTransform *transform)
|
||||
{
|
||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||
GdkRectangle adjusted;
|
||||
@ -4187,7 +4187,7 @@ gtk_widget_allocate (GtkWidget *widget,
|
||||
GtkCssStyle *style;
|
||||
GtkBorder margin, border, padding;
|
||||
graphene_matrix_t transform_matrix;
|
||||
GtkTransform *css_transform;
|
||||
GskTransform *css_transform;
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
GdkDisplay *display;
|
||||
#endif
|
||||
@ -4223,11 +4223,11 @@ gtk_widget_allocate (GtkWidget *widget,
|
||||
baseline_changed = priv->allocated_size_baseline != baseline;
|
||||
size_changed = (priv->allocated_width != width ||
|
||||
priv->allocated_height != height);
|
||||
transform_changed = !gtk_transform_equal (priv->allocated_transform, transform);
|
||||
transform_changed = !gsk_transform_equal (priv->allocated_transform, transform);
|
||||
|
||||
/* order is important, sometimes priv->allocated_transform == transform */
|
||||
gtk_transform_ref (transform);
|
||||
gtk_transform_unref (priv->allocated_transform);
|
||||
gsk_transform_ref (transform);
|
||||
gsk_transform_unref (priv->allocated_transform);
|
||||
priv->allocated_transform = transform;
|
||||
priv->allocated_width = width;
|
||||
priv->allocated_height = height;
|
||||
@ -4308,12 +4308,12 @@ gtk_widget_allocate (GtkWidget *widget,
|
||||
|
||||
if (css_transform)
|
||||
{
|
||||
transform = gtk_transform_translate (transform, &GRAPHENE_POINT_INIT (adjusted.x, adjusted.y));
|
||||
transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (adjusted.x, adjusted.y));
|
||||
adjusted.x = adjusted.y = 0;
|
||||
|
||||
transform = gtk_transform_translate (transform, &GRAPHENE_POINT_INIT (adjusted.width / 2, adjusted.height / 2));
|
||||
transform = gtk_transform_transform (transform, css_transform);
|
||||
transform = gtk_transform_translate (transform, &GRAPHENE_POINT_INIT (- adjusted.width / 2, - adjusted.height / 2));
|
||||
transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (adjusted.width / 2, adjusted.height / 2));
|
||||
transform = gsk_transform_transform (transform, css_transform);
|
||||
transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (- adjusted.width / 2, - adjusted.height / 2));
|
||||
}
|
||||
|
||||
get_box_margin (style, &margin);
|
||||
@ -4332,9 +4332,9 @@ gtk_widget_allocate (GtkWidget *widget,
|
||||
baseline -= margin.top + border.top + padding.top;
|
||||
|
||||
graphene_matrix_init_translate (&priv->transform, &GRAPHENE_POINT3D_INIT (adjusted.x, adjusted.y, 0));
|
||||
gtk_transform_to_matrix (transform, &transform_matrix);
|
||||
gsk_transform_to_matrix (transform, &transform_matrix);
|
||||
graphene_matrix_multiply (&priv->transform, &transform_matrix, &priv->transform);
|
||||
priv->transform_category = gtk_transform_categorize (transform);
|
||||
priv->transform_category = gsk_transform_categorize (transform);
|
||||
if (adjusted.x || adjusted.y)
|
||||
priv->transform_category = MIN (priv->transform_category, GSK_MATRIX_CATEGORY_2D_TRANSLATE);
|
||||
|
||||
@ -6220,7 +6220,7 @@ _gtk_widget_set_visible_flag (GtkWidget *widget,
|
||||
|
||||
if (!visible)
|
||||
{
|
||||
g_clear_pointer (&priv->allocated_transform, gtk_transform_unref);
|
||||
g_clear_pointer (&priv->allocated_transform, gsk_transform_unref);
|
||||
priv->allocated_width = 0;
|
||||
priv->allocated_height = 0;
|
||||
priv->allocated_size_baseline = 0;
|
||||
|
@ -407,7 +407,7 @@ void gtk_widget_allocate (GtkWidget *widget,
|
||||
int width,
|
||||
int height,
|
||||
int baseline,
|
||||
GtkTransform *transform);
|
||||
GskTransform *transform);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkSizeRequestMode gtk_widget_get_request_mode (GtkWidget *widget);
|
||||
|
@ -144,7 +144,7 @@ struct _GtkWidgetPrivate
|
||||
GtkStyleContext *context;
|
||||
|
||||
/* The widget's allocated size */
|
||||
GtkTransform *allocated_transform;
|
||||
GskTransform *allocated_transform;
|
||||
int allocated_width;
|
||||
int allocated_height;
|
||||
gint allocated_size_baseline;
|
||||
|
@ -375,7 +375,6 @@ gtk_public_sources = files([
|
||||
'gtktoolshell.c',
|
||||
'gtktooltip.c',
|
||||
'gtktooltipwindow.c',
|
||||
'gtktransform.c',
|
||||
'gtktreednd.c',
|
||||
'gtktreelistmodel.c',
|
||||
'gtktreemenu.c',
|
||||
@ -606,7 +605,6 @@ gtk_public_headers = files([
|
||||
'gtktoolitem.h',
|
||||
'gtktoolshell.h',
|
||||
'gtktooltip.h',
|
||||
'gtktransform.h',
|
||||
'gtktreednd.h',
|
||||
'gtktreelistmodel.h',
|
||||
'gtktreemodel.h',
|
||||
|
@ -104,7 +104,7 @@ gtk_transform_tester_size_allocate (GtkWidget *widget,
|
||||
int baseline)
|
||||
{
|
||||
GtkTransformTester *self = (GtkTransformTester *)widget;
|
||||
GtkTransform *global_transform;
|
||||
GskTransform *global_transform;
|
||||
int w, h;
|
||||
|
||||
if (!self->test_widget)
|
||||
@ -121,16 +121,16 @@ gtk_transform_tester_size_allocate (GtkWidget *widget,
|
||||
|
||||
global_transform = NULL;
|
||||
|
||||
global_transform = gtk_transform_translate (global_transform, &GRAPHENE_POINT_INIT (width / 2.0f, height / 2.0f));
|
||||
global_transform = gtk_transform_rotate (global_transform, scale);
|
||||
global_transform = gtk_transform_translate (global_transform, &GRAPHENE_POINT_INIT (-w / 2.0f, -h / 2.0f));
|
||||
global_transform = gsk_transform_translate (global_transform, &GRAPHENE_POINT_INIT (width / 2.0f, height / 2.0f));
|
||||
global_transform = gsk_transform_rotate (global_transform, scale);
|
||||
global_transform = gsk_transform_translate (global_transform, &GRAPHENE_POINT_INIT (-w / 2.0f, -h / 2.0f));
|
||||
|
||||
gtk_widget_allocate (self->test_widget,
|
||||
w, h,
|
||||
-1,
|
||||
global_transform);
|
||||
|
||||
gtk_transform_unref (global_transform);
|
||||
gsk_transform_unref (global_transform);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user