forked from AuroraMiddleware/gtk
transform: Make category public API
Also rename it from GskMatrixCategory to GskTransformCategory.
This commit is contained in:
parent
791bf0c2eb
commit
3cc84d2860
@ -152,6 +152,9 @@ GskTransform
|
||||
gsk_transform_ref
|
||||
gsk_transform_unref
|
||||
<SUBSECTION>
|
||||
GskTransformCategory
|
||||
gsk_transform_get_category
|
||||
<SUBSECTION>
|
||||
gsk_transform_print
|
||||
gsk_transform_to_string
|
||||
gsk_transform_to_matrix
|
||||
|
@ -796,16 +796,16 @@ render_transform_node (GskGLRenderer *self,
|
||||
RenderOpBuilder *builder)
|
||||
{
|
||||
GskTransform *node_transform = gsk_transform_node_get_transform (node);
|
||||
const GskMatrixCategory category = gsk_transform_categorize (node_transform);
|
||||
const GskTransformCategory category = gsk_transform_get_category (node_transform);
|
||||
GskRenderNode *child = gsk_transform_node_get_child (node);
|
||||
|
||||
switch (category)
|
||||
{
|
||||
case GSK_MATRIX_CATEGORY_IDENTITY:
|
||||
case GSK_TRANSFORM_CATEGORY_IDENTITY:
|
||||
gsk_gl_renderer_add_render_ops (self, child, builder);
|
||||
break;
|
||||
|
||||
case GSK_MATRIX_CATEGORY_2D_TRANSLATE:
|
||||
case GSK_TRANSFORM_CATEGORY_2D_TRANSLATE:
|
||||
{
|
||||
float dx, dy;
|
||||
|
||||
@ -820,7 +820,7 @@ render_transform_node (GskGLRenderer *self,
|
||||
}
|
||||
break;
|
||||
|
||||
case GSK_MATRIX_CATEGORY_2D_AFFINE:
|
||||
case GSK_TRANSFORM_CATEGORY_2D_AFFINE:
|
||||
{
|
||||
graphene_matrix_t mat;
|
||||
|
||||
@ -831,9 +831,10 @@ render_transform_node (GskGLRenderer *self,
|
||||
}
|
||||
break;
|
||||
|
||||
case GSK_MATRIX_CATEGORY_UNKNOWN:
|
||||
case GSK_MATRIX_CATEGORY_ANY:
|
||||
case GSK_MATRIX_CATEGORY_INVERTIBLE:
|
||||
case GSK_TRANSFORM_CATEGORY_UNKNOWN:
|
||||
case GSK_TRANSFORM_CATEGORY_ANY:
|
||||
case GSK_TRANSFORM_CATEGORY_3D:
|
||||
case GSK_TRANSFORM_CATEGORY_2D:
|
||||
default:
|
||||
{
|
||||
const float min_x = child->bounds.origin.x;
|
||||
@ -1426,7 +1427,7 @@ render_outset_shadow_node (GskGLRenderer *self,
|
||||
op.op = OP_CLEAR;
|
||||
ops_add (builder, &op);
|
||||
prev_projection = ops_set_projection (builder, &item_proj);
|
||||
ops_set_modelview (builder, &identity, GSK_MATRIX_CATEGORY_IDENTITY);
|
||||
ops_set_modelview (builder, &identity, GSK_TRANSFORM_CATEGORY_IDENTITY);
|
||||
prev_viewport = ops_set_viewport (builder, &GRAPHENE_RECT_INIT (0, 0, texture_width, texture_height));
|
||||
|
||||
/* Draw outline */
|
||||
@ -2644,7 +2645,7 @@ add_offscreen_ops (GskGLRenderer *self,
|
||||
op.op = OP_CLEAR;
|
||||
ops_add (builder, &op);
|
||||
prev_projection = ops_set_projection (builder, &item_proj);
|
||||
ops_set_modelview (builder, &identity, GSK_MATRIX_CATEGORY_IDENTITY);
|
||||
ops_set_modelview (builder, &identity, GSK_TRANSFORM_CATEGORY_IDENTITY);
|
||||
prev_viewport = ops_set_viewport (builder,
|
||||
&GRAPHENE_RECT_INIT (bounds->origin.x * scale,
|
||||
bounds->origin.y * scale,
|
||||
@ -2905,7 +2906,7 @@ gsk_gl_renderer_do_render (GskRenderer *renderer,
|
||||
render_op_builder.current_opacity = 1.0f;
|
||||
render_op_builder.render_ops = self->render_ops;
|
||||
ops_set_modelview (&render_op_builder, &modelview,
|
||||
scale_factor == 1 ? GSK_MATRIX_CATEGORY_IDENTITY : GSK_MATRIX_CATEGORY_2D_AFFINE);
|
||||
scale_factor == 1 ? GSK_TRANSFORM_CATEGORY_IDENTITY : GSK_TRANSFORM_CATEGORY_2D_AFFINE);
|
||||
|
||||
/* Initial clip is self->render_region! */
|
||||
if (self->render_region != NULL)
|
||||
|
@ -65,22 +65,23 @@ extract_matrix_metadata (const graphene_matrix_t *m,
|
||||
{
|
||||
switch (md->category)
|
||||
{
|
||||
case GSK_MATRIX_CATEGORY_IDENTITY:
|
||||
case GSK_TRANSFORM_CATEGORY_IDENTITY:
|
||||
md->scale_x = 1;
|
||||
md->scale_y = 1;
|
||||
break;
|
||||
|
||||
case GSK_MATRIX_CATEGORY_2D_TRANSLATE:
|
||||
case GSK_TRANSFORM_CATEGORY_2D_TRANSLATE:
|
||||
md->translate_x = graphene_matrix_get_value (m, 3, 0);
|
||||
md->translate_y = graphene_matrix_get_value (m, 3, 1);
|
||||
md->scale_x = 1;
|
||||
md->scale_y = 1;
|
||||
break;
|
||||
|
||||
case GSK_MATRIX_CATEGORY_UNKNOWN:
|
||||
case GSK_MATRIX_CATEGORY_ANY:
|
||||
case GSK_MATRIX_CATEGORY_INVERTIBLE:
|
||||
case GSK_MATRIX_CATEGORY_2D_AFFINE:
|
||||
case GSK_TRANSFORM_CATEGORY_UNKNOWN:
|
||||
case GSK_TRANSFORM_CATEGORY_ANY:
|
||||
case GSK_TRANSFORM_CATEGORY_3D:
|
||||
case GSK_TRANSFORM_CATEGORY_2D:
|
||||
case GSK_TRANSFORM_CATEGORY_2D_AFFINE:
|
||||
{
|
||||
graphene_vec3_t col1;
|
||||
graphene_vec3_t col2;
|
||||
@ -121,21 +122,22 @@ ops_transform_bounds_modelview (const RenderOpBuilder *builder,
|
||||
|
||||
switch (head->metadata.category)
|
||||
{
|
||||
case GSK_MATRIX_CATEGORY_IDENTITY:
|
||||
case GSK_TRANSFORM_CATEGORY_IDENTITY:
|
||||
*dst = *src;
|
||||
break;
|
||||
|
||||
case GSK_MATRIX_CATEGORY_2D_TRANSLATE:
|
||||
case GSK_TRANSFORM_CATEGORY_2D_TRANSLATE:
|
||||
*dst = *src;
|
||||
dst->origin.x += head->metadata.translate_x;
|
||||
dst->origin.y += head->metadata.translate_y;
|
||||
break;
|
||||
|
||||
/* TODO: Handle scale */
|
||||
case GSK_MATRIX_CATEGORY_2D_AFFINE:
|
||||
case GSK_MATRIX_CATEGORY_UNKNOWN:
|
||||
case GSK_MATRIX_CATEGORY_ANY:
|
||||
case GSK_MATRIX_CATEGORY_INVERTIBLE:
|
||||
case GSK_TRANSFORM_CATEGORY_UNKNOWN:
|
||||
case GSK_TRANSFORM_CATEGORY_ANY:
|
||||
case GSK_TRANSFORM_CATEGORY_3D:
|
||||
case GSK_TRANSFORM_CATEGORY_2D:
|
||||
case GSK_TRANSFORM_CATEGORY_2D_AFFINE:
|
||||
default:
|
||||
graphene_matrix_transform_bounds (builder->current_modelview,
|
||||
src,
|
||||
@ -333,7 +335,7 @@ ops_set_modelview_internal (RenderOpBuilder *builder,
|
||||
void
|
||||
ops_set_modelview (RenderOpBuilder *builder,
|
||||
const graphene_matrix_t *mv,
|
||||
GskMatrixCategory mv_category)
|
||||
GskTransformCategory mv_category)
|
||||
{
|
||||
MatrixStackEntry *entry;
|
||||
|
||||
@ -363,7 +365,7 @@ ops_set_modelview (RenderOpBuilder *builder,
|
||||
void
|
||||
ops_push_modelview (RenderOpBuilder *builder,
|
||||
const graphene_matrix_t *mv,
|
||||
GskMatrixCategory mv_category)
|
||||
GskTransformCategory mv_category)
|
||||
{
|
||||
float scale = ops_get_scale (builder);
|
||||
MatrixStackEntry *entry;
|
||||
|
@ -25,7 +25,7 @@ typedef struct
|
||||
float dx_before;
|
||||
float dy_before;
|
||||
|
||||
GskMatrixCategory category;
|
||||
GskTransformCategory category;
|
||||
} OpsMatrixMetadata;
|
||||
|
||||
typedef struct
|
||||
@ -281,10 +281,10 @@ void ops_dump_framebuffer (RenderOpBuilder *builder,
|
||||
void ops_finish (RenderOpBuilder *builder);
|
||||
void ops_push_modelview (RenderOpBuilder *builder,
|
||||
const graphene_matrix_t *mv,
|
||||
GskMatrixCategory mv_category);
|
||||
GskTransformCategory mv_category);
|
||||
void ops_set_modelview (RenderOpBuilder *builder,
|
||||
const graphene_matrix_t *mv,
|
||||
GskMatrixCategory mv_category);
|
||||
GskTransformCategory mv_category);
|
||||
void ops_pop_modelview (RenderOpBuilder *builder);
|
||||
float ops_get_scale (const RenderOpBuilder *builder);
|
||||
|
||||
|
@ -170,4 +170,42 @@ typedef enum {
|
||||
GSK_SERIALIZATION_INVALID_DATA
|
||||
} GskSerializationError;
|
||||
|
||||
/**
|
||||
* GskTransformCategory:
|
||||
* @GSK_TRANSFORM_CATEGORY_UNKNOWN: The category of the matrix has not been
|
||||
* determined.
|
||||
* @GSK_TRANSFORM_CATEGORY_ANY: Analyzing the matrix concluded that it does
|
||||
* not fit in any other category.
|
||||
* @GSK_TRANSFORM_CATEGORY_2D: The matrix is a 3D matrix. This means that
|
||||
* the w column (the last column) has the values (0, 0, 0, 1).
|
||||
* @GSK_TRANSFORM_CATEGORY_2D: The matrix is a 2D matrix. This is equivalent
|
||||
* to graphene_matrix_is_2d() returning %TRUE. In particular, this
|
||||
* means that Cairo can deal with the matrix.
|
||||
* @GSK_TRANSFORM_CATEGORY_2D_AFFINE: The matrix is a combination of 2D scale
|
||||
* and 2D translation operations. In particular, this means that any
|
||||
* rectangle can be transformed exactly using this matrix.
|
||||
* @GSK_TRANSFORM_CATEGORY_2D_TRANSLATE: The matrix is a 2D translation.
|
||||
* @GSK_TRANSFORM_CATEGORY_IDENTITY: The matrix is the identity matrix.
|
||||
*
|
||||
* The categories of matrices relevant for GSK and GTK. Note that any
|
||||
* category includes matrices of all later categories. So if you want
|
||||
* to for example check if a matrix is a 2D matrix,
|
||||
* `category >= GSK_TRANSFORM_CATEGORY_2D` is the way to do this.
|
||||
*
|
||||
* Also keep in mind that rounding errors may cause matrices to not
|
||||
* conform to their categories. Otherwise, matrix operations done via
|
||||
* mutliplication will not worsen categories. So for the matrix
|
||||
* multiplication `C = A * B`, `category(C) = MIN (category(A), category(B))`.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GSK_TRANSFORM_CATEGORY_UNKNOWN,
|
||||
GSK_TRANSFORM_CATEGORY_ANY,
|
||||
GSK_TRANSFORM_CATEGORY_3D,
|
||||
GSK_TRANSFORM_CATEGORY_2D,
|
||||
GSK_TRANSFORM_CATEGORY_2D_AFFINE,
|
||||
GSK_TRANSFORM_CATEGORY_2D_TRANSLATE,
|
||||
GSK_TRANSFORM_CATEGORY_IDENTITY
|
||||
} GskTransformCategory;
|
||||
|
||||
#endif /* __GSK_TYPES_H__ */
|
||||
|
@ -2441,7 +2441,7 @@ gsk_transform_node_serialize (GskRenderNode *node)
|
||||
graphene_matrix_to_float (&matrix, mat);
|
||||
|
||||
return g_variant_new (GSK_TRANSFORM_NODE_VARIANT_TYPE,
|
||||
gsk_transform_categorize (self->transform),
|
||||
gsk_transform_get_category (self->transform),
|
||||
(double) mat[0], (double) mat[1], (double) mat[2], (double) mat[3],
|
||||
(double) mat[4], (double) mat[5], (double) mat[6], (double) mat[7],
|
||||
(double) mat[8], (double) mat[9], (double) mat[10], (double) mat[11],
|
||||
|
@ -6,44 +6,6 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/*<private>
|
||||
* GskMatrixCategory:
|
||||
* @GSK_MATRIX_CATEGORY_UNKNOWN: The category of the matrix has not been
|
||||
* determined.
|
||||
* @GSK_MATRIX_CATEGORY_ANY: Analyzing the matrix concluded that it does
|
||||
* not fit in any other category.
|
||||
* @GSK_MATRIX_CATEGORY_INVERTIBLE: The matrix is linear independant and
|
||||
* should therefor be invertible. Note that this is not guaranteed
|
||||
* to actually be true due to rounding errors when inverting.
|
||||
* @GSK_MATRIX_CATEGORY_2D: The matrix is a 2D matrix. This is equivalent
|
||||
* to graphene_matrix_is_2d() returning %TRUE. In particular, this
|
||||
* means that Cairo can deal with the matrix.
|
||||
* @GSK_MATRIX_CATEGORY_2D_AFFINE: The matrix is a combination of 2D scale
|
||||
* and 2D translation operations. In particular, this means that any
|
||||
* rectangle can be transformed exactly using this matrix.
|
||||
* @GSK_MATRIX_CATEGORY_2D_TRANSLATE: The matrix is a 2D translation.
|
||||
* @GSK_MATRIX_CATEGORY_IDENTITY: The matrix is the identity matrix.
|
||||
*
|
||||
* The categories of matrices relevant for GSK and GTK. Note that any
|
||||
* category includes matrices of all later categories. So if you want
|
||||
* to for example check if a matrix is a 2D matrix,
|
||||
* `category >= GSK_MATRIX_CATEGORY_2D` is the way to do this.
|
||||
*
|
||||
* Also keep in mind that rounding errors may cause matrices to not
|
||||
* conform to their categories. Otherwise, matrix operations done via
|
||||
* mutliplication will not worsen categories. So for the matrix
|
||||
* multiplication `C = A * B`, `category(C) = MIN (category(A), category(B))`.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GSK_MATRIX_CATEGORY_UNKNOWN,
|
||||
GSK_MATRIX_CATEGORY_ANY,
|
||||
GSK_MATRIX_CATEGORY_INVERTIBLE,
|
||||
GSK_MATRIX_CATEGORY_2D_AFFINE,
|
||||
GSK_MATRIX_CATEGORY_2D_TRANSLATE,
|
||||
GSK_MATRIX_CATEGORY_IDENTITY
|
||||
} GskMatrixCategory;
|
||||
|
||||
typedef struct _GskRenderNodeClass GskRenderNodeClass;
|
||||
|
||||
#define GSK_IS_RENDER_NODE_TYPE(node,type) (GSK_IS_RENDER_NODE (node) && (node)->node_class->node_type == (type))
|
||||
|
@ -53,7 +53,7 @@ struct _GskTransformClass
|
||||
const char *type_name;
|
||||
|
||||
void (* finalize) (GskTransform *transform);
|
||||
GskMatrixCategory (* categorize) (GskTransform *transform);
|
||||
GskTransformCategory (* categorize) (GskTransform *transform);
|
||||
void (* to_matrix) (GskTransform *transform,
|
||||
graphene_matrix_t *out_matrix);
|
||||
gboolean (* apply_2d) (GskTransform *transform,
|
||||
@ -124,10 +124,10 @@ gsk_identity_transform_finalize (GskTransform *transform)
|
||||
{
|
||||
}
|
||||
|
||||
static GskMatrixCategory
|
||||
static GskTransformCategory
|
||||
gsk_identity_transform_categorize (GskTransform *transform)
|
||||
{
|
||||
return GSK_MATRIX_CATEGORY_IDENTITY;
|
||||
return GSK_TRANSFORM_CATEGORY_IDENTITY;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -254,7 +254,7 @@ struct _GskMatrixTransform
|
||||
GskTransform parent;
|
||||
|
||||
graphene_matrix_t matrix;
|
||||
GskMatrixCategory category;
|
||||
GskTransformCategory category;
|
||||
};
|
||||
|
||||
static void
|
||||
@ -262,7 +262,7 @@ gsk_matrix_transform_finalize (GskTransform *self)
|
||||
{
|
||||
}
|
||||
|
||||
static GskMatrixCategory
|
||||
static GskTransformCategory
|
||||
gsk_matrix_transform_categorize (GskTransform *transform)
|
||||
{
|
||||
GskMatrixTransform *self = (GskMatrixTransform *) transform;
|
||||
@ -302,25 +302,26 @@ gsk_matrix_transform_apply_affine (GskTransform *transform,
|
||||
|
||||
switch (self->category)
|
||||
{
|
||||
case GSK_MATRIX_CATEGORY_UNKNOWN:
|
||||
case GSK_MATRIX_CATEGORY_ANY:
|
||||
case GSK_MATRIX_CATEGORY_INVERTIBLE:
|
||||
case GSK_TRANSFORM_CATEGORY_UNKNOWN:
|
||||
case GSK_TRANSFORM_CATEGORY_ANY:
|
||||
case GSK_TRANSFORM_CATEGORY_3D:
|
||||
case GSK_TRANSFORM_CATEGORY_2D:
|
||||
default:
|
||||
return FALSE;
|
||||
|
||||
case GSK_MATRIX_CATEGORY_2D_AFFINE:
|
||||
case GSK_TRANSFORM_CATEGORY_2D_AFFINE:
|
||||
*out_dx += *out_scale_x * graphene_matrix_get_value (&self->matrix, 3, 0);
|
||||
*out_dy += *out_scale_y * graphene_matrix_get_value (&self->matrix, 3, 1);
|
||||
*out_scale_x *= graphene_matrix_get_value (&self->matrix, 0, 0);
|
||||
*out_scale_y *= graphene_matrix_get_value (&self->matrix, 1, 1);
|
||||
return TRUE;
|
||||
|
||||
case GSK_MATRIX_CATEGORY_2D_TRANSLATE:
|
||||
case GSK_TRANSFORM_CATEGORY_2D_TRANSLATE:
|
||||
*out_dx += *out_scale_x * graphene_matrix_get_value (&self->matrix, 3, 0);
|
||||
*out_dy += *out_scale_y * graphene_matrix_get_value (&self->matrix, 3, 1);
|
||||
return TRUE;
|
||||
|
||||
case GSK_MATRIX_CATEGORY_IDENTITY:
|
||||
case GSK_TRANSFORM_CATEGORY_IDENTITY:
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -334,19 +335,20 @@ gsk_matrix_transform_apply_translate (GskTransform *transform,
|
||||
|
||||
switch (self->category)
|
||||
{
|
||||
case GSK_MATRIX_CATEGORY_UNKNOWN:
|
||||
case GSK_MATRIX_CATEGORY_ANY:
|
||||
case GSK_MATRIX_CATEGORY_INVERTIBLE:
|
||||
case GSK_MATRIX_CATEGORY_2D_AFFINE:
|
||||
case GSK_TRANSFORM_CATEGORY_UNKNOWN:
|
||||
case GSK_TRANSFORM_CATEGORY_ANY:
|
||||
case GSK_TRANSFORM_CATEGORY_3D:
|
||||
case GSK_TRANSFORM_CATEGORY_2D:
|
||||
case GSK_TRANSFORM_CATEGORY_2D_AFFINE:
|
||||
default:
|
||||
return FALSE;
|
||||
|
||||
case GSK_MATRIX_CATEGORY_2D_TRANSLATE:
|
||||
case GSK_TRANSFORM_CATEGORY_2D_TRANSLATE:
|
||||
*out_dx += graphene_matrix_get_value (&self->matrix, 3, 0);
|
||||
*out_dy += graphene_matrix_get_value (&self->matrix, 3, 1);
|
||||
return TRUE;
|
||||
|
||||
case GSK_MATRIX_CATEGORY_IDENTITY:
|
||||
case GSK_TRANSFORM_CATEGORY_IDENTITY:
|
||||
return TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
@ -421,7 +423,7 @@ static const GskTransformClass GSK_TRANSFORM_TRANSFORM_CLASS =
|
||||
GskTransform *
|
||||
gsk_transform_matrix_with_category (GskTransform *next,
|
||||
const graphene_matrix_t *matrix,
|
||||
GskMatrixCategory category)
|
||||
GskTransformCategory category)
|
||||
{
|
||||
GskMatrixTransform *result = gsk_transform_alloc (&GSK_TRANSFORM_TRANSFORM_CLASS, next);
|
||||
|
||||
@ -444,7 +446,7 @@ GskTransform *
|
||||
gsk_transform_matrix (GskTransform *next,
|
||||
const graphene_matrix_t *matrix)
|
||||
{
|
||||
return gsk_transform_matrix_with_category (next, matrix, GSK_MATRIX_CATEGORY_UNKNOWN);
|
||||
return gsk_transform_matrix_with_category (next, matrix, GSK_TRANSFORM_CATEGORY_UNKNOWN);
|
||||
}
|
||||
|
||||
/*** TRANSLATE ***/
|
||||
@ -463,15 +465,15 @@ gsk_translate_transform_finalize (GskTransform *self)
|
||||
{
|
||||
}
|
||||
|
||||
static GskMatrixCategory
|
||||
static GskTransformCategory
|
||||
gsk_translate_transform_categorize (GskTransform *transform)
|
||||
{
|
||||
GskTranslateTransform *self = (GskTranslateTransform *) transform;
|
||||
|
||||
if (self->point.z != 0.0)
|
||||
return GSK_MATRIX_CATEGORY_INVERTIBLE;
|
||||
return GSK_TRANSFORM_CATEGORY_3D;
|
||||
|
||||
return GSK_MATRIX_CATEGORY_2D_TRANSLATE;
|
||||
return GSK_TRANSFORM_CATEGORY_2D_TRANSLATE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -650,10 +652,10 @@ gsk_rotate_transform_finalize (GskTransform *self)
|
||||
{
|
||||
}
|
||||
|
||||
static GskMatrixCategory
|
||||
static GskTransformCategory
|
||||
gsk_rotate_transform_categorize (GskTransform *transform)
|
||||
{
|
||||
return GSK_MATRIX_CATEGORY_INVERTIBLE;
|
||||
return GSK_TRANSFORM_CATEGORY_3D;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -821,15 +823,15 @@ gsk_scale_transform_finalize (GskTransform *self)
|
||||
{
|
||||
}
|
||||
|
||||
static GskMatrixCategory
|
||||
static GskTransformCategory
|
||||
gsk_scale_transform_categorize (GskTransform *transform)
|
||||
{
|
||||
GskScaleTransform *self = (GskScaleTransform *) transform;
|
||||
|
||||
if (self->factor_z != 1.0)
|
||||
return GSK_MATRIX_CATEGORY_INVERTIBLE;
|
||||
return GSK_TRANSFORM_CATEGORY_3D;
|
||||
|
||||
return GSK_MATRIX_CATEGORY_2D_AFFINE;
|
||||
return GSK_TRANSFORM_CATEGORY_2D_AFFINE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1315,21 +1317,21 @@ gsk_transform_equal (GskTransform *first,
|
||||
return first->transform_class->equal (first, second);
|
||||
}
|
||||
|
||||
/*<private>
|
||||
* gsk_transform_categorize:
|
||||
* @self: (allow-none): A matrix
|
||||
/**
|
||||
* gsk_transform_get_category:
|
||||
* @self: (allow-none): A #GskTransform
|
||||
*
|
||||
* Returns the category this transform belongs to.
|
||||
*
|
||||
*
|
||||
* Returns: The category this matrix belongs to
|
||||
* Returns: The category of the transform
|
||||
**/
|
||||
GskMatrixCategory
|
||||
gsk_transform_categorize (GskTransform *self)
|
||||
GskTransformCategory
|
||||
gsk_transform_get_category (GskTransform *self)
|
||||
{
|
||||
if (self == NULL)
|
||||
return GSK_MATRIX_CATEGORY_IDENTITY;
|
||||
return GSK_TRANSFORM_CATEGORY_IDENTITY;
|
||||
|
||||
return MIN (gsk_transform_categorize (self->next),
|
||||
return MIN (gsk_transform_get_category (self->next),
|
||||
self->transform_class->categorize (self));
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#error "Only <gsk/gsk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gsk/gskenums.h>
|
||||
#include <gsk/gsktypes.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@ -66,6 +67,8 @@ gboolean gsk_transform_to_translate (GskTransform
|
||||
float *out_dx,
|
||||
float *out_dy) G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GskTransformCategory gsk_transform_get_category (GskTransform *self) G_GNUC_PURE;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gsk_transform_equal (GskTransform *first,
|
||||
GskTransform *second) G_GNUC_PURE;
|
||||
|
@ -28,11 +28,9 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GskMatrixCategory gsk_transform_categorize (GskTransform *self);
|
||||
|
||||
GskTransform * gsk_transform_matrix_with_category (GskTransform *next,
|
||||
const graphene_matrix_t*matrix,
|
||||
GskMatrixCategory category);
|
||||
GskTransformCategory category);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -1270,7 +1270,7 @@ gtk_snapshot_transform_matrix (GtkSnapshot *snapshot,
|
||||
void
|
||||
gtk_snapshot_transform_matrix_with_category (GtkSnapshot *snapshot,
|
||||
const graphene_matrix_t *matrix,
|
||||
GskMatrixCategory category)
|
||||
GskTransformCategory category)
|
||||
{
|
||||
GtkSnapshotState *state;
|
||||
|
||||
|
@ -104,7 +104,7 @@ GtkSnapshot * gtk_snapshot_new_with_parent (GtkSnapshot
|
||||
void gtk_snapshot_transform_matrix_with_category
|
||||
(GtkSnapshot *snapshot,
|
||||
const graphene_matrix_t*matrix,
|
||||
GskMatrixCategory category);
|
||||
GskTransformCategory category);
|
||||
void gtk_snapshot_append_text (GtkSnapshot *snapshot,
|
||||
PangoFont *font,
|
||||
PangoGlyphString *glyphs,
|
||||
|
@ -4334,9 +4334,9 @@ gtk_widget_allocate (GtkWidget *widget,
|
||||
graphene_matrix_init_translate (&priv->transform, &GRAPHENE_POINT3D_INIT (adjusted.x, adjusted.y, 0));
|
||||
gsk_transform_to_matrix (transform, &transform_matrix);
|
||||
graphene_matrix_multiply (&priv->transform, &transform_matrix, &priv->transform);
|
||||
priv->transform_category = gsk_transform_categorize (transform);
|
||||
priv->transform_category = gsk_transform_get_category (transform);
|
||||
if (adjusted.x || adjusted.y)
|
||||
priv->transform_category = MIN (priv->transform_category, GSK_MATRIX_CATEGORY_2D_TRANSLATE);
|
||||
priv->transform_category = MIN (priv->transform_category, GSK_TRANSFORM_CATEGORY_2D_TRANSLATE);
|
||||
|
||||
if (!alloc_needed && !size_changed && !baseline_changed)
|
||||
{
|
||||
|
@ -150,7 +150,7 @@ struct _GtkWidgetPrivate
|
||||
gint allocated_size_baseline;
|
||||
|
||||
graphene_matrix_t transform;
|
||||
GskMatrixCategory transform_category;
|
||||
GskTransformCategory transform_category;
|
||||
int width;
|
||||
int height;
|
||||
int baseline;
|
||||
|
@ -890,12 +890,13 @@ populate_render_node_properties (GtkListStore *store,
|
||||
case GSK_TRANSFORM_NODE:
|
||||
{
|
||||
static const char * category_names[] = {
|
||||
[GSK_MATRIX_CATEGORY_UNKNOWN] = "unknown",
|
||||
[GSK_MATRIX_CATEGORY_ANY] = "any",
|
||||
[GSK_MATRIX_CATEGORY_INVERTIBLE] = "invertible",
|
||||
[GSK_MATRIX_CATEGORY_2D_AFFINE] = "2D affine",
|
||||
[GSK_MATRIX_CATEGORY_2D_TRANSLATE] = "2D transform",
|
||||
[GSK_MATRIX_CATEGORY_IDENTITY] = "identity"
|
||||
[GSK_TRANSFORM_CATEGORY_UNKNOWN] = "unknown",
|
||||
[GSK_TRANSFORM_CATEGORY_ANY] = "any",
|
||||
[GSK_TRANSFORM_CATEGORY_3D] = "3D",
|
||||
[GSK_TRANSFORM_CATEGORY_2D] = "2D",
|
||||
[GSK_TRANSFORM_CATEGORY_2D_AFFINE] = "2D affine",
|
||||
[GSK_TRANSFORM_CATEGORY_2D_TRANSLATE] = "2D translate",
|
||||
[GSK_TRANSFORM_CATEGORY_IDENTITY] = "identity"
|
||||
};
|
||||
GskTransform *transform;
|
||||
char *s;
|
||||
@ -904,7 +905,7 @@ populate_render_node_properties (GtkListStore *store,
|
||||
s = gsk_transform_to_string (transform);
|
||||
add_text_row (store, "Matrix", s);
|
||||
g_free (s);
|
||||
add_text_row (store, "Category", category_names[gsk_transform_categorize (transform)]);
|
||||
add_text_row (store, "Category", category_names[gsk_transform_get_category (transform)]);
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user