Commit Graph

3871 Commits

Author SHA1 Message Date
Emmanuele Bassi
853f9941da analysis: ClutterBoxLayout
Remove an useless assignment. The n_expand_children is not used outside
the extra_space check, and if n_expand_children is 0 then the extra
space we allocate is 0.
2010-02-12 14:50:10 +00:00
Emmanuele Bassi
cd05856253 analysis: ClutterBehaviour
Remove an unused variable.
2010-02-12 14:50:06 +00:00
Emmanuele Bassi
6dc0e9632c analysis: ClutterAnimation
• Remove one unused variable.

• We ignore the result of get_timeline_internal() so we need to tell
  the compiler that - though a better solution would be to split the
  timeline implicit creation into its own function.
2010-02-12 14:50:06 +00:00
Emmanuele Bassi
a287ca7a28 analysis: ClutterAnimator/2
Clean up an unused variable.
2010-02-12 14:50:06 +00:00
Emmanuele Bassi
667222c301 analysis: ClutterAnimator/1
Do not de-reference a void*; use a temporary variable -- after
checking the contents of the pointer. This actually simplifies
the readability and avoids pulling a Lisp with the parentheses.
2010-02-12 14:50:06 +00:00
Emmanuele Bassi
fcd3cfc0bf analysis: ClutterAlpha
Clean up unused variables.
2010-02-12 14:50:06 +00:00
Emmanuele Bassi
aa6d7a3029 analysis: ClutterActor
Clean up ClutterActor for unused variables.
2010-02-12 14:50:06 +00:00
Neil Roberts
7a372bc001 cogl: Cache the value for GL_MAX_TEXTURE_UNITS
The function _cogl_get_max_texture_units is called quite often while
rendering and it returns a constant value so we might as well cache
the result. Calling glGetInteger on Mesa can be expensive because it
flushes a lot of state.
2010-02-12 14:38:53 +00:00
Robert Bragg
22c33b2fea cogl: resolves some low hanging issues flagged by clang
An initial pass over the Cogl source code using the Clang static
analysis tool flagged a few low hanging issues such as un-used variables
or redundant initializing of variables which this patch fixes.
2010-02-12 14:05:02 +00:00
Robert Bragg
18305cbd98 cogl_rectangle: avoid redundant copy of geometry
All the cogl_rectangle* APIs normalize their input into into an array of
_CoglMutiTexturedRect rectangles and pass these on to our work horse;
_cogl_rectangles_with_multitexture_coords. The definition of
_CoglMutiTexturedRect had 4 separate float members, x_1, y_1, x_2 and
y_2 which meant for some common cases we were having to copy out from an
array into these members. We are now able to simply point into the users
array avoiding a copy which seems desirable when submiting lots of
rectangles.
2010-02-12 14:05:02 +00:00
Robert Bragg
5f18fc928d cogl: explicitly mark cogl_<object>_ref/unref APIs as deprecated
This uses the G_GNUC_DEPRECATED macros to mark the
cogl_{texture,vertex_buffer,shader}_ref and unref APIs as deprecated.
Since this flagged that cogl-pango-display-list.c and
clutter-glx-texture-pixmap.c were still using deprecated _ref/_unref
APIs they have now been changed to use the cogl_handle_ref/unref API
instead.
2010-02-12 14:05:01 +00:00
Robert Bragg
48660349db cogl: cleanly separate primitives + paths code
The function prototypes for the primitives API were spread between
cogl-path.h and cogl-texture.h and should have been in a
cogl-primitives.h.

As well as shuffling the prototypes around into more sensible places
this commit splits the cogl-path API out from cogl-primitives.c into
a cogl-path.c
2010-02-12 14:05:01 +00:00
Robert Bragg
9f5a3e1445 cogl: remove redundant _cogl_journal_flush prototype
There was a redundant _cogl_journal_flush function prototype in
cogl-primitives.h
2010-02-12 14:05:01 +00:00
Robert Bragg
7edcbaa1f9 cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.

There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.

The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:

 return_type
 cogl_function_name (CoglType arg0,
                     CoglType arg1);

Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.

The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.

The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.

The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-12 14:05:00 +00:00
Robert Bragg
8c9472bc4c cogl: deprecates cogl_check_extension
OpenGL is an implementation detail for Cogl so it's not appropriate to
expose OpenGL extensions through the Cogl API.

Note: Clutter is currently still using this API, because it is still
doing raw GL calls in ClutterGLXTexturePixmap, so this introduces a
couple of (legitimate) build warnings while compiling Clutter.
2010-02-12 14:05:00 +00:00
Robert Bragg
b898f0e227 never presume queuing redraws on invisible actors is redundant
This replaces code like this:
  if (CLUTTER_ACTOR_IS_VISIBLE (self))
    clutter_actor_queue_redraw (self);
with:
  clutter_actor_queue_redraw (self);

clutter_actor_queue_redraw internally knows what can be optimized when
the actor is not visible, but it also knows that the queue_redraw signal
must always be sent in case a ClutterClone is cloning a hidden actor.
2010-02-12 14:05:00 +00:00
Robert Bragg
bfb271b403 box: port a ClutterGroup::foreach fix to ClutterBox
ClutterGroup::foreach was recently changed (ref: ce030a3fce) to use
g_list_foreach() to iterate the children instead of manually iterating
the list so it would safely handle calls like:

  clutter_container_foreach (container, clutter_actor_destroy);

  (In this example clutter_actor_destroy will result in the current
   list item being iterated being freed.)
2010-02-12 12:31:24 +00:00
Robert Bragg
60a4664d6e box: Adds missing copyright header
Adds a Copyright (C) 2009,2010  Intel Corporation header
2010-02-12 12:31:24 +00:00
Robert Bragg
4355621aeb group: make it comparable to ClutterBox
There is a lot of duplication between ClutterGroup and ClutterBox so
this makes the two files diff-able so that new fixes can easily be
ported to both and bug fixes missing in one or the other can be spotted
more easily. This doesn't change the behaviour of either actor; it's
really just a shuffle around of code and normalizes the coding style to
make the files comparable.

This has already uncovered one bug in ClutterBox, and also highlights
a bug in ClutterGroup + many other actors:

1) ClutterGroup::real_foreach was recently changed to use
   g_list_foreach instead of manually iterating the child list so it can
   safely handle calls like:
     clutter_container_foreach (container, clutter_actor_destroy);
   ClutterBox is still manually iterating the list.

2) In ClutterGroup we guard _queue_redraw() calls like this:
    if (CLUTTER_ACTOR_IS_VISIBLE (container))
	clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
   In ClutterBox we don't:
     I think ClutterBox is correct here because
     clutter_actor_queue_redraw already optimizes the case where the
     actor's not visible, but it also considers that the actor may be
     cloned and so the guard in ClutterGroup could break clones. This
     actually highlights a wider clutter bug since the same kinds of
     guards can be found in all other clutter actors.
2010-02-12 12:31:24 +00:00
Emmanuele Bassi
34c7611407 docs: Update the backend HACKING file
Clarify the Backend::create_context() vfunc role, and the
Stage::realize() vfunc with regards to creating the GL/GLES
context.
2010-02-12 11:38:47 +00:00
Neil Roberts
44818a4827 cogl: Add a fallback for when the signbit macro is missing
The signbit macro is defined in C99 so it should be available but some
versions of GCC don't appear to define it by default. If it's not
available we can use a hack to test the bit directly.
2010-02-11 15:59:53 +00:00
Emmanuele Bassi
59463c2213 Do a sanity check on _clutter_do_pick() arguments
We should check that the passed ClutterStage pointer is indeed: a) still
valid and b) a Stage.
2010-02-10 17:20:31 +00:00
Emmanuele Bassi
d0734bc474 input-device: Do not pick() on NULL stages
If the stage associated to the InputDevice is not set we should
short-circuit out and return NULL. This will result in a pick()
done on the event's stage - if applicable.

http://bugzilla.moblin.org/show_bug.cgi?id=9602
2010-02-10 17:13:33 +00:00
Emmanuele Bassi
4208169ab4 text: Bump up the preferred height
Instead of returning a sub-pixel height round up the preferred height to
the nearest integral value that is not less than the size reported by
Pango, once converted in pixels.
2010-02-10 15:45:54 +00:00
Emmanuele Bassi
f54b29a0c0 test-text-field: Tone down the border
Use a low opacity for the text field border.
2010-02-10 15:45:54 +00:00
Emmanuele Bassi
2670fc5871 test-text-field: Use ActorBox methods for the border
Clamp to pixel and use get_size() when painting the border of the text
field.
2010-02-10 15:45:54 +00:00
Robert Bragg
3fdb0a5950 uprof: make the Redrawing timer a child of the Master Clock
Previously it was a child of the Mainloop, but it's more closely
a child of the Master Clock.
2010-02-10 15:04:53 +00:00
Robert Bragg
1899dbdc27 backend-glx: Fix glXQueryVersion test
This fixes some backwards logic for asserting that we have a GLX major
version == 1 and a minor version >= 2. (NB: Although we technically
depend on GLX 1.3 features, we still have to support drivers that report
GLX 1.2 because there are a lot of mesa drivers out there incorrectly
report GLX 1.2 even though they export extensions that depend on GLX
1.3)
2010-02-10 15:04:53 +00:00
Neil Roberts
ce1bb3d858 cogl-material: Layers are not equal if the filters aren't equal
A material layer can not be considered equal if it is using different
texture filtering modes. This was causing problems where rectangles
with different filters would end up batched together and then rendered
with the wrong filter mode.
2010-02-10 12:41:09 +00:00
Emmanuele Bassi
b61c2b510b build: Tweak internal defines for building Clutter
When building Clutter we should:

  • disable Cogl deprecated API;
  • enable experimental API.
2010-02-10 10:58:14 +00:00
Robert Bragg
4a9f08639f debug: Adds CLUTTER_DEBUG=disable-swap-events option
This allows us to forcibly disable the use of the GLX_INTEL_swap_events
extension for testing or debugging purposes.
2010-02-09 22:19:41 +00:00
Robert Bragg
5d702853b8 glx backend: Adds support for GLX_INTEL_swap_event
If your OpenGL driver supports GLX_INTEL_swap_event that means when
glXSwapBuffers is called it returns immediatly and an XEvent is sent when
the actual swap has finished.

Clutter can use the events that notify swap completion as a means to
throttle rendering in the master clock without blocking the CPU and so it
should help improve the performance of CPU bound applications.
2010-02-09 22:19:41 +00:00
Robert Bragg
848db1ee4c glx backend: when running with GLX 1.3 then create GLXWindows for stages
Some extensions only support GLX versions > 1.3 and may not support
old style X Windows as GLXDrawables, so we now create GLXWindows for
stages when possible.
2010-02-09 22:19:41 +00:00
Neil Roberts
ca3ab41a1b clutter-backend: Fix the error check in _clutter_backend_create_stage
Commit d2bdd3cb62 fixed some compiler warnings but also broke the
ability to create a stage. Although not having warnings from the
compiler is nice, it is also nice to be able to create a stage so lets
not invert the meaning of the error check.
2010-02-09 18:33:09 +00:00
Emmanuele Bassi
7b1925df82 cogl: Move material_copy() out of the deprecated section
We strongly suggest people should be using cogl_material_copy(), but it
was hidden behind the deprecation guards.
2010-02-09 17:07:08 +00:00
Emmanuele Bassi
d2bdd3cb62 Fix some compiler warnings
GCC complains that some variable might be used uninitialized.
2010-02-09 16:58:03 +00:00
Neil Roberts
193c477495 cogl-bitmap: Remove const from premult_alpha_last_four_pixels_sse2
The function modifies the pixels pointed by p in-place so the pointer
can not be constant. The compiler was accepting this because the
modification is done from inline assembler.
2010-02-09 16:30:28 +00:00
Emmanuele Bassi
f5d2f58b03 docs: Clean up the unused symbols for Cogl
Gtk-doc is reporting a lot of false positives in the unused text file,
mostly because of new private files that have been added to Cogl but not
to the gtk-doc ignore list for the Cogl API reference.

Once the false positives have been removed we have a couple of really
missing symbols that should be added to the cogl-sections.txt file.
2010-02-09 15:29:29 +00:00
Bastian Winkler
ecc5ffe91a cogl-buffer: Use correct argument types in cogl_buffer_set_data_EXP
offset and size arguments are gsize in cogl-buffer.h

http://bugzilla.openedhand.com/show_bug.cgi?id=1980

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-02-09 15:01:09 +00:00
Emmanuele Bassi
9aac36b47e docs: Move some Cogl defines in the private section
The PixelFormat bit and mask #defines should not be used and are there
mostly for convenience, so we can push them to the "private" sub-section
of the API reference.

This pushed Cogl's API reference coverage to 100%.
2010-02-09 14:48:11 +00:00
Emmanuele Bassi
7ebb1e7157 docs: Fixes for Cogl API reference
98% symbol docs coverage.
  335 symbols documented.
  0 symbols incomplete.
  8 not documented.

Not bad, if I may say so.
2010-02-09 14:41:37 +00:00
Emmanuele Bassi
1d28ed035f Post-release bump to 1.1.11 2010-02-09 13:39:08 +00:00
Emmanuele Bassi
a24d4d21a0 Release 1.1.10
Brown paper bag release.
2010-02-09 13:24:13 +00:00
Emmanuele Bassi
738e73873d Update NEWS file 2010-02-09 13:24:13 +00:00
Emmanuele Bassi
cccf23caa4 build: Always build conformance tests with debug symbols
Having the conformance test suite build without debug symbols doesn't
make any sense.
2010-02-09 13:24:13 +00:00
Robert Bragg
e46db37c03 conform: fix stack corruption in test-behaviours.c
The test was calling g_object_get to fetch the "opacity-start" property
(unsigned int) into a guint8 local variable. It's a bit of a mean trap
given that the getter function returns guint8 values so this also adds a
comment explaining what's going on.
2010-02-09 13:09:24 +00:00
Neil Roberts
a02253f19a cogl-texture-2d: Use _cogl_texture_driver_gen to generate the GL tex
_cogl_texture_driver_gen is needed to set the texture minification
mode to Cogl's default of GL_LINEAR. There was also a line to set this
in _cogl_texture_2d_new_with_size but it wasn't working because it was
called *before* the texture was bound. If the texture was later
rendered with the default material it then it would end up with GL's
default mipmap filtering mode but without mipmaps so it would render
white squares instead.
2010-02-09 12:21:10 +00:00
Neil Roberts
1b2ff7eff7 cogl: Use SSE2 when possible for premultiplying
This adds a fast path for premultiplying an RGBA image using SSE2
instructions. SSE registers are 128-bit and we need at least 16-bits
per component for the intermediate result of the multiplication so we
can do two pixels in parallel with one register. The function
interleaves 2 SSE registers to multiply 4 pixels in one function call
with the hope that this will pipeline better.

http://bugzilla.openedhand.com/show_bug.cgi?id=1939
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-02-09 11:03:21 +00:00
Emmanuele Bassi
bbb058df40 actor: Improve readability of raise/lower warnings
• Add the function name in the warning, since the text is the same in
  both clutter_actor_raise() and clutter_actor_lower().

• If an actor has a name then prefer it to the type name.
2010-02-09 10:34:41 +00:00
Halton Huo
7664568fff Remove return from void functions
This patch fixes compilation on suncc.

http://bugzilla.openedhand.com/show_bug.cgi?id=1978

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-02-09 10:24:25 +00:00