Commit Graph

7 Commits

Author SHA1 Message Date
Emmanuele Bassi
c93cd4a096 [docs] Documentation fixes for CairoTexture
Sync up the arguments name inside the gtk-doc annotations with their
name inside the function declaration in the header file.
2008-12-19 17:48:30 +00:00
Neil Roberts
64de0411ea [cairo-texture] Remove the construct only restriction on surface size
It is possible to change the surface size after construction with
clutter_cairo_texture_set_surface_size so it doesn't seem right to
restrict changing the properties.

clutter_cairo_texture_resize_surface_internal is called in a handler
for the notify signal. It is called there rather than directly in the
set_property handler so that changing both properties in a single
g_object_set will only cause one resize. The constructed override is
no longer needed.

resize_surface_internal will now bail out if the size of the surface
is already the right size.
2008-12-19 15:35:14 +00:00
Emmanuele Bassi
e130e0c9b3 [cairo-texture] Silently discard 0x0 surfaces
The current CairoTexture can be created with a surface size of 0
by 0 pixels, but a warning will be printed.

Worse, the surface can be resized to be 0 by 0 pixels without a
warning. The :surface-width and :surface-height properties accept
a minimum value of 0, and not check is performed on either the
constructor or set_surface_size() parameters to enforce the "greater
than zero" rule.

The correct and consistent behaviour is to allow a 0 by 0 pixels
surface size everywhere; inside surface_resize_internal(), the
current surface will be destroyed and if either :surface-width or
:surface-height are set to 0, the resizing terminates.

Attempting to create a Cairo context from a CairoTexture with
either :surface-width or :surface-height set to 0 will result in
a warning.

This allows:

  - creating a CairoTexture with :surface-width or :surface-height
    set to zero and delaying the surface resize at a later point;
  - resizing the surface to 0 by 0 pixels to destroy the image
    surface used internally;
  - increase the consistency in the usage of CairoTexture.
2008-12-17 15:58:11 +00:00
Emmanuele Bassi
0e1a3c2124 Warn instead of returning in the IN_PAINT check
It's conceivable that a warning should be deemed enough, instead
of just returning a NULL cairo_t when creating a context for the
CairoTexture actor.
2008-12-12 11:42:16 +00:00
Emmanuele Bassi
4d34872dea Small documentation fixes
Fix the CairoTexture description, and some of the comments inside
the code, especially with regards to the alpha channel unpremultiplication
that we have to perform each time we upload the image surface to
GL.
2008-12-11 15:51:24 +00:00
Emmanuele Bassi
cf9dea7cf6 Print a warning when creating a cairo_t while painting
If you create a Cairo context in the middle of a paint run and then
you destroy it, the CairoTexture will have to upload the contents of
the image surface to the GL pipeline. This usually leads to slow
downs and general performance degradation.

ClutterCairoTexture will warn to the console if Clutter has been
compiled with the debug messages and if create() or create_region()
are called while an actor is in the middle of a paint.
2008-12-11 15:48:43 +00:00
Emmanuele Bassi
e934ad03ca Add ClutterCairoTexture
Move the ClutterCairo actor from a separate library to an in-tree
actor.

ClutterCairoTexture is a simple texture subclass that allows you
to retrieve a Cairo context for a private image surface. When the
Cairo context is destroyed it will cause the image surface
contents to be uploaded to a GL texture.

The image surface used is not hardware accelerated.
2008-12-11 15:34:47 +00:00