forked from AuroraMiddleware/gtk
Move gtk_rounded_rect_scale_affine to the right place
This function should live with the rest of the GskRoundedRect code in gskroundedrect.c.
This commit is contained in:
parent
b73c9e992f
commit
c60a316e22
@ -274,6 +274,31 @@ gsk_rounded_rect_shrink (GskRoundedRect *self,
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
gsk_rounded_rect_scale_affine (GskRoundedRect *dest,
|
||||
const GskRoundedRect *src,
|
||||
float scale_x,
|
||||
float scale_y,
|
||||
float dx,
|
||||
float dy)
|
||||
{
|
||||
guint flip = ((scale_x < 0) ? 1 : 0) + (scale_y < 0 ? 2 : 0);
|
||||
|
||||
g_assert (dest != src);
|
||||
|
||||
graphene_rect_scale (&src->bounds, scale_x, scale_y, &dest->bounds);
|
||||
graphene_rect_offset (&dest->bounds, dx, dy);
|
||||
|
||||
scale_x = fabs (scale_x);
|
||||
scale_y = fabs (scale_y);
|
||||
|
||||
for (guint i = 0; i < 4; i++)
|
||||
{
|
||||
dest->corner[i].width = src->corner[i ^ flip].width * scale_x;
|
||||
dest->corner[i].height = src->corner[i ^ flip].height * scale_y;
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX: Find a better name */
|
||||
gboolean
|
||||
gsk_rounded_rect_is_circular (const GskRoundedRect *self)
|
||||
|
@ -17,6 +17,13 @@ G_BEGIN_DECLS
|
||||
}}
|
||||
|
||||
|
||||
void gsk_rounded_rect_scale_affine (GskRoundedRect *dest,
|
||||
const GskRoundedRect *src,
|
||||
float scale_x,
|
||||
float scale_y,
|
||||
float dx,
|
||||
float dy);
|
||||
|
||||
gboolean gsk_rounded_rect_is_circular (const GskRoundedRect *self);
|
||||
|
||||
void gsk_rounded_rect_path (const GskRoundedRect *self,
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "gsktransformprivate.h"
|
||||
|
||||
#include "gsk/gskrendernodeprivate.h"
|
||||
#include "gsk/gskroundedrectprivate.h"
|
||||
|
||||
#include "gtk/gskpango.h"
|
||||
|
||||
@ -708,29 +709,6 @@ gtk_graphene_rect_scale_affine (const graphene_rect_t *rect,
|
||||
graphene_rect_normalize (res);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_rounded_rect_scale_affine (GskRoundedRect *dest,
|
||||
const GskRoundedRect *src,
|
||||
float scale_x,
|
||||
float scale_y,
|
||||
float dx,
|
||||
float dy)
|
||||
{
|
||||
guint flip;
|
||||
guint i;
|
||||
|
||||
g_assert (dest != src);
|
||||
|
||||
gtk_graphene_rect_scale_affine (&src->bounds, scale_x, scale_y, dx, dy, &dest->bounds);
|
||||
flip = ((scale_x < 0) ? 1 : 0) + (scale_y < 0 ? 2 : 0);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
dest->corner[i].width = src->corner[i ^ flip].width * fabsf (scale_x);
|
||||
dest->corner[i].height = src->corner[i ^ flip].height * fabsf (scale_y);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_snapshot_ensure_affine (GtkSnapshot *snapshot,
|
||||
float *scale_x,
|
||||
@ -1099,7 +1077,7 @@ gtk_snapshot_push_rounded_clip (GtkSnapshot *snapshot,
|
||||
gtk_snapshot_collect_rounded_clip,
|
||||
NULL);
|
||||
|
||||
gtk_rounded_rect_scale_affine (&state->data.rounded_clip.bounds, bounds, scale_x, scale_y, dx, dy);
|
||||
gsk_rounded_rect_scale_affine (&state->data.rounded_clip.bounds, bounds, scale_x, scale_y, dx, dy);
|
||||
}
|
||||
|
||||
static GskRenderNode *
|
||||
@ -2441,7 +2419,7 @@ gtk_snapshot_append_border (GtkSnapshot *snapshot,
|
||||
g_return_if_fail (border_color != NULL);
|
||||
|
||||
gtk_snapshot_ensure_affine (snapshot, &scale_x, &scale_y, &dx, &dy);
|
||||
gtk_rounded_rect_scale_affine (&real_outline, outline, scale_x, scale_y, dx, dy);
|
||||
gsk_rounded_rect_scale_affine (&real_outline, outline, scale_x, scale_y, dx, dy);
|
||||
|
||||
node = gsk_border_node_new (&real_outline, border_width, border_color);
|
||||
|
||||
@ -2478,7 +2456,7 @@ gtk_snapshot_append_inset_shadow (GtkSnapshot *snapshot,
|
||||
g_return_if_fail (color != NULL);
|
||||
|
||||
gtk_snapshot_ensure_affine (snapshot, &scale_x, &scale_y, &x, &y);
|
||||
gtk_rounded_rect_scale_affine (&real_outline, outline, scale_x, scale_y, x, y);
|
||||
gsk_rounded_rect_scale_affine (&real_outline, outline, scale_x, scale_y, x, y);
|
||||
|
||||
node = gsk_inset_shadow_node_new (&real_outline,
|
||||
color,
|
||||
@ -2520,7 +2498,7 @@ gtk_snapshot_append_outset_shadow (GtkSnapshot *snapshot,
|
||||
g_return_if_fail (color != NULL);
|
||||
|
||||
gtk_snapshot_ensure_affine (snapshot, &scale_x, &scale_y, &x, &y);
|
||||
gtk_rounded_rect_scale_affine (&real_outline, outline, scale_x, scale_y, x, y);
|
||||
gsk_rounded_rect_scale_affine (&real_outline, outline, scale_x, scale_y, x, y);
|
||||
|
||||
node = gsk_outset_shadow_node_new (&real_outline,
|
||||
color,
|
||||
|
Loading…
Reference in New Issue
Block a user