Commit Graph

3618 Commits

Author SHA1 Message Date
Emmanuele Bassi
8a2e164354 actor-box: Correctly clamp to pixel
Use ceilf() to round up the right side of the actor's box, and floorf()
to round down the left side.
2010-09-13 18:18:34 +01:00
Robert Bragg
f5f066df9c Try to clean up how we handle actor transformations
When building actor relative transforms, instead of using the matrix
stack to combine transformations and making assumptions about what is
currently on the stack we now just explicitly initialize an identity
matrix and apply transforms to that.

This removes the full_vertex_t typedef for internal transformation code
and we just use ClutterVertex.

ClutterStage now implements apply_transform like any other actor now
and the code we had in _cogl_setup_viewport has been moved to the
stage's apply_transform instead.

ClutterStage now tracks an explicit projection matrix and viewport
geometry. The projection matrix is derived from the perspective whenever
that changes, and the viewport is updated when the stage gets a new
allocation. The SYNC_MATRICES mechanism has been removed in favour of
_clutter_stage_dirty_viewport/projection() APIs that get used when
switching between multiple stages to ensure cogl has the latest
information about the onscreen framebuffer.
2010-09-13 18:18:34 +01:00
Robert Bragg
ab008948cf actor: Add _get_stage_internal to clutter-private.h
This adds _clutter_actor_get_stage_internal to clutter-private.h since
we plan to use it in clutter-offscreen-effect when preparing to
redirect an actor offscreen.
2010-09-13 18:18:34 +01:00
Murray Cumming
28f28c0309 Remove trailin enum commas, avoiding C++ warnings.
http://bugzilla.clutter-project.org/show_bug.cgi?id=2314
2010-09-13 15:45:55 +01:00
Alejandro Piñeiro
209bef6f8a cally: fixing public headers
Cally headers were including specific clutter object headers.

This caused a problem including cally.h on a external program.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2234
2010-09-13 12:19:54 +01:00
Emmanuele Bassi
dec0863f58 build: Add tesselator to the include paths 2010-09-13 11:31:46 +01:00
Emmanuele Bassi
94e2c7a949 build: Generate ClutterJson in the top directory
Instead of doing the shlib trick, build ClutterJson (if needed) inside
the top-level clutter/ directory - similar to a non-recursive layout.

Hopefully, one day, we'll be able to do this with a real non-recursive
layout.
2010-09-13 02:26:47 +01:00
Emmanuele Bassi
c03458a861 build: Remove gir files from dist
The introspection data is going to be generated, so it should never be
in the dist.
2010-09-13 02:10:35 +01:00
Emmanuele Bassi
64924f0e98 build: Do not build a noinst library for the tesselator
Let's try to keep Cogl's build as non-recursive as possible, in the hope
that one day we'll be able to make it fully non-recursive along with the
rest of Clutter.
2010-09-12 19:25:47 +01:00
Emmanuele Bassi
4ee05f8e21 keysyms: Update the macros to CLUTTER_KEY_*
The keysyms defines in clutter-keysyms.h are generated from the X11 key
symbols headers by doing the equivalent of a pass of sed from XK_* to
CLUTTER_*. This might lead to namespace collisions, down the road.
Instead, we should use the CLUTTER_KEY_* namespace.

This commit includes the script, taken from GDK, that parses the X11
key symbols and generates two headers:

  - clutter-keysyms.h: the default included header, with CLUTTER_KEY_*
  - clutter-keysyms-compat.h: the compatibility header, with CLUTTER_*

The compat.h header file is included if CLUTTER_DISABLE_DEPRECATED is
not defined - essentially deprecating all the old key symbols.

This does not change any ABI and, assuming that an application or
library is not compiling with CLUTTER_DISABLE_DEPRECATED, the source
compatibility is still guaranteed.
2010-09-10 17:54:52 +01:00
Lucas Rocha
1447eff00f introspection: Add full path for the Clutter-1.0 inclusion
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-09-10 17:51:19 +01:00
Emmanuele Bassi
edb54574fa build: Disable deprecated API when building Clutter
Make sure we don't use deprecated API internally by adding
CLUTTER_DISABLE_DEPRECATED to the AM_CPPFLAGS.

This requires adding -UCLUTTER_DISABLE_DEPRECATED to the introspection
scanner CFLAGS, otherwise the deprecated API will never be introspected
and the data generated will not be compatible.
2010-09-10 17:51:18 +01:00
Emmanuele Bassi
d76f64a10c Do not use deprecated API internally 2010-09-10 17:51:13 +01:00
Emmanuele Bassi
01362effca actor: Add a method for querying key focus
A simple convenience method on Clutter.Actor for checking whether
it has key focus assigned on the Stage to which it belongs.
2010-09-10 11:42:11 +01:00
Emmanuele Bassi
71a4db6135 animation: Allow detaching an animation from an actor
When animating an actor through clutter_actor_animate() and friends we
might want forcibly detach the animation instance from the actor in
order to start a new one - for instance, in response to user
interaction.

Currently, there is no way to do that except in a very convoluted way,
by emitting the ::completed signal and adding a special case in the
signal handlers; this is due to the fact that clutter_actor_animate()
adds more logic than the one added by clutter_animation_set_object(),
so calling set_object(NULL) or unreferencing the animation instance
itself won't be enough.

The right way to approach this is to add a new method to Clutter.Actor
that detaches any eventual Animation currently referencing it.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2051
2010-09-10 11:18:53 +01:00
Colin Walters
3aa2d00c3b introspection: Don't look for installed Cogl-1.0.gir
If we're depending on an uninstalled .gir, use --include-uninstalled.
We need to explicitly specify Cogl to let the scanner know it's also
uninstalled.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-09-09 23:01:40 +01:00
Colin Walters
5f5369990f introspection: Don't look for installed Clutter-1.0.gir
If we're depending on an uninstalled .gir, use --include-uninstalled.
2010-09-09 18:44:03 +01:00
Chris Kühl
d86dc377de Added documentation for alpha parameter in Behaviour constructors.
http://bugzilla.clutter-project.org/show_bug.cgi?id=2304

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-09-09 16:34:21 +01:00
Neil Roberts
9e1cd15b48 cogl-vertex-buffer: Flush the framebuffer state first
Flushing the framebuffer state can cause some drawing to occur if the
framebuffer has a clip stack which needs the stencil buffer. This was
causing the array pointers set up by enable_state_for_drawing_buffer
to get mangled so it would crash when it hits glDrawArrays. This patch
moves the framebuffer state flush to before it sets up the array
pointers.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2297
2010-09-09 12:19:53 +01:00
Robert Bragg
bcf20955d3 ClutterX11TexturePixmap: Fix unbalanced error trapping
I think this is what commit 2cf1405506 intended to do since it
specifically mentioned cleaning up the trap in
clutter_x11_texture_pixmap_set_pixmap, but although it moved the untrap
to only be done in the case where Pixmap != None it left the position of
the trap itself unchanged. This meant the error trapping wouldn't be
balanced if pixmap == None since the untrap wouldn't be done. We now
only trap and untrap around the XGetGeometry call done when pixmap !=
None.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2303
2010-09-09 11:18:53 +01:00
Emmanuele Bassi
089a20e79d build: Add ClutterX11 introspection generation 2010-09-08 18:27:12 +01:00
Emmanuele Bassi
f8bd45dbce x11-texture-pixmap: Do not go through g_object_get()
The pixmap width and height are stored in our own private data
structure; going through g_object_get() is pointless overhead.
2010-09-08 17:39:04 +01:00
Owen W. Taylor
2cf1405506 Clean up CoglTexturePixmapX11 first
With currently distributed versions of Mesa, calling XFreePixmap()
before glxDestroyPixmap() will cause an X error from DRI. So, we
need to make sure that we get rid of the CoglTexturePixmapX11 before
we XFreePixmap().

clutter_x11_texture_pixmap_dispose(): Call
 clutter_x11_texture_pixmap_set_pixmap() instead of using XFreePixmap
 directly so that we leverage the text-clearing hack and destroy
 things in the right order.

clutter_x11_texture_pixmap_set_pixmap(): Don't do a pointless roundtrip
 and trap a pointless error when setting pixmap to None.

clutter_x11_texture_pixmap_set_pixmap(): Free damage resources when
 we are setting Pixmap to None.

clutter_x11_texture_pixmap_set_window(): When setting a new window
 or setting the window to None, immedediately  call
 cluter_x11_texture_pixmap_set_pixmap(). This means that set_window(None)
 immediately will free any referenced resources related to the window.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2303
2010-09-08 17:24:49 +01:00
Emmanuele Bassi
ca8db4c2ee Add caller-allocates annotations
For ClutterColor, ClutterUnits, ClutterInterval and the Perspective
accessor in ClutterStage.
2010-09-08 17:04:21 +01:00
Emmanuele Bassi
8a5686d835 Further annotation fixes 2010-09-08 16:41:47 +01:00
Owen W. Taylor
f1c44a27a1 introspection: Add missing (out) annotations
Comprehensively add (out) annotations to functions parameters
returning int/float/double.

Not handled here: structure out returns like ClutterColor or
ClutterPerspective or GValue that should get (out caller-allocates).

Not handled here: Cogl

http://bugzilla.clutter-project.org/show_bug.cgi?id=2302
2010-09-08 15:43:07 +01:00
Emmanuele Bassi
e4870ebaf4 Constify Event accessors and copy method
This is still C, but at least we can get some sort of safety net when
using the API correctly.
2010-09-08 15:15:57 +01:00
Javier Jardón
98cac30d82 build: Use upstream gettext instead the glib one
Fixes http://bugzilla.clutter-project.org/show_bug.cgi?id=2300
2010-09-08 11:46:36 +01:00
Owen W. Taylor
c4ca75350f introspection: Fix annotation for clutter_container_get_children()
(element-type) should have a full name like Clutter.Actor rather than
a non-namespaced name like Actor. gobject-introspection has become
more strict about this with the recent scanner rewrite.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2301
2010-09-08 01:05:27 +01:00
Henrik Hedberg
1eae9fcd7e drag-action: Added x-drag-threshold and y-drag-threshold properties
*** This is an API change ***

Replaced the original drag-threshold property with two separate
horizontal (x-drag-threshold) and vertical (y-drag-threshold)
thresholds.

It is some times necessary to have different drag thresholds for the
horizontal and vertical axes. For example, when a draggable actor is
inside a horizontal scrolling area, only vertical movement must begin
dragging. That can be achieved by setting the x-drag-threshold to
G_MAXUINT while y-drag-threshold is something usual, say, 20 pixels.

This is different than drag axis, because after the threshold
has been cleared by the pointer, the draggable actor can be dragged
along both axes (if allowed by the drag-axis property).

http://bugzilla.clutter-project.org/show_bug.cgi?id=2291

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-09-07 10:40:49 +01:00
Emmanuele Bassi
ba9aa3b332 texture: Move the material unref() in ::dispose 2010-09-06 18:09:19 +01:00
Emmanuele Bassi
128e981f6c texture: Do some more validation in get_cogl_texture()
Check the layer type, even though right now we only have one type
available.
2010-09-06 18:09:19 +01:00
Emmanuele Bassi
7e56a98413 texture: Use a base material for all instances
Creating new materials for every Texture instance results in a lot of
ARBfp programs being generated/compiled. Since most textures will just
be similar we should create a template material for all of them, and
then copy it in every instance. Cogl will try to optimize the generation
of the program and, hopefully, will reuse the same program most of the
time.

With this change, a simple test shows that loading 48 textures will
result in just two programs being compiled - with and without batching
enabled.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2295
2010-09-06 18:09:19 +01:00
Emmanuele Bassi
283dce8e21 material: Check before unreferencing a texture
When disposing a material layer of type 'texture' we should check that
the texture handle is still valid before calling cogl_handle_unref().
This avoids an assertion failure when disposing a ClutterTexture.
2010-09-06 18:09:19 +01:00
Emmanuele Bassi
b4120b81e4 Add some more introspection annotations 2010-09-06 16:11:46 +01:00
Emmanuele Bassi
7abe63953e cogl-shader: Add deprecation guards for cogl_program_uniform_* 2010-09-03 16:59:01 +01:00
Emmanuele Bassi
abef73bb58 Replace cogl_color_set_from_* with cogl_color_init_from_*
The former is not yet "officially" deprecated by the latter, but it's
confusing to have them both in the code base.
2010-09-03 16:58:47 +01:00
Emmanuele Bassi
0caef5c8aa docs: Fixes for gtk-doc 2010-09-03 16:12:24 +01:00
Emmanuele Bassi
3e74f42f07 introspection: Add annotations
Reduce the amount of warnings coming from g-ir-scanner.
2010-09-03 12:14:50 +01:00
Emmanuele Bassi
710c7aed40 build: Use Makefile.introspection
Whenever possible, instead of writing our own rules for generating GIR
files and typelibs.
2010-09-03 11:38:22 +01:00
Colin Walters
f7854dd90f introspection: Build fixes
This patch merges in substantial work from
Emmanuele Bassi <ebassi@linux.intel.com>

* Use new introspection --include-uninstalled API since we don't want
  to try to find the clutter-1.0.pc file before it's installed.
* Use --pkg-export for Clutter-1.0.gir, since we want the .gir file to
  contain the associated pkg-config file.
* Drop the use of --pkg for dependencies; those come from the associated
  .gir files.  (Actually, --pkg is almost never needed)
* Add --quiet

http://bugzilla.clutter-project.org/show_bug.cgi?id=2292
2010-09-03 11:38:22 +01:00
Damien Lespiau
24b12d626c cex100: Remove C99-ism
We were declaring a variable in the middle of the code. Blasphemy, for
non-c99 compilers.
2010-09-03 11:14:05 +01:00
Damien Lespiau
0216f0b281 cex100: Use % not # to document constants
gtk-doc contants should be prefixed by %, not # (types).
2010-09-03 11:13:57 +01:00
Damien Lespiau
0a0a59cf7b cex100: Add an API to configure the buffering mode of the GDL plane
GDL planes can be double or triple buffered. Let the user choose between
the two modes befored initalizing Clutter.
2010-09-03 11:13:35 +01:00
Damien Lespiau
01fcd11efd cex100: Add an API to configure the GDL plane to use
Intel CE3100 and CE4100 have several planes (framebuffers) and a
hardware blender to blend the planes togeteher to produce the final
image.

clutter_cex100_set_plane() lets you configure which framebuffer clutter
will use for its rendering.
2010-09-03 11:13:35 +01:00
Damien Lespiau
70dc3ecbd6 egl: Fix the installed headers
• Use the public COGL_HAS_GLES[12] define instead of the HAVE_COGL_*
   ones which are private and defined in config.h,
 • Install clutter-egl-headers.h which is needed by clutter-egl.h,
 • Remove clutter-stage.h as it's uneeded and does not work since the
   single clutter.h include policy,
 • Install the egl headers into their own egl directory as the x11 and
   glx backends do. The include should then be <clutter/egl/clutter-egl.h>,
   so document it. It does not really break anything as nobody could
   have used those broken headers.
2010-09-03 11:13:35 +01:00
Damien Lespiau
e1e5db0032 cex100: Add a Clutter EGL backend for CE3100/CE4100 SoCs
Intel CE3100 and CE4100 SoCs are designed for TVs. They have separate
framebuffers that are blended together by a piece of hardware to make
the final output. The library that allows you to initialize and
configure those planes is called GDL. A EGL GDL winsys can then be
use with those planes as NativeWindowType to select which plane to use.

This patch adds a new ClutterBackendCex100 backend that can be
selected at compile time with the new --with-flavour=cex100 option.
2010-09-03 11:13:35 +01:00
Damien Lespiau
af983faccd egl: Fix compilation for EGL native
Some minor fixes here and there: missing include, wrongly placed #endif,
unused variable warning fixes, missing #ifdef.

Make ClutterStageEGL a subclass of either ClutterStageX11 or GObject
depending if you compile with X11 support (EGLX) or not (native).
2010-09-03 11:13:35 +01:00
Emmanuele Bassi
12a5bf2e06 offscreen-effect: Rename create_target to create_buffer
*** This is an API change ***

The create_target() virtual function should return a CoglHandle to a
texture; clutter_offscreen_effect_get_target(), instead, returns a
CoglMaterial to be painted in the implementation of the paint_target()
virtual function.

Instead of equating textures with materials, and confusing the user of
the API, we should mark the difference more prominently.

First of all, we should return a CoglMaterial* (now that we have that
as a public type) in get_target(); having handles all over the place
does not make it easier to distinguish the semantics of the virtual
functions.

Then we should rename create_target() to create_texture(), to make it
clear that what should be returned is a texture that is used as the
backing for the offscreen framebuffer.
2010-09-01 18:05:53 +01:00
Emmanuele Bassi
ac6256ae60 docs: Add @Title to the X11TexturePixmap gtk-doc section 2010-08-28 21:17:23 +01:00
Emmanuele Bassi
36d45b660f click-action: Add get_button()
Allow retrieving the pointer button that caused the ::clicked signal to
be emitted.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2287
2010-08-26 16:39:39 +01:00
Emmanuele Bassi
550d5ab621 click-action: Fix the release() method name
Documented and declared as release(), it's implemented as
force_release().

http://bugzilla.clutter-project.org/show_bug.cgi?id=2286
2010-08-26 16:39:39 +01:00
Bastian Winkler
cb58f1f68c script-parser: Apply child and layout properties to the right actor
http://bugzilla.clutter-project.org/show_bug.cgi?id=2285

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-08-25 16:18:25 +01:00
Neil Roberts
2e12768e3c win32: Fix the check for the 'IN_DESTRUCTION' flag
Commit eae4561929 tried to clean how it checks for the private actor
flags. However the check for the 'IN_DESTRUCTION' flag in the Win32
backend got inverted so it would always clear the current
context. This was causing _cogl_check_driver_valid to fail later and
then the realize would get stuck in a infinite loop.
2010-08-24 20:00:04 +01:00
Øyvind Kolås
04d55107f3 state: clutter_state_remove_key_internal fix memory corruption
When we free a state because there are no more keys with it as a target use a
goto to re-initialize temporary variables that have become invalid.

Fixing bug #2273
2010-08-23 14:01:08 +01:00
Neil Roberts
66018a7035 Invert the check for whether to clip the pick
In 965907deb3 the picking was changed to render the full stage
instead of a single pixel whenever picking is performed more than once
between paints. However the condition in the if-statement was
backwards so it would end up always doing a full stage render.
2010-08-23 11:55:14 +01:00
Neil Roberts
ddd08ba723 Add some debugging notes for picking
This adds a new CLUTTER_DEBUG option for picking. Currently this just
reports the position for each pick and whether it is clipped or not.
2010-08-23 11:55:13 +01:00
Alexandros Frantzis
12e58c7813 Hide internal glx and egl(x) backend symbols.
The glx and egl(x) backends export some internal symbols. Hide these
symbols (using '_' prefix) to reduce ABI differentiation between the
glx and eglx flavours.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2267

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-08-23 11:49:07 +01:00
Emmanuele Bassi
cda5afb419 box-layout: Use the correct name for the arguments
Since we're getting the preferred height for a given width, the width
argument should be named "for_width" and not "for_height".
2010-08-20 17:03:06 +01:00
Emmanuele Bassi
213bd1eab4 debug: Add a macro for checking debug flags 2010-08-19 13:57:10 +01:00
Emmanuele Bassi
459a6bb24c click-action: Add a method to force a release
It can be useful to be able to forcibly break the grab set up by the
ClickAction. The newly added release() method provides a mechanism to
release the grab and unset the :held state of the ClickAction.
2010-08-19 12:10:43 +01:00
Emmanuele Bassi
db7d821ef6 click-action: Add attribution
The ClickAction semantics were inspired by the StClickable widget in the
GNOME Shell Toolkit (St).
2010-08-19 11:26:51 +01:00
Robert Bragg
5ccaa61e4f docs: Clarifies that queue_redraw also applies to picking
This clarifies the documentation for clutter_actor_queue_redraw to
explain that custom actors should call this whenever some private state
changes that affects painting *or* picking.
2010-08-18 18:30:31 +01:00
Robert Bragg
f8940e3c9a clutter-texture: queue redraw when changing pick_with_alpha
The expectation is that actors should call clutter_actor_queue_redraw
when ever some private state changes that affects painting *or* picking.
ClutterTexture was not doing this for pick_with_alpha property changes.
2010-08-18 18:30:30 +01:00
Robert Bragg
965907deb3 Cache a full pick render if we have a static stage
The idea is that if we see multiple picks per frame then that implies
the visible scene has become static. In this case we can promote the
next pick render to be unclipped so we have valid pick values for the
entire stage. Now we can continue to read from this cached buffer until
the stage contents do visibly change.

Thanks to Luca Bruno on #clutter for this idea!
2010-08-18 18:30:30 +01:00
Emmanuele Bassi
c646a366c6 actor: Ignore paint() on actors being destroyed
OBVIOUS OPTIMIZATION IS OBVIOUS
2010-08-18 18:20:45 +01:00
Emmanuele Bassi
56097df60c docs: Improve paint() documentation 2010-08-18 18:20:04 +01:00
Emmanuele Bassi
ad0c36e1a1 docs: Fixes to avoid gtk-doc warnings 2010-08-17 14:54:20 +01:00
Emmanuele Bassi
92b1a33eb3 texture: Default square textures to height-for-width
Square textures should have a preferred geometry request set to
height-for-width, as it is the default for Clutter itself.
2010-08-16 15:56:49 +01:00
Emmanuele Bassi
271e0d9604 animator: Plug some leaks 2010-08-13 17:03:02 +01:00
Robert Bragg
12031ca2c5 material: Implements weak materials
Weak materials are ones that don't take a reference on their parent and
they are associated with a callback that notifies when the material is
destroyed, because its parent was freed or modified.

More details can be found at:
http://wiki.clutter-project.org/wiki/CoglDesign/CoglMaterial

For now the concept is internal only but the plan is to make this public
at some point once we have tested the design internally.
2010-08-13 16:23:19 +01:00
Emmanuele Bassi
50c5ecfe87 state: Plug some memory leakage
Thanks to Valgrind, test-state-base now reports 0 bytes definitely lost.
2010-08-13 12:12:59 +01:00
Emmanuele Bassi
daf6e73936 Remove last uses of cogl_program_uniform*
Following the commits:

  c03544da - clutter-shader: use cogl_program_set_uniform_xyz API
  a26119b5 - tests: Remove use of cogl_program_use

Remove the users of cogl_program_uniform_* and cogl_program_use() in the
shader-based effects.
2010-08-12 17:08:26 +01:00
Robert Bragg
01a7272599 cogl-shader: get_info_log should always use strdup
In the case where there is no error log for arbfp we were returning a
"" string literal. The other paths were using g_strdup to return a
string that could be freed with g_free. This makes the arbfp path return
g_strdup ("") instead.
2010-08-12 16:50:47 +01:00
Robert Bragg
b50bdd7919 cogl-shader: correctly #ifdef guard an if else block
There are quite a few if {} else {} blocks for dealing with arbfp else
glsl and the first block is guarded with #ifdef HAVE_COGL_GL. In this
case though the #endif was before the else so it wouldn't compile for
gles.
2010-08-12 16:50:47 +01:00
Robert Bragg
94692370d2 material-glsl: #include "cogl-shader-private.h"
We need to include cogl-shader-private.h to have the
COGL_SHADER_TYPE_GLSL define. When building for opengl this wasn't
noticed probably because some other header indirectly includes this
file. It was a problem when building for gles2 though.
2010-08-12 16:50:47 +01:00
Robert Bragg
c03544daa6 clutter-shader: use cogl_program_set_uniform_xyz API
Instead of using the deprecated cogl_program_uniform_xyz functions we
now use the cogl_program_set_uniform methods. It looks like this should
also fix a problem with clutter-shader too in that previously we weren't
calling cogl_program_use before cogl_program_uniform_xyz so setting
uniforms would only work while the shader is enabled.
2010-08-12 16:50:46 +01:00
Robert Bragg
f03037d580 cogl-program: Adds use_uniform_xyz methods
Instead of exposing an API that provides an OpenGL state machine style
where you first have to bind the program to the context using
cogl_program_use() followed by updating uniforms using
cogl_program_uniform_xyz we now have uniform setter methods that take an
explicit CoglHandle for the program.

This deprecates cogl_program_use and all the cogl_program_uniform
variants and provides the following replacements:
    cogl_program_set_uniform_1i
    cogl_program_set_uniform_1f
    cogl_program_set_uniform_int
    cogl_program_set_uniform_float
    cogl_program_set_uniform_matrix
2010-08-12 16:50:46 +01:00
Damien Lespiau
2f54f8f0ea introspection: Use the --quiet flag conditionally
--quiet has been added to g-ir-scanner in the 0.9.1 cycle. We really
want to be able to compile clutter with 0.6.14 to be able to reuse
gir files that are distributed in current distributions.

Use the INTROSPECTION_SCANNER_ARGS (previously unused) variable to
convey --quiet when necessary.

Fixes: http://bugzilla.clutter-project.org/show_bug.cgi?id=2265
2010-08-12 16:43:07 +01:00
Neil Roberts
db0c15aee8 cogl-atlas: Verify that the chosen initial size is supported
CoglAtlas chooses a fairly large default initial size of either
512x512 or 1024x1024 depending on the texture format. There is a
chance that this size will not be supported on some platforms which
would be catastrophic for the glyph cache because it would mean that
it would always fail to put any glyphs in the cache so text wouldn't
work. To fix this the atlas code now checks whether the chosen initial
size is supported by the texture driver and if not it will get halved
until it is supported.
2010-08-12 11:57:00 +01:00
Neil Roberts
b9f9ea3a9c cogl-atlas: Use _cogl_texture_driver_size_supported
Previously when creating a new rectangle map it would try increasingly
larger texture sizes until GL_MAX_TEXTURE_SIZE is reached. This is bad
because it queries state which should really be owned by the texture
driver. Also GL_MAX_TEXTURE_SIZE is often a conservative estimate so
larger texture sizes can be used if the proxy texture is queried
instead.
2010-08-12 11:57:00 +01:00
Neil Roberts
72029e14db cogl-rectangle-map: Record largest gap rather than the remaining space
Previously each node in the rectangle map tree would store the total
remaining space in all of its children to use as an optimization when
adding nodes. With this it could skip an entire branch of the tree if
it knew there could never be enough space for the new node in the
branch. This modifies that slightly to instead store the largest
single gap. This allows it to skip a branch earlier because often
there would be a lot of small gaps which would add up to enough a
space for the new rectangle, but the space can't be used unless it is
in a single node.

The rectangle map still needs to keep track of the total remaining
space for the whole map for the debugging output so this has been
added back in to the CoglRectangleMap struct. There is a separate
debugging function to verify this value.
2010-08-12 11:57:00 +01:00
Neil Roberts
2b5bb06bed cogl-atlas: Try the next size when there would be less than 6% waste
Previously when the atlas needs to be migrated it would start by
trying with the same size as the existing atlas if there is enough
space for the new texture. However even if the atlas is completely
sorted there will always be some amount of waste so when the atlas
needs to grow it would usually end up redundantly trying the same size
when it is very unlikely to fit. This patch changes it so that there
must be at least 6% waste available after the new texture is added
otherwise it will start with the next atlas size.
2010-08-12 11:57:00 +01:00
Neil Roberts
f98be241a8 cogl-atlas: Add some more debugging notes
This adds some debugging notes which report when the atlas is trying
various sizes.
2010-08-12 11:57:00 +01:00
Neil Roberts
e080e824ee cogl-rectangle-map: Use a GArray for the stack
When iterating over the rectangle map a stack is used to implement a
recursive algorithm. Previously this was slice allocating a linked
list. Now it uses a GArray which is retained with the rectangle map to
avoid frequent allocations which is a little bit faster.
2010-08-12 11:56:59 +01:00
Neil Roberts
0e2d18d700 cogl-rectangle-map: Store the remaining space per node
Previously the remaining space was managed as part of the
CoglRectangleMap struct. Now it is stored per node so that at any
point in the hierarchy we can quickly determine how much space is
remaining in all of the node's children. That way when adding a
rectangle we can miss out entire branches more quickly if we know that
there is no way the new rectangle would fit in that branch.

This also adds a function to recursively verify the cached state in
the nodes such as the remaining space and the number of
rectangles. This function is only called when the dump-atlas-image
debug flag is set because it is potentially quite slow.
2010-08-12 11:56:59 +01:00
Neil Roberts
e609a658a4 cogl-atlas: Increase the default minimum texture size
When initially creating a texture it would start with a minimum size
of 256x256. This increases the size so that it would try to match 1MB
of memory.
2010-08-12 11:56:59 +01:00
Neil Roberts
d03fbf9f64 cogl-pango: Use a CoglAtlas to maintain the glyph cache
The glyph cache is now stored in a CoglAtlas structure instead of the
custom atlasing code. This has the advantage that it can share code
with the main texture atlas and that it supports reorganizing the
atlas when it becomes full. Unlike the texture atlas, the glyph cache
can use multiple atlases which would be neccessary if the maximum
texture size is reached and we need to create a second
texture. Whenever a display list is created it now has to register a
callback with the glyph cache so that the display list can be
recreated whenever any of the atlases are reorganized. This is needed
because the display list directly stores texture coordinates within
the atlas texture and they would become invalid when the texture is
moved.

The ensure_glyphs_for_layout now works in two steps. First it reserves
space in the atlas for all of the glyphs. The atlas is created with
the DISABLE_MIGRATION flag so that it won't actually copy any textures
if any rearranging is needed. Whenever the position is updated for a
glyph then it is marked as dirty. After space for all of the glyphs
has been reserved it will iterate over all dirty glyphs and redraw
them using Cairo. The rendered glyph is then stored in the texture
with a sub texture update.

The glyphs need to all be set at the right location before starting to
create the display list because the display list stores the texture
coordinates of the glyph. If any of the glyphs were moved around then
the parts of the display list that was created already would become
invalid. To make this work, ensure_glyphs_for_layout is now always
called before rendering a layout or a layout line.
2010-08-12 11:56:59 +01:00
Neil Roberts
047227fbd7 cogl-atlas: Support multiple formats and clearing the texture
_cogl_atlas_new now has two extra parameters to specify the format of
the textures it creates as well as a set of flags to modify the
behavious of the atlas. One of the flags causes the new textures to be
cleared and the other causes migration to avoid actually copying the
textures. This is needed to use CoglAtlas from the pango glyph cache
because it needs to use COGL_PIXEL_A_8 and to clear the textures as it
does not fill in the gaps between glyphs. It needs to avoid copying
the textures so that it can work on GL implementations without FBO
support.
2010-08-12 11:56:59 +01:00
Neil Roberts
9b2f8179f0 cogl-atlas-texture: Split out the atlas data structure
Instead of storing a pointer to the CoglRectangleMap and a handle to
the atlas texture in the context, there is a now a separate data
structure called a CoglAtlas to manage these two. The context just
contains a pointer to this. The code to reorganise the atlas has been
moved from cogl-atlas-texture.c to cogl-atlas.c
2010-08-12 11:56:59 +01:00
Neil Roberts
0c8582aad8 cogl: Add an internal utility to maintain a list of callback functions
This adds an internal CoglCallbackList type which is just a GSList of
of function pointers along with a data pointer to form a
closure. There are functions to add and remove items and to invoke the
list of functions. This could be used in a number of places in Cogl.
2010-08-12 11:54:42 +01:00
Neil Roberts
4989000f55 cogl-atlas: Rename to CoglRectangleMap
This simply renames CoglAtlas to CoglRectangleMap without making any
functional changes. The old 'CoglAtlas' is just a data structure for
managing unused areas of a rectangle and it doesn't neccessarily have
to be used for an atlas so it wasn't a very good name.
2010-08-12 11:54:42 +01:00
Neil Roberts
89c535f50d cogl-material: Compare whether textures are equal by their GL handle
Textures within a layer were compared for equality by comparing their
texture handle. However this means that sub textures and atlas
textures which may be internally using the same GL handle would not be
batched together. Instead it now tries to determine the underlying GL
handle using either the slice override or _cogl_texture_get_gl_texture
and then compares those.
2010-08-12 11:36:18 +01:00
Neil Roberts
8538bdbdea cogl-atlas-texture: Accept formats with different component orders
When filtering on allowed formats for atlas textures, it now masks out
the BGR and AFIRST bits in addition to the premult bit. That way it
will accept RGB and RGBA formats in any component order.

In theory it could also accept luminance and alpha-only textures but I
haven't added this because presumably if the application has requested
these formats then it has some reason not to use a full RGB or RGBA
texture and we should respect that.
2010-08-12 10:03:52 +01:00
Emmanuele Bassi
2bf01dd959 build: Make the introspection generation quiet (again) 2010-08-12 09:03:58 +01:00
Emmanuele Bassi
9b736cfeba drag-action: Capture ENTER when dragging
This completes commit 9ab83cebf.
2010-08-12 08:53:06 +01:00
Emmanuele Bassi
ed39948ccf colorize-effect: Do not inherit from ShaderEffect
See commits:

  7daeb217 blur-effect: Do not inherit from ShaderEffect
  1ec57743 desaturate-effect: Do not inherit from ShaderEffect

We might avoid using shaders at all in the future for simple effects.
2010-08-11 17:43:15 +01:00
Emmanuele Bassi
d10ebe9fca effects: Check before using the cogl_shader_* API
Since BlurEffect and DesaturateEffect are using the shader API
implicitly and not using ClutterShaderEffect, we need to check if the
underlying GL implementation supports the GLSL shading language and warn
if not.
2010-08-11 17:25:17 +01:00
Emmanuele Bassi
9ab83cebfd drag-action: Capture stage leave
If we are dragging, we don't want the drag handle to emit a
::leave-event even if the pointer left the stage.
2010-08-11 14:42:56 +01:00
Emmanuele Bassi
1ec577438e desaturate-effect: Do not inherit from ShaderEffect
Hide the fact that we're using a fragment shader, in case we're able in
the future to use a material layer combine function when painting the
offscreen target texture.
2010-08-11 14:21:23 +01:00