Robert Bragg [Wed, 21 Oct 2009 22:24:49 +0000 (23:24 +0100)]
[cogl] Make sure Cogl always knows the current window geometry
Because Cogl defines the origin of viewport and window coordinates to be
top-left it always needs to know the size of the current window so that Cogl
window/viewport coordinates can be transformed into OpenGL coordinates.
This also fixes cogl_read_pixels to use the current draw buffer height
instead of the viewport height to determine the OpenGL y coordinate to use
for glReadPixels.
Robert Bragg [Thu, 22 Oct 2009 15:13:01 +0000 (16:13 +0100)]
[cogl] Make sure we draw upside down to offscreen draw buffers
First a few notes about Cogl coordinate systems:
- Cogl defines the window origin, viewport origin and texture coordinates
origin to be top left unlike OpenGL which defines them as bottom left.
- Cogl defines the modelview and projection identity matrices in exactly the
same way as OpenGL.
- I.e. we believe that for 2D centric constructs: windows/framebuffers,
viewports and textures developers are more used to dealing with a top left
origin, but when modeling objects in 3D; an origin at the center with y
going up is quite natural.
The way Cogl handles textures is by uploading data upside down in OpenGL
terms so that bottom left becomes top left. (Note: This also has the
benefit that we don't need to flip the data we get from image decoding
libraries since they typically also consider top left to be the image
origin.)
The viewport and window coords are mostly handled with various y =
height - y tweaks before we pass y coordinates to OpenGL.
Generally speaking though the handling of coordinate spaces in Cogl is a bit
fragile. I guess partly because none of it was design to be, it just
evolved from how Clutter defines its coordinates without much consideration
or testing. I hope to improve this over a number of commits; starting here.
This commit deals with the fact that offscreen draw buffers may be bound to
textures but we don't "upload" the texture data upside down, and so if you
texture from an offscreen draw buffer you need to manually flip the texture
coordinates to get it the right way around. We now force offscreen
rendering to be flipped upside down by tweaking the projection matrix right
before we submit it to OpenGL to scale y by -1. The tweak is entirely
hidden from the user such that if you call cogl_get_projection you will not
see this scale.
Robert Bragg [Thu, 22 Oct 2009 11:35:33 +0000 (12:35 +0100)]
[cogl] Ensure features are initialized first in cogl_create_context
Previously some context initializing was being done without valid feature
flags.
Robert Bragg [Fri, 16 Oct 2009 23:31:26 +0000 (00:31 +0100)]
[clip-stack] Handle flipped rectangles in try_pushing_rect_as_window_rect()
We were ignoring the possibility that the current modelview matrix may flip
the incoming rectangle in which case we didn't calculate a valid scissor
rectangle for clipping.
This fixes: http://bugzilla.o-hand.com/show_bug.cgi?id=1809
(Clipping doesn't work within an FBO)
Robert Bragg [Fri, 25 Sep 2009 13:34:34 +0000 (14:34 +0100)]
[draw-buffers] First pass at overhauling Cogl's framebuffer management
Cogl's support for offscreen rendering was originally written just to support
the clutter_texture_new_from_actor API and due to lack of documentation and
several confusing - non orthogonal - side effects of using the API it wasn't
really possible to use directly.
This commit does a number of things:
- It removes {gl,gles}/cogl-fbo.{c,h} and adds shared cogl-draw-buffer.{c,h}
files instead which should be easier to maintain.
- internally CoglFbo objects are now called CoglDrawBuffers. A
CoglDrawBuffer is an abstract base class that is inherited from to
implement CoglOnscreen and CoglOffscreen draw buffers. CoglOffscreen draw
buffers will initially be used to support the
cogl_offscreen_new_to_texture API, and CoglOnscreen draw buffers will
start to be used internally to represent windows as we aim to migrate some
of Clutter's backend code to Cogl.
- It makes draw buffer objects the owners of the following state:
- viewport
- projection matrix stack
- modelview matrix stack
- clip state
(This means when you switch between draw buffers you will automatically be
switching to their associated viewport, matrix and clip state)
Aside from hopefully making cogl_offscreen_new_to_texture be more useful
short term by having simpler and well defined semantics for
cogl_set_draw_buffer, as mentioned above this is the first step for a couple
of other things:
- Its a step toward moving ownership for windows down from Clutter backends
into Cogl, by (internally at least) introducing the CoglOnscreen draw
buffer. Note: the plan is that cogl_set_draw_buffer will accept on or
offscreen draw buffer handles, and the "target" argument will become
redundant since we will instead query the type of the given draw buffer
handle.
- Because we have a common type for on and offscreen framebuffers we can
provide a unified API for framebuffer management. Things like:
- blitting between buffers
- managing ancillary buffers (e.g. attaching depth and stencil buffers)
- size requisition
- clearing
Robert Bragg [Tue, 20 Oct 2009 15:55:10 +0000 (16:55 +0100)]
[stage-x11] Ensure viewport is initialized before first stage paint
This ensures that glViewport is called before the first stage paint.
Previously _clutter_stage_maybe_setup_viewport (which is done before we
start painting) was bailing out without calling cogl_setup_viewport because
the CLUTTER_STAGE_IN_RESIZE flag may be set if the stage was resized before
the first paint. (NB: The CLUTTER_STAGE_IN_RESIZE flag isn't removed until
we get an explicit event back from the X server since the window manager may
choose to deny/alter the resize.)
We now special case the first resize - where the viewport hasn't previously
been initialized and use the requested geometry to initialize the
glViewport without waiting for a reply from the server.
Robert Bragg [Tue, 15 Sep 2009 21:19:01 +0000 (22:19 +0100)]
[cogl-fbo] Bring the gles code more in line with gl code
Over time the two cogl-fbo.c files have needlessly diverged as bug fixes or
cleanups went into one version but not the other. This tries to bring them
back in line with each other. It should actually be simple enough to move
cogl-fbo.c to be a common file, and simply not build it for GLES 1.1, so
maybe I'll follow up with such a patch soon.
Robert Bragg [Tue, 15 Sep 2009 21:15:03 +0000 (22:15 +0100)]
[cogl-fbo] Remove poorly documented workaround for unknown driver/hardware
The comment just said: "Some implementation require a clear before drawing
to an fbo. Luckily it is affected by scissor test." and did a scissored
clear, which is clearly a driver bug workaround, but for what driver? The
fact that it was copied into the gles backend (or vica versa is also
suspicious since it seems unlikely that the workaround is necessary for both
backends.)
We can easily restore the workaround with a better comment if this problem
really still exists on current drivers, but for now I'd rather minimize
hand-wavey workaround code that can't be tested.
Damien Lespiau [Sun, 1 Nov 2009 14:36:05 +0000 (14:36 +0000)]
texture: Don't compare fbo_source with COGL_INVALID_HANDLE
fbo_source is a ClutterActor, it should be compared to NULL instead of
COGL_INVALID_HANDLE.
Emmanuele Bassi [Fri, 30 Oct 2009 12:11:19 +0000 (12:11 +0000)]
build: Add missing gles/cogl-context-driver.h to dist
The gles/cogl-context-driver.h header file is missing from the
dist target, which means it's not in the tarballs.
Emmanuele Bassi [Fri, 30 Oct 2009 11:02:35 +0000 (11:02 +0000)]
Add run-time version checks
Just like CLUTTER_CHECK_VERSION does version checking at compile
time, we need a way to verify the version of the library that we
are linking against. This is mostly needed for language bindings
and for run-time loadable modules -- when we'll get those.
Neil Roberts [Tue, 27 Oct 2009 13:18:51 +0000 (13:18 +0000)]
[cogl_polygon] Enable COGL_ENABLE_BLEND when use_color is set
Otherwise you can't use the alpha channel of the vertex colors unless
the material has a texture with alpha or the material's color has
alpha less than 255.
Neil Roberts [Tue, 27 Oct 2009 12:38:10 +0000 (12:38 +0000)]
build: Add $(top_buiddir)/clutter/cogl to the include path in clutter/cogl/cogl
Some files try to include "cogl/cogl-defines-gl.h" so
$(top_builddir)/clutter/cogl needs to be in the include path for out of
tree builds to work.
Emmanuele Bassi [Mon, 26 Oct 2009 16:29:31 +0000 (16:29 +0000)]
color: Fix HLS-to-RGB conversion
Apparently, on 64bit systems the floating point noise is enough
to screw up the float-to-int truncation.
The solution is to round up by 0.5 and then use floorf(). This
gives predictable and correct results on both 32bit and 64bit
systems.
Emmanuele Bassi [Mon, 26 Oct 2009 16:02:06 +0000 (16:02 +0000)]
layout: Do not create a LayoutMeta on remove
When calling remove_child_meta() we check if there is a LayoutMeta
already attached to the Actor, and if that LayoutMeta matches the
(manager, container, actor) tuple. If the LayoutMeta does not match,
though, we create a new LayoutMeta instance -- in order to remove it
right afterwards.
Instead of doing this, we can simply check for a matching LayoutMeta
and if present, remove it.
In case of an existing, non-matching LayoutMeta, we're left with a
dangling instance, but it does not matter: the removal happens in the
unparenting phase of a ClutterContainer, so either the Actor will be
destroyed and thus the LayoutMeta will be disposed along with it; or
it will be parented to another container, and thus the LayoutMeta
will be replaced.
Emmanuele Bassi [Mon, 26 Oct 2009 15:10:20 +0000 (15:10 +0000)]
tests: Use the right key symbol for adding children
The test-box-layout should be using CLUTTER_plus instead of a
literal '+'.
Emmanuele Bassi [Mon, 26 Oct 2009 15:09:07 +0000 (15:09 +0000)]
box: Depth level changes should queue a relayout
ClutterBox is not ClutterGroup: a change in the level of an actor
through raise, lower or depth sorting must trigger a relayout.
Emmanuele Bassi [Mon, 26 Oct 2009 15:08:03 +0000 (15:08 +0000)]
box: Check before using the LayoutManager instance
A ClutterBox might not have a ClutterLayoutManager instance
associated -- for instance, during destruction. We should check
for one before calling methods on it.
Emmanuele Bassi [Mon, 26 Oct 2009 11:51:30 +0000 (11:51 +0000)]
texture: Error handling fix
When cogl_texture_new_from_data() fails in clutter_texture_set_from_data()
and no GError is provided, the clutter app will segfault when dereferencing
the GError ** and emitting LOAD_FINISHED signal.
Based on a patch by: Haakon Sporsheim <haakon.sporsheim@gmail.com>
http://bugzilla.openedhand.com/show_bug.cgi?id=1806
Emmanuele Bassi [Mon, 26 Oct 2009 11:42:16 +0000 (11:42 +0000)]
tests: Print out the captured event type
The ::captured-event signal on the Stage is not printing out the
event type.
Emmanuele Bassi [Fri, 23 Oct 2009 16:32:18 +0000 (17:32 +0100)]
docs: Add images for layout managers
It's easier to show the layout manager policy with a simple
screen shot coming from our interactive tests.
Emmanuele Bassi [Fri, 23 Oct 2009 15:44:28 +0000 (16:44 +0100)]
cogl: Avoid C99-isms
Do not declare variables after statements.
Emmanuele Bassi [Fri, 23 Oct 2009 14:46:25 +0000 (15:46 +0100)]
cogl: Remove cogl-current-matrix.c
The cogl-current-matrix.c file is unused since commit
5e5d94dfbed18bf2b4c8c7a7ff9847952b2c4ae2 and it's not compiled
or distributed anymore.
Emmanuele Bassi [Fri, 23 Oct 2009 13:30:15 +0000 (14:30 +0100)]
Update Git ignore rules
Emmanuele Bassi [Fri, 23 Oct 2009 12:55:50 +0000 (13:55 +0100)]
Post-release bump to 1.1.3
Emmanuele Bassi [Fri, 23 Oct 2009 12:38:28 +0000 (13:38 +0100)]
Release 1.1.2 developers snapshot
Emmanuele Bassi [Fri, 23 Oct 2009 11:15:25 +0000 (12:15 +0100)]
build: Make COGL pass distcheck
Some changes to make COGL pass distcheck with Automake 1.11 and
anal-retentiveness turned up to 11.
The "major" change is the flattening of the winsys/ part of COGL,
which is built directly inside libclutter-cogl.la instead of an
intermediate libclutter-cogl-winsys.la object.
Ideally, the whole COGL should be flattened out using a
quasi-non-recursive Automake layout; unfortunately, the driver/
sub-section ships with identical targets and Automake cannot
distinguish GL and GLES objects.
Emmanuele Bassi [Fri, 23 Oct 2009 09:17:40 +0000 (10:17 +0100)]
actor: Identify allocation cycles
If an actor calls directly or indirectly clutter_actor_queue_relayout()
on itself from within the allocate() implementation it will cause a
relayout cycle. This is usually a condition that should be checked by
ClutterActor and we should emit a warning if it is verified.
Emmanuele Bassi [Fri, 23 Oct 2009 09:08:02 +0000 (10:08 +0100)]
actor: Add checks for IN_DESTRUCTION flag
ClutterActor should check whether the current instance is being
destroyed and avoid performing operations like:
• queueing redraws
• queueing relayouts
It should also warn if the actor is being parented to an actor
currently being destroyed.
Emmanuele Bassi [Fri, 23 Oct 2009 08:48:35 +0000 (09:48 +0100)]
actor: Show actor name or type in the state checks warnings
When showing a warning in the state checks we perform to verify that
the invariants are maintained when showing, mapping and realizing, we
should also print out the name of the actor failing the checks. If the
actor has no name, the GType name should be used as a fallback.
Neil Roberts [Thu, 22 Oct 2009 15:55:29 +0000 (16:55 +0100)]
Fix some compilation errors in cogl-gles2-wrapper.c
The changes in
74f2122b6 introduced some syntax errors which were
preventing the GLES2 backend from compiling.
Emmanuele Bassi [Thu, 22 Oct 2009 12:48:49 +0000 (13:48 +0100)]
clone: Set :source as CONSTRUCT
The :source property for ClutterClone is a constructor property, but
it most definitely is not a constructor-only one.
Neil Roberts [Thu, 22 Oct 2009 14:39:30 +0000 (15:39 +0100)]
Remove cogl/{gl,gles}/Makefile.am
These are no longer used anywhere.
Emmanuele Bassi [Wed, 21 Oct 2009 16:44:44 +0000 (17:44 +0100)]
docs: Close the right tag to avoid XML errors
Emmanuele Bassi [Wed, 21 Oct 2009 16:43:34 +0000 (17:43 +0100)]
docs: Rename the Shader and StageManager sections
Emmanuele Bassi [Wed, 21 Oct 2009 15:15:18 +0000 (16:15 +0100)]
tests: Update test-script
Use explicit alpha definition and custom alpha functions.
Emmanuele Bassi [Wed, 21 Oct 2009 15:04:12 +0000 (16:04 +0100)]
alpha: Manually parse the :mode property in ClutterScript
The :mode property for a ClutterAlpha can either be an integer, for
an easing mode logical id, or a string for the easing mode "nickname".
Emmanuele Bassi [Wed, 21 Oct 2009 14:43:01 +0000 (15:43 +0100)]
script, docs: Update documentation for alphas
It is now possible to have Alpha instances defined explicitly for
behaviours, so we need to fix the documentation.
Emmanuele Bassi [Wed, 21 Oct 2009 14:29:25 +0000 (15:29 +0100)]
alpha: Allow setting the function in ClutterScript
When defining an Alpha in ClutterScript we should allow setting
the alpha function by using a custom property. This makes it
possible to have both:
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : { "timeline" : "timeline-1", "function" : "alpha_func" },
...
}
And:
{
"id" : "alpha-1",
"type" : "ClutterAlpha",
"timeline" : "timeline-1",
"function" : "alpha_func"
},
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : "alpha-1",
...
}
The latter allows defining a single alpha function for multiple
behaviours.
Emmanuele Bassi [Wed, 21 Oct 2009 14:17:50 +0000 (15:17 +0100)]
script: Always allow setting object properties by id reference
The block that allows setting a GObject property holding an object
instance is conditionally depending on the USE_PIXBUF define. This
makes it impossible to reference an object inside ClutterScript on
platforms not using GdkPixbuf.
Emmanuele Bassi [Wed, 21 Oct 2009 14:16:43 +0000 (15:16 +0100)]
behaviour: Notify changes of the :alpha property
The set_alpha() setter of ClutterBehaviour is not emitting notifications
for the alpha property.
Owen W. Taylor [Tue, 6 Oct 2009 03:20:07 +0000 (23:20 -0400)]
Force a relayout when showing an actor
When an actor is hidden, the parent actor is not required to
size request or allocate it. (ClutterGroup does, but, for example,
NbtkBoxLayout doesn't.) This means that the
needs_width_request/needs_height_request/needs_allocate can be
stale when we go to show it again - they are set for the actor
but not the parent. Explicitly setting them to FALSE avoids
clutter_actor_relayout() improperly short-circuiting.
http://bugzilla.openedhand.com/show_bug.cgi?id=1831
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Emmanuele Bassi [Tue, 20 Oct 2009 21:05:04 +0000 (22:05 +0100)]
text: Invalidate caches and sizes in set_text_internal()
The change in commit
3bbc96e17e5a03ba931c86a5cd2a0ecaa2a3b77b moved the
:text property setter to use set_text_internal(); this function does not
invalidate the Layout cache and does not queue a relayout, thus breaking
the behaviour of ClutterText when setting the contents of the actor using
the property.
http://bugzilla.openedhand.com/show_bug.cgi?id=1851
Robert Bragg [Tue, 20 Oct 2009 13:57:40 +0000 (14:57 +0100)]
[group] Fix copy & paste error from
857b0239e (Use FixedLayout inside Group)
clutter_group_get_preferred_height was calling
clutter_layout_manager_get_preferred_width which e.g. broke
test-actor-clone.
Robert Bragg [Tue, 29 Sep 2009 01:56:23 +0000 (02:56 +0100)]
[gles2] remove lots of redundant matrix stack code
Since we no longer depend on the GL matrix API in Cogl we can remove a lot
of wrapper code from the GLES 2 backend. This is particularly nice given
that there was no code shared between the cogl-matrix-stack API and gles2
wrappers so we had a lot of duplicated logic.
Robert Bragg [Tue, 13 Oct 2009 22:09:42 +0000 (23:09 +0100)]
[cogl] Removes the cogl-current-matrix abstraction
The indirection through this API isn't necessary since we no longer
arbitrate between the OpenGL matrix API and Cogl's client side API. Also it
doesn't help to maintain an OpenGL style matrix mode API for internal use
since it's awkward to keep restoring the MODELVIEW mode and easy enough to
directly work with the matrix stacks of interest.
This replaces use of the _cogl_current_matrix API with direct use of the
_cogl_matrix_stack API. All the unused cogl_current_matrix API is removed
and the matrix utility code left in cogl-current-matrix.c was moved to
cogl.c.
Robert Bragg [Wed, 14 Oct 2009 09:53:48 +0000 (10:53 +0100)]
[matrix-stack] Adds ctx->flushed_matrix_mode to cache the gl matrix mode
This cache of the gl matrix mode lets us avoid repeat calls to glMatrixMode
in _cogl_matrix_stack_flush_to_gl when we have lots of sequential modelview
matrix modifications.
Robert Bragg [Tue, 6 Oct 2009 11:36:32 +0000 (12:36 +0100)]
matrix-stack: more optimization for load_identity case
This goes a bit further than the previous patch, and as a special case
we now simply represent identity matrices using a boolean, and only
lazily initialize them when they need to be modified.
Robert Bragg [Tue, 6 Oct 2009 09:52:07 +0000 (10:52 +0100)]
[matrix-stack] avoid redundant clearing of matrix when using load_identity
The journal always uses an identity matrix since it uses software
transformation. Currently it manually uses glLoadMatrix since previous
experimentation showed that the cogl-matrix-stack gave bad performance, but
it would be nice to fix performance so we only have to care about one path
for loading matrices.
For the common case where we do:
cogl_matrix_stack_push()
cogl_matrix_stack_load_identity()
we were effectively initializing the matrix 3 times. Once due to use of
g_slice_new0, then we had a cogl_matrix_init_identity in
_cogl_matrix_state_new for good measure, and then finally in
cogl_matrix_stack_load_identity we did another cogl_matrix_init_identity.
We don't use g_slice_new0 anymore, _cogl_matrix_state_new is documented as
not initializing the matrix (instead _cogl_matrix_stack_top_mutable now
takes a boolean to choose if new stack entries should be initialised) and so
we now only initialize once in cogl_matrix_stack_load_identity.
Robert Bragg [Tue, 29 Sep 2009 01:58:27 +0000 (02:58 +0100)]
[current-matrix] Adds texture matrix stacks + removes GL matrix API usage
This relates back to an earlier commitment to stop using the OpenGL matrix
API which is considered deprecated. (ref
54159f5a1d029db)
The new texture matrix stacks are hung from a list of (internal only)
CoglTextureUnit structures which the CoglMaterial code internally references
via _cogl_get_texure_unit ().
So we would be left with only the cogl-matrix-stack code being responsible
for glMatrixMode, glLoadMatrix and glLoadIdentity this commit updates the
journal code so it now uses the matrix-stack API instead of GL directly.
Emmanuele Bassi [Mon, 19 Oct 2009 14:31:29 +0000 (15:31 +0100)]
text: Take pre-edit cursor position into account
When determining the cursor position we also need to take into account
the pre-edit cursor position as set by the set_preedit_string()
function.
Emmanuele Bassi [Mon, 19 Oct 2009 11:01:38 +0000 (12:01 +0100)]
docs: Documentation fixes
• Fix list_stages() and peek_stages() documentation
• Fix clutter_text_set_preedit_string() arguments in the header
to match source and documentation
• Add clutter_units_cm() to the private section for Units
• Rename the LayoutManager section
• Add FlowLayout:homogeneous accessors
Emmanuele Bassi [Mon, 19 Oct 2009 10:45:15 +0000 (11:45 +0100)]
Merge branch 'layout-manager'
* layout-manager: (50 commits)
docs: Reword a link
layout, docs: Add more documentation to LayoutManager
layout, docs: Fix description of Bin properties
layout, bin: Use ceilf() instead of casting to int
layout, docs: Add long description for FlowLayout
layout, box: Clean up
layout, box: Write long description for Box
layout, docs: Remove unused functions
layout: Document BoxLayout
layout: Add BoxLayout, a single line layout manager
layout: Report the correct size of FlowLayout
layout: Resizing the stage resizes the FlowLayout box
layout: Use the get_request_mode() getter in BinLayout
layout: Change the request-mode along with the orientation
actor: Add set_request_mode() method
[layout] Remove FlowLayout:wrap
[layout] Rename BinLayout and FlowLayout interactive tests
[layout] Skip invisible children in FlowLayout
[layout] Clean up and document FlowLayout
[layout] Snap children of FlowLayout to column/row
...
Emmanuele Bassi [Mon, 19 Oct 2009 10:44:29 +0000 (11:44 +0100)]
docs: Reword a link
Emmanuele Bassi [Mon, 19 Oct 2009 10:00:23 +0000 (11:00 +0100)]
layout, docs: Add more documentation to LayoutManager
The layout manager reference should have some documentation on how
to use a LayoutManager object inside a container and how to implement
a LayoutManager sub-class correctly.
Emmanuele Bassi [Sun, 18 Oct 2009 16:49:00 +0000 (17:49 +0100)]
build: Add back QUIET_GEN to the GIR generation
Emmanuele Bassi [Sun, 18 Oct 2009 16:15:04 +0000 (17:15 +0100)]
Update ignore file
Emmanuele Bassi [Sun, 18 Oct 2009 16:12:12 +0000 (17:12 +0100)]
build: De-nest the JSON from the introspection rules
The JSON conditional rules can be moved outside the introspection
conditional ones to avoid a nested check, as all the JSON rules do
is setting up variables that may or may not be used.
Emmanuele Bassi [Sun, 18 Oct 2009 16:11:42 +0000 (17:11 +0100)]
build: Use QUIET_GEN when building ClutterJson GIR
Emmanuele Bassi [Sun, 18 Oct 2009 16:00:24 +0000 (17:00 +0100)]
build: Fix up the GIR generation rules
The rules for generating Clutter's introspection data are
still referencing the old COGL layout.
Emmanuele Bassi [Fri, 16 Oct 2009 23:30:37 +0000 (00:30 +0100)]
build: Add CPPFLAGS for the g-ir-scanner command line
When I moved all CPP flags to AM_CPPFLAGS from the INCLUDES directive
I forgot that g-ir-scanner needs those defines as well.
Robert Bragg [Wed, 16 Sep 2009 13:01:57 +0000 (14:01 +0100)]
[cogl-primitives] Split the journal out from cogl-primitives.c
The Journal can be considered a standalone component, so even though
it's currently only used to log quads, it seems better to split it
out into its own file.
Robert Bragg [Sun, 6 Sep 2009 20:47:46 +0000 (21:47 +0100)]
[test-backface-culling] Check that inverted tex coords don't affect culling
The additional check draws another front facing rectangle but this time with
the texture coords flipped on the x axis. The code that handles sliced
textures in cogl-primitives.c makes some suspicious changes to the geometry
when the texture coords are inverted.
Robert Bragg [Wed, 23 Sep 2009 14:11:55 +0000 (15:11 +0100)]
[cogl-spans] split out cogl-spans code from cogl-texture-2d-sliced
When we implement atlas textures we will probably want to use the spans API
to handle texture repeating so it doesn't make sense to leave the code in
cogl-texture-2d-sliced.c. Since it's a standalone set of data structures
and algorithms it also seems reasonable to split out from cogl-texture.
Vladimir Nadvornik [Sun, 30 Aug 2009 10:36:11 +0000 (12:36 +0200)]
[cogl-texture] Split CoglTexture into an abstract class + CoglTexture2dSliced
cogl-texture-2d-sliced provides an implementation of CoglTexture and this
seperation lays the foundation for potentially supporting atlas textures,
pixmap textures (as in GLX_EXT_texture_from_pixmap) and fast-path
GL_TEXTURE_{1D,2D,3D,RECTANGLE} textures in a maintainable fashion.
Robert Bragg [Wed, 16 Sep 2009 10:56:17 +0000 (11:56 +0100)]
[cogl-texture] Seal CoglTexture internals from cogl-primitives.c
cogl-primitives.c was previously digging right into CoglTextures so it could
manually iterate the texture slices for texturing quads and polygons and
because we were missing some state getters we were lazily just poking into
the structures directly.
This adds some extra state getter functions, and adds a higher level
_cogl_texture_foreach_slice () API that hopefully simplifies the way in
which sliced textures may be used to render primitives. This lets you
specify a rectangle in "virtual" texture coords and it will call a given
callback for each slice that intersects that rectangle giving the virtual
coords of the current slice and corresponding "real" texture coordinates for
the underlying gl texture.
At the same time a noteable bug in how we previously iterated sliced
textures was fixed, whereby we weren't correctly handling inverted texture
coordinates. E.g. with the previous code if you supplied texture coords of
tx1=100,ty1=0,tx2=0,ty2=100 (inverted along y axis) that would result in a
back-facing quad, which could be discarded if using back-face culling.
Robert Bragg [Thu, 30 Jul 2009 11:06:02 +0000 (12:06 +0100)]
[docs] switch gl_handle+gl_target docs for cogl_texture_new_from_foreign
The descriptions for gl_handle and gl_target were inverted.
Thanks to Young-Ho Cha for spotting that.
Signed-off-by: Robert Bragg <robert@linux.intel.com>
Robert Bragg [Wed, 29 Jul 2009 16:21:07 +0000 (17:21 +0100)]
[cogl] move clutter/pango to clutter/cogl/pango
As part of the re-organisation of Cogl; move clutter/pango to be part of the
cogl sub-project.
Robert Bragg [Tue, 28 Jul 2009 01:02:02 +0000 (02:02 +0100)]
Intial Re-layout of the Cogl source code and introduction of a Cogl Winsys
As part of an incremental process to have Cogl be a standalone project we
want to re-consider how we organise the Cogl source code.
Currently this is the structure I'm aiming for:
cogl/
cogl/
<put common source here>
winsys/
cogl-glx.c
cogl-wgl.c
driver/
gl/
gles/
os/ ?
utils/
cogl-fixed
cogl-matrix-stack?
cogl-journal?
cogl-primitives?
pango/
The new winsys component is a starting point for migrating window system
code (i.e. x11,glx,wgl,osx,egl etc) from Clutter to Cogl.
The utils/ and pango/ directories aren't added by this commit, but they are
noted because I plan to add them soon.
Overview of the planned structure:
* The winsys/ API is the API that binds OpenGL to a specific window system,
be that X11 or win32 etc. Example are glx, wgl and egl. Much of the logic
under clutter/{glx,osx,win32 etc} should migrate here.
* Note there is also the idea of a winsys-base that may represent a window
system for which there are multiple winsys APIs. An example of this is
x11, since glx and egl may both be used with x11. (currently only Clutter
has the idea of a winsys-base)
* The driver/ represents a specific varient of OpenGL. Currently we have "gl"
representing OpenGL 1.4-2.1 (mostly fixed function) and "gles" representing
GLES 1.1 (fixed funciton) and 2.0 (fully shader based)
* Everything under cogl/ should fundamentally be supporting access to the
GPU. Essentially Cogl's most basic requirement is to provide a nice GPU
Graphics API and drawing a line between this and the utility functionality
we add to support Clutter should help keep this lean and maintainable.
* Code under utils/ as suggested builds on cogl/ adding more convenient
APIs or mechanism to optimize special cases. Broadly speaking you can
compare cogl/ to OpenGL and utils/ to GLU.
* clutter/pango will be moved to clutter/cogl/pango
How some of the internal configure.ac/pkg-config terminology has changed:
backendextra -> CLUTTER_WINSYS_BASE # e.g. "x11"
backendextralib -> CLUTTER_WINSYS_BASE_LIB # e.g. "x11/libclutter-x11.la"
clutterbackend -> {CLUTTER,COGL}_WINSYS # e.g. "glx"
CLUTTER_FLAVOUR -> {CLUTTER,COGL}_WINSYS
clutterbackendlib -> CLUTTER_WINSYS_LIB
CLUTTER_COGL -> COGL_DRIVER # e.g. "gl"
Note: The CLUTTER_FLAVOUR and CLUTTER_COGL defines are kept for apps
As the first thing to take advantage of the new winsys component in Cogl;
cogl_get_proc_address() has been moved from cogl/{gl,gles}/cogl.c into
cogl/common/cogl.c and this common implementation first trys
_cogl_winsys_get_proc_address() but if that fails then it falls back to
gmodule.
Robert Bragg [Tue, 28 Jul 2009 00:34:33 +0000 (01:34 +0100)]
Make the CoglContext structure a bit more maintainable
This moves most of cogl-context.{c.h} to cogl/common with some driver
specific members now living in a CoglContextDriver struct. Driver specific
context initialization and typedefs now live in
cogl/{gl,gles}/cogl-context-driver.{c,h}
Driver specific members can be found under ctx->drv.stuff
Robert Bragg [Mon, 27 Jul 2009 23:37:11 +0000 (00:37 +0100)]
Improve cogl-texture maintainability by moving 90% into cogl/common
This splits the limited components that differed between
cogl/{gl,gles}/cogl-texture.c into new {gl,gles}/cogl-texture-driver.c files
and the rest that can now be shared into cogl/common/cogl-texture.c
Robert Bragg [Thu, 20 Aug 2009 10:54:41 +0000 (11:54 +0100)]
[stage-egl] support fallbacks in clutter_stage_egl_realize
Most of clutter_stage_egl_realize was renamed to
_clutter_stage_egl_try_realize which now takes a cookie indicating which
fallback number should tried next. clutter_stage_egl_realize now keeps
trying to realize with successive fallback numbers until it succeeds or runs
out of fallbacks.
The only fallback supported for now is for hardware with no stencil buffer
support.
Robert Bragg [Mon, 3 Aug 2009 13:50:10 +0000 (14:50 +0100)]
[x11 backend] remove data duplicated between backends and stages
Make backends the canonical point of reference for the xdisplay, the xscreen
number, the x root window and the xvisinfo for creating foreign stages.
Robert Bragg [Fri, 31 Jul 2009 19:39:28 +0000 (20:39 +0100)]
[glx backend] white space fixes
Simply removes lots of trailing white spaces
Robert Bragg [Fri, 31 Jul 2009 16:07:10 +0000 (17:07 +0100)]
[glx backend] use FBConfigs instead of Visuals for GL context creation
This replaces calls to the old (glx 1.2) functions glXChooseVisual,
glXCreateContext, glXMakeCurrent with the 1.3+ fbconfig varients
glXChooseFBConfig, glXCreateNewContext, glXMakeContextCurrent.
Robert Bragg [Fri, 31 Jul 2009 17:34:51 +0000 (18:34 +0100)]
[backends] Remove the idea of offscreen stages from all backends
The only backend that tried to implement offscreen stages was the GLX backend
and even this has apparently be broken for some time without anyone noticing.
The property still remains and since the property already clearly states that
it may not work I don't expect anyone to notice.
This simplifies quite a bit of the GLX code which is very desireable from the
POV that we want to start migrating window system code down to Cogl and the
simpler the code is the more straight forward this work will be.
In the future when Cogl has a nicely designed API for framebuffer objects then
re-implementing offscreen stages cleanly for *all* backends should be quite
straightforward.
Robert Bragg [Fri, 16 Oct 2009 16:15:47 +0000 (17:15 +0100)]
[build] more Makefile.am.{enums,marshal} fixes for out of tree builds
for the marshal files $(srcdir) was getting prefixed twice since my last
commit (
2cc88f1140) since it was already being prefixed including
Makefile.am. The problem with prefixing it in the includer file though is
that the Make variable substitutions like :.list=.h mean we end up
generating into the $(srcdir). This removes the prefix added in
clutter/Makefile.am
We were also missing a $(srcdir) prefix when setting EXTRA_DIST
Emmanuele Bassi [Fri, 16 Oct 2009 14:57:21 +0000 (15:57 +0100)]
Simple coding style fix for commit
c5551184
Emmanuele Bassi [Fri, 16 Oct 2009 14:55:05 +0000 (15:55 +0100)]
Merge branch 'bug-1846'
* bug-1846:
Fix warning message in the ParamSpec validation
Emmanuele Bassi [Fri, 16 Oct 2009 14:55:04 +0000 (15:55 +0100)]
Merge branch 'bug-1845'
* bug-1845:
Add a warning when ClutterInterval can't compute progress
Damien Lespiau [Mon, 12 Oct 2009 16:05:05 +0000 (17:05 +0100)]
Fix warning message in the ParamSpec validation
When validating a new GValue against the ClutterParamSpecUnits, we issue
a warning when the units do not match with both the new value and the
unit we expect to have. Unfortunately we were printing the unit of the
new value twice and not the unit of the ParamSpec.
http://bugzilla.openedhand.com/show_bug.cgi?id=1846
Damien Lespiau [Mon, 12 Oct 2009 15:45:39 +0000 (16:45 +0100)]
Add a warning when ClutterInterval can't compute progress
This is really useful when trying to animate GTypes that haven't
registered any progress function. Instead of silently not working it
will warn the developer.
http://bugzilla.openedhand.com/show_bug.cgi?id=1845
Damien Lespiau [Mon, 12 Oct 2009 15:28:10 +0000 (16:28 +0100)]
Add ClutterInterval integration
To be able to animate CLUTTER_TYPE_UNITS properties we need to register
the GType and its progress function against the ClutterInterval code.
The two ClutterUnits defining the interval can use different units, the
resulting unit will always be in pixels, so calculating a progress
between 10px and 4cm is valid.
http://bugzilla.openedhand.com/show_bug.cgi?id=1844
Emmanuele Bassi [Fri, 16 Oct 2009 14:25:37 +0000 (15:25 +0100)]
units: Cache the pixels value inside Units
When computing the pixels value of a ClutterUnits value we should
be caching the value to avoid recomputing for every call of
clutter_units_to_pixels(). We already have a flag telling us to
return the cached value, but we miss the mechanism to evict the
cache whenever the Backend settings affecting the conversion, that
is default font and resolution, change.
In order to implement the eviction we can use a "serial"; the
Backend will have an internal serial field which we retrieve and
put inside the ClutterUnits structure (we split one of the two
64 bit padding fields into two 32 bit fields to maintain ABI); every
time we call clutter_units_to_pixels() we compare the units serial
with that of the Backend; if they match and pixels_set is set to
TRUE then we just return the stored pixels value. If the serials
do not match then we unset the pixels_set flag and recompute the
pixels value.
We can verify this by adding a simple test unit checking that
by changing the resolution of ClutterBackend we get different
pixel values for 1 em.
http://bugzilla.openedhand.com/show_bug.cgi?id=1843
Emmanuele Bassi [Fri, 16 Oct 2009 13:22:15 +0000 (14:22 +0100)]
text: Notify :position when it changes
The :position property is not notified when changed.
http://bugzilla.openedhand.com/show_bug.cgi?id=1830
Emmanuele Bassi [Sat, 19 Sep 2009 08:19:06 +0000 (09:19 +0100)]
[text] NULL-ify strings to avoid double-frees
Emmanuele Bassi [Sat, 19 Sep 2009 08:18:06 +0000 (09:18 +0100)]
[text] Do not apply unset preedit attributes
The pre-edit attributes are optional and thus should only be applied
if they have been set to avoid assertion failures.
Emmanuele Bassi [Wed, 9 Sep 2009 11:15:23 +0000 (12:15 +0100)]
[text] Add pre-edit string to ClutterText
Input Methods require to be able to set a "pre-edit string", that is
a string that it's just displayed into the Text actor without being
committed to the actor's buffer. The string might require custom Pango
attributes, and an update of the cursor position.
Robert Bragg [Thu, 15 Oct 2009 18:12:34 +0000 (19:12 +0100)]
[build] fix Makefile.am.{enums,marshal} to support out of tree builds
Out of tree builds were broken in commit
46b736f42e1165 since we didn't
explicitly use $(srcdir) to find the input files for glib-mkenums and
glib-genmarshal.
Emmanuele Bassi [Thu, 15 Oct 2009 13:20:44 +0000 (14:20 +0100)]
layout, docs: Fix description of Bin properties
The BinLayer and BinLayout properties name and blurb for introspection
should be slightly more descriptive.
Emmanuele Bassi [Thu, 15 Oct 2009 13:12:37 +0000 (14:12 +0100)]
layout, bin: Use ceilf() instead of casting to int
Casting a float to int to truncate it before assigning the value
to a float again is wrong. We should use ceilf() instead which
does what we want to achieve (rounding up the size to avoid
sub-pixel positioning of children).
Emmanuele Bassi [Thu, 15 Oct 2009 13:11:36 +0000 (14:11 +0100)]
layout, docs: Add long description for FlowLayout
Add the full description of the layout policy
Emmanuele Bassi [Thu, 15 Oct 2009 11:15:49 +0000 (12:15 +0100)]
layout, box: Clean up
* Use g_list_foreach() instead of iterating over the list inside
the destruction sequence, since we are causing the widgets to be
implicitly removed from the list via the destroy() call.
* Use g_signal_connect_swapped() and spare us from a callback.
Emmanuele Bassi [Thu, 15 Oct 2009 11:04:50 +0000 (12:04 +0100)]
layout, box: Write long description for Box
Also have an example of how to create a Box with a layout manager
and how to use the pack() method.
Emmanuele Bassi [Tue, 13 Oct 2009 15:52:57 +0000 (16:52 +0100)]
layout, docs: Remove unused functions
The :wrap property and its accessor functions were removed from
ClutterFlowLayout.
Emmanuele Bassi [Tue, 13 Oct 2009 11:15:25 +0000 (12:15 +0100)]
layout: Document BoxLayout
Add BoxLayout to the API reference.
Emmanuele Bassi [Tue, 13 Oct 2009 11:14:05 +0000 (12:14 +0100)]
layout: Add BoxLayout, a single line layout manager
The BoxLayout layout manager implements a layout policy for arranging
children on a single line, either alongside the X axis or alongside the
Y axis.
Emmanuele Bassi [Thu, 8 Oct 2009 14:45:29 +0000 (15:45 +0100)]
layout: Report the correct size of FlowLayout
FlowLayout should compute the correct height for the assigned width when
in horizontal flow, and the correct width for the assigned height when
in vertical flow. This means pre-computing the number of lines inside
the get_preferred_width() and get_preferred_height(). We can then cache
the computed column width and row height, cache them inside the layout
and then use them when allocating the children.
Emmanuele Bassi [Wed, 7 Oct 2009 14:30:29 +0000 (15:30 +0100)]
layout: Resizing the stage resizes the FlowLayout box
Add some user interaction to verify the dynamic reflowing.
Emmanuele Bassi [Wed, 7 Oct 2009 14:29:47 +0000 (15:29 +0100)]
layout: Use the get_request_mode() getter in BinLayout
Instead of using g_object_get(child, "request-mode", ...).