mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 23:58:25 +02:00
Abstract CAIRO_ALPHA_IS_OPAQUE out for general internal use.
Optimize to defer to cairo_paint if the alpha value is actually opaque.
This commit is contained in:
parent
f15ec64e7f
commit
ab668278b0
4 changed files with 17 additions and 1 deletions
|
|
@ -1,3 +1,12 @@
|
|||
2005-06-20 Carl Worth <cworth@cworth.org>
|
||||
|
||||
* src/cairoint.h:
|
||||
* src/cairo-pattern.c: (_cairo_pattern_is_opaque_solid): Abstract
|
||||
CAIRO_ALPHA_IS_OPAQUE out for general internal use.
|
||||
|
||||
* src/cairo.c: (cairo_paint_with_alpha): Optimize to defer to
|
||||
cairo_paint if the alpha value is actually opaque.
|
||||
|
||||
2005-06-20 Carl Worth <cworth@cworth.org>
|
||||
|
||||
* src/cairo.h:
|
||||
|
|
|
|||
|
|
@ -1115,7 +1115,7 @@ _cairo_pattern_is_opaque_solid (cairo_pattern_t *pattern)
|
|||
|
||||
solid = (cairo_solid_pattern_t *) pattern;
|
||||
|
||||
return (solid->color.alpha >= ((double)0xff00 / (double)0xffff));
|
||||
return CAIRO_ALPHA_IS_OPAQUE (solid->color.alpha);
|
||||
}
|
||||
|
||||
static cairo_int_status_t
|
||||
|
|
|
|||
|
|
@ -1249,6 +1249,11 @@ cairo_paint_with_alpha (cairo_t *cr,
|
|||
return;
|
||||
}
|
||||
|
||||
if (CAIRO_ALPHA_IS_OPAQUE (alpha)) {
|
||||
cairo_paint (cr);
|
||||
return;
|
||||
}
|
||||
|
||||
_cairo_color_init_rgba (&color, 1., 1., 1., alpha);
|
||||
_cairo_pattern_init_solid (&pattern.solid, &color);
|
||||
|
||||
|
|
|
|||
|
|
@ -147,6 +147,8 @@ typedef cairo_fixed_16_16_t cairo_fixed_t;
|
|||
#define CAIRO_MAXSHORT SHRT_MAX
|
||||
#define CAIRO_MINSHORT SHRT_MIN
|
||||
|
||||
#define CAIRO_ALPHA_IS_OPAQUE(alpha) ((alpha) >= ((double)0xff00 / (double)0xffff))
|
||||
|
||||
typedef struct _cairo_point {
|
||||
cairo_fixed_t x;
|
||||
cairo_fixed_t y;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue