1
0
Fork 0
Commit graph

3991 commits

Author SHA1 Message Date
Neil Roberts
289e880efd cogl-pipeline-glsl: Don't use gl_PointCoord on OpenGL
We don't want to use gl_PointCoord to implement point sprites on big
GL because in that case we already use glTexEnv(GL_COORD_REPLACE) to
replace the texture coords with the point sprite coords. Although GL
also supports the gl_PointCoord variable, it requires GLSL 1.2 which
would mean we would have to declare the GLSL version and check for
it. We continue to use gl_PointCoord for GLES2 because it has no
glTexEnv function.
2010-11-24 18:06:44 +00:00
Neil Roberts
a50010fb40 Remove the fragment shader generation from the GLES2 wrapper
The GLES2 wrapper no longer needs to generate any fragment shader
state because the GLSL pipeline backend will always give the wrapper a
custom fragment shader. This simplifies a lot of the state comparison
done by the wrapper. The fog generation is also removed even though
it's actually part of the vertex shader because only the fixed
function pipeline backend actually calls the fog functions so it would
be disabled when using any of the other backends anyway. We can fix
this when the two shader backends also start generating vertex
shaders.
2010-11-24 18:06:44 +00:00
Neil Roberts
987e3c32dc Disable the fixed function backend for GLES2
GLES2 doesn't really support fixed function so if we disable it we can
remove the fixed function wrappers from the GLES2 Cogl backend.
2010-11-24 18:06:44 +00:00
Neil Roberts
3504491b46 cogl-pipeline-glsl: Generate the alpha test snippet under GLES2
GLES2 has no glAlphaFunc function so we need to simulate the behaviour
in the fragment shader. The alpha test function is simulated with an
if-statement and a discard statement. The reference value is stored as
a uniform.
2010-11-24 18:06:44 +00:00
Neil Roberts
c3582b77df cogl-pipeline: Add getters for the alpha test state
This adds two public functions:

 cogl_pipeline_get_alpha_test_function
   and
 cogl_pipeline_get_alpha_test_reference.
2010-11-24 18:06:44 +00:00
Neil Roberts
959846326f cogl: Separate out state flags for the alpha test func and ref
Previously the flag to mark the differences for the alpha test
function and reference value were conflated into one. However this is
awkward when generating shader code to simulate the alpha testing for
GLES 2 because in that case changing the function would need a
different program but changing the reference value just requires
updating a uniform. This patch makes the function and reference have
their own state flags.
2010-11-24 18:06:44 +00:00
Neil Roberts
124441aade Remove the disabling of layer constants for GLES2
The GLSL shader generation supports layer combine constants so there's
no need to disable it for GLES2. It looks like there was also code for
it in the GLES2 wrapper so I'm not sure why it was disabled in the
first place.
2010-11-24 18:06:44 +00:00
Neil Roberts
3fa73735c0 Generate GLSL in the CoglPipeline GLSL backend
The GLSL pipeline backend can now generate code to represent the
pipeline state in a similar way to the ARBfp backend. Most of the code
for this is taken from the GLES 2 wrapper.
2010-11-24 18:06:43 +00:00
Neil Roberts
6246c2bd6c Move the cogl shader boilerplate setting code to a separate function
_cogl_shader_compile_real had some code to create a set of strings to
combine the boilerplate code with a shader before calling
glShaderSource. This has now been moved to its own internal function
so that it could be used from the GLSL pipeline backend as well.
2010-11-24 18:06:43 +00:00
Neil Roberts
339fc68bcb Move need_texture_combine_separate to cogl-pipeline
need_texture_combine_separate is moved to cogl-pipeline.c and renamed
to _cogl_pipeline_need_texture_combine_separate. The function is
needed by both the ARBfp and GLSL codegen backends so it makes sense to
share it.
2010-11-24 18:06:43 +00:00
Neil Roberts
9bbb088a2a Move find_arbfp_authority to cogl-pipeline.c
The code for finding the arbfp authority for a pipeline should be the
same as finding the GLSL authority. So that the code can be shared the
function has been moved to cogl-pipeline.c and renamed to
_cogl_pipeline_find_codegen_authority.
2010-11-24 18:06:43 +00:00
Neil Roberts
e57a132f94 cogl: Rename arbfp_source_buffer to fragment_source_buffer
Only one of the material backends can be generating code at the same
time so it seems to make sense to share the same source buffer between
arbfp and glsl. The new name is fragment_source_buffer in case we
later want to create a new buffer for the vertex shader. That probably
couldn't share the same buffer because it will likely need to be
generated at the same time.
2010-11-24 18:06:43 +00:00
Evan Nemerson
9b5c90f441 cogl: Include exported pacakges information in GIR
http://bugzilla.clutter-project.org/show_bug.cgi?id=2438
2010-11-24 17:18:17 +00:00
Chris Lord
f687ec6a22 docs: Update documentation to reflect automatic map/unmap/etc.
Update the ClutterActor documentation to reflect the new automatic
map/unmap/realize/unrealize implementations.
2010-11-24 16:51:59 +00:00
Chris Lord
186d5698ce actor: Use the internal child list for map/unmap
Use the internal child list for the default map/unmap vfuncs. This removes
the requirement for non-container composite actors to implement their own
map/unmap functions.
2010-11-24 16:51:59 +00:00
Robert Bragg
4752cc38b2 actor: re-work unrealize to work with composite actors
Unrealizing an actor is a recursive process that needs to traverse the
children of an actor to ensure they are also unrealized. This maintains
the invariant that if any given actor is marked as unrealized then you
know that all its children have also been unrealized.

The previous implementation would use the container interface's
foreach_with_internals vfunc to explicitly traverse the children of
container actors but this didn't consider composite actors that aren't
containers.

Since clutter-actor now maintains an explicit list of children we can
also handle composite actors that aren't containers using
_clutter_actor_traverse.
2010-11-24 16:51:59 +00:00
Robert Bragg
4bda674732 actor: make _clutter_actor_traverse more flexible
This makes it possible to choose the traversal order; either depth first
or breadth first and when visiting actors in a depth first order there
is now a callback called before children are traversed and one called
after. Some tasks such as unrealizing actors need to explicitly control
the traversal order to maintain the invariable that all children of an
actor are unrealized before we actually mark the parent as unrealized.

The callbacks are now passed the relative depth in the graph of the
actor being visited and instead of only being able to return a boolean
to bail out of further traversal it can now do one of: continue,
skip_children or break. To implement something like unrealize it's
desirable to skip children that you find have already been unrealized.
2010-11-24 16:51:59 +00:00
Owen W. Taylor
9df6f0c524 ClutterX11TexturePixmap: Optimize ConfigureEvent handling
ClutterX11TexturePixmap watches for configure events to tell when it
needs to name a new pixmap for the window. However, ConfigureEvents
occur on moves in addition to resizes, and doing round trips and
naming new pixmaps every time a window is moved is a real performance
killer.

Add clutter_x11_texture_pixmap_sync_window_internal() that takes the
size/position of the window as arguments rather than always calling
XGetWindowAttributes. This allows us to bypass all work other than
notifying the window-x/window-y properties when we get a ConfigurEvent
for a move.

The last received width/height is saved to allow us to also omit
XGetWindowAttributes on MapNotify events.

The public clutter_x11_texture_pixmap_sync_window() becomes a bit less
efficient since we no longer combine the roundtrips for
XGetWindowAttributes() and XCompositeNameWindowPixmap(), but it appears
to have no callers in current publicly available code.

Several FIXME's are added for areas where there are still weird things
going on in the code or improvements could be made.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2356
2010-11-24 16:19:21 +00:00
Owen W. Taylor
8b4034cd06 Use FBOs and use cogl_read_pixels() to efficiently read partial textures
* cogl_texture_get_data() is converted to use
   _cogl_texture_foreach_sub_texture_in_region() to iterate
  through the underlying textures.

 * When we need to read only a portion of the underlying
   texture, we set up a FBO and use _cogl_read_pixels()
   to read the portion we need. This is enormously more
   efficient for reading a small portion of a large atlas
   texture.

 * The CoglAtlasTexture, CoglSubTexture, and CoglTexture2dSliced
   implementation of get_texture() are removed.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2414
2010-11-24 15:56:35 +00:00
Neil Roberts
519b6fe6f2 cogl-framebuffer: Try to track format of the framebuffer
Previously in cogl_read_pixels we assume the format of the framebuffer
is always premultiplied because that is the most likely format with
the default Cogl blend mode. However when the framebuffer is bound to
a texture we should be able to make a better guess at the format
because we know the texture keeps track of the premult status. This
patch adds an internal format member to CoglFramebuffer. For onscreen
framebuffers we still assume it is RGBA_8888_PRE but for offscreen to
textures we copy the texture format. cogl_read_pixels uses this to
determine whether the data returned by glReadPixels will be
premultiplied.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2414
2010-11-24 15:56:35 +00:00
Neil Roberts
08e1d7f574 cogl_read_pixels: Fix the format used in GLES2
When converting the data in cogl_read_pixels it was using bmp_format
instead of the format passed in to the function. bmp_format is the
same as the passed in format except that it always has the premult bit
set. Therefore the conversion would not handle premultiply correctly.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2414
2010-11-24 15:56:35 +00:00
Neil Roberts
2bd054f886 Add an internal _cogl_read_pixels_with_rowstride
This is the same as _cogl_read_pixels except that it takes a rowstride
parameter for the destination buffer. Under OpenGL setting the
rowstride this will end up calling GL_ROW_LENGTH so that the buffer
region can be directly written to. Under GLES GL_ROW_LENGTH is not
supported so it will use an intermediate buffer as it does if the
format is not GL_RGBA.

cogl_read_pixels now just calls the full version of the function with
the rowstride set to width*bpp.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2414
2010-11-24 15:56:34 +00:00
Neil Roberts
b4016f64fa Add an internal _cogl_offscreen_new_to_texture_full function
This function is the same as cogl_offscreen_new_to_texture but it
takes a level parameter and a set of flags so that FBOs can be used to
render to higher mipmap levels and to disable the depth and stencil
buffers. cogl_offscreen_new_to_texture now just calls the new function
with the level set to zero. This function could be useful in a few
places in Cogl where we want to use FBOs as an implementation detail
such as when copying between textures.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2414
2010-11-24 15:56:34 +00:00
Robert Bragg
a53b9febcd stage: if backend _ignoring_redraw_clips queue full redraw
In clutter_stage_real_queue_redraw we were checking to see if the
backend will ignore any subsequent redraw_clip so we can avoid the cost
of projecting the paint-volume of an actor into stage coordinates, but
we weren't ensuring that a full redraw would be queued instead we just
bailed out immediately. This makes sure to call
_clutter_stage_window_add_redraw_clip (stage_window, NULL) in this case
to make sure the backend will do an un-clipped redraw.
2010-11-24 15:09:47 +00:00
Robert Bragg
5f181f7265 stage-window: tweak has_redraw_clips semantics
This tweaks the semantics of the has_redraw_clips vfunc so we can assume
that at the start of a new frame there is an implied, initial,
redraw_clip that clips everything (i.e. nothing would be redrawn) so in
that case we would expect the has_redraw_clips vfunc to return True at
the start of a new frame for backends that support clipping.

Previously there was an ambiguity when this function returned False
since it could either mean a full screen redraw had been queued or it
could mean that the clip state wasn't yet initialized for that frame.
This would result in _clutter_stage_has_full_redraw_queued() returning
True at the start of a new frame even before any actors have been
updated, which in turn meant we would incorrectly ignore queue_redraw
requests for actors, believing them to be redundant.
2010-11-24 15:09:47 +00:00
Emmanuele Bassi
446107f19d x11: Check for initialized context when enabling ARGB visuals
Instead of using the backend singleton. This allows lazy initialization
of Clutter.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2435
2010-11-24 12:02:38 +00:00
Tomeu Vizoso
6a552e27ab Fix API docs for ClutterShaderEffects
It can implement now both fragment and vertex shaders.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2442
2010-11-24 11:51:42 +00:00
Robert Bragg
65d0ce607e stage: Report an unknown paint volume.
Previously we were leaving it up to the default implementation of
get_paint_volume in ClutterGroup to handle the stage by determining the
bounding box of all contained children. This isn't the true bounding box
of the stage though since the stage is responsible for clearing the
entire framebuffer at the start of the frame. This adds a
get_paint_volume implementation for ClutterStage which simply returns
False which means Clutter has to assume it covers everything.
2010-11-23 16:31:49 +00:00
Robert Bragg
52bf38c38c x11: only queue clipped redraw for Expose
When we handle Expose events we try and queue a clipped redraw of the
stage, but for some reason we were also redundantly calling
clutter_actor_queue_redraw for the stage which would negate the request
to queue a clipped redraw.
2010-11-23 16:31:49 +00:00
Neil Roberts
1b7c895a2d cogl-texture-driver-gles: Fix image height for uploading 3D textures
When uploading a 3D texture with an awkward rowstride, on GLES Cogl
will copy the images to an intermediate buffer to pass to GL. However
it was using the wrong height when copying the data so it would end up
overflowing the buffer and crashing.
2010-11-23 14:12:17 +00:00
Emmanuele Bassi
01c6ccfa13 pipeline: Use WrapModeInternal in the Layer struct
Since we're using CoglPipelineWrapModeInternal in the internal API
anyway, and the compiler complains loudly when comparing two enumeration
types without casting, the PipelineLayer struct should store the
wrap modes using the internal enumeration.
2010-11-23 13:08:25 +00:00
Owen W. Taylor
8e6fac38fa Don't update or use last_paint_box when painting inside a clone
The last_paint_box for an actor represents its "normal" position - we
shouldn't update it or use it to cull drawing if we are painting
a clone of the actor. Tracking whether we are painting a clone is
done by adding  _clutter_actor_push/pop_clone_paint() and a global
"clone paint level".

http://bugzilla.clutter-project.org/show_bug.cgi?id=2396
2010-11-23 12:50:29 +00:00
Robert Bragg
c68280556e clip-stack: combine modelview-projection in set_clip_planes
When using clip planes and we we have to project some vertices into
screen coordinates we used to transform those by the modelview and then
the projection matrix separately. Now we combine the modelview and
projection matrix and then use that to transform the vertices in one
step instead.
2010-11-23 12:50:29 +00:00
Robert Bragg
99f4832c28 journal: remove possability of fallback layers
When logging quads in the journal it used to be possible to specify a
mask of fallback layers (layers where a default white texture should be
used in-place of the corresponding texture in the current source
pipeline). Since we now handle fallbacks for cogl_rectangle* primitives
when validating the pipeline up-front before logging in the journal we
no longer need the ability for the journal to apply fallbacks too.
2010-11-23 12:50:29 +00:00
Robert Bragg
305bb124b7 use cogl_matrix_transform_points in clutter
When transforming a paint-volume or transforming allocation vertices we
are transforming more than one point at a time so we can batch those
together with cogl_matrix_transform_points instead of
cogl_matrix_transform_point. Also in both of these cases we don't need
to do a projective transform so using cogl_matrix_transform_points also
lets us reduce the per-vertex computation.
2010-11-23 12:50:29 +00:00
Robert Bragg
2dba3e8cbf matrix: Adds experimental cogl_matrix_{transform,project}_points
This add two new function that allows us to transform or project an
array of points instead of only transforming one point at a time. Recent
benchmarking has shown cogl_matrix_transform_point to be a bottleneck
sometimes, so this should allow us to reduce the overhead when
transforming lots of vertices at the same time, and also reduce the cost
of 3 component, non-projective transforms.

For now they are marked as experimental (you have to define
COGL_ENABLE_EXPERIMENTAL_API) because there is some concern that it
introduces some inconsistent naming. cogl_matrix_transform_point would
have to be renamed cogl_matrix_project_point to be consistent, but that
would be an API break.
2010-11-23 12:50:29 +00:00
Robert Bragg
4307e65f93 primitives: validate with _cogl_pipeline_foreach_layer
Switch _cogl_rectangles_with_multitexture_coords to using
_cogl_pipeline_foreach_layer to iterate the layers of a pipeline when
validating instead of iterating the pipelines internal list, which is
risky since any modifications to pipelines (even to an override pipeline
derived from the original), could potentially corrupt the list as it is
being iterated.
2010-11-23 12:50:28 +00:00
Robert Bragg
fb564cc2ca cogl: remove WrapModeOverrides from FlushOptions
This removes the possibility to specify wrap mode overrides within a
CoglPipelineFlushOptions struct since the right way to handle these
overrides is by copying the user's material and making the changes to
that copy before flushing. All primitives code has already switched away
from using these wrap mode overrides so this patch just removes unused
code and types. It also remove the wrap_mode_overrides argument for
_cogl_journal_log_quad.
2010-11-23 12:50:28 +00:00
Emmanuele Bassi
b8c9ee7e88 x11: Ignore NULL settings
Prevent a segfault when dealing with XSETTINGS_ACTION_DELETE.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2441
2010-11-23 10:26:15 +00:00
Emmanuele Bassi
1db8b8a70e color: Do not shadow a variable
Avoid a warning.
2010-11-22 17:01:17 +00:00
Emmanuele Bassi
f4531aef4b color: And finally, add hsla() support
Missed it when reading the CSS spec.
2010-11-22 15:07:01 +00:00
Emmanuele Bassi
e86db85cd2 color: Support the CSS hsl() notation
Since we support the rgb() and rgba() notations we might as well also
support the hsl() one.
2010-11-22 15:02:47 +00:00
Emmanuele Bassi
ab6da347f6 color: Support CSS color definitions
The CSS Color Module 3, available at:

  http://www.w3.org/TR/css3-color/

allows defining colors as:

  rgb ( r, g, b )
  rgba ( r, g, b, a)

along with the usual hexadecimal and named notations.

The r, g, and b channels can be:

  • integers between 0 and 255
  • percentages, between 0% and 100%

The alpha channel, if included using the rgba() modifier, can be a
floating point value between 0.0 and 1.0.

The ClutterColor parser should support this notation.
2010-11-22 14:38:44 +00:00
Emmanuele Bassi
b674fcf3bb build: Add missing cogl-shader-boilerplate.h 2010-11-20 10:47:22 +00:00
Emmanuele Bassi
be3040fd2b build: Add a missing file 2010-11-19 18:30:06 +00:00
Emmanuele Bassi
e30b7b2d5a build: Don't reference non-existing files 2010-11-19 18:15:49 +00:00
Emmanuele Bassi
d39277d0cf actor: Reset the last paint box on unmap
This allows hiding + moving + showing an actor without repainting the
wrong area.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2395
2010-11-19 14:49:00 +00:00
Owen W. Taylor
346d3e40a3 Free state at the end of a journal flush
At the end of flushing the journal, we need to free the vertex
attributes and vertex array.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2423
2010-11-19 13:27:30 +00:00
Owen W. Taylor
1299672b5a Actually free buffer objects
With the refactoring to centralize code into CoglBuffer,
_cogl_buffer_fini() was never actually implemented, so all GL
vertex and index buffer objects were leaked.

The duplicate call to glDeleteBuffers() in CoglPixelArray is
removed (it wasn't paying attention to whether the buffer had been
allocated as a PBO or not.)

http://bugzilla.clutter-project.org/show_bug.cgi?id=2423
2010-11-19 13:27:30 +00:00
Robert Bragg
a5c30398df egl: Adds support for clipped redraws
This adds egl backend support for handling clipped redraws. This uses
the EGL_NOK_swap_region extension to enable the EGL backend to present a
subregion from the back buffer to the front so we don't always have to
redraw the entire stage for small updates.
2010-11-19 13:27:30 +00:00
Robert Bragg
a4d3208eb5 debug: Adds a COGL_DEBUG=wireframe option
This adds a COGL_DEBUG=wireframe option to visualize the underlying
geometry of the primitives being drawn via Cogl. This works for triangle
list, triangle fan, triangle strip and quad (internal only) primitives.
It also works for indexed vertex arrays.
2010-11-19 13:27:30 +00:00
Robert Bragg
78ac92f8e5 vertex-buffer: don't unref NULL object
In cogl_vertex_buffer_indices_get_for_quads() we sometimes have to
extend the length of an existing array, but when we came to unref the
previous array we didn't first check that it wasn't simply NULL.
2010-11-19 13:27:30 +00:00
Robert Bragg
f473c213fc vertex-array: Adds data arg for _vertex_array_new()
This adds an optional data argument for cogl_vertex_array_new() since it
seems that mostly every case where we use this API we follow up with a
cogl_buffer_set_data() matching the size of the new array. This
simplifies all those cases and whenever we want to delay uploading of
data then NULL can simply be passed.
2010-11-19 13:27:30 +00:00
Robert Bragg
804dd5d5fc indices: Makes cogl_indices_get_array public
This makes the previously internal only _cogl_indices_get_array API
public as cogl_indices_get_array (Though marked as experimental)
2010-11-19 13:27:30 +00:00
Robert Bragg
dfc671da59 build: cogl-clip-state.h depends on cogl-clip-stack.h
This adds a #include "cogl-clip-stack.h" to cogl-clip-state.h which
depends on the CoglClipStack typedef.
2010-11-19 13:27:30 +00:00
Robert Bragg
6f68bb3656 debug: disable-culling was disabling clipped redraws
there was a typo and the disable-culling option was actually disabling
clipped redraws.
2010-11-19 12:55:55 +00:00
Emmanuele Bassi
694632ce95 build: Re-arrange headers
Try to minimize the included headers, especially in clutter-actor.h.
2010-11-18 18:23:49 +00:00
Emmanuele Bassi
63cef64d17 docs: Fix some wrong function/signal/property names 2010-11-18 15:21:16 +00:00
Emmanuele Bassi
a35708eb74 Deprecate ClutterBehaviour and sub-classes
The Behaviour class and its implementations have been replaced by the
new animation framework API and by the constraints for layout-related
animations.

Currently, we need to make tests build, so we undef DISABLE_DEPRECATED
in specific test cases while they get ported.
2010-11-18 15:21:16 +00:00
Emmanuele Bassi
71a838815f timeline: Add :reverse property
The :reverse property removes the pattern of connecting to the
::completed signal of a Timeline to change the direction.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2408
2010-11-18 15:18:19 +00:00
Emmanuele Bassi
1ce47bb562 docs: Remove unnecessary '#'
The hash is confusing gtk-doc.
2010-11-18 15:04:33 +00:00
Emmanuele Bassi
a94ea93bde paint-volume: Do not take a reference on the actor
The paint volume structure is cached in the Actor it references, and
this causes a reference cycle.

The paint volume is going to be used when painting, so the actor must
still be valid - otherwise Clutter will bail out far before than
accessing the actor pointer in ClutterPaintVolume.

Otherwise, we could have used dispose() to check for a valid actor and
remove a reference if the actor field is !NULL; it feels less clean,
though, since we're effectively managing an extra reference on
ourselves.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2431
2010-11-18 11:11:03 +00:00
Emmanuele Bassi
0371ba3976 actor: Group bitfields together 2010-11-18 11:10:59 +00:00
Emmanuele Bassi
8f60d5a3a2 Start using the monotonic API in GLib ≥ 2.27
Starting from the 2.27 cycle, GLib is exposing a monotonic clock with
microseconds granularity throughout the time-based API. We can start
using it, given that the old, non-monotonic version is going to be
deprecated by the same cycle.
2010-11-17 16:19:10 +00:00
Emmanuele Bassi
68d7a5e847 Move away from GTimeVal
GLib 2.28 will deprecate GTimeVal and related API in favour of
standardizing on microseconds granularity for all time-based API.

Clutter should switch too.

All of the current users of GTimeVal convert to milliseconds when
doing time operations, and use GTimeVal only as storage. This can
effectively be replaced by a gint64.

The Master Clock uses a microsecond resolution, except when interacting
with the main loop itself, since the main loop has a millisecond
resolution - at least until Ryan Lortie manages to switch that too to
microseconds on Linux.

The clutter_timeline_do_tick() function was erroneously not privatized,
but it was still assumed to be private; we should just remove it from
the public symbols.
2010-11-17 16:19:10 +00:00
Emmanuele Bassi
8b047d0bc9 docs: Move the constraints example picture about the source code 2010-11-17 12:49:10 +00:00
Emmanuele Bassi
e5da5b0907 shaders: Fix the usage of the Cogl GLSL variables 2010-11-17 12:47:46 +00:00
Emmanuele Bassi
f96113705d docs: Fix closing tag 2010-11-17 12:14:02 +00:00
Emmanuele Bassi
a731682ac3 actor: Simple show/hide optimizations
Showing a visible (and hiding an invisible) actor is far less cheap than
it should be.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2422
2010-11-17 08:32:55 +00:00
Emmanuele Bassi
a32f781144 docs: Break down the constraints example 2010-11-17 08:32:54 +00:00
Emmanuele Bassi
2950cb3e78 docs: Fix Since tags for PaintVolume-related API 2010-11-15 16:02:15 +00:00
Emmanuele Bassi
b7fa13a52f docs: Add introductory section on Constraints
Use the snap-constraint code for the example code and screenshot.
2010-11-15 16:00:49 +00:00
Emmanuele Bassi
3c15c0c9bb Add SnapConstraint
A SnapConstraint is a constraint that "snaps" the edges of two actors
together.
2010-11-15 16:00:49 +00:00
Emmanuele Bassi
b3f5a6e2ba actor: Do not queue relayouts on actors being destroyed
Simple optimization is simple.
2010-11-15 16:00:48 +00:00
Emmanuele Bassi
0523d6db08 actor: Add a get_debug_name() private Actor method
For internal usage, writing:

  clutter_actor_get_name (actor) != NULL
    ? clutter_actor_get_name (actor)
    : G_OBJECT_TYPE_NAME (actor)

is overly verbose and does two type checks. A simple, internal method
for getting the same result without type checks would be much more
appreciated.
2010-11-15 16:00:48 +00:00
Emmanuele Bassi
5f9df7e3a0 Fix compilation warning by using the correct type 2010-11-15 15:36:41 +00:00
Emmanuele Bassi
e80035331b Use the right string in the font settings debug blurb 2010-11-14 23:06:53 +00:00
Emmanuele Bassi
e6bc65b5c3 text: Do not segfault with NULL :font-name
Make sure that we have a fall back in place for the default font name
string, and use g_strcmp0 to protect ourselves from NULL strings.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2417
2010-11-14 23:06:48 +00:00
Owen W. Taylor
9249bd8411 xsettings: don't use the xsettings watch function functionality
The "watch" function functionality in xsettings-client.c is designed
for setups like GDK where filters are per-window. If we are going
to pass all events to _clutter_xsettings_client_process_event()
anyways, we can just pass in NULL for watch.

This avoids a nasty infinite loop where an event would get processed
triggering removing a filter and adding a new filter, which would
immediately run and remove a filter and add another and so on
ad-infinitum.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2415
2010-11-14 14:50:25 +00:00
Lucas Rocha
03a713e18e click-action: don't use pointer grabs
The same behavior can be achieved by capturing events on stage while
button is pressed. This fixes a problem when using click and drag
actions on the same actor as there no grabs involved.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2409
2010-11-11 23:18:20 +00:00
Emmanuele Bassi
dfdd591414 Merge branch 'wip/static-colors'
* wip/static-colors:
  Move tests to static colors where possible
  color: Add named, global colors
2010-11-11 17:53:42 +00:00
Neil Roberts
1bcf15e1b8 cogl-texture: Remove the gl_handle from CoglTextureSliceCallback
There's no longer any need to use the GL handle in the callback for
_cogl_texture_foreach_sub_texture_in_region because it can now work in
terms of primitive cogl textures so it has now been removed. This
would be helpful if we ever want to make the foreach function public
so that apps could implement their own primitives using sliced
textures.
2010-11-11 16:25:13 +00:00
Neil Roberts
49898d43dd cogl-pipeline: Use layer overrides as CoglHandles instead of GLuint
Since d5634e37 the sliced texture backend now works in terms of
CoglTexture2Ds so there's no need to have special casing for
overriding the texture of a pipeline layer with a GL handle. Instead
we can just use cogl_pipeline_set_layer_texture with the
CoglHandle. The special _cogl_pipeline_set_layer_gl_texture_slice
function has now been removed and parts of the code for comparing
materials have been simplified.
2010-11-11 16:25:13 +00:00
Neil Roberts
1447ceb0de CoglTexture2DSliced: Pass slice tex to callback in foreach_sub_texture
The cogl_texture_foreach_sub_texture_in_region virtual for the sliced
texture backend was previously passing the CoglHandle of the sliced
texture to the callback. Since d5634e37 the slice texture backend now
works in terms of 2D textures so it's possible to pass the underlying
slice texture as a handle too. This makes all of the foreach callbacks
consistent in that they pass a CoglHandle of the primitive texture
type that matches the GL handle.
2010-11-11 16:25:13 +00:00
Robert Bragg
fb9d3a8350 path 2.0: update path API for experimental 2.0 API
When COGL_ENABLE_EXPERIMENTAL_2_0_API is defined cogl.h will now include
cogl2-path.h which changes cogl_path_new() so it can directly return a
CoglPath pointer; it no longer exposes a prototype for
cogl_{get,set}_path and all the remaining cogl_path_ functions now take
an explicit path as their first argument.

The idea is that we want to encourage developers to retain path objects
for as long as possible so they can take advantage of us uploading the
path geometry to the GPU. Currently although it is possible to start a
new path and query the current path, it is not convenient.

The other thing is that we want to get Cogl to the point where nothing
depends on a global, current context variable. This will allow us to one
day define a sensible threading model if/when that is ever desired.
2010-11-11 13:17:26 +00:00
Robert Bragg
b993195dc8 cogl: Adds COGL_ENABLE_EXPERIMENTAL_2_0_API define
For now this new define is simply an alias for
COGL_ENABLE_EXPERIMENTAL_API but the intention is that we will also use
it to start experimenting with changes that need to break the existing
Cogl API in incompatible ways.
2010-11-11 13:17:26 +00:00
Emmanuele Bassi
985518c601 color: Add named, global colors
Since EGA colors are apparently all the rage in other toolkits, Clutter
should not be left out. On top of the usual CGA/EGA palette the static
colors also include the Tango Icon palette, which at least is more
pleasant to the eye.

Static colors are accessed through an enumeration by using
clutter_color_get_static(), or using the short-hand pre-processor
macros.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2066
2010-11-11 13:14:23 +00:00
Robert Bragg
5f30835eae cogl-shader: Prepend boilerplate for portable shaders
We now prepend a set of defines to any given GLSL shader so that we can
define builtin uniforms/attributes within the "cogl" namespace that we
can use to provide compatibility across a range of the earlier versions
of GLSL.

This updates test-cogl-shader-glsl.c and test-shader.c so they no longer
needs to special case GLES vs GL when splicing together its shaders as
well as the blur, colorize and desaturate effects.

To get a feel for the new, portable uniform/attribute names here are the
defines for OpenGL vertex shaders:

 #define cogl_position_in gl_Vertex
 #define cogl_color_in gl_Color
 #define cogl_tex_coord_in  gl_MultiTexCoord0
 #define cogl_tex_coord0_in gl_MultiTexCoord0
 #define cogl_tex_coord1_in gl_MultiTexCoord1
 #define cogl_tex_coord2_in gl_MultiTexCoord2
 #define cogl_tex_coord3_in gl_MultiTexCoord3
 #define cogl_tex_coord4_in gl_MultiTexCoord4
 #define cogl_tex_coord5_in gl_MultiTexCoord5
 #define cogl_tex_coord6_in gl_MultiTexCoord6
 #define cogl_tex_coord7_in gl_MultiTexCoord7
 #define cogl_normal_in gl_Normal

 #define cogl_position_out gl_Position
 #define cogl_point_size_out gl_PointSize
 #define cogl_color_out gl_FrontColor
 #define cogl_tex_coord_out gl_TexCoord

 #define cogl_modelview_matrix gl_ModelViewMatrix
 #define cogl_modelview_projection_matrix gl_ModelViewProjectionMatrix
 #define cogl_projection_matrix gl_ProjectionMatrix
 #define cogl_texture_matrix gl_TextureMatrix

And for fragment shaders we have:

 #define cogl_color_in gl_Color
 #define cogl_tex_coord_in gl_TexCoord

 #define cogl_color_out gl_FragColor
 #define cogl_depth_out gl_FragDepth

 #define cogl_front_facing gl_FrontFacing
2010-11-10 14:24:52 +00:00
Tomeu Vizoso
373140c830 Discard the current pick buffer...
if we are asked to pick with a different mode.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2385
2010-11-08 16:45:15 +00:00
Emmanuele Bassi
4909ecc71e gtk-doc: Fixes for the API references 2010-11-08 16:01:19 +00:00
Emmanuele Bassi
993d3b3fe1 timeout-pool: Deprecate the structure too
Don't leave it lying around, since nothing can use it anyway.
2010-11-08 15:52:17 +00:00
Emmanuele Bassi
26a70707ab path-constraint: Add a ::node-reached signal
Emit a signal whenever a node in the path has been reached.
2010-11-07 21:35:40 +00:00
Emmanuele Bassi
ef7f729c68 build: Re-instate profile builds
The profiling support was broken - probably during the restructuring of
the build environment, but I'm too lazy to bisect that.

The fix is trivial, and everything works as it should.
2010-11-07 15:27:17 +00:00
Emmanuele Bassi
38912ee4d9 Deprecate ClutterFrameSource
The FrameSource API hasn't been used internally since 1.0; since it's
not part of the paint clock, it is of limited use.
2010-11-06 20:11:16 +00:00
Emmanuele Bassi
9ac2f5cba5 Deprecate ClutterTimeoutPool
Timelines have stopped using the pool since 1.0; there is no real reason
to expose it as part of the active API.
2010-11-06 20:11:16 +00:00
Emmanuele Bassi
a432d9973d Remove a compiler warning 2010-11-06 18:12:41 +00:00
Maxim Ermilov
6ec9c3247c CoglContext: correct initialization order
http://bugzilla.clutter-project.org/show_bug.cgi?id=2401
2010-11-06 18:06:19 +00:00
Neil Roberts
cc63c7dd8f cogl-texture-2d-sliced: Fix the foreach callback for waste textures
When converting the virtual coordinates of the underlying texture for
a slice to virtual coordinates for the whole texture it was using the
size and offset of the intersection as the size of the child
texture. This would be incorrect if the texture contains waste or the
texture coordinates are not the default. Instead the sliced foreach
function now passes the CoglSpan to the callback instead of the
intersection.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2398
2010-11-05 18:45:31 +00:00
Neil Roberts
8112bfc49f Replace the disable-npots tool with a COGL_DEBUG option
Previously in the tests/tools directory we build a disable-npots
library which was used as an LD_PRELOAD to trick Cogl in to thinking
there is no NPOT texture extension. This is a little awkward to use so
it seems much simpler to just define a COGL_DEBUG option to disable
npot textures.
2010-11-05 18:45:31 +00:00
Robert Bragg
632412c9c8 actor: Check "paint" handlers in _get_paint_volume
Instead of waiting until clutter_actor_paint to check if there are any
handlers connected to the "paint" signal, we now do the check whenever
the paint-volume is requested in _actor_get_paint_volume_mutable().

Previously we checked in clutter_actor_paint(), but at that time we may
already be using a stage clip that could be derived from an invalid
paint-volume. We used to try and handle that by queuing a follow up,
unclipped, redraw but anyway there was an additional problem with the
previous approach because the checking wasn't enough to always catch
invalid volumes involved in culling (considering that containers may
derive their volume from children that haven't yet been painted)

By moving the check to _get_paint_volume time not only do we now
correctly check children in cases where a container derives its volume
from its children's volumes but we no longer need to queue follow up
redraws to cover up artefacts.

Since we now never queue follow up redraws, this in turn means we should
no longer clobber redraws queued with an explicit clip which was
something affecting gnome-shell since it connects a handler to the paint
signal of the stage.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2388
2010-11-05 17:22:05 +00:00