1
0
Fork 0
Commit graph

1594 commits

Author SHA1 Message Date
Robert Bragg
4a110afe08 [cogl-material] Fixes some dirty flag checks
Flushing material layers wasn't clearing the right dirty flag and
some of the tests used to avoid re-submitting GL state weren't
complete.
2009-02-09 14:15:06 +00:00
Robert Bragg
fa55c096d8 [Cogl] Renames cogl_fog_set to cogl_set_fog for consistency
More things follow the <object>_set_<property> convention.
2009-02-09 14:15:06 +00:00
Neil Roberts
0be6f42070 [cogl-texture] Fix uninitialised priv var in texture_finalize
Fix my failure to initialise the priv var which was some causing
crashes.
2009-02-05 23:02:38 +00:00
Neil Roberts
a2168686b9 [cogl-texture] Move the destruction of the material to _finalize
Otherwise if the dipose method is called twice the material will
already be destroyed when texture_free_gl_resources is called so it
will issue a warning about an invalid handle.
2009-02-05 20:29:25 +00:00
Neil Roberts
05c7e5a97c [cogl-texture] Fix offset to next quad when flushing the log
When the quad log contains multiple textures (such as when a sliced
texture is drawn) it dispatches the log with multiple calls to
flush_quad_batch and walks a pointer along the list of vertices.
However this pointer was being incremented by only one vertex so the
next quad would be drawn with three of the vertices from the last
quad.
2009-02-05 20:29:25 +00:00
Neil Roberts
a4de12dbe8 [clutter-texture] Fix the no_slice property
The 'no_slice' property means the texture should never be sliced. We
want cogl to create a texture with any amount of waste so we pass
max_waste as -1. However this got broken in commit 168d55 so that the
meaning got negated (no_slice enabled slicing).
2009-02-05 20:29:25 +00:00
Chris Lord
6bc7f4c723 [actor] Force a relayout on set_parent()
The current code that handles the invariant that the new parent
of an actor needing a layout should also be queued for relayout
is hitting the short-circuiting we do in the queue_relayout()
method.

In order to fix this we can forcibly set the actor to need a
width/height request and an allocation; then we queue a relayout
on the parent.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-02-05 19:54:48 +00:00
Emmanuele Bassi
9cf02bfdb9 [text] Rename :alignment to :line-alignment
The :alignment property is prone to generate confusion: developers
will set it thinking that the contents of a ClutterText will
automagically align themselves.

Instead of using the generic term :alignment, and following the
GTK+ convention, we should use a more specific term, conveying the
actual effect of the property: alignment of the lines with respect
to each other, and not to the overall allocated area.

See bug 1428:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1428
2009-02-05 19:54:48 +00:00
Neil Roberts
e349642937 [clutter-texture] Unref the Cogl material on dispose
The material is created in the _init function and is owned by the
ClutterTexture so it will be leaked if not freed.
2009-02-05 18:27:04 +00:00
Neil Roberts
ee0bf5e26d [clutter-texture] Release the temporary ref taken when setting a texture
When setting the cogl texture, the ClutterTexture takes a reference to
the Cogl handle but the material takes an additional reference when it
is set as the layer. Nothing was unrefing the temporary reference so
the textures were being leaked.
2009-02-05 18:26:08 +00:00
Neil Roberts
8feb99722c [clutter-clone] Override the parent opacity to self not self->parent
The opacity of the source actor when painted from the clone should be
combined with the opacity of the clone as well as the clone's parents,
instead of just the parents.
2009-02-04 00:14:16 +00:00
Neil Roberts
8e44874a93 [cogl-gles2-wrapper] Remove the FIXME to adjust the fragment color
Removed some debugging code which sets the r and g values to 1 in the
fragment shader.
2009-02-02 22:02:47 +00:00
Neil Roberts
49359407b0 [cogl-texture] Fix the count for the number of enabled arrays
The quad drawing code keeps track of the number of texture units that
have the tex coord array enabled so that in the next call it can
disabled any that are no longer enabled. However it was using 'i+1' as
the count but 'i' is already set to 'n_layers' from the previous for
loop.

Therefore it was disabling an extra texture unit. This doesn't
normally matter but it was causing GLES 2 to pointlessly realize an
extra unit.
2009-02-02 22:01:47 +00:00
Neil Roberts
e88de5f5fd Fix building GLES 2 after the material branch merge
- In cogl-material.h it directly sets the values of the
  CoglMaterialLayerCombineFunc to some GL_* constants. However these
  aren't defined in GLES 2 beacuse it has no fixed function texture
  combining. Instead the CGL_* versions are now used. cogl-defines.h
  now sets these to either the GL_* version if it is available,
  otherwise it directly uses the number.

- Under GLES 2 cogl-material.c needs to access the CoglTexture struct
  so it needs to include cogl-texture-private.h

- There are now #define's in cogl-gles2-wrapper.h to remap the GL
  function names to the wrapper names. These are disabled in
  cogl-gles2-wrapper.c by defining COGL_GLES2_WRAPPER_NO_REMAP.

- Added missing wrappers for glLoadMatrixf and glMaterialfv.

- Renamed the TexEnvf wrapper to TexEnvi because the latter is used
  instead from the material API.
2009-02-02 21:57:41 +00:00
Neil Roberts
edbe9a0377 [cogl-material] Always bind the new texture handle
Cogl previously tried to cache the currently bound texture when
drawing through the material API to avoid excessive GL calls. However,
a few other places in Cogl and Clutter rebind the texture as well so
this can cause problems.

This was causing shaped windows to fail in Mutter because
ClutterGLXTexturePixmap was binding a different texture to update it
while the second texture unit was still active which meant the mask
texture would not be selected when the shaped window was drawn
subsequent times.

Ideally we would fix this by providing a wrapper around glBindTexture
which would affect the cached value. The cache would also have to be
cleared if a selected texture was deleted.
2009-02-02 14:53:23 +00:00
Emmanuele Bassi
2747aa7be2 [text] Use create_pango_layout()
Since we added clutter_actor_get_pango_layout() it would be a
good idea to use it in the ClutterText actor to cut down the
PangoContext-related calls.
2009-02-02 12:07:29 +00:00
Emmanuele Bassi
6e12722a9b [clone] Allow cloning unparented actors
If the source of a ClutterClone does not have a parent actor the
clone will be unable to paint it because it's missing an allocation.

A simple way to fix it is to make the ClutterClone act like a
"foster parent": when it is allocated it will check if the source
actor has a parent and if not it will allocate the source with
its preferred size.
2009-02-02 12:07:29 +00:00
Emmanuele Bassi
801e535e94 Add Actor::create_pango_layout()
Final bit of integration between ClutterActor and Pango: a simple
method for creating a PangoLayout, pre-filled with text and ready
to be rendered using cogl_pango_render_layout().

This should make writing new Actors rendering custom text in their
paint() implementation easy and reliable.
2009-02-02 12:07:28 +00:00
Emmanuele Bassi
488de99fc6 [text] Merge the attributes with markup enabled
ClutterText should merge the PangoAttributes set by using
clutter_text_set_attributes() with the attributes generated by
parsing Pango markup.

For this to work we must parse the markup and merge the attributes
we get out of pango_parse_markup() with the attributes set by
the user.

Setting the markup or the attributes on an editable text should
not work for the time being.
2009-02-02 12:07:28 +00:00
Tomas Frydrych
e8ef5153b1 Fix clutter_x11_texture_pixmap_get/set_property() following change of PROP_WINDOW type.
PROP_WINDOW is now gulong, so we need to use appropriate GValue accessors.
2009-02-02 07:37:08 +00:00
Tomas Frydrych
c1de33fafe Fixed handling of enter and leave events in clutter_x11_handle_event()
When processing a motion event, we need to spin the event loop two extra
  times to ensure that any enter/leave events that might have been synthesized
  are pumped through (otherwise they end up being pushed down the queue and
  never processed).
2009-02-02 07:36:36 +00:00
Emmanuele Bassi
bb6202a1a1 Add cogl-material-private.h to the source files
The material-private.h file was not added to the dist files and
caused a build failure.
2009-01-29 16:00:15 +00:00
Emmanuele Bassi
86aba661bd Fix a variable masking warning
The usual issue with math.h defined symbols.
2009-01-29 13:31:51 +00:00
Neil Roberts
f1bae778ce [cogl] Add an NULL terminator to the call to material_flush_gl_state
This fixes a compiler warning and a potential crash.
2009-01-29 12:21:56 +00:00
Robert Bragg
6516dd3033 Another Cogl gl vs gles normalizaion pass
This tries to make a number of files more comparable with the intention of
moving some code into cogl/common/

Files normalized:
 cogl.c
 cogl-context.c
 cogl-context.h
 cogl-texture.c
2009-01-28 17:20:16 +00:00
Robert Bragg
081f2056bc Removes cogl_color_set_from_4d as it may mislead people.
Someone not sure which cogl_color_set_from_* version is "best" may use
set_from_4d because taking doubles implies higher precision. Currently
it doesn't have any advantage.
2009-01-28 17:20:15 +00:00
Robert Bragg
ef4052c18d Changes cogl_rectangle to take x1, y1, x2, y2 args not x1, y1, width, height
This makes it consistent with cogl_rectangle_with_{multi,}texture_coords.
Notably the reason cogl_rectangle_with_{multi,}texture_coords wasn't changed
instead is that the former approach lets you describe back facing rectangles.
(though technically you could pass negative width/height values to achieve
 this; it doesn't seem as neat.)
2009-01-28 17:20:15 +00:00
Robert Bragg
6048a0544a Adds some debug code to _cogl_journal_flush_quad_batch
The code is #if 0 guarded, but when uncommented it outlines all drawn
rectangles with an un-blended red, green or blue border. This may e.g. help
with debugging texture slicing issues or blending issues, plus it looks quite
cool.
2009-01-28 17:20:15 +00:00
Neil Roberts
e30c5b33b9 Undeprecate clutter_actor_set_scale_with_gravity
The scale center has returned so this function is available again but
it was still deprecated so you couldn't use it.
2009-01-28 16:24:02 +00:00
Neil Roberts
3e68b23ea8 Merge branch 'scale-center'
Bug 1349 - Using the anchor point to set the scale center is messy

The branch adds an extra center point for scaling which can be used
for example to set a scale about the center without affecting the
position of the actor.

The scale center can be specified as a unit offset from the origin or
as a gravity. If specified as a gravity it will be stored as a
fraction of the actor's size so that the position will track when the
actor changes size.

The anchor point and rotation centers have been modified so they can
be set with a gravity in the same way. However, only the Z rotation
exposes a property to set using a gravity because the other two
require a Z coordinate which doesn't make sense to interpret as a
fraction of the actor's width or height.

Conflicts:

	clutter/clutter-actor.c
2009-01-28 15:39:51 +00:00
Neil Roberts
1cd313477b [clutter-actor] Use G_STMT_START/END instead of do { } while (0)
In the TRANSFORM_ABOUT_ANCHOR_COORD macro it now uses G_STMT_START and
G_STMT_END instead of directly using do/while because it's more
readable.
2009-01-28 15:33:34 +00:00
Neil Roberts
d7c275f5e5 [cogl-texture] Fix order of tex coords when compensating for waste
When drawing a texture with waste in _cogl_multitexture_unsliced_quad
it scales the texture coordinates so that the waste is not
included. However the formula was the wrong way around so it was
calculating as if the texture coordinates are ordered x1,x2,y1,y2 but
it is actually x1,y1,x2,y2.
2009-01-28 12:57:06 +00:00
Neil Roberts
e72042648c [cogl-texture] Reset size of vertex log after drawing a polygon
Otherwise trying to render a rectangle after a polygon doesn't work
because it expects the array to be empty when it starts logging
vertices.
2009-01-28 12:24:11 +00:00
Neil Roberts
eda1d08f76 Fix rectangles_with_multitexture_coords for sliced without tex coords
When the texture is sliced it drops back to a fallback function and
passes it the texture coordinates from the rectangle. However if no
tex coords are given it would crash. Now it passes the default
0.0->1.0 tex coords instead.
2009-01-28 12:24:10 +00:00
Neil Roberts
7df1987652 Fix _cogl_texture_unsliced_quad when no texture coordinates are given
If no texture coordinates are given then texture_unsliced_quad tries
to generate its own coordinates. However it also tries to read the
texture coordinates to check if they are in [0.0,1.0] range so it will
crash before it reaches that.
2009-01-28 12:24:10 +00:00
Emmanuele Bassi
9b7fa2cb04 Reuse the layers list
Instead of getting the layers list twice from the Material, we
can reuse the list when we need to retrieve the first layer.
2009-01-28 11:57:49 +00:00
Emmanuele Bassi
b3e02869cd Remove gtk-doc annotation
The _cogl_material_flush_layers_gl_state() function is static,
so it should not have a gtk-doc annotation.
2009-01-28 11:57:49 +00:00
Emmanuele Bassi
b08a011512 Fix typo in the :clone getter method
The :clone property getter method, clutter_clone_get_source(), was
defined using the wrong name of clutter_clone_get_clone_source().
2009-01-28 11:57:49 +00:00
Neil Roberts
2722909b76 Fix building GLES after _cogl_texture_handle_from_pointer got removed
Commit a688b1db removed the function and replaced it with a direct
cast. This was also being used in the GL ES so the build broke.
2009-01-28 10:56:47 +00:00
Neil Roberts
6b9da72ab0 Directly set backend font options in clutter_set_font_flags
Instead of having a separate set of font options that override the
backend options when clutter_set_font_flags is called, it now just
directly sets the backend font options. So now the font flags are just
a convenience wrapper around the backend font options.

This also makes the ClutterText labels automatically update when the
font flags are changed because they will respond to the 'font-changed'
signal from the backend.
2009-01-27 17:11:02 +00:00
Neil Roberts
89b0b00dd1 Listen for the font-changed signal on the backend in ClutterText
Whenever a ClutterText is created it now connects to the font-changed
signal. When it is emitted the layout cache is dirtied and a relayout
is queued. That way changes to the font options or resolution will
cause an immediate update to the labels in the scene.
2009-01-27 17:07:02 +00:00
Emmanuele Bassi
1b578fb9c7 [docs] Documentation fixes
Update the COGL API reference to avoid a lot of warnings coming
from gtk-doc.
2009-01-27 16:53:01 +00:00
Emmanuele Bassi
865f04decd Removed unused conditional
USE_COGL_MATERIAL is a left-over from the development branch.
2009-01-27 16:40:51 +00:00
Emmanuele Bassi
3cfc7fb1ca Merge branch 'generic-actor-clone'
* generic-actor-clone:
  Remove CloneTexture from the API
  [tests] Clean up the Clone interactive test
  Rename ActorClone to Clone/2
  Rename ActorClone to Clone/1
  Improves the unit test to verify more awkward scaling and some corresponding fixes
  Implements a generic ClutterActorClone that doesn't need fbos.
2009-01-27 16:14:35 +00:00
Emmanuele Bassi
a688b1db01 Fallout from cogl-material merge
When enabling the maintainer CFLAGS the compiler got very angry
at the code that has been merged.
2009-01-27 16:02:04 +00:00
Robert Bragg
840941fdfe Adds padding to CoglColor to future proof it a bit
This adds enough padding to allow us to change to an internal float storage
for the color components if needs be in the future.
2009-01-27 15:20:16 +00:00
Robert Bragg
70d7d16f13 Support scaling on the z axis with cogl_scale
This simply adds a z argument to cogl_scale and updates clutter-actor.c
to pass 1.0 for the z scale.
2009-01-27 15:20:13 +00:00
Robert Bragg
e9a45c7744 Merge branch 'cogl-material'
Conflicts:

	clutter/cogl/gl/cogl-texture.c
	clutter/cogl/gles/cogl-primitives.c

* cogl-material:
 clutter-{clone-,}texture weren't updating their material opacity.
 Updates GLES1 support for CoglMaterial
 Normalizes gl vs gles code in preperation for synching material changes
 Removes cogl_blend_func and cogl_alpha_func
 Fully integrates CoglMaterial throughout the rest of Cogl
 [cogl-material] Restore the GL_TEXTURE_ENV_MODE after material_rectangle
 [cogl-material] Make the user_tex_coords parameter of _rectangle const
 [test-cogl-material] Remove return value from material_rectangle_paint
 Add cogl-material.h and cogl-matrix.h to libclutterinclude_HEADERS
 [cogl-material] improvements for cogl_material_rectangle
 [cogl-material] Adds a cogl_material_set_color function
 [cogl-material] Some improvements for how we sync CoglMaterial state with OpenGL
 [cogl-material] Converts clutter-texture/clutter-clone-texture to the material API
 [doc] Hooks up cogl-material reference documentation
 Updates previous GLES multi-texturing code to use CoglMaterial
 Adds a CoglMaterial abstraction, which includes support for multi-texturing
 [doc] Hooks up cogl-matrix reference documentation
 Adds CoglMatrix utility code
 [tests] Adds an interactive unit test for multi-texturing
 [multi-texturing] This adds a new cogl_multi_texture API for GL,GLES1 + GLES2
2009-01-27 15:19:34 +00:00
Emmanuele Bassi
86e95a779a Remove CloneTexture from the API
ClutterClone supercedes ClutterCloneTexture, since it can clone
every kind of actor -- including composite ones.

This is another "brain surgery with a shotgun" kind of commit: it
removes CloneTexture and updates every test case using CloneTexture
to ClutterClone. The API fallout is minimal, luckily for us.
2009-01-27 15:18:45 +00:00
Neil Roberts
418fb995c8 Replace clutter_set_use_mipmapped_text with clutter_set_font_flags
The hope is that this function makes it easier to extend the font
settings with more flags without having to add a function for every
setting.

A new flag for enabling hinting has been added. If set, this changes
the font options on the global PangoContext and any newly created
PangoContexts. The options are only set if the flag is changed from
the default so it won't override any detailed setting chosen by the
backend.
2009-01-27 14:43:44 +00:00