cairo-texture: Use an internal function for create_region()

Avoid double argument checking, and a deprecation warning when
implementing create() as a wrapper around create_region(), by using
a simple internal function.
This commit is contained in:
Emmanuele Bassi 2011-11-02 12:48:31 +00:00
parent b19c919645
commit f4e971a7e5

View File

@ -757,49 +757,19 @@ intersect_rectangles (cairo_rectangle_int_t *a,
}
}
/**
* clutter_cairo_texture_create_region:
* @self: a #ClutterCairoTexture
* @x_offset: offset of the region on the X axis
* @y_offset: offset of the region on the Y axis
* @width: width of the region, or -1 for the full surface width
* @height: height of the region, or -1 for the full surface height
*
* Creates a new Cairo context that will updat the region defined
* by @x_offset, @y_offset, @width and @height.
*
* <warning><para>Do not call this function within the paint virtual
* function or from a callback to the #ClutterActor::paint
* signal.</para></warning>
*
* Return value: a newly created Cairo context. Use cairo_destroy()
* to upload the contents of the context when done drawing
*
* Since: 1.0
*
* Deprecated: 1.8: Use the #ClutterCairoTexture::draw signal and
* clutter_cairo_texture_invalidate_rectangle() to obtain a
* clipped Cairo context for 2D drawing.
*/
cairo_t *
clutter_cairo_texture_create_region (ClutterCairoTexture *self,
gint x_offset,
gint y_offset,
gint width,
gint height)
static cairo_t *
clutter_cairo_texture_create_region_internal (ClutterCairoTexture *self,
gint x_offset,
gint y_offset,
gint width,
gint height)
{
ClutterCairoTexturePrivate *priv;
DrawContext *ctxt;
ClutterCairoTexturePrivate *priv = self->priv;
cairo_rectangle_int_t region, area, inter;
cairo_surface_t *surface;
DrawContext *ctxt;
cairo_t *cr;
g_return_val_if_fail (CLUTTER_IS_CAIRO_TEXTURE (self), NULL);
clutter_warn_if_paint_fail (self);
priv = self->priv;
if (width < 0)
width = priv->surface_width;
@ -842,6 +812,46 @@ clutter_cairo_texture_create_region (ClutterCairoTexture *self,
return cr;
}
/**
* clutter_cairo_texture_create_region:
* @self: a #ClutterCairoTexture
* @x_offset: offset of the region on the X axis
* @y_offset: offset of the region on the Y axis
* @width: width of the region, or -1 for the full surface width
* @height: height of the region, or -1 for the full surface height
*
* Creates a new Cairo context that will updat the region defined
* by @x_offset, @y_offset, @width and @height.
*
* <warning><para>Do not call this function within the paint virtual
* function or from a callback to the #ClutterActor::paint
* signal.</para></warning>
*
* Return value: a newly created Cairo context. Use cairo_destroy()
* to upload the contents of the context when done drawing
*
* Since: 1.0
*
* Deprecated: 1.8: Use the #ClutterCairoTexture::draw signal and
* clutter_cairo_texture_invalidate_rectangle() to obtain a
* clipped Cairo context for 2D drawing.
*/
cairo_t *
clutter_cairo_texture_create_region (ClutterCairoTexture *self,
gint x_offset,
gint y_offset,
gint width,
gint height)
{
g_return_val_if_fail (CLUTTER_IS_CAIRO_TEXTURE (self), NULL);
clutter_warn_if_paint_fail (self);
return clutter_cairo_texture_create_region_internal (self,
x_offset, y_offset,
width, height);
}
/**
* clutter_cairo_texture_invalidate_rectangle:
* @self: a #ClutterCairoTexture
@ -953,7 +963,7 @@ clutter_cairo_texture_create (ClutterCairoTexture *self)
clutter_warn_if_paint_fail (self);
return clutter_cairo_texture_create_region (self, 0, 0, -1, -1);
return clutter_cairo_texture_create_region_internal (self, 0, 0, -1, -1);
}
/**