1
0
Fork 0
Commit graph

170 commits

Author SHA1 Message Date
Robert Bragg
abae6013e1 Remove all internal use of deprecated cogl_clip_* API
cogl_clip_push, and cogl_clip_push_window_rect which are now deprecated were
used in various places internally so this just switches to using the
replacement functions.
2009-11-05 21:10:18 +00:00
Robert Bragg
272e227109 [cogl-clip] deprecate parts and cleanup the API
cogl_clip_push() which accepts a rectangle in model space shouldn't have
been defined to take x,y,width,height arguments because this isn't consistant
with other Cogl API dealing with model space rectangles.  If you are using a
coordinate system with the origin at the center and the y+ extending up,
then x,y,width,height isn't as natural as (x0,y0)(x1,y1). This API has
now been replace with cogl_clip_push_rectangle()

(As a general note: the Cogl API should only use the x,y,width,height style
when the appropriate coordinate space is defined by Cogl to have a top left
origin.  E.g.  window coordinates, or potentially texture coordinates)

cogl_clip_push_window_rect() shouldn't have been defined to take float
arguments since we only clip with integral pixel precision. We also
shouldn't have abbreviated "rectangle". This API has been replaced with
cogl_clip_push_window_rectangle()

cogl_clip_ensure() wasn't documented at all in Clutter 1.0 and probably
no one even knew it existed. This API isn't useful, and so it's now
deprecated. If no one complains we may remove the API altogether for
Clutter 1.2.

cogl_clip_stack_save() and cogl_clip_stack_restore() were originally added
to allow us to save/restore the clip when switching to/from offscreen
rendering.  Now that offscreen draw buffers are defined to own their clip
state and the state will be automatically saved and restored this API is now
redundant and so deprecated.
2009-11-05 21:10:17 +00:00
Emmanuele Bassi
0b4899ef23 tests: Clean up interactive test build
The build for interactive tests creates symbolic links for the data
under tests/data; it also uses symbolic links for creating "binaries"
for each interactive test. This is less than ideal, though.

Instead, the tests should build a path to the data files by using
a pre-processor define like TESTS_DATADIR; both g_build_filename() and
pre-processor string concatenation can be used to generate a valid
file name with the full path to the files.

The build system should also create wrapper scripts, just like we
do inside the conformance test suite, to be able to launch single
tests.
2009-11-05 17:47:26 +00:00
Robert Bragg
4258214e50 [test-fbo] greatly simplify the test
This test tried to do too much, and I can't remember the last time I saw this
test work.

It no longer tries to create a texture from an offscreen actor and it no
longer tries to use shaders.

It does though show that chaining of clutter_texture_new_from_actor now
works, and that animating the source actor is reflected in textures created
from it.

When run you should see three actors:
- on the left is the pristine source actor rotating around the y-axis
- in the middle is the first texture created from the source actor
- and on the right a texture created from the middle actor

Note: the somewhat strange bobbing of the middle and right textures is
actually correct given how it was decided long ago to map the transformed
(to screen space) allocation of the source actor to the texture.  When the
hand spins around the perspective projection of the top of the hand results
in the origin of the texture bobbing up to a higher stage position, but the
position of the textures is fixed.  This design also means we end up
reallocating our offscreen draw buffer every frame that the actors
transformed size changes, which isn't ideal.
2009-11-04 03:34:09 +00:00
Emmanuele Bassi
5a63e8af8f tests: Use the right key symbol for adding children
The test-box-layout should be using CLUTTER_plus instead of a
literal '+'.
2009-10-26 15:10:20 +00:00
Emmanuele Bassi
00748f6656 tests: Print out the captured event type
The ::captured-event signal on the Stage is not printing out the
event type.
2009-10-26 11:42:16 +00:00
Emmanuele Bassi
673199b6e0 tests: Update test-script
Use explicit alpha definition and custom alpha functions.
2009-10-21 16:15:18 +01:00
Emmanuele Bassi
ba25571c8e 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
  ...
2009-10-19 11:45:15 +01:00
Robert Bragg
43efab46bc 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.
2009-10-16 18:58:50 +01:00
Emmanuele Bassi
2883728387 [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.
2009-10-16 12:45:29 +01:00
Emmanuele Bassi
b526b76593 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.
2009-10-14 11:31:48 +01:00
Emmanuele Bassi
c4b2d4ce79 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.
2009-10-14 11:31:35 +01:00
Emmanuele Bassi
6f19666b13 layout: Resizing the stage resizes the FlowLayout box
Add some user interaction to verify the dynamic reflowing.
2009-10-14 11:31:31 +01:00
Emmanuele Bassi
6d954ec074 [layout] Rename BinLayout and FlowLayout interactive tests
The BinLayout and FlowLayout interactive tests should be named more
explicitly.
2009-10-14 11:31:30 +01:00
Emmanuele Bassi
e5a074fd9e [layout] Add :homogeneous to FlowLayout 2009-10-14 11:31:30 +01:00
Emmanuele Bassi
5737cf869f [layout] Initial implementation of FlowLayout
FlowLayout is a layout manager that arranges its children in a
reflowing line; the orientation controls the major axis for the
layout: horizontal, for reflow on the Y axis, and vertical, for
reflow on the X axis.
2009-10-14 11:31:30 +01:00
Emmanuele Bassi
8b2088a917 [layout, tests] Use variants for child packing in Box
There are three potential variants to add a child inside a Box
with a BinLayout:

  - clutter_box_pack(), a variadic argument function which
    allows passing arbitrary LayoutMeta properties and values;

  - clutter_bin_layout_add(), which uses the backpointer to
    the container from the LayoutManager and sets the layout
    properties directly without GValue (de)marshalling

  - clutter_container_add_actor() and
    clutter_bin_layout_set_alignment(), similar to the
    clutter_bin_layout_add() function above, but split in two

The test-box interactive test should exercise all three variants.
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
f58bdbad15 [layout] Rename Box::add to Box::pack
Since ClutterBox is a ClutterContainer we should avoid naming
collisions between methods.
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
aaae60e178 [layout] Implement ClutterBox::add
The ClutterBox::add method is a simple wrapper around the Container
add_actor() method and the LayoutManager layout properties API. It
allows adding an actor to a Box and setting the layout properties in
one call.

If the LayoutManager used by the Box does not support layout properties
then the add() method short-circuits out.

Along with the varargs version of the method there's also a vector-based
variant, for language bindings to use.
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
9cccff504a [layout] Add layers to BinLayout
Each actor managed by a BinLayout policy should reside inside its
own "layer", with horizontal and vertical alignment. The :x-align
and :y-align properties of the BinLayout are the default alignment
policies, which are copied to each new "layer" when it is created.

The set_alignment() and get_alignment() methods of BinLayout can
be changed to operate on a specific "layer".

The whole machinery uses the new ChildMeta support inside the
LayoutManager base abstract class.
2009-10-14 11:27:29 +01:00
Emmanuele Bassi
a1853892ba [tests] Add a Box interactive test 2009-10-14 11:27:19 +01:00
Emmanuele Bassi
72243081b5 Merge branch 'stage-window-object'
* stage-window-object:
  [x11] Fix Stage user-initiated resize
  [x11] Remove a useless forced paint
  [stage] Rework the Stage implementation class
2009-10-05 12:37:08 +01:00
Emmanuele Bassi
111512a2a0 [x11] Fix Stage user-initiated resize
The user-initiated resize is conflicting with the allocated size. This
happens because we change the size of the stage's X Window behind the
back of the size allocation machinery.

Instead, we should change the size of the actor whenever we receive a
ConfigureNotify event to reflect the new size of the actor.
2009-10-05 12:24:19 +01:00
Robert Bragg
4293920a11 [tests] Remove test-entry.c since we don't have a ClutterEntry any more
Removes an unused interactive unit test for the old ClutterEntry actor we
used to have.
2009-09-22 11:30:36 +01:00
Emmanuele Bassi
ecfa0c4f92 [build] Split out the custom silent rules
The silent rules we use for custom targets should be moved into a
separate Makefile.am that gets included from all the others.
2009-09-16 17:47:59 +01:00
Robert Bragg
94e60c393b [test-cogl-multitexture] Print an error if textures can't be loaded
I just wasted a silly amount time trying to bisect an apparently broken
cogl-test-multitexture until I realized it was just silently failing to load
any textures.
2009-09-16 17:20:03 +01:00
Robert Bragg
c9f57452e6 [build] remove reference to light1.png in tests/interactive/Makefile.am
This file doesn't exist in the repo and isn't referenced by any unit tests.
2009-08-03 15:16:42 +01:00
Robert Bragg
71c4fa0f73 [build] dist tests/interactive/wrapper.sh
in tests/interactive/Makefile.am add wrapper.sh to EXTRA_DIST otherwise
interactive unit tests wont be runnable when building from distributed
tarballs.
2009-08-03 15:08:13 +01:00
Haakon Sporsheim
9cf8410b0f Reposition variable declarations to avoid C99. 2009-07-28 12:13:43 +01:00
Haakon Sporsheim
94a571ea76 Add MSVC preprocessor guards in test-clutter-cairo-flowers.c 2009-07-28 12:13:43 +01:00
Haakon Sporsheim
fa4a37072e Add white_color a variable on the stack. 2009-07-28 12:13:43 +01:00
Haakon Sporsheim
f852ade823 Remove config.h inclusion. 2009-07-28 12:13:42 +01:00
Emmanuele Bassi
76140c5f52 [build] Use API_VERSION, not MAJORMINOR
The correct macro for Clutter's API version is CLUTTER_API_VERSION,
not CLUTTER_MAJORMINOR anymore.
2009-07-28 11:42:58 +01:00
Emmanuele Bassi
ea436a20b3 [build] Use per-target flags and libraries
AM_LDFLAGS is ignored by the LDFLAGS target, and it's also not the right
place to put the libraries used by the linker.

Thanks to Vincent Untz for spotting this.
2009-07-21 14:11:28 +01:00
Emmanuele Bassi
b08bbcccad [tests] Remove test-perspective
The perspective test was used essentially to determine whether the
perspective set up in COGL worked correctly. The perspective code
has been changed a lot since Clutter 0.3: we rely on client-side
matrices and we use floating point; so, all the conditions the test
was supposed to verify do not exist anymore.
2009-07-12 01:43:41 +01:00
Robert Bragg
060f1488e0 [test-cogl-tex-getset] Assume a premultiplied pixel format
test-cogl-tex-getset was assuming it was dealing with
COGL_PIXEL_FORMAT_RGBA_8888 but since merging the premultiplcation branch
the pixel format is actually COGL_PIXEL_FORMAT_RGBA_8888_PRE
2009-06-29 23:49:06 +01:00
Neil Roberts
20f3c173fe [test-shader] Fix some of the shaders to use premultiplied colors
Texture data is now in premultiplied format and the shader should
output a premultiplied color if the default blend mode is being
used. Shaders that directly manipulate the rgb values now
unpremultiply and premultiply again afterwards.
2009-06-24 12:05:19 +01:00
Emmanuele Bassi
0ec541282a [tests] Remove unneeded g_type_init()
Now that we can safely check for an uninitialized Clutter we
don't have side effects in calling one of the functions like
clutter_x11_enable_xinput(), which require to be called before
any other Clutter function.
2009-06-19 14:20:50 +01:00
Emmanuele Bassi
184df2a5fa [input] Rework input device API
The input device API is split halfway thorugh the backends in a very
weird way. The data structures are private, as they should, but most
of the information should be available in the main API since it's
generic enough.

The device type enumeration, for instance, should be common across
every backend; the accessors for device type and id should live in the
core API. The internal API should always use ClutterInputDevice and
not the private X11 implementation when dealing with public structures
like ClutterEvent.

By adding accessors for the device type and id, and by moving the
device type enumeration into the core API we can cut down the amount
of symbols private and/or visible only to the X11 backends; this way
when other backends start implementing multi-pointer support we can
share the same API across the code.
2009-06-19 13:12:05 +01:00
Matthew Allum
1aa8c89f2c [XInput] Get XInput working again.
Check for distros shipping out of sync header vs libXi,
call in g_type_init() in test-devices, fix ifdef so
XInput events get correctly selected.
2009-06-17 15:09:16 +01:00
Emmanuele Bassi
f8e9565482 [tests] Beautify the bouncing actor
The test-easing interactive demo for the high-level animation API
is a bit "flat". Instead of using a Rectangle actor we should
probably be using something more "interesting" -- like a CairoTexture
with a gradient.
2009-06-15 15:08:59 +01:00
Emmanuele Bassi
9799750c03 [animation] Rework animation chaining
In order to chain up animations using clutter_actor_animate() and
friends you have to use an idle handler that guarantees that the
main loop spins at least once after the animation pointer has been
detached from the actor.

This has several drawbacks, first and foremost the fact that the
slice of the main loop for the idle handler might be starved by
other operations, like redrawing. This inevitably leads to tricks
with priorities and the like, contributing to the overall complexity.

Instead, we should guarantee that the animation instance created by
clutter_actor_animate() is valid for the ::completed signal until
it reaches its default handler; after that, the animation is detached
from the actor and destroyed. This means that it's possible to
create a new animation after the first is complete by simply using
g_signal_connect_after().

This unfortunately makes it impossible to keep a reference to the
animation pointer attached to the actor by using g_object_ref(); a
way to "fix" this would be to have a clutter_animation_attach()
and a clutter_animation_detach() pair of methods that allow attaching
any animation to an actor. This might overcomplicate what it is
the simple animation API, though, so it's currently not implemented
and left for future versions.

The test-easing interactive demo has been modified to show how
the animation queuing works by adding a command line switch that
recenters the animated actor once the first animation has ended.
2009-06-15 11:49:33 +01:00
Emmanuele Bassi
0415d62d40 Disable single header inclusion for GLib
In order to be ready for the next major version of GLib we need to
disable single header inclusion by using the G_DISABLE_SINGLE_INCLUDES
define in the build process.
2009-06-15 11:29:37 +01:00
Neil Roberts
0dfc1dd284 [test-cogl-tex-tile] Fix breakages from ClutterFixed removal and timelines
The test has been broken since the change to use floats instead of
fixed point because it was passing degrees to sin and cos but they
expect radians.

It was further broken since the timeline changes because it was
directly using the parameter of the new-frame signal as a frame number
but it now represents the elapsed time.
2009-06-12 11:05:26 +01:00
Emmanuele Bassi
6414adbfeb [tests] Fix the cogl_polygon() interactive test
We need to premultiply the alpha, and we also need to change the
frame painting to use the frame-less Timeline.
2009-06-11 16:59:50 +01:00
Emmanuele Bassi
a8fc4e1694 [tests] Fix the VBO interactive test
We need to fix the VBO premultiplication; we also do not need to
forcibly queue a redraw in an idle handler: the timeline and the
master clock will do that for us.
2009-06-11 16:53:52 +01:00
Emmanuele Bassi
19f112f9bc [tests] Update test-actors (and clones)
The test-actors test (and its clones, test-actor-clone and
test-paint-wrapper) was written a long time ago for a different API
and has been tweaked to bits. We should probably have something a
little bit more complicated, but at least we should not use semantics
and coding patterns from Clutter 0.2, otherwise we won't be testing
anything except that Clutter 0.2 worked.
2009-06-11 16:26:02 +01:00
Robert Bragg
96827db740 Bug 1406 - Handling of premultiplication in clutter
Merge branch 'premultiplication'

[cogl-texture docs] Improves the documentation of the internal_format args
[test-premult] Adds a unit test for texture upload premultiplication semantics
[fog] Document that fogging only works with opaque or unmultipled colors
[test-blend-strings] Explicitly request RGBA_888 tex format for test textures
[premultiplication] Be more conservative with what data gets premultiplied
[bitmap] Fixes _cogl_bitmap_fallback_unpremult
[cogl-bitmap] Fix minor copy and paste error in _cogl_bitmap_fallback_premult
Avoid unnecesary unpremultiplication when saving to local data
Don't unpremultiply Cairo data
Default to a blend function that expects premultiplied colors
Implement premultiplication for CoglBitmap
Use correct texture format for pixmap textures and FBO's
Add cogl_color_premultiply()
2009-06-11 16:00:28 +01:00
Robert Bragg
70636b4815 [fog] Document that fogging only works with opaque or unmultipled colors
The fixed function fogging provided by OpenGL only works with unmultiplied
colors (or if the color has an alpha of 1.0) so since we now premultiply
textures and colors by default a note to this affect has been added to
clutter_stage_set_fog and cogl_set_fog.

test-depth.c no longer uses clutter_stage_set_fog for this reason.

In the future when we can depend on fragment shaders we should also be
able to support fogging of premultiplied primitives.
2009-06-11 14:17:53 +01:00
Owen W. Taylor
c3448314d5 Default to a blend function that expects premultiplied colors
Many operations, like mixing two textures together or alpha-blending
onto a destination with alpha, are done most logically if texture data
is in premultiplied form. We also have many sources of premultiplied
texture data, like X pixmaps, FBOs, cairo surfaces. Rather than trying
to work with two different types of texture data, simplify things by
always premultiplying texture data before uploading to GL.

Because the default blend function is changed to accommodate this,
uses of pure-color CoglMaterial need to be adapted to add
premultiplication.

gl/cogl-texture.c gles/cogl-texture.c: Always premultiply
  non-premultiplied texture data before uploading to GL.

cogl-material.c cogl-material.h: Switch the default blend functions
  to ONE, ONE_MINUS_SRC_ALPHA so they work correctly with premultiplied
  data.

cogl.c: Make cogl_set_source_color() premultiply the color.

cogl.h.in color-material.h: Add some documentation about
  premultiplication and its interaction with color values.

cogl-pango-render.c clutter-texture.c tests/interactive/test-cogl-offscreen.c:
  Use premultiplied colors.

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

Signed-off-by: Robert Bragg <robert@linux.intel.com>
2009-06-11 14:17:52 +01:00