Compare commits

...

154 Commits

Author SHA1 Message Date
4d6f99c95d backend/native: Use high priority contexts for secondary GPUs
Ensure the context requests EGL_CONTEXT_PRIORITY_HIGH_IMG, and
that we use cogl_egl_create_context() to ensure that is honored.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/923
2019-11-13 15:12:12 +01:00
9e54e404ee backends: Drop rt-scheduler configuration key
This is no longer an experimental feature. Even if we wanted to,
GSettings spawns threads, which we want to avoid until we drop
capabilities.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/923
2019-11-13 15:12:12 +01:00
6ec6ea7d3c core: Drop all capabilities on initialization
Add an optional dependency on libcap-ng, if the library is detected
drop all capabilities by default, in order to allow packagers/users
to do "setcap CAP_SYS_NICE=+ep `which gnome-shell`" and let it set
higher sched/egl priorities without preserving the capability forever.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/923
2019-11-13 15:12:12 +01:00
d8c4d78f4a core: Set up EGL context creation thread before dropping capabilities
We do intend this thread to preserve the necessary capabilities to
create high priority EGL contexts. Set this thread up before we drop
these.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/923
2019-11-13 15:12:12 +01:00
b7a662bfdd core: Set SCHED_RR by default on Wayland sessions
This still may fail if the executable is missing the right capability.
This can no longer depend on a setting as we want this to happen
before capabilities are dropped (and before other threads are spawned).

The necessary bits (eg. "setcap CAP_SYS_NICE=+ep `which gnome-shell`")
are still left up to users/distributors.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/923
2019-11-13 15:12:12 +01:00
9d61e6e56f core: Move unix signal handler later in the process
This does spawn a thread, so better to leave for late(r) initialization.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/923
2019-11-13 15:12:12 +01:00
231d9e3c31 cogl: Defer EGLContext creation to a separate thread
This is rather pointless and complex at the moment, but will pay
off as we can then spawn this thread early enough that it keeps
capabilities to create high priority contexts.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/923
2019-11-13 15:12:12 +01:00
8907a29912 cursor-renderer/native: Fix cursor drawing in combination with panel_orientation_transform
Properly take the panel_orientation_transform into account in
update_monitor_crtc_cursor. This fixes us sometimes drawing the cursor
on two monitors at the same time as we did not properly swap the crtc
width/height when a panel_orientation_transform is active.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/927
2019-11-13 10:54:37 +01:00
a5f986259f output-kms: Fix "panel orientation" kms-prop being ignored on native outputs
Actually store the panel_orientation_transform in the meta_output, so
that it gets honored by the core code.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/927
2019-11-13 10:53:50 +01:00
bcc519e4ee clutter: return correct enum type
clutter_event_get_scroll_finish_flags() should return a ClutterScrollFinishFlags
but due to what looks like a bad copy/paste it instead returns a
ClutterScrollSource on asserts.

The definitions of the enums are these:

typedef enum
{
  CLUTTER_SCROLL_SOURCE_UNKNOWN,
  CLUTTER_SCROLL_SOURCE_WHEEL,
  CLUTTER_SCROLL_SOURCE_FINGER,
  CLUTTER_SCROLL_SOURCE_CONTINUOUS
} ClutterScrollSource;

typedef enum
{
  CLUTTER_SCROLL_FINISHED_NONE       = 0,
  CLUTTER_SCROLL_FINISHED_HORIZONTAL = 1 << 0,
  CLUTTER_SCROLL_FINISHED_VERTICAL   = 1 << 1
} ClutterScrollFinishFlags;

The asserts would only return CLUTTER_SCROLL_SOURCE_UNKNOWN. This
is equal to CLUTTER_SCROLL_FINISHED_NONE which this patch uses
instead. Thus no functional change is intended. This only fixes a
compile warning.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/931
2019-11-12 17:09:09 +01:00
044238b503 clutter/actor: Draw paint volumes using paint nodes
Clutter has a draw debug mode that allows for painting
paint volumes. Right now, this debug mode uses the old
immediate paint mode.

Switch the painting of paint volumes to use paint nodes,
and sneak a few minor style cleanups.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/890
2019-11-11 10:40:44 -03:00
03b59f9e19 clutter/actor: Move paint flag to ClutterActorNode
Now that we unconditionally use ClutterActorNode to
paint ClutterActors, move the PAINT private flag to
the ClutterActorNode. This way, we can run the paint
on the actor anywhere inside the paint tree.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/890
2019-11-11 10:40:44 -03:00
7193938d27 compositor: Guard against untimely calls
It seems that sometimes these functions are called by Javascript in
GNOME Shell during tear down. This causes segfaults and crash reports,
but without any backtraces other than the entry and exit points into
gjs.

In order to get more useful information about where these calls come
from, validate the input passed gracefully, by complaining in the log
and returning NULL values.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/926
2019-11-11 13:09:20 +00:00
5afec87b96 input-settings/x11: Add missing clutter_x11_trap_x_errors around XIGetProperty
Add missing clutter_x11_[un]trap_x_errors around the XIGetProperty call
in meta-input-settings-x11.c's get_property helper function.

This fixes mutter crashing with the following error if the XInput device
goes away at an unconvenient time:

 X Error of failed request:  XI_BadDevice (invalid Device parameter)
   Major opcode of failed request:  131 (XInputExtension)
   Minor opcode of failed request:  59 ()
   Device id in failed request: 0x200011
   Serial number of failed request:  454
   Current serial number in output stream:  454

https://gitlab.gnome.org/GNOME/mutter/merge_requests/928
2019-11-10 19:45:08 +01:00
a4f51da184 plugin-manager: Kill window effects on destroy
We do so for all other window effects already. Why this was left out
is unknown (9b3a0d1ad8), but we will need it for a fix in GS.

Related: https://gitlab.gnome.org/GNOME/mutter/issues/655

https://gitlab.gnome.org/GNOME/mutter/merge_requests/924
2019-11-08 22:18:09 +00:00
0545b93232 plugins/default: Handle skipped animations
We currently assume that the actor_animate() helper function returns
a timeline. However Clutter may skip implicit animations and simple
set properties directly, for example when the actor is hidden.

The returned timeline will be NULL in that case, and we abort when
using it as instance parameter to g_signal_connect().

Fix this by only setting up a completed handler when we are actually
animating, and complete the effect directly otherwise.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/925
2019-11-08 22:49:31 +01:00
9cbf83d59c cogl: glBlendFuncSeparate is always available
So we don't need glBlendFunc.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/903
2019-11-08 12:15:39 +00:00
07ca100130 cogl: glBlendEquationSeparate is always available
So we don't need glBlendEquation.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/903
2019-11-08 12:15:39 +00:00
6944839ab6 window-props: Read WM_TRANSIENT_FOR for override-redirect windows
As per the Extended Window Manager Hints standard version 1.3 [1] an
override-redirect window can set a transient-for window per compositing and
app-matching purposes.

So just read the WM_TRASIENT_FOR property also for such windows, adapting
the error in case they are transient for another O-R window and adding a
test to check such case.

[1] https://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472512128

https://gitlab.gnome.org/GNOME/mutter/merge_requests/920
2019-11-07 18:43:16 +00:00
4a76f66a54 wayland/surface: Don't double scale when getting absolute coordinates
The actor is already in surface coordinate space, so we should not scale
with the buffer scale to transform surface coordinates to stage
coordinates.

This bug causes input method using wayland text-input protocol to
receive wrong cursor location. Reproduced in ibus (when candidate
window is open) with scaling factor other than 1.

This commit also fixes pointer confinement.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/915
2019-11-07 16:20:13 +00:00
bacbbbd628 window-props: Don't set override redirect windows as top-level parent
Java applications might use override-redirect windows as parent windows for
top-level windows, although this is not following the standard [1].

In such case, the first non-override-redirect child window that is created
was marked as being on_all_workspaces since the call to
should_be_on_all_workspaces() returns TRUE for its parent, and this even
though the on_all_workspaces_requested bit is unset.
When a further child of this window was added, it was set as not having a
workspace and not being on_all_workspaces, since the call to
should_be_on_all_workspaces() for its parent would return FALSE (unless if
it is in a different monitor, and the multiple-monitors workspaces are
disabled).

Since per commit 09bab98b we don't recompute the workspace if the
on_all_workspaces bit is unset, we could end up in a case where a window can
be nor in all the workspaces or in a specific workspace.

So let's just ignore the transient_for bit for a window if that points to an
override-redirect, using the x11 root window instead.

Add a stacking test to verify this scenario (was failing before of this
commit).

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/885
https://gitlab.gnome.org/GNOME/mutter/merge_requests/895

[1] https://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472512128
2019-11-07 16:04:19 +00:00
c85fb107c0 window-props: Don't look for parent multiple times
Once we set the transient_for, we look for parent MetaWindow, so instead
of overwriting this value for loops check, just use another function
and avoid to look for the xwindow again when setting the MetaWindow parent.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/895
2019-11-07 16:04:19 +00:00
13f10e36e4 window: Assert we only set a NULL workspace when unmanaging
There might be cases in which a window might be marked as both not in all
workspaces and with NULL workspace.

So to avoid this to happen, let's just assert early instead of doing this at
later point where the context might not be clear.

Related to https://gitlab.gnome.org/GNOME/mutter/issues/885

https://gitlab.gnome.org/GNOME/mutter/merge_requests/895
2019-11-07 16:04:19 +00:00
2644e54c51 window: Warn if O-R window workspace state is used
Override-redirect windows have no workspace by default, and can't be parent
of a top-level window, so we must check that the parent window is not an
O-R one when setting the workspace state.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/895
2019-11-07 16:04:19 +00:00
0e5a5df5fe wayland/actor-surface: Always store away frame callbacks on commit
We're expected by MetaWaylandSurface to always pick the frame callbacks
out from the pending state when committing (applying) so that no frame
callbacks are unaccounted for. We failed to do this if our actor for
some reason (e.g. associated window was unmanaged) was destroyed. To
handle this situation better, store away the frame callbacks until we
some later point in time need to pass them on forward.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/893
2019-11-07 12:56:58 +00:00
806ebc464a cogl: Remove cogl_texture_2d_gl_new_from_foreign
As noted in <cogl-texture-2d-gl.h> (now also removed), this is for
allowing external GL callers to promote one of their textures to a
CoglTexture. We aren't doing that and don't want to start.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/883
2019-11-07 12:47:23 +00:00
54ac1f6b59 test: Remove unreferenced test-texture-rectangle
This isn't even built, and it's testing GL_TEXTURE_RECTANGLE_ARB, which
is not even a code path we support anymore since we require real NPOT.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/883
2019-11-07 12:47:23 +00:00
9b16b74b5d cogl: Remove unused stuff from cogl-material-compat.[ch]
You could probably move (most of) what's left into a static-inline kind
of header that only gets consumed by the tests.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/922
2019-11-07 12:33:35 +00:00
9172901458 ci: Fix checkout out gnome-shell on stable branches
For stable branches, we currently only check out the correct shell
branch for merge requests. For the regular pipeline, our code to
determine the current mutter branch fails because CI runs on a
temporary "pipeline/12345" branch that doesn't exist for gnome-shell.

Switching to the correct gitlab environment variable fixes that.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/811
2019-11-07 00:06:25 +01:00
ffa0a24848 x11-display: Get next serial just before using it
We ask XLib the next request serial number before performing other actions
triggered by meta_x11_display_set_input_focus_internal() that doesn't use
the request serial anyways. So, just request it before updating the focus
window as that's the operation that needs it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/909
2019-11-06 17:32:29 +00:00
efe5bed5b4 x11-display: Don't unset the X11 focused window after setting one
When using DesktopIcons extension and clicking in an icon, gnome-shell
starts an infinite loop caused by the first focus change that may trigger
on X11 a focus in/out event that leads to stage activation/deactivation
which never ends.

This happens because as part of meta_x11_display_set_input_focus_xwindow()
to focus the X11 stage window, we unset the display focus, but this also
causes to request the X11 display to unset the focus since we convolute by
calling meta_x11_display_set_input_focus() with no window, that leads to
focusing the no_focus_window and then a focus-in / focus-out dance that the
shell amplifies in order to give back the focus to the stage.

In order to fix this, mimic what meta_display_set_input_focus() does, but
without updating the X11 display, and so without implicitly calling
meta_x11_display_set_input_focus(), stopping the said convolution and
properly focusing the requested xwindow.
Also ensure that we're not doing this when using an older timestamp, since
this check isn't performed anymore.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/896
Fixes https://gitlab.gnome.org/GNOME/mutter/issues/899

https://gitlab.gnome.org/GNOME/mutter/merge_requests/909
2019-11-06 17:32:29 +00:00
e865fcc460 wayland: Check focus surface client in wl_data_device.set_selection()
Similar to our handling in set_primary(), ignore set_selection() requests
that come from unfocused clients.

https://gitlab.gnome.org/GNOME/mutter/issues/878
2019-11-06 15:59:16 +01:00
16eb461054 wayland: Clean up meta_wayland_data_device_set_primary()
This function is already checking for the focus surface client
matching the requestor. The type check was slightly bogus though
as it'd be an screwup in our code, make it an assert instead.

Also, move the check for the client having the focus into the
upper call, so this and wl_data_device.set_selection code can
get more in line.

https://gitlab.gnome.org/GNOME/mutter/issues/878
2019-11-06 15:59:16 +01:00
c11ef6ef07 wayland: Flatten data source object hierarchy
We have an abstract MetaWaylandDataSource and 2 subclasses for
clipboard/primary data sources. Since the abstraction provided
by the additional sublevel is arguable, push the wl_resource
field up, and leave us with just 2 objects to think about, all
of them containing a wl_resource.

https://gitlab.gnome.org/GNOME/mutter/issues/878
2019-11-06 15:59:16 +01:00
95eda361c1 wayland: use correct enum type for tablet pad
Fixes a compile warning.  The two enums are identical, so no
functional change intended.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/863
2019-11-05 13:07:47 +00:00
662c76c4fc tests/monitor-unit-tests: Add another tiling window hot plug test
Checks that we handle hot plugs of a untiled window, that was previously
tiled.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 10:36:25 +01:00
ff799a1abe window: Reset tile monitor number when untiling
Otherwise we'll end up trying to access the out of date state later.

Fixes the following test failure backtrace:

    #0  _g_log_abort ()
    #1  g_logv ()
    #2  g_log ()
    #3  meta_monitor_manager_get_logical_monitor_from_number ()
    #4  meta_window_get_work_area_for_monitor ()
    #5  meta_window_get_tile_area ()
    #6  constrain_maximization ()
    #7  do_all_constraints ()
    #8  meta_window_constrain ()
    #9  meta_window_move_resize_internal ()
    #10 meta_window_tile ()

https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 10:36:25 +01:00
155b7bf569 tests/monitor-unit-tests: Add window tiling hot plug test
This test that we handle hot plugs correctly together with tiled
windows.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 10:36:25 +01:00
47155ed524 tests/runner: Move window shown synchronization to helper
https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 10:35:00 +01:00
db91439bb0 tests/monitor-unit-tests: Move test client sanity check into helper
https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 10:35:00 +01:00
77aad0869f window: Always update tile monitor number on hot plug
Otherwise we'll end up crashing if we had two connected monitors,
unplugged both, then replugged in a single one.

Avoids the following error:

    #0  _g_log_abort ()
    #1  g_logv ()
    #2  g_log ()
    #3  meta_monitor_manager_get_logical_monitor_from_number ()
    #4  meta_window_get_work_area_for_monitor ()
    #5  meta_window_get_tile_area ()
    #6  constrain_maximization ()
    #7  do_all_constraints ()
    #8  meta_window_constrain ()
    #9  meta_window_move_resize_internal ()
    #10 meta_window_move_resize_frame ()
    #11 meta_window_move_resize_now ()
    #12 idle_move_resize ()
    #13 call_idle_later ()

https://bugzilla.redhat.com/show_bug.cgi?id=1767703

https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 10:35:00 +01:00
dc1a28c42a plugins/default: Clean up tile preview when closing display
On finalize, the preview actor will have been destroyed behind our back;
avoid that by cleaning up before it's too late.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 10:35:00 +01:00
955b27637c plugin/default: Init quark before using
Cut lines in pieces, and remove useless "optimizations" while at it

https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 10:35:00 +01:00
1f5b403524 display: Add 'closing' signal
Emitted when the MetaDisplay is closing. Meant for clean up that depends
on things that will be torn down during closing.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 10:35:00 +01:00
5e87d67e5f surface-actor-wayland: Do not send frame callbacks if the actor is obscured
`meta_surface_actor_is_obscured` implies that the actor got successfully culled
out and nothing of it will get painted. This includes that there are no clones,
no effects etc. In this cases we don't want to send frame callbacks, thus avoiding
unnecessary client work.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/918
2019-11-04 16:06:37 +01:00
f133de2dd4 clutter/actor: Unref the root node if set as child
When setting the root node as child of a clip or transform node, we add a
new reference to it, without removing the one that we've previously added
when getting it from the actor node (and that won't ever be unset by the
auto-pointer since the root_node is re-associated).

So, once we add the root node as child and re-define it, unref it.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/908
2019-11-04 12:07:43 +00:00
60800d2313 renderer-native: Separate offscreen and shadowfb
Create the intermediate shadow framebuffer for use exclusively when a
shadowfb is required.

Keep the previous offscreen framebuffer is as an intermediate
framebuffer for transformations only.

This way, we can apply transformations between in-memory framebuffers
prior to blit the result to screen, and achieve acceptable performance
even with software rendering on discrete GPU.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/877
2019-11-04 10:44:42 +01:00
db90c0d509 clutter/stage-view: Separate offscreen and shadowfb
Previously, we would use a single offscreen framebuffer for both
transformations and when a shadow framebuffer should be used, but that
can be dreadfully slow when using software rendering with a discrete GPU
due to bandwidth limitations.

Keep the offscreen framebuffer for transformations only and add another
intermediate shadow framebuffer used as a copy of the onscreen
framebuffer.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/877
2019-11-04 10:44:42 +01:00
e5b0f474ab cogl: Remove some unused framebuffer API
https://gitlab.gnome.org/GNOME/mutter/merge_requests/913
2019-11-01 16:48:12 -04:00
1688cf7c44 clutter: Drop the no-clear stage hint
A compositor is notably opaque (usually has nothing to be painted on!).
gnome-shell sets this hint, but there's no reason why we wouldn't want
it by default.

Also, the color buffer being cleared messes with stencil clips, as the
clear operation by definition ignores the stencil buffer. We want to
use these more extensively in the future, so just drop this API.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/911
2019-11-01 15:02:09 +00:00
2202c0d02e tests: Explicitly set a background color for offscreen actor tests
Those change opacity and read pixels, relying on an implicit stage color.
We won't do that anymore.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/911
2019-11-01 15:02:09 +00:00
dbb95cbe5f window-xwayland: Add Xwayland fullscreen games workaround
This is a workaround for X11 games which use randr to change the resolution
in combination with NET_WM_STATE_FULLSCREEN when going fullscreen.

Newer versions of Xwayland support the randr part of this by supporting randr
resolution change emulation in combination with using WPviewport to scale the
app's window (at the emulated resolution) to fill the entire monitor.

Apps using randr in combination with NET_WM_STATE_FULLSCREEN expect the
fullscreen window to have the size of the emulated randr resolution since
when running on regular Xorg the resolution will actually be changed and
after that going fullscreen through NET_WM_STATE_FULLSCREEN will size
the window to be equal to the new resolution.

We need to emulate this behavior for these games to work correctly.

Xwayland's emulated resolution is a per X11 client setting and Xwayland
will set a special _XWAYLAND_RANDR_EMU_MONITOR_RECTS property on the
toplevel windows of a client (and only those of that client), which has
changed the (emulated) resolution through a randr call.

This commit checks for that property and if it is set adjusts the fullscreen
monitor rect for this window to match the emulated resolution.

Here is a step-by-step of such an app going fullscreen:
1. App changes monitor resolution with randr.
2. Xwayland sets the _XWAYLAND_RANDR_EMU_MONITOR_RECTS property on all the
   apps current and future windows. This property contains the origin of the
   monitor for which the emulated resolution is set and the emulated
   resolution.
3. App sets _NET_WM_FULLSCREEN.
4. We check the property and adjust the app's fullscreen size to match
   the emulated resolution.
5. Xwayland sees a Window at monitor origin fully covering the emulated
   monitor resolution. Xwayland sets a viewport making the emulated
   resolution sized window cover the full actual monitor resolution.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/739
2019-11-01 14:14:21 +01:00
ae238d1d4d window: Add adjust_fullscreen_monitor_rect virtual method
Add an adjust_fullscreen_monitor_rect virtual method to MetaWindowClass
and call this from setup_constraint_info() if the window is fullscreen.

This allows MetaWindowClass to adjust the monitor-rectangle used to size
the window when going fullscreen, which will be used in further commits
for a workaround related to fullscreen games under Xwayland.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/739
2019-11-01 14:12:17 +01:00
6051712919 profiler: track changes in GLib and Sysprof
This tracks the changes to gdbus-codegen in terms of how GUnixFDList is
done to use the UnixFD annotation.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/908
2019-10-30 16:07:36 -07:00
6bfa61a3a7 Revert "clutter/cogl: Store empty clip regions for buffer age"
This reverts commit 4918893326.

This commit prevented cogl_stage_cogl_redraw_view() from skipping
swap buffers entirely if the invalidation region ended up empty.
This meant we were actually swapping buffers when we didn't need to.

The source of the glitches was fixed more properly, so this just adds
extra work.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/898
2019-10-30 17:17:29 +00:00
cf89e4d2cd clutter/cogl: Fix invalidation on non-primary monitors with no buffer age
We passed the view rectangle, we however want a fb-scaled rectangle starting
at 0,0. Fixes invalidation on other than the primary monitor when those
paths are hit.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/898
2019-10-30 17:17:29 +00:00
d47324e8d7 cogl/egl: Explicitly initialize age variable
In case of error, it's untouched by EGL, which probably means an
invalid read.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/906
2019-10-30 17:09:03 +00:00
ee4638ef5c cogl/egl: Make surface current before querying buffer age
Unknown since when, we started deferring the eglMakeCurrent for the
current framebuffer till we started painting on it, which means we
are preparing for rendering a view without guarantees that the
framebuffer we will paint to is the current drawing surface for the
EGL context.

A fairly common case where that assumption will break is multimonitor
set ups, in this case we will be preparing to paint to a view while
the current draw surface is that of the previously rendered view's.

Mesa will in this case return EGL_BAD_SURFACE when querying the buffer
age, since the surface is not yet the current draw surface. This
makes us give up on buffer age checks, and paint the whole view. Since
the problem repeats when painting the next view, we are effectively
doing full-screen redraws on all monitors.

Since cogl usually works implicitly, and querying the buffer age is
meaningless if you're not meant to paint on a surface, make the surface
the current draw surface implicitly before querying the buffer age.

This brings us glorious partial invalidations back when several views
had to be repainted.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/906
2019-10-30 17:09:03 +00:00
6ee7c0f486 cogl/egl: Warn when we fail to query a buffer age.
In order to avoid log spamming, just warn once it starts to happen, not
on every frame for every onscreen. Just knowing that this is happening
is a hint that something's going wrong.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/906
2019-10-30 17:09:03 +00:00
f4f7e31303 cogl: Fix GLES2 fallback
Say you're using intel gen3, you poor soul. Your big-GL maxes out at 1.5
unless you use dirty tricks, but you do have GLES2. We try to fall back
to GLES in this case, but we only ever say eglBindAPI(EGL_OPENGL_API).
So when we go to do CreateContext, even though we think we've requested
GLES 2.0, the driver will compare that "2.0" against the maximum big-GL
version, and things will fail.

Fix this by binding EGL_OPENGL_ES_API before trying a GLES context.

https://gitlab.gnome.org/GNOME/mutter/issues/635
2019-10-30 16:14:32 +00:00
7c036c5896 cogl: fix a compile warning
In find_onscreen_for_xid() we want to loop over the framebuffers
and skip any that is not onscreen.

The code today does this by negating the framebuffer type variable
and skipping if that equals COGL_FRAMEBUFFER_TYPE_ONSCREEN. This
actually works as the enum used will function as a boolean:

typedef enum _CoglFramebufferType {
  COGL_FRAMEBUFFER_TYPE_ONSCREEN,
  COGL_FRAMEBUFFER_TYPE_OFFSCREEN
} CoglFramebufferType;

But it is a bit weird logic and fragile if more types are added.
(not that I can think of any different type...)

To simplify this, and to silence a warning in clang this patch just
changes it to a != test.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/905
2019-10-30 16:02:45 +00:00
793c2ac58d cogl: Remove unused cogl-deprecated.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/896
2019-10-30 02:28:40 +00:00
13d9e4db30 cogl: Remove unused cogl/cogl-pango.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/896
2019-10-30 02:28:40 +00:00
e84dbd7faf cogl: Remove unused CoglPipelineLightingState
https://gitlab.gnome.org/GNOME/mutter/merge_requests/904
2019-10-29 16:00:02 -04:00
711023ea93 cogl: Remove unused COGL_PIPELINE_STATE_LIGHTING
https://gitlab.gnome.org/GNOME/mutter/merge_requests/904
2019-10-29 16:00:01 -04:00
468dc99dc9 cogl: Remove unused pipeline lighting API
https://gitlab.gnome.org/GNOME/mutter/merge_requests/904
2019-10-29 15:59:59 -04:00
6b8ee80fd0 cogl: Remove unused deprecated material lighting API
https://gitlab.gnome.org/GNOME/mutter/merge_requests/904
2019-10-29 15:59:53 -04:00
17e39ad79c cogl: Remove support for cogl.conf
There are still environment variables for these controls, but having
them in a config file doesn't really make sense for mutter. Even if it
did we probably don't want to be parsing the same file as some
standalone version of cogl.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/902
2019-10-29 19:25:37 +00:00
46aeb9634f ci: Add gnome-control-center
Since 3.34, the gnome-shell package was cleaned up to only depend
on gnome-control-center-filesystem at build-time. However one of
the gnome-shell tests needs the gettext ITS file for keybindings
provided by the main gnome-control-center package (in fact, the
COPR package is stripped down to just that file), so install that
explicitly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/901
2019-10-29 18:34:36 +00:00
3f9c5d04d4 cogl: Remove old workaround for software Mesa
The comment says this was fixed in 10.1, which is over five years old
now. Please use a newer Mesa already.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/900
2019-10-29 12:42:30 -04:00
40a76590dd ci: Update docker image to v3
It's this time of the cycle again: Rebase the docker image to the
upcoming Fedora release, so we can drop a fair bit of the custom
dependencies that have piled up.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/894
2019-10-29 02:11:02 +01:00
f2b3dd318f wayland: Check stylus serials on meta_wayland_seat_can_popup()
This allows xdg_popup.grab() to work with styli. Without this check
we would bail out and emit xdg_popup.popup_done, leaving stylus users
unable to interact with popup menus, comboboxes, etc...

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/886
2019-10-28 19:10:01 +00:00
942883577e x11: Limit touch replay pointer events to when replaying
When a touch sequence was rejected, the emulated pointer events would be
replayed with old timestamps. This caused issues with grabs as they
would be ignored due to being too old. This was mitigated by making sure
device event timestamps never travelled back in time by tampering with
any event that had a timestamp seemingly in the past.

This failed when the most recent timestamp that had been received were
much older than the timestamp of the new event. This could for example
happen when a session was left not interacted with for 40+ days or so;
when interacted with again, as any new timestamp would according to
XSERVER_TIME_IS_BEFORE() still be in the past compared to the "most
recent" one. The effect is that we'd always use the `latest_evtime` for
all new device events without ever updating it.

The end result of this was that passive grabs would become active when
interacted with, but would then newer be released, as the timestamps to
XIAllowEvents() would out of date, resulting in the desktop effectively
freezing, as the Shell would have an active pointer grab.

To avoid the situation where we get stuck with an old `latest_evtime`
timestamp, limit the tampering with device event timestamp to 1) only
pointer events, and 2) only during the replay sequence. The second part
is implemented by sending an asynchronous message via the X server after
rejecting a touch sequence, only potentially tampering with the device
event timestamps until the reply. This should avoid the stuck timestamp
as in those situations, we'll always have a relatively up to date
`latest_evtime` meaning XSERVER_TIME_IS_BEFORE() will not get confused.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/886
2019-10-28 18:40:44 +00:00
23fa59b77c display: Move finishing of touch sequence to the backend
We need to manipulate an X11 grab when a touch sequence ends; move that
logic to where it belongs - in the X11 backend.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/886
2019-10-28 18:40:43 +00:00
9678fd5306 clutter/cogl: Scale clip region in paint_stage()
To simplify the code and because it was forgotten once in a7f4f5b291,
breaking clipped redraws of clipped views.

Also sneak in a very small cleanup.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/889
2019-10-28 18:18:34 +01:00
563e7139b6 Allow changing Clutter debug flags at runtime
This way, we can simply pop up the Looking Glass and run:

 >>> Meta.add_clutter_debug_flags(Clutter.DebugFlag.PICK, 0, 0)

And measure specific actions or events on GNOME Shell.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/862
2019-10-25 19:12:34 +00:00
2e9faaf67a clutter/cogl: Ensure to paint full view if there's no buffer age support
This was falling back to painting an empty area, which is not what we want.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/888
2019-10-25 15:03:24 +00:00
4918893326 clutter/cogl: Store empty clip regions for buffer age
As we do not prevent the SwapBuffers call from happening, those also
do count. Results in clip area calculations to be right for monitors
that previously did not get invalidated.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/888
2019-10-25 15:03:24 +00:00
3e5960b5a2 cogl: Remove unused cogl_egl_context_get_egl_context
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:53:03 -04:00
b294e62aed cogl: Remove unused cogl_glx_context_get_glx_context
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:53:01 -04:00
c63f54b7a7 cogl: Remove unused cogl_texture_pixmap_x11_set_damage_object
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:53:00 -04:00
3186e45ae5 cogl: Remove unused cogl_xlib_renderer_get_visual_info
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:59 -04:00
ed7afd9e80 cogl: Remove unused cogl_x11_onscreen_set_foreign_window_xid
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:57 -04:00
683f18639e cogl: Remove unused cogl_x11_onscreen_get_visual_xid
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:56 -04:00
e17494f3bd cogl: Inline cogl_xlib_renderer_set_event_retrieval_enabled into its one caller
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:54 -04:00
c36c865987 cogl: Remove unused _cogl_xlib_renderer_get_dispatch_timeout
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:53 -04:00
a99f579127 cogl: Remove unused cogl_check_extension and cogl_clutter_check_extension
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:51 -04:00
acc7b83322 cogl: Remove the stub winsys
It's not useful and supporting it leaks into the API in other weird
ways.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:49 -04:00
95662fd3d8 cogl: Remove unused cogl_xlib_renderer_get_visual_info
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:47 -04:00
b3980f7a94 cogl: Move _cogl_xlib_get_damage_base near its only consumer
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:46 -04:00
ac626f7334 cogl: Remove unused API from cogl-xlib
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:43 -04:00
b622a8b55d ci: Print all the commits that need bug references
Rather than just the latest one, otherwise it might leave the patch
submitter to iterate over every commit, if they didn't know every patch
needed a reference.

Closes: #1809
2019-10-23 10:58:07 +02:00
b6170dbe7b ci: Phrase error in a way that gives a hint on how to fix problem
The passive phrasing makes it sound like there's something inherently
broken with the commit, rather than simply being missing an annotation
that the author can add.

Closes: #1809
2019-10-23 10:56:35 +02:00
d6bf4800ed cogl: Remove unused _cogl_matrix_entry_flush_to_gl_builtins
https://gitlab.gnome.org/GNOME/mutter/merge_requests/880
2019-10-22 19:44:54 +00:00
a60457c2d8 clutter: Remove behaviours
https://gitlab.gnome.org/GNOME/mutter/merge_requests/879
2019-10-22 19:01:17 +00:00
33d1bae03f clutter: Remove deprecated/clutter-behaviour-scale.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/879
2019-10-22 19:01:17 +00:00
013b336690 clutter: Remove unused deprecated/clutter-behaviour-depth.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/879
2019-10-22 19:01:17 +00:00
096d78479b clutter: Remove tests/interactive/test-texture-quality.c
This is the last consumer of clutter_behaviour_depth_*, and is testing
clutter_texture_set_filter_quality which is also deprecated.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/879
2019-10-22 19:01:17 +00:00
68fca552d7 clutter: Remove unused deprecated/clutter-behaviour-opacity.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/879
2019-10-22 19:01:17 +00:00
18e0a8f7bf clutter: Remove stray references to ClutterBehaviour{Path,Rotate}
These were removed back in cc077023 and df3d2389.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/879
2019-10-22 19:01:17 +00:00
cd2ee44216 clutter/actor: Always paint using paint nodes
Make ClutterActor paint using ClutterTransformNode, ClutterClip
node, and ClutterActorNode. Essencially, the actor node is a
replacement for clutter_actor_continue_paint().

An interesting aspect of this commit is that the order of the
operations is reversed to be preserved.

Before being able to remove the dummy node hack, we'll need to
make ClutterEffects compatible with paint nodes first -- and
naturally, that's enough content for its own merge request.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/872
2019-10-22 14:53:48 -03:00
ebf9ac091d clutter/paint-nodes: Introduce ClutterActorNode
ClutterActorNode is a paint node that runs the 'paint'
function of an actor. It is a useful helper node to be
used during the transition to paint nodes.

The role of ClutterActorNode will change over time. For
now, it is just a call to clutter_actor_continue_paint(),
which also paints the effects. When ClutterEffect is
ported to paint nodes, ClutterActorNode will morph to
only notify the actor about the painting, and will become
a private node to Clutter.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/872
2019-10-22 14:47:37 -03:00
cf791c09f0 clutter/paint-nodes: Expose and cleanup ClutterTransformNode
It will also be used by ClutterActor to apply it's own transform
to the paint node tree, and thus preserve it's rendering area.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/872
2019-10-22 14:47:37 -03:00
1d8807a171 clutter/paint-nodes: Expose ClutterLayerNode
It will be useful to port ClutterOffscreenEffect in
the future.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/872
2019-10-22 14:47:37 -03:00
f18e2d2e62 clutter: Remove unused clutter-layout-manager-deprecated.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/878
2019-10-22 11:57:55 -04:00
71c3f4af31 x11: Update X11 focus before updating MetaDisplay focus
In a similar vein to commit 8fd55fef85. This notably failed when setting
the focus on the stage (eg. to redirect key events to Clutter actors).
Deeper in MetaDisplay focus updating machinery, it would check
meta_stage_is_focused() which would still return FALSE at the time it's
called.

This would not typically have side effects, but our "App does not respond"
dialogs see the focus change under their feet, so they try to bring
themselves to focus again. This results in a feedback loop.

Changing the order results in later checks on the X11 POV of the focus
being correct, so focus is not mistakenly stolen from the close dialog,
and it actually succeeds in keeping the key focus.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1607

https://gitlab.gnome.org/GNOME/mutter/merge_requests/876
2019-10-22 14:51:36 +02:00
3078394951 ClutterStage: Use clutter_region_t for swap_region
We use `clutter_region_t` for the clip now, so lets also use it
for the swap region.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/692
2019-10-22 00:28:47 +02:00
a7f4f5b291 ClutterStage: Store clip area as a region
This will allow drawing optimizations as a region is more concrete
than the bounding rectangle.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/692
2019-10-22 00:28:47 +02:00
bd1630a12c cogl: Remove unused CoglFeatureFlags
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
67d5ebb187 cogl: Remove unused COGL_FEATURE_PBOS
Almost there.  The CoglFeatureFlags type is changed to "int"
momentarily.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
ba7b8a5de3 cogl: Remove unused COGL_FEATURE_TEXTURE_YUV
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
d54c548aac clutter: Remove unused deprecated clutter_texture_set_from_yuv_data
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
f01db80387 cogl: Remove unused COGL_FEATURE_TEXTURE_READ_PIXELS
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
5e0989532e clutter: Remove unused CLUTTER_FEATURE_TEXTURE_READ_PIXELS
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
673f4295e8 cogl: Remove unused COGL_FEATURE_ID_OFFSCREEN_MULTISAMPLE
This is a _little_ strange, as we still fill in the vtable slot for
glRenderbufferStorageMultisampleIMG, and can in principle still call it.
But that feature was weird to begin with as we were only checking for
that function in big-GL contexts despite that its extension is for GLES.
I'll leave cleaning that up to a future pass.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
1f04b1ae69 cogl: Remove unused COGL_FEATURE_OFFSCREEN_MULTISAMPLE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
26a7387f40 cogl: Remove unused COGL_FEATURE_FOUR_CLIP_PLANES
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
bd5266a05e cogl: Remove unused COGL_FEATURE_STENCIL_BUFFER
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
eb3ffeff0a cogl: Remove unused COGL_FEATURE_UNSIGNED_INT_INDICES
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
0731eb629c cogl: Remove unused COGL_FEATURE_MAP_BUFFER_FOR_{READ,WRITE}
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
34a38827b7 cogl: Remove unused COGL_FEATURE_ID_ONSCREEN_MULTIPLE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
3076895e98 cogl: Remove unused COGL_FEATURE_ONSCREEN_MULTIPLE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
0e4c23c985 cogl: Remove unused depth texture API
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
fb49e9def7 cogl: Remove unused COGL_FEATURE_ID_DEPTH_TEXTURE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
45e77c1d87 cogl: Remove unused COGL_FEATURE_DEPTH_TEXTURE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
cf107c89b8 cogl: Remove always-set COGL_FEATURE_OFFSCREEN
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
6a8830a551 cogl: Remove always-set COGL_FEATURE_ID_OFFSCREEN
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
4523251849 cogl: Require {EXT,ARB}_framebuffer_object in the GL driver
This was only promoted to core in 3.0, but Mesa's supported it
unconditionally since around 7.0 even in 2.1 contexts, so this is not a
particularly onerous requirement.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
5f4e8789df cogl: Remove unused COGL_FEATURE_POINT_SPRITE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
eaf0aa1f07 cogl: Remove unused COGL_FEATURE_DEPTH_RANGE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
96da0c60bd cogl: Remove always-set COGL_FEATURE_ID_POINT_SPRITE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
da36575d7f cogl: Remove always-set COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
7716a418ce cogl: Remove always-set COGL_PRIVATE_FEATURE_BLEND_CONSTANT
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
6ab2e30fff cogl: Remove unused COGL_FEATURE_ID_MIRRORED_REPEAT
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
8b0289a5ba cogl: Remove unused COGL_FEATURE_ID_DEPTH_RANGE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
d810c0576d cogl: Move some GL function pointers from in-gles-core to core
Now that we require GLES2 or GL 2.1 these are always available.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
82f56054d4 cogl: Remove some completely unused GL function pointers
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
de362537c6 cogl: VBOs are always available
ARB_vertex_buffer_object was promoted to core in GL 1.5 (and thus GLES
2.0).

https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
ba9fb16048 cogl: Remove COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES
Again, just a difference between GL and GLES for no real reason.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
148cba3270 cogl: Remove COGL_PRIVATE_FEATURE_QUADS
There's no real performance benefit to this, it's just a difference
between GL and GLES for no reason.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:07 +00:00
c5bb2e3f56 cogl: Remove unused cogl_renderer_get_n_fragment_texture_units
https://gitlab.gnome.org/GNOME/mutter/merge_requests/874
2019-10-21 16:32:46 -04:00
049e7882b7 cogl: Move _cogl_bitmap_gl_{,un}bind into the GL driver
These are the only pieces of the cogl bitmap support that need GL driver
knowledge, so move them there like the TODO suggests.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/874
2019-10-21 16:32:46 -04:00
f297a5faa5 cogl: Remove unneeded driver/ includes from the core
https://gitlab.gnome.org/GNOME/mutter/merge_requests/874
2019-10-21 16:32:46 -04:00
40e6aa7d94 compositor: Plug cairo_region_t leak
The MetaBackgroundActor uses a region to find out the areas that need
repainting, but forgot to free it, oops.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/873
2019-10-21 19:01:37 +02:00
668be1f4bd backends: Plug MetaKmsPageFlipData leak
If the page flip is postponed, keep a ref to it, but still unref it
on the page flip callback anyways. Fix suggested by Jonas Ådahl.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/873
2019-10-21 19:01:35 +02:00
a444a4c5f5 EGL: Include EGL/eglmesaext.h
The eglext.h shipped by libglvnd does not include the Mesa extensions,
unlike the header shipped in Mesa.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/876
2019-10-21 14:04:30 +00:00
05da4a6094 clutter/effect: Remove pick flags
As pointed out, they are now unused. Remove
the pick flags.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/865
2019-10-21 13:49:26 +00:00
db8fcc0537 clutter/actor: Remove pick code from paint
Now that they are properly split, remove the pick
code from paint paths.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/865
2019-10-21 13:49:26 +00:00
86a5358812 clutter/stage: Pick with clutter_actor_pick()
Use the new function to perform picking.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/865
2019-10-21 13:49:26 +00:00
ff8ed70f84 clutter/stage: Refactor view setup code
We'll share it between pick and paint, so refactor
the framebuffer and view setup code from paint
into a new function.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/865
2019-10-21 13:49:26 +00:00
179d5ba6a6 clutter: Split pick and paint
Add the corresponding clutter_actor_pick() and
clutter_actor_continue_pick() as public APIs,
and use them in pick overrides and ClutterEffect.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/865
2019-10-21 13:49:26 +00:00
98892391d7 wayland/surface: Reset buffer_destroy_handler_id
Syncronized subsurfaces that call into `merge_pending_state` might
otherwise not create new destroy handlers, ending up with a invalid
handler ids, throwing errors and leaking.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/868
2019-10-21 12:54:36 +00:00
45a8806e65 x11: Iterate over selections in a safer manner for event handling
It might be the case that handling an event induces the stream to
trigger completion, hence removing itself from the list. In that
case we would operate on the no longer valid list element to fetch
the next one.

Keep a pointer to the next element beforehand, so we can tiptoe
over streams that did remove themselves.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/869
2019-10-21 13:19:48 +02:00
e1fa0734a9 x11: Detach selection streams on dispose
The streams were only detached from MetaX11Display (and its event handling)
on completion. This is too much to expect, and those might be in some
circumstances replaced while operating.

Make those streams detach themselves on dispose(), so we don't trip into
freed memory later on when trying to dispatch unrelated X11 selection events.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/869
2019-10-21 11:47:40 +02:00
220 changed files with 2670 additions and 9179 deletions

View File

@ -1,4 +1,4 @@
image: registry.gitlab.gnome.org/gnome/mutter/master:v2
image: registry.gitlab.gnome.org/gnome/mutter/master:v3
stages:
- review

View File

@ -1,39 +1,28 @@
# Rebuild and push with
#
# cd .gitlab-ci/
# docker build --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v2 .
# docker push registry.gitlab.gnome.org/gnome/mutter/master:v2
# docker build --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v3 .
# docker push registry.gitlab.gnome.org/gnome/mutter/master:v3
#
FROM fedora:30
FROM fedora:31
RUN dnf -y update && dnf -y upgrade && \
dnf install -y 'dnf-command(builddep)' && \
dnf install -y 'dnf-command(copr)' && \
dnf copr enable -y fmuellner/gnome-shell-ci && \
dnf copr enable -y jadahl/mutter-ci && \
dnf copr enable -y hergertme/sysprof-3 && \
dnf -y update && dnf -y upgrade && \
dnf builddep -y mutter && \
# Until Fedora catches up with meson build-deps
dnf install -y meson xorg-x11-server-Xorg gnome-settings-daemon-devel egl-wayland-devel xorg-x11-server-Xwayland graphene-devel && \
# Until Fedora catches up with mesa bug fixes
dnf upgrade -y mesa-dri-drivers mesa-libEGL && \
# Until Fedora catches up with new build-deps
dnf install -y 'pkgconfig(graphene-gobject-1.0)' 'pkgconfig(sysprof-capture-3)' 'pkgconfig(libcap-ng)' && \
# For running unit tests
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 '*/xvfb-run' gdm-lib accountsservice-libs && \
dnf install -y sysprof-devel && \
dnf install -y intltool redhat-rpm-config make && \
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 '*/xvfb-run' gdm-lib accountsservice-libs gnome-control-center && \
# GNOME Shell
dnf builddep -y gnome-shell --setopt=install_weak_deps=False && \
# New dep this cycle
dnf install -y 'pkgconfig(gnome-autoar-0)' && \
dnf remove -y gnome-bluetooth-libs-devel dbus-glib-devel upower-devel python3-devel && \
dnf remove -y --noautoremove mutter mutter-devel && \

View File

@ -40,11 +40,12 @@ function commit_message_subject_is_compliant() {
return 0
}
RET=0
for commit in $commits; do
commit_short=$(echo $commit | cut -c -8)
if ! commit_message_has_url $commit; then
echo "Missing merge request or issue URL on commit $commit_short"
echo "Commit $commit_short needs a merge request or issue URL"
exit 1
fi
@ -52,6 +53,8 @@ for commit in $commits; do
if [ $? != 0 ]; then
echo "Commit message for $commit_short is not compliant:"
echo "$errors"
exit 1
RET=1
fi
done
exit $RET

View File

@ -1,6 +1,5 @@
#!/usr/bin/bash
mutter_branch=$(git describe --contains --all HEAD)
gnome_shell_target=
git clone https://gitlab.gnome.org/GNOME/gnome-shell.git
@ -26,8 +25,7 @@ if [ "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
fi
if [ -z "$gnome_shell_target" ]; then
gnome_shell_target=$(git branch -r -l origin/$mutter_branch)
gnome_shell_target=${gnome_shell_target:-$(git branch -r -l ${mutter_branch#remotes/})}
gnome_shell_target=$(git branch -r -l origin/$CI_COMMIT_REF_NAME)
gnome_shell_target=${gnome_shell_target:-origin/master}
echo Using $gnome_shell_target instead
fi

View File

@ -656,7 +656,6 @@
#include "clutter-units.h"
#include "deprecated/clutter-actor.h"
#include "deprecated/clutter-behaviour.h"
#include "deprecated/clutter-container.h"
/* Internal enum used to control mapped state update. This is a hint
@ -2373,7 +2372,7 @@ clutter_actor_real_pick (ClutterActor *self)
for (iter = self->priv->first_child;
iter != NULL;
iter = iter->priv->next_sibling)
clutter_actor_paint (iter);
clutter_actor_pick (iter);
}
}
@ -3406,20 +3405,20 @@ _clutter_actor_apply_relative_transformation_matrix (ClutterActor *self,
}
static void
_clutter_actor_draw_paint_volume_full (ClutterActor *self,
_clutter_actor_draw_paint_volume_full (ClutterActor *self,
ClutterPaintVolume *pv,
const char *label,
const CoglColor *color)
const char *label,
const ClutterColor *color,
ClutterPaintNode *node)
{
g_autoptr (ClutterPaintNode) pipeline_node = NULL;
static CoglPipeline *outline = NULL;
CoglPrimitive *prim;
graphene_point3d_t line_ends[12 * 2];
int n_vertices;
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
/* XXX: at some point we'll query this from the stage but we can't
* do that until the osx backend uses Cogl natively. */
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
CoglColor cogl_color;
if (outline == NULL)
outline = cogl_pipeline_new (ctx);
@ -3453,29 +3452,50 @@ _clutter_actor_draw_paint_volume_full (ClutterActor *self,
n_vertices,
(CoglVertexP3 *)line_ends);
cogl_pipeline_set_color (outline, color);
cogl_framebuffer_draw_primitive (fb, outline, prim);
cogl_color_set_from_4ub (&cogl_color,
color->red,
color->green,
color->blue,
color->alpha);
cogl_pipeline_set_color (outline, &cogl_color);
pipeline_node = clutter_pipeline_node_new (outline);
clutter_paint_node_set_name (pipeline_node,
"ClutterActor (paint volume outline)");
clutter_paint_node_add_primitive (pipeline_node, prim);
clutter_paint_node_add_child (node, pipeline_node);
cogl_object_unref (prim);
if (label)
{
g_autoptr (ClutterPaintNode) text_node = NULL;
PangoLayout *layout;
layout = pango_layout_new (clutter_actor_get_pango_context (self));
pango_layout_set_text (layout, label, -1);
cogl_pango_render_layout (layout,
pv->vertices[0].x,
pv->vertices[0].y,
color,
0);
text_node = clutter_text_node_new (layout, color);
clutter_paint_node_set_name (text_node,
"ClutterActor (paint volume label)");
clutter_paint_node_add_rectangle (text_node,
&(ClutterActorBox) {
.x1 = pv->vertices[0].x,
.y1 = pv->vertices[0].y,
.x2 = pv->vertices[2].x,
.y2 = pv->vertices[2].y,
});
clutter_paint_node_add_child (node, text_node);
g_object_unref (layout);
}
}
static void
_clutter_actor_draw_paint_volume (ClutterActor *self)
_clutter_actor_draw_paint_volume (ClutterActor *self,
ClutterPaintNode *node)
{
ClutterPaintVolume *pv;
CoglColor color;
ClutterColor color;
pv = _clutter_actor_get_paint_volume_mutable (self);
if (!pv)
@ -3490,61 +3510,79 @@ _clutter_actor_draw_paint_volume (ClutterActor *self)
clutter_paint_volume_set_width (&fake_pv, width);
clutter_paint_volume_set_height (&fake_pv, height);
cogl_color_init_from_4f (&color, 0, 0, 1, 1);
clutter_color_init (&color, 0, 0, 255, 255);
_clutter_actor_draw_paint_volume_full (self, &fake_pv,
_clutter_actor_get_debug_name (self),
&color);
&color,
node);
clutter_paint_volume_free (&fake_pv);
}
else
{
cogl_color_init_from_4f (&color, 0, 1, 0, 1);
clutter_color_init (&color, 0, 255, 0, 255);
_clutter_actor_draw_paint_volume_full (self, pv,
_clutter_actor_get_debug_name (self),
&color);
&color,
node);
}
}
static void
_clutter_actor_paint_cull_result (ClutterActor *self,
gboolean success,
ClutterCullResult result)
_clutter_actor_paint_cull_result (ClutterActor *self,
gboolean success,
ClutterCullResult result,
ClutterPaintNode *node)
{
ClutterActorPrivate *priv = self->priv;
ClutterPaintVolume *pv;
CoglColor color;
ClutterColor color;
if (success)
{
if (result == CLUTTER_CULL_RESULT_IN)
cogl_color_init_from_4f (&color, 0, 1, 0, 1);
clutter_color_init (&color, 0, 255, 0, 255);
else if (result == CLUTTER_CULL_RESULT_OUT)
cogl_color_init_from_4f (&color, 0, 0, 1, 1);
clutter_color_init (&color, 0, 0, 255, 255);
else
cogl_color_init_from_4f (&color, 0, 1, 1, 1);
clutter_color_init (&color, 0, 255, 255, 255);
}
else
cogl_color_init_from_4f (&color, 1, 1, 1, 1);
clutter_color_init (&color, 255, 255, 255, 255);
if (success && (pv = _clutter_actor_get_paint_volume_mutable (self)))
_clutter_actor_draw_paint_volume_full (self, pv,
_clutter_actor_get_debug_name (self),
&color);
&color,
node);
else
{
g_autoptr (ClutterPaintNode) text_node = NULL;
PangoLayout *layout;
float width;
float height;
char *label =
g_strdup_printf ("CULL FAILURE: %s", _clutter_actor_get_debug_name (self));
cogl_color_init_from_4f (&color, 1, 1, 1, 1);
cogl_set_source_color (&color);
clutter_color_init (&color, 255, 255, 255, 255);
width = clutter_actor_box_get_width (&priv->allocation);
height = clutter_actor_box_get_height (&priv->allocation);
layout = pango_layout_new (clutter_actor_get_pango_context (self));
pango_layout_set_text (layout, label, -1);
cogl_pango_render_layout (layout,
0,
0,
&color,
0);
text_node = clutter_text_node_new (layout, &color);
clutter_paint_node_set_name (text_node,
"ClutterActor (paint volume text)");
clutter_paint_node_add_rectangle (text_node,
&(ClutterActorBox) {
.x1 = 0.f,
.y1 = 0.f,
.x2 = width,
.y2 = height,
});
clutter_paint_node_add_child (node, text_node);
g_free (label);
g_object_unref (layout);
}
@ -3808,8 +3846,6 @@ clutter_actor_paint_node (ClutterActor *actor,
bg_color.alpha);
clear_flags = COGL_BUFFER_BIT_DEPTH;
if (!clutter_stage_get_no_clear_hint (CLUTTER_STAGE (actor)))
clear_flags |= COGL_BUFFER_BIT_COLOR;
node = clutter_root_node_new (fb, &bg_color, clear_flags);
clutter_paint_node_set_name (node, "stageClear");
@ -3876,11 +3912,11 @@ clutter_actor_paint_node (ClutterActor *actor,
void
clutter_actor_paint (ClutterActor *self)
{
g_autoptr (ClutterPaintNode) actor_node = NULL;
g_autoptr (ClutterPaintNode) root_node = NULL;
ClutterActorPrivate *priv;
ClutterPickMode pick_mode;
ClutterActorBox clip;
gboolean clip_set = FALSE;
ClutterStage *stage;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
@ -3888,16 +3924,11 @@ clutter_actor_paint (ClutterActor *self)
return;
priv = self->priv;
pick_mode = _clutter_context_get_pick_mode ();
if (pick_mode == CLUTTER_PICK_NONE)
priv->propagated_one_redraw = FALSE;
priv->propagated_one_redraw = FALSE;
/* It's an important optimization that we consider painting of
* actors with 0 opacity to be a NOP... */
if (pick_mode == CLUTTER_PICK_NONE &&
/* ignore top-levels, since they might be transparent */
if (/* ignore top-levels, since they might be transparent */
!CLUTTER_ACTOR_IS_TOPLEVEL (self) &&
/* Use the override opacity if its been set */
((priv->opacity_override >= 0) ?
@ -3912,22 +3943,50 @@ clutter_actor_paint (ClutterActor *self)
clutter_actor_ensure_resource_scale (self);
stage = (ClutterStage *) _clutter_actor_get_stage_internal (self);
actor_node = clutter_actor_node_new (self);
root_node = clutter_paint_node_ref (actor_node);
/* mark that we are in the paint process */
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_PAINT);
if (priv->has_clip)
{
clip.x1 = priv->clip.origin.x;
clip.y1 = priv->clip.origin.y;
clip.x2 = priv->clip.origin.x + priv->clip.size.width;
clip.y2 = priv->clip.origin.y + priv->clip.size.height;
clip_set = TRUE;
}
else if (priv->clip_to_allocation)
{
clip.x1 = 0.f;
clip.y1 = 0.f;
clip.x2 = priv->allocation.x2 - priv->allocation.x1;
clip.y2 = priv->allocation.y2 - priv->allocation.y1;
clip_set = TRUE;
}
cogl_push_matrix ();
if (clip_set)
{
ClutterPaintNode *clip_node;
clip_node = clutter_clip_node_new ();
clutter_paint_node_add_rectangle (clip_node, &clip);
clutter_paint_node_add_child (clip_node, root_node);
clutter_paint_node_unref (root_node);
root_node = g_steal_pointer (&clip_node);
}
if (priv->enable_model_view_transform)
{
CoglMatrix matrix;
ClutterPaintNode *transform_node;
CoglMatrix transform;
/* XXX: It could be better to cache the modelview with the actor
* instead of progressively building up the transformations on
* the matrix stack every time we paint. */
cogl_get_modelview_matrix (&matrix);
_clutter_actor_apply_modelview_transform (self, &matrix);
clutter_actor_get_transform (self, &transform);
transform_node = clutter_transform_node_new (&transform);
clutter_paint_node_add_child (transform_node, root_node);
clutter_paint_node_unref (root_node);
root_node = g_steal_pointer (&transform_node);
#ifdef CLUTTER_ENABLE_DEBUG
/* Catch when out-of-band transforms have been made by actors not as part
@ -3939,7 +3998,7 @@ clutter_actor_paint (ClutterActor *self)
_clutter_actor_get_relative_transformation_matrix (self, NULL,
&expected_matrix);
if (!cogl_matrix_equal (&matrix, &expected_matrix))
if (!cogl_matrix_equal (&transform, &expected_matrix))
{
GString *buf = g_string_sized_new (1024);
ClutterActor *parent;
@ -3966,54 +4025,14 @@ clutter_actor_paint (ClutterActor *self)
}
}
#endif /* CLUTTER_ENABLE_DEBUG */
cogl_set_modelview_matrix (&matrix);
}
if (priv->has_clip)
{
clip.x1 = priv->clip.origin.x;
clip.y1 = priv->clip.origin.y;
clip.x2 = priv->clip.origin.x + priv->clip.size.width;
clip.y2 = priv->clip.origin.y + priv->clip.size.height;
clip_set = TRUE;
}
else if (priv->clip_to_allocation)
{
clip.x1 = 0.f;
clip.y1 = 0.f;
clip.x2 = priv->allocation.x2 - priv->allocation.x1;
clip.y2 = priv->allocation.y2 - priv->allocation.y1;
clip_set = TRUE;
}
if (clip_set)
{
if (pick_mode == CLUTTER_PICK_NONE)
{
CoglFramebuffer *fb = _clutter_stage_get_active_framebuffer (stage);
cogl_framebuffer_push_rectangle_clip (fb,
clip.x1,
clip.y1,
clip.x2,
clip.y2);
}
else
{
if (!_clutter_actor_push_pick_clip (self, &clip))
clip_set = FALSE;
}
}
if (pick_mode == CLUTTER_PICK_NONE)
{
/* We check whether we need to add the flatten effect before
each paint so that we can avoid having a mechanism for
applications to notify when the value of the
has_overlaps virtual changes. */
add_or_remove_flatten_effect (self);
}
/* We check whether we need to add the flatten effect before
* each paint so that we can avoid having a mechanism for
* applications to notify when the value of the
* has_overlaps virtual changes.
*/
add_or_remove_flatten_effect (self);
/* We save the current paint volume so that the next time the
* actor queues a redraw we can constrain the redraw to just
@ -4042,7 +4061,7 @@ clutter_actor_paint (ClutterActor *self)
* paint then the last-paint-volume would likely represent the new
* actor position not the old.
*/
if (!in_clone_paint () && pick_mode == CLUTTER_PICK_NONE)
if (!in_clone_paint ())
{
gboolean success;
/* annoyingly gcc warns if uninitialized even though
@ -4059,9 +4078,9 @@ clutter_actor_paint (ClutterActor *self)
success = cull_actor (self, &result);
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS))
_clutter_actor_paint_cull_result (self, success, result);
_clutter_actor_paint_cull_result (self, success, result, actor_node);
else if (result == CLUTTER_CULL_RESULT_OUT && success)
goto done;
return;
}
if (priv->effects == NULL)
@ -4070,36 +4089,14 @@ clutter_actor_paint (ClutterActor *self)
priv->next_effect_to_paint =
_clutter_meta_group_peek_metas (priv->effects);
clutter_actor_continue_paint (self);
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES))
_clutter_actor_draw_paint_volume (self, actor_node);
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES &&
pick_mode == CLUTTER_PICK_NONE))
_clutter_actor_draw_paint_volume (self);
clutter_paint_node_paint (root_node);
/* If we make it here then the actor has run through a complete
paint run including all the effects so it's no longer dirty */
if (pick_mode == CLUTTER_PICK_NONE)
priv->is_dirty = FALSE;
done:
if (clip_set)
{
if (pick_mode == CLUTTER_PICK_NONE)
{
CoglFramebuffer *fb = _clutter_stage_get_active_framebuffer (stage);
cogl_framebuffer_pop_clip (fb);
}
else
{
_clutter_actor_pop_pick_clip (self);
}
}
cogl_pop_matrix ();
/* paint sequence complete */
CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_IN_PAINT);
priv->is_dirty = FALSE;
}
/**
@ -4135,43 +4132,28 @@ clutter_actor_continue_paint (ClutterActor *self)
actual actor */
if (priv->next_effect_to_paint == NULL)
{
if (_clutter_context_get_pick_mode () == CLUTTER_PICK_NONE)
{
ClutterPaintNode *dummy;
ClutterPaintNode *dummy;
/* XXX - this will go away in 2.0, when we can get rid of this
* stuff and switch to a pure retained render tree of PaintNodes
* for the entire frame, starting from the Stage; the paint()
* virtual function can then be called directly.
*/
dummy = _clutter_dummy_node_new (self);
clutter_paint_node_set_name (dummy, "Root");
/* XXX - this will go away in 2.0, when we can get rid of this
* stuff and switch to a pure retained render tree of PaintNodes
* for the entire frame, starting from the Stage; the paint()
* virtual function can then be called directly.
*/
dummy = _clutter_dummy_node_new (self);
clutter_paint_node_set_name (dummy, "Root");
/* XXX - for 1.12, we use the return value of paint_node() to
* decide whether we should emit the ::paint signal.
*/
clutter_actor_paint_node (self, dummy);
clutter_paint_node_unref (dummy);
/* XXX - for 1.12, we use the return value of paint_node() to
* decide whether we should emit the ::paint signal.
*/
clutter_actor_paint_node (self, dummy);
clutter_paint_node_unref (dummy);
/* XXX:2.0 - Call the paint() virtual directly */
if (g_signal_has_handler_pending (self, actor_signals[PAINT],
0, TRUE))
g_signal_emit (self, actor_signals[PAINT], 0);
else
CLUTTER_ACTOR_GET_CLASS (self)->paint (self);
}
/* XXX:2.0 - Call the paint() virtual directly */
if (g_signal_has_handler_pending (self, actor_signals[PAINT],
0, TRUE))
g_signal_emit (self, actor_signals[PAINT], 0);
else
{
/* The actor will log a silhouette of itself to the stage pick log.
*
* XXX:2.0 - Call the pick() virtual directly
*/
if (g_signal_has_handler_pending (self, actor_signals[PICK],
0, TRUE))
g_signal_emit (self, actor_signals[PICK], 0);
else
CLUTTER_ACTOR_GET_CLASS (self)->pick (self);
}
CLUTTER_ACTOR_GET_CLASS (self)->paint (self);
}
else
{
@ -4185,31 +4167,157 @@ clutter_actor_continue_paint (ClutterActor *self)
priv->current_effect = priv->next_effect_to_paint->data;
priv->next_effect_to_paint = priv->next_effect_to_paint->next;
if (_clutter_context_get_pick_mode () == CLUTTER_PICK_NONE)
if (priv->is_dirty)
{
if (priv->is_dirty)
{
/* If there's an effect queued with this redraw then all
effects up to that one will be considered dirty. It
is expected the queued effect will paint the cached
image and not call clutter_actor_continue_paint again
(although it should work ok if it does) */
if (priv->effect_to_redraw == NULL ||
priv->current_effect != priv->effect_to_redraw)
run_flags |= CLUTTER_EFFECT_PAINT_ACTOR_DIRTY;
}
_clutter_effect_paint (priv->current_effect, run_flags);
/* If there's an effect queued with this redraw then all
* effects up to that one will be considered dirty. It
* is expected the queued effect will paint the cached
* image and not call clutter_actor_continue_paint again
* (although it should work ok if it does)
*/
if (priv->effect_to_redraw == NULL ||
priv->current_effect != priv->effect_to_redraw)
run_flags |= CLUTTER_EFFECT_PAINT_ACTOR_DIRTY;
}
_clutter_effect_paint (priv->current_effect, run_flags);
priv->current_effect = old_current_effect;
}
}
/**
* clutter_actor_pick:
* @actor: A #ClutterActor
*
* Asks @actor to perform a pick.
*/
void
clutter_actor_pick (ClutterActor *actor)
{
ClutterActorPrivate *priv;
ClutterActorBox clip;
gboolean clip_set = FALSE;
if (CLUTTER_ACTOR_IN_DESTRUCTION (actor))
return;
priv = actor->priv;
/* if we aren't paintable (not in a toplevel with all
* parents paintable) then do nothing.
*/
if (!CLUTTER_ACTOR_IS_MAPPED (actor))
return;
clutter_actor_ensure_resource_scale (actor);
/* mark that we are in the paint process */
CLUTTER_SET_PRIVATE_FLAGS (actor, CLUTTER_IN_PICK);
cogl_push_matrix ();
if (priv->enable_model_view_transform)
{
CoglMatrix matrix;
cogl_get_modelview_matrix (&matrix);
_clutter_actor_apply_modelview_transform (actor, &matrix);
cogl_set_modelview_matrix (&matrix);
}
if (priv->has_clip)
{
clip.x1 = priv->clip.origin.x;
clip.y1 = priv->clip.origin.y;
clip.x2 = priv->clip.origin.x + priv->clip.size.width;
clip.y2 = priv->clip.origin.y + priv->clip.size.height;
clip_set = TRUE;
}
else if (priv->clip_to_allocation)
{
clip.x1 = 0.f;
clip.y1 = 0.f;
clip.x2 = priv->allocation.x2 - priv->allocation.x1;
clip.y2 = priv->allocation.y2 - priv->allocation.y1;
clip_set = TRUE;
}
if (clip_set)
clip_set = _clutter_actor_push_pick_clip (actor, &clip);
priv->next_effect_to_paint = NULL;
if (priv->effects)
{
priv->next_effect_to_paint =
_clutter_meta_group_peek_metas (priv->effects);
}
clutter_actor_continue_pick (actor);
if (clip_set)
_clutter_actor_pop_pick_clip (actor);
cogl_pop_matrix ();
/* paint sequence complete */
CLUTTER_UNSET_PRIVATE_FLAGS (actor, CLUTTER_IN_PICK);
}
/**
* clutter_actor_continue_pick:
* @actor: A #ClutterActor
*
* Run the next stage of the pick sequence. This function should only
* be called within the implementation of the pick virtual of a
* #ClutterEffect. It will cause the run method of the next effect to
* be applied, or it will pick the actual actor if the current effect
* is the last effect in the chain.
*/
void
clutter_actor_continue_pick (ClutterActor *actor)
{
ClutterActorPrivate *priv;
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
g_return_if_fail (CLUTTER_ACTOR_IN_PICK (actor));
priv = actor->priv;
/* Skip any effects that are disabled */
while (priv->next_effect_to_paint &&
!clutter_actor_meta_get_enabled (priv->next_effect_to_paint->data))
priv->next_effect_to_paint = priv->next_effect_to_paint->next;
/* If this has come from the last effect then we'll just pick the
* actual actor.
*/
if (priv->next_effect_to_paint == NULL)
{
/* The actor will log a silhouette of itself to the stage pick log.
*
* XXX:2.0 - Call the pick() virtual directly
*/
if (g_signal_has_handler_pending (actor, actor_signals[PICK],
0, TRUE))
g_signal_emit (actor, actor_signals[PICK], 0);
else
{
/* We can't determine when an actor has been modified since
its last pick so lets just assume it has always been
modified */
run_flags |= CLUTTER_EFFECT_PAINT_ACTOR_DIRTY;
CLUTTER_ACTOR_GET_CLASS (actor)->pick (actor);
}
else
{
ClutterEffect *old_current_effect;
_clutter_effect_pick (priv->current_effect, run_flags);
}
/* Cache the current effect so that we can put it back before
* returning.
*/
old_current_effect = priv->current_effect;
priv->current_effect = priv->next_effect_to_paint->data;
priv->next_effect_to_paint = priv->next_effect_to_paint->next;
_clutter_effect_pick (priv->current_effect);
priv->current_effect = old_current_effect;
}
@ -14639,40 +14747,6 @@ parse_actor_metas (ClutterScript *script,
return g_slist_reverse (retval);
}
static GSList *
parse_behaviours (ClutterScript *script,
ClutterActor *actor,
JsonNode *node)
{
GList *elements, *l;
GSList *retval = NULL;
if (!JSON_NODE_HOLDS_ARRAY (node))
return NULL;
elements = json_array_get_elements (json_node_get_array (node));
for (l = elements; l != NULL; l = l->next)
{
JsonNode *element = l->data;
const gchar *id_ = _clutter_script_get_id_from_node (element);
GObject *behaviour;
if (id_ == NULL || *id_ == '\0')
continue;
behaviour = clutter_script_get_object (script, id_);
if (behaviour == NULL)
continue;
retval = g_slist_prepend (retval, behaviour);
}
g_list_free (elements);
return g_slist_reverse (retval);
}
static ClutterMargin *
parse_margin (ClutterActor *self,
JsonNode *node)
@ -14788,24 +14862,6 @@ clutter_actor_parse_custom_node (ClutterScriptable *scriptable,
else
g_slice_free (RotationInfo, info);
}
else if (strcmp (name, "behaviours") == 0)
{
GSList *l;
#ifdef CLUTTER_ENABLE_DEBUG
if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
_clutter_diagnostic_message ("The 'behaviours' key is deprecated "
"and it should not be used in newly "
"written ClutterScript definitions.");
#endif
l = parse_behaviours (script, actor, node);
g_value_init (value, G_TYPE_POINTER);
g_value_set_pointer (value, l);
retval = TRUE;
}
else if (strcmp (name, "actions") == 0 ||
strcmp (name, "constraints") == 0 ||
strcmp (name, "effects") == 0)
@ -14876,26 +14932,6 @@ clutter_actor_set_custom_property (ClutterScriptable *scriptable,
return;
}
if (strcmp (name, "behaviours") == 0)
{
GSList *behaviours, *l;
if (!G_VALUE_HOLDS (value, G_TYPE_POINTER))
return;
behaviours = g_value_get_pointer (value);
for (l = behaviours; l != NULL; l = l->next)
{
ClutterBehaviour *behaviour = l->data;
clutter_behaviour_apply (behaviour, actor);
}
g_slist_free (behaviours);
return;
}
if (strcmp (name, "actions") == 0 ||
strcmp (name, "constraints") == 0 ||
strcmp (name, "effects") == 0)

View File

@ -353,6 +353,10 @@ void clutter_actor_paint
CLUTTER_EXPORT
void clutter_actor_continue_paint (ClutterActor *self);
CLUTTER_EXPORT
void clutter_actor_pick (ClutterActor *actor);
CLUTTER_EXPORT
void clutter_actor_continue_pick (ClutterActor *actor);
CLUTTER_EXPORT
void clutter_actor_queue_redraw (ClutterActor *self);
CLUTTER_EXPORT
void clutter_actor_queue_redraw_with_clip (ClutterActor *self,

View File

@ -6,45 +6,6 @@
G_BEGIN_DECLS
typedef enum
{
CLUTTER_DEBUG_MISC = 1 << 0,
CLUTTER_DEBUG_ACTOR = 1 << 1,
CLUTTER_DEBUG_TEXTURE = 1 << 2,
CLUTTER_DEBUG_EVENT = 1 << 3,
CLUTTER_DEBUG_PAINT = 1 << 4,
CLUTTER_DEBUG_PANGO = 1 << 5,
CLUTTER_DEBUG_BACKEND = 1 << 6,
CLUTTER_DEBUG_SCHEDULER = 1 << 7,
CLUTTER_DEBUG_SCRIPT = 1 << 8,
CLUTTER_DEBUG_SHADER = 1 << 9,
CLUTTER_DEBUG_MULTISTAGE = 1 << 10,
CLUTTER_DEBUG_ANIMATION = 1 << 11,
CLUTTER_DEBUG_LAYOUT = 1 << 12,
CLUTTER_DEBUG_PICK = 1 << 13,
CLUTTER_DEBUG_EVENTLOOP = 1 << 14,
CLUTTER_DEBUG_CLIPPING = 1 << 15,
CLUTTER_DEBUG_OOB_TRANSFORMS = 1 << 16
} ClutterDebugFlag;
typedef enum
{
CLUTTER_DEBUG_NOP_PICKING = 1 << 0,
} ClutterPickDebugFlag;
typedef enum
{
CLUTTER_DEBUG_DISABLE_SWAP_EVENTS = 1 << 0,
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS = 1 << 1,
CLUTTER_DEBUG_REDRAWS = 1 << 2,
CLUTTER_DEBUG_PAINT_VOLUMES = 1 << 3,
CLUTTER_DEBUG_DISABLE_CULLING = 1 << 4,
CLUTTER_DEBUG_DISABLE_OFFSCREEN_REDIRECT = 1 << 5,
CLUTTER_DEBUG_CONTINUOUS_REDRAW = 1 << 6,
CLUTTER_DEBUG_PAINT_DEFORM_TILES = 1 << 7,
CLUTTER_DEBUG_PAINT_DAMAGE_REGION = 1 << 8,
} ClutterDrawDebugFlag;
#ifdef CLUTTER_ENABLE_DEBUG
#define CLUTTER_HAS_DEBUG(type) ((clutter_debug_flags & CLUTTER_DEBUG_##type) != FALSE)

View File

@ -7,10 +7,6 @@
#include "deprecated/clutter-alpha.h"
#include "deprecated/clutter-animatable.h"
#include "deprecated/clutter-animation.h"
#include "deprecated/clutter-behaviour.h"
#include "deprecated/clutter-behaviour-depth.h"
#include "deprecated/clutter-behaviour-opacity.h"
#include "deprecated/clutter-behaviour-scale.h"
#include "deprecated/clutter-bin-layout.h"
#include "deprecated/clutter-box.h"
#include "deprecated/clutter-cairo-texture.h"

View File

@ -12,8 +12,7 @@ gboolean _clutter_effect_modify_paint_volume (ClutterEffect
gboolean _clutter_effect_has_custom_paint_volume (ClutterEffect *effect);
void _clutter_effect_paint (ClutterEffect *effect,
ClutterEffectPaintFlags flags);
void _clutter_effect_pick (ClutterEffect *effect,
ClutterEffectPaintFlags flags);
void _clutter_effect_pick (ClutterEffect *effect);
G_END_DECLS

View File

@ -216,14 +216,13 @@ clutter_effect_real_paint (ClutterEffect *effect,
}
static void
clutter_effect_real_pick (ClutterEffect *effect,
ClutterEffectPaintFlags flags)
clutter_effect_real_pick (ClutterEffect *effect)
{
ClutterActorMeta *actor_meta = CLUTTER_ACTOR_META (effect);
ClutterActor *actor;
actor = clutter_actor_meta_get_actor (actor_meta);
clutter_actor_continue_paint (actor);
clutter_actor_continue_pick (actor);
}
static void
@ -288,12 +287,11 @@ _clutter_effect_paint (ClutterEffect *effect,
}
void
_clutter_effect_pick (ClutterEffect *effect,
ClutterEffectPaintFlags flags)
_clutter_effect_pick (ClutterEffect *effect)
{
g_return_if_fail (CLUTTER_IS_EFFECT (effect));
CLUTTER_EFFECT_GET_CLASS (effect)->pick (effect, flags);
CLUTTER_EFFECT_GET_CLASS (effect)->pick (effect);
}
gboolean

View File

@ -82,8 +82,7 @@ struct _ClutterEffectClass
void (* paint) (ClutterEffect *effect,
ClutterEffectPaintFlags flags);
void (* pick) (ClutterEffect *effect,
ClutterEffectPaintFlags flags);
void (* pick) (ClutterEffect *effect);
/*< private >*/
void (* _clutter_effect4) (void);

View File

@ -970,8 +970,6 @@ typedef enum
/**
* ClutterFeatureFlags:
* @CLUTTER_FEATURE_SWAP_THROTTLE: Set if backend throttles buffer swaps.
* @CLUTTER_FEATURE_TEXTURE_YUV: Set if YUV based textures supported.
* @CLUTTER_FEATURE_TEXTURE_READ_PIXELS: Set if texture pixels can be read.
* @CLUTTER_FEATURE_STAGE_STATIC: Set if stage size if fixed (i.e framebuffer)
* @CLUTTER_FEATURE_STAGE_CURSOR: Set if stage has a graphical cursor.
* @CLUTTER_FEATURE_SHADERS_GLSL: Set if the backend supports GLSL shaders.
@ -987,8 +985,6 @@ typedef enum
typedef enum
{
CLUTTER_FEATURE_SWAP_THROTTLE = (1 << 3),
CLUTTER_FEATURE_TEXTURE_YUV = (1 << 4),
CLUTTER_FEATURE_TEXTURE_READ_PIXELS = (1 << 5),
CLUTTER_FEATURE_STAGE_STATIC = (1 << 6),
CLUTTER_FEATURE_STAGE_CURSOR = (1 << 8),
CLUTTER_FEATURE_SHADERS_GLSL = (1 << 9),
@ -1217,8 +1213,7 @@ typedef enum
* @CLUTTER_TEXTURE_RGB_FLAG_PREMULT: Unused flag
* @CLUTTER_TEXTURE_YUV_FLAG_YUV2: Unused flag
*
* Flags for clutter_texture_set_from_rgb_data() and
* clutter_texture_set_from_yuv_data().
* Flags for clutter_texture_set_from_rgb_data().
*
* Since: 0.4
*

View File

@ -2161,9 +2161,9 @@ clutter_event_get_scroll_source (const ClutterEvent *event)
ClutterScrollFinishFlags
clutter_event_get_scroll_finish_flags (const ClutterEvent *event)
{
g_return_val_if_fail (event != NULL, CLUTTER_SCROLL_SOURCE_UNKNOWN);
g_return_val_if_fail (event != NULL, CLUTTER_SCROLL_FINISHED_NONE);
g_return_val_if_fail (event->type == CLUTTER_SCROLL,
CLUTTER_SCROLL_SOURCE_UNKNOWN);
CLUTTER_SCROLL_FINISHED_NONE);
return event->scroll.finish_flags;
}

View File

@ -33,8 +33,6 @@
*
* It is possible to ask whether Clutter has support for specific features at
* run-time.
*
* See also cogl_get_features() and #CoglFeatureFlags
*/
#include "clutter-build-config.h"
@ -60,20 +58,13 @@ typedef struct ClutterFeatures
static ClutterFeatures* __features = NULL;
static ClutterFeatureFlags
clutter_features_from_cogl (guint cogl_flags)
clutter_features_from_cogl (void)
{
ClutterFeatureFlags clutter_flags = 0;
if (cogl_flags & COGL_FEATURE_TEXTURE_YUV)
clutter_flags |= CLUTTER_FEATURE_TEXTURE_YUV;
if (cogl_flags & COGL_FEATURE_TEXTURE_READ_PIXELS)
clutter_flags |= CLUTTER_FEATURE_TEXTURE_READ_PIXELS;
clutter_flags |= CLUTTER_FEATURE_SHADERS_GLSL;
if (cogl_flags & COGL_FEATURE_OFFSCREEN)
clutter_flags |= CLUTTER_FEATURE_OFFSCREEN;
clutter_flags |= CLUTTER_FEATURE_OFFSCREEN;
return clutter_flags;
}
@ -101,7 +92,7 @@ _clutter_feature_init (GError **error)
if (!_clutter_backend_create_context (context->backend, error))
return FALSE;
__features->flags = (clutter_features_from_cogl (cogl_get_features ())
__features->flags = (clutter_features_from_cogl ()
| _clutter_backend_get_features (context->backend));
__features->features_set = TRUE;

View File

@ -329,9 +329,6 @@ layout_manager_real_begin_animation (ClutterLayoutManager *manager,
/* let the alpha take ownership of the timeline */
g_object_unref (timeline);
g_signal_connect_swapped (timeline, "completed",
G_CALLBACK (clutter_layout_manager_end_animation),
manager);
g_signal_connect_swapped (timeline, "new-frame",
G_CALLBACK (clutter_layout_manager_layout_changed),
manager);
@ -375,9 +372,6 @@ layout_manager_real_end_animation (ClutterLayoutManager *manager)
if (clutter_timeline_is_playing (timeline))
clutter_timeline_stop (timeline);
g_signal_handlers_disconnect_by_func (timeline,
G_CALLBACK (clutter_layout_manager_end_animation),
manager);
g_signal_handlers_disconnect_by_func (timeline,
G_CALLBACK (clutter_layout_manager_layout_changed),
manager);

View File

@ -213,15 +213,6 @@ void clutter_layout_manager_child_get_property (ClutterLayoutMa
const gchar *property_name,
GValue *value);
CLUTTER_DEPRECATED
ClutterAlpha * clutter_layout_manager_begin_animation (ClutterLayoutManager *manager,
guint duration,
gulong mode);
CLUTTER_DEPRECATED
void clutter_layout_manager_end_animation (ClutterLayoutManager *manager);
CLUTTER_DEPRECATED
gdouble clutter_layout_manager_get_animation_progress (ClutterLayoutManager *manager);
G_END_DECLS
#endif /* __CLUTTER_LAYOUT_MANAGER_H__ */

View File

@ -2605,6 +2605,36 @@ clutter_check_windowing_backend (const char *backend_type)
return FALSE;
}
/**
* clutter_add_debug_flags: (skip)
*
* Adds the debug flags passed to the list of debug flags.
*/
void
clutter_add_debug_flags (ClutterDebugFlag debug_flags,
ClutterDrawDebugFlag draw_flags,
ClutterPickDebugFlag pick_flags)
{
clutter_debug_flags |= debug_flags;
clutter_paint_debug_flags |= draw_flags;
clutter_pick_debug_flags |= pick_flags;
}
/**
* clutter_remove_debug_flags: (skip)
*
* Removes the debug flags passed from the list of debug flags.
*/
void
clutter_remove_debug_flags (ClutterDebugFlag debug_flags,
ClutterDrawDebugFlag draw_flags,
ClutterPickDebugFlag pick_flags)
{
clutter_debug_flags &= ~debug_flags;
clutter_paint_debug_flags &= ~draw_flags;
clutter_pick_debug_flags &= ~pick_flags;
}
void
_clutter_set_sync_to_vblank (gboolean sync_to_vblank)
{

View File

@ -34,6 +34,45 @@
G_BEGIN_DECLS
typedef enum
{
CLUTTER_DEBUG_MISC = 1 << 0,
CLUTTER_DEBUG_ACTOR = 1 << 1,
CLUTTER_DEBUG_TEXTURE = 1 << 2,
CLUTTER_DEBUG_EVENT = 1 << 3,
CLUTTER_DEBUG_PAINT = 1 << 4,
CLUTTER_DEBUG_PANGO = 1 << 5,
CLUTTER_DEBUG_BACKEND = 1 << 6,
CLUTTER_DEBUG_SCHEDULER = 1 << 7,
CLUTTER_DEBUG_SCRIPT = 1 << 8,
CLUTTER_DEBUG_SHADER = 1 << 9,
CLUTTER_DEBUG_MULTISTAGE = 1 << 10,
CLUTTER_DEBUG_ANIMATION = 1 << 11,
CLUTTER_DEBUG_LAYOUT = 1 << 12,
CLUTTER_DEBUG_PICK = 1 << 13,
CLUTTER_DEBUG_EVENTLOOP = 1 << 14,
CLUTTER_DEBUG_CLIPPING = 1 << 15,
CLUTTER_DEBUG_OOB_TRANSFORMS = 1 << 16,
} ClutterDebugFlag;
typedef enum
{
CLUTTER_DEBUG_NOP_PICKING = 1 << 0,
} ClutterPickDebugFlag;
typedef enum
{
CLUTTER_DEBUG_DISABLE_SWAP_EVENTS = 1 << 0,
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS = 1 << 1,
CLUTTER_DEBUG_REDRAWS = 1 << 2,
CLUTTER_DEBUG_PAINT_VOLUMES = 1 << 3,
CLUTTER_DEBUG_DISABLE_CULLING = 1 << 4,
CLUTTER_DEBUG_DISABLE_OFFSCREEN_REDIRECT = 1 << 5,
CLUTTER_DEBUG_CONTINUOUS_REDRAW = 1 << 6,
CLUTTER_DEBUG_PAINT_DEFORM_TILES = 1 << 7,
CLUTTER_DEBUG_PAINT_DAMAGE_REGION = 1 << 8,
} ClutterDrawDebugFlag;
/**
* CLUTTER_INIT_ERROR:
*
@ -158,6 +197,15 @@ guint clutter_get_default_frame_rate (void);
CLUTTER_EXPORT
gboolean clutter_check_windowing_backend (const char *backend_type);
CLUTTER_EXPORT
void clutter_add_debug_flags (ClutterDebugFlag debug_flags,
ClutterDrawDebugFlag draw_flags,
ClutterPickDebugFlag pick_flags);
CLUTTER_EXPORT
void clutter_remove_debug_flags (ClutterDebugFlag debug_flags,
ClutterDrawDebugFlag draw_flags,
ClutterPickDebugFlag pick_flags);
G_END_DECLS

View File

@ -139,30 +139,6 @@ ClutterPaintNode * clutter_paint_node_get_last_child (Clutter
G_GNUC_INTERNAL
ClutterPaintNode * clutter_paint_node_get_parent (ClutterPaintNode *node);
#define CLUTTER_TYPE_LAYER_NODE (_clutter_layer_node_get_type ())
#define CLUTTER_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LAYER_NODE, ClutterLayerNode))
#define CLUTTER_IS_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_LAYER_NODE))
/*
* ClutterLayerNode:
*
* The #ClutterLayerNode structure is an opaque
* type whose members cannot be directly accessed.
*
* Since: 1.10
*/
typedef struct _ClutterLayerNode ClutterLayerNode;
typedef struct _ClutterLayerNodeClass ClutterLayerNodeClass;
GType _clutter_layer_node_get_type (void) G_GNUC_CONST;
ClutterPaintNode * _clutter_layer_node_new (const CoglMatrix *projection,
const cairo_rectangle_t *viewport,
float width,
float height,
guint8 opacity);
G_END_DECLS
#endif /* __CLUTTER_PAINT_NODE_PRIVATE_H__ */

View File

@ -183,35 +183,31 @@ clutter_root_node_new (CoglFramebuffer *framebuffer,
}
/*
* Transform node
*
* A private PaintNode, that changes the modelview of its child
* nodes.
* ClutterTransformNode
*/
#define clutter_transform_node_get_type _clutter_transform_node_get_type
typedef struct _ClutterTransformNode {
struct _ClutterTransformNode
{
ClutterPaintNode parent_instance;
CoglMatrix modelview;
} ClutterTransformNode;
CoglMatrix transform;
};
typedef struct _ClutterPaintNodeClass ClutterTransformNodeClass;
struct _ClutterTransformNodeClass
{
ClutterPaintNodeClass parent_class;
};
G_DEFINE_TYPE (ClutterTransformNode, clutter_transform_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean
clutter_transform_node_pre_draw (ClutterPaintNode *node)
{
ClutterTransformNode *tnode = (ClutterTransformNode *) node;
CoglMatrix matrix;
ClutterTransformNode *transform_node = (ClutterTransformNode *) node;
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
cogl_push_matrix ();
cogl_get_modelview_matrix (&matrix);
cogl_matrix_multiply (&matrix, &matrix, &tnode->modelview);
cogl_set_modelview_matrix (&matrix);
cogl_framebuffer_push_matrix (fb);
cogl_framebuffer_transform (fb, &transform_node->transform);
return TRUE;
}
@ -219,7 +215,9 @@ clutter_transform_node_pre_draw (ClutterPaintNode *node)
static void
clutter_transform_node_post_draw (ClutterPaintNode *node)
{
cogl_pop_matrix ();
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
cogl_framebuffer_pop_matrix (fb);
}
static void
@ -235,18 +233,24 @@ clutter_transform_node_class_init (ClutterTransformNodeClass *klass)
static void
clutter_transform_node_init (ClutterTransformNode *self)
{
cogl_matrix_init_identity (&self->modelview);
cogl_matrix_init_identity (&self->transform);
}
/*
* clutter_transform_node_new:
* @transform: (nullable): the transform matrix to apply
*
* Return value: (transfer full): the newly created #ClutterTransformNode.
* Use clutter_paint_node_unref() when done.
*/
ClutterPaintNode *
_clutter_transform_node_new (const CoglMatrix *modelview)
clutter_transform_node_new (const CoglMatrix *transform)
{
ClutterTransformNode *res;
res = _clutter_paint_node_create (_clutter_transform_node_get_type ());
if (modelview != NULL)
res->modelview = *modelview;
res = _clutter_paint_node_create (CLUTTER_TYPE_TRANSFORM_NODE);
if (transform)
res->transform = *transform;
return (ClutterPaintNode *) res;
}
@ -1078,10 +1082,114 @@ clutter_clip_node_new (void)
}
/*
* ClutterLayerNode (private)
* ClutterActorNode
*/
#define clutter_layer_node_get_type _clutter_layer_node_get_type
struct _ClutterActorNode
{
ClutterPaintNode parent_instance;
ClutterActor *actor;
};
struct _ClutterActorNodeClass
{
ClutterPaintNodeClass parent_class;
};
G_DEFINE_TYPE (ClutterActorNode, clutter_actor_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean
clutter_actor_node_pre_draw (ClutterPaintNode *node)
{
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
CLUTTER_SET_PRIVATE_FLAGS (actor_node->actor, CLUTTER_IN_PAINT);
return TRUE;
}
static void
clutter_actor_node_draw (ClutterPaintNode *node)
{
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
clutter_actor_continue_paint (actor_node->actor);
}
static void
clutter_actor_node_post_draw (ClutterPaintNode *node)
{
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
CLUTTER_UNSET_PRIVATE_FLAGS (actor_node->actor, CLUTTER_IN_PAINT);
}
static JsonNode *
clutter_actor_node_serialize (ClutterPaintNode *node)
{
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
g_autoptr (JsonBuilder) builder = NULL;
const char *debug_name;
debug_name = _clutter_actor_get_debug_name (actor_node->actor);
builder = json_builder_new ();
json_builder_begin_object (builder);
json_builder_set_member_name (builder, "actor");
json_builder_add_string_value (builder, debug_name);
json_builder_end_object (builder);
return json_builder_get_root (builder);
}
static void
clutter_actor_node_class_init (ClutterActorNodeClass *klass)
{
ClutterPaintNodeClass *node_class;
node_class = CLUTTER_PAINT_NODE_CLASS (klass);
node_class->pre_draw = clutter_actor_node_pre_draw;
node_class->draw = clutter_actor_node_draw;
node_class->post_draw = clutter_actor_node_post_draw;
node_class->serialize = clutter_actor_node_serialize;
}
static void
clutter_actor_node_init (ClutterActorNode *self)
{
}
/*
* clutter_actor_node_new:
* @actor: the actor to paint
*
* Creates a new #ClutterActorNode.
*
* The actor is painted together with any effects
* applied to it. Children of this node will draw
* over the actor contents.
*
* Return value: (transfer full): the newly created #ClutterActorNode.
* Use clutter_paint_node_unref() when done.
*/
ClutterPaintNode *
clutter_actor_node_new (ClutterActor *actor)
{
ClutterActorNode *res;
g_assert (actor != NULL);
res = _clutter_paint_node_create (CLUTTER_TYPE_ACTOR_NODE);
res->actor = actor;
return (ClutterPaintNode *) res;
}
/*
* ClutterLayerNode
*/
struct _ClutterLayerNode
{
@ -1268,11 +1376,11 @@ clutter_layer_node_init (ClutterLayerNode *self)
* Since: 1.10
*/
ClutterPaintNode *
_clutter_layer_node_new (const CoglMatrix *projection,
const cairo_rectangle_t *viewport,
float width,
float height,
guint8 opacity)
clutter_layer_node_new (const CoglMatrix *projection,
const cairo_rectangle_t *viewport,
float width,
float height,
guint8 opacity)
{
ClutterLayerNode *res;
CoglColor color;

View File

@ -143,6 +143,25 @@ CLUTTER_EXPORT
ClutterPaintNode * clutter_text_node_new (PangoLayout *layout,
const ClutterColor *color);
#define CLUTTER_TYPE_ACTOR_NODE (clutter_actor_node_get_type ())
#define CLUTTER_ACTOR_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ACTOR_NODE, ClutterActorNode))
#define CLUTTER_IS_ACTOR_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ACTOR_NODE))
/**
* ClutterActorNode:
*
* The #ClutterActorNode structure is an opaque
* type whose members cannot be directly accessed.
*/
typedef struct _ClutterActorNode ClutterActorNode;
typedef struct _ClutterActorNode ClutterActorNodeClass;
CLUTTER_EXPORT
GType clutter_actor_node_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
ClutterPaintNode * clutter_actor_node_new (ClutterActor *actor);
#define CLUTTER_TYPE_ROOT_NODE (clutter_root_node_get_type ())
#define CLUTTER_ROOT_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ROOT_NODE, ClutterRootNode))
#define CLUTTER_IS_ROOT_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ROOT_NODE))
@ -163,6 +182,54 @@ CLUTTER_EXPORT
ClutterPaintNode * clutter_root_node_new (CoglFramebuffer *framebuffer,
const ClutterColor *clear_color,
CoglBufferBit clear_flags);
#define CLUTTER_TYPE_LAYER_NODE (clutter_layer_node_get_type ())
#define CLUTTER_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LAYER_NODE, ClutterLayerNode))
#define CLUTTER_IS_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_LAYER_NODE))
/*
* ClutterLayerNode:
*
* The #ClutterLayerNode structure is an opaque
* type whose members cannot be directly accessed.
*
* Since: 1.10
*/
typedef struct _ClutterLayerNode ClutterLayerNode;
typedef struct _ClutterLayerNodeClass ClutterLayerNodeClass;
CLUTTER_EXPORT
GType clutter_layer_node_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
ClutterPaintNode * clutter_layer_node_new (const CoglMatrix *projection,
const cairo_rectangle_t *viewport,
float width,
float height,
guint8 opacity);
#define CLUTTER_TYPE_TRANSFORM_NODE (clutter_transform_node_get_type ())
#define CLUTTER_TRANSFORM_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TRANSFORM_NODE, ClutterTransformNode))
#define CLUTTER_IS_TRANSFORM_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TRANSFORM_NODE))
/*
* ClutterTransformNode:
*
* The #ClutterLayerNode structure is an opaque
* type whose members cannot be directly accessed.
*
* Since: 1.10
*/
typedef struct _ClutterTransformNode ClutterTransformNode;
typedef struct _ClutterPaintNodeClass ClutterTransformNodeClass;
CLUTTER_EXPORT
GType clutter_transform_node_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
ClutterPaintNode * clutter_transform_node_new (const CoglMatrix *projection);
G_END_DECLS
#endif /* __CLUTTER_PAINT_NODES_H__ */

View File

@ -27,8 +27,7 @@
* and bezier curves.
*
* A #ClutterPath contains a description of a path consisting of
* straight lines and bezier curves. This can be used in a
* #ClutterBehaviourPath to animate an actor moving along the path.
* straight lines and bezier curves.
*
* The path consists of a series of nodes. Each node is one of the
* following four types:
@ -244,9 +243,6 @@ clutter_path_finalize (GObject *object)
*
* Creates a new #ClutterPath instance with no nodes.
*
* The object has a floating reference so if you add it to a
* #ClutterBehaviourPath then you do not need to unref it.
*
* Return value: the newly created #ClutterPath
*
* Since: 1.0
@ -267,9 +263,6 @@ clutter_path_new (void)
* @desc. See clutter_path_add_string() for details of the format of
* the string.
*
* The object has a floating reference so if you add it to a
* #ClutterBehaviourPath then you do not need to unref it.
*
* Return value: the newly created #ClutterPath
*
* Since: 1.0

View File

@ -67,6 +67,7 @@ typedef struct _ClutterVertex4 ClutterVertex4;
#define CLUTTER_ACTOR_IN_DESTRUCTION(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_DESTRUCTION) != FALSE)
#define CLUTTER_ACTOR_IN_REPARENT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_REPARENT) != FALSE)
#define CLUTTER_ACTOR_IN_PAINT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PAINT) != FALSE)
#define CLUTTER_ACTOR_IN_PICK(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PICK) != FALSE)
#define CLUTTER_ACTOR_IN_RELAYOUT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_RELAYOUT) != FALSE)
#define CLUTTER_ACTOR_IN_PREF_WIDTH(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PREF_WIDTH) != FALSE)
#define CLUTTER_ACTOR_IN_PREF_HEIGHT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PREF_HEIGHT) != FALSE)
@ -104,9 +105,10 @@ typedef enum
/* Used to avoid recursion */
CLUTTER_IN_PAINT = 1 << 5,
CLUTTER_IN_PICK = 1 << 6,
/* Used to avoid recursion */
CLUTTER_IN_RELAYOUT = 1 << 6,
CLUTTER_IN_RELAYOUT = 1 << 7,
} ClutterPrivateFlags;
/*

View File

@ -75,65 +75,6 @@
* packing rules of Clutter still apply, and an actor cannot be packed
* in multiple containers without unparenting it in between).
*
* Behaviours and timelines can also be defined inside a UI definition
* buffer:
*
* <informalexample><programlisting><![CDATA[
* {
* "id" : "rotate-behaviour",
* "type" : "ClutterBehaviourRotate",
* "angle-start" : 0.0,
* "angle-end" : 360.0,
* "axis" : "z-axis",
* "alpha" : {
* "timeline" : { "duration" : 4000, "loop" : true },
* "mode" : "easeInSine"
* }
* }
* ]]></programlisting></informalexample>
*
* And then to apply a defined behaviour to an actor defined inside the
* definition of an actor, the "behaviour" member can be used:
*
* <informalexample><programlisting><![CDATA[
* {
* "id" : "my-rotating-actor",
* "type" : "ClutterTexture",
* ...
* "behaviours" : [ "rotate-behaviour" ]
* }
* ]]></programlisting></informalexample>
*
* A #ClutterAlpha belonging to a #ClutterBehaviour can only be defined
* implicitly like in the example above, or explicitly by setting the
* "alpha" property to point to a previously defined #ClutterAlpha, e.g.:
*
* <informalexample><programlisting><![CDATA[
* {
* "id" : "rotate-behaviour",
* "type" : "ClutterBehaviourRotate",
* "angle-start" : 0.0,
* "angle-end" : 360.0,
* "axis" : "z-axis",
* "alpha" : {
* "id" : "rotate-alpha",
* "type" : "ClutterAlpha",
* "timeline" : {
* "id" : "rotate-timeline",
* "type : "ClutterTimeline",
* "duration" : 4000,
* "loop" : true
* },
* "function" : "custom_sine_alpha"
* }
* }
* ]]></programlisting></informalexample>
*
* Implicitely defined #ClutterAlpha<!-- -->s and #ClutterTimeline<!-- -->s
* can omit the `id`, as well as the `type` members, but will not be available
* using clutter_script_get_object() (they can, however, be extracted using the
* #ClutterBehaviour and #ClutterAlpha API respectively).
*
* Signal handlers can be defined inside a Clutter UI definition file and
* then autoconnected to their respective signals using the
* clutter_script_connect_signals() function:
@ -210,7 +151,6 @@
* function
* "type_func" := the GType function name, for non-standard classes
* "children" := an array of names or objects to add as children
* "behaviours" := an array of names or objects to apply to an actor
* "signals" := an array of signal definitions to connect to an object
* "is-default" := a boolean flag used when defining the #ClutterStage;
* if set to "true" the default stage will be used instead
@ -246,7 +186,6 @@
#include "clutter-debug.h"
#include "deprecated/clutter-alpha.h"
#include "deprecated/clutter-behaviour.h"
#include "deprecated/clutter-container.h"
#include "deprecated/clutter-state.h"
@ -524,11 +463,10 @@ clutter_script_init (ClutterScript *script)
/**
* clutter_script_new:
*
* Creates a new #ClutterScript instance. #ClutterScript can be used
* to load objects definitions for scenegraph elements, like actors,
* or behavioural elements, like behaviours and timelines. The
* definitions must be encoded using the JavaScript Object Notation (JSON)
* language.
* Creates a new #ClutterScript instance. #ClutterScript can be used to load
* objects definitions for scenegraph elements, like actors, or behavioural
* elements, like timelines. The definitions must be encoded using the
* JavaScript Object Notation (JSON) language.
*
* Return value: the newly created #ClutterScript instance. Use
* g_object_unref() when done.
@ -863,9 +801,7 @@ construct_each_objects (gpointer key,
if (oinfo->object == NULL)
_clutter_script_construct_object (script, oinfo);
/* this will take care of setting up properties,
* adding children and applying behaviours
*/
/* this will take care of setting up properties and adding children */
_clutter_script_apply_properties (script, oinfo);
}
}

View File

@ -20,8 +20,8 @@
#include "clutter/clutter-stage-view.h"
void clutter_stage_view_blit_offscreen (ClutterStageView *view,
const cairo_rectangle_int_t *clip);
void clutter_stage_view_after_paint (ClutterStageView *view,
const cairo_rectangle_int_t *clip);
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);

View File

@ -30,6 +30,7 @@ enum
PROP_LAYOUT,
PROP_FRAMEBUFFER,
PROP_OFFSCREEN,
PROP_SHADOWFB,
PROP_SCALE,
PROP_LAST
@ -44,7 +45,10 @@ typedef struct _ClutterStageViewPrivate
CoglFramebuffer *framebuffer;
CoglOffscreen *offscreen;
CoglPipeline *pipeline;
CoglPipeline *offscreen_pipeline;
CoglOffscreen *shadowfb;
CoglPipeline *shadowfb_pipeline;
guint dirty_viewport : 1;
guint dirty_projection : 1;
@ -78,6 +82,8 @@ clutter_stage_view_get_framebuffer (ClutterStageView *view)
if (priv->offscreen)
return priv->offscreen;
else if (priv->shadowfb)
return priv->shadowfb;
else
return priv->framebuffer;
}
@ -99,6 +105,24 @@ clutter_stage_view_get_onscreen (ClutterStageView *view)
return priv->framebuffer;
}
static CoglPipeline *
clutter_stage_view_create_framebuffer_pipeline (CoglFramebuffer *framebuffer)
{
CoglPipeline *pipeline;
pipeline = cogl_pipeline_new (cogl_framebuffer_get_context (framebuffer));
cogl_pipeline_set_layer_filters (pipeline, 0,
COGL_PIPELINE_FILTER_NEAREST,
COGL_PIPELINE_FILTER_NEAREST);
cogl_pipeline_set_layer_texture (pipeline, 0,
cogl_offscreen_get_texture (framebuffer));
cogl_pipeline_set_layer_wrap_mode (pipeline, 0,
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
return pipeline;
}
static void
clutter_stage_view_ensure_offscreen_blit_pipeline (ClutterStageView *view)
{
@ -109,21 +133,27 @@ clutter_stage_view_ensure_offscreen_blit_pipeline (ClutterStageView *view)
g_assert (priv->offscreen != NULL);
if (priv->pipeline)
if (priv->offscreen_pipeline)
return;
priv->pipeline =
cogl_pipeline_new (cogl_framebuffer_get_context (priv->offscreen));
cogl_pipeline_set_layer_filters (priv->pipeline, 0,
COGL_PIPELINE_FILTER_NEAREST,
COGL_PIPELINE_FILTER_NEAREST);
cogl_pipeline_set_layer_texture (priv->pipeline, 0,
cogl_offscreen_get_texture (priv->offscreen));
cogl_pipeline_set_layer_wrap_mode (priv->pipeline, 0,
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
priv->offscreen_pipeline =
clutter_stage_view_create_framebuffer_pipeline (priv->offscreen);
if (view_class->setup_offscreen_blit_pipeline)
view_class->setup_offscreen_blit_pipeline (view, priv->pipeline);
view_class->setup_offscreen_blit_pipeline (view, priv->offscreen_pipeline);
}
static void
clutter_stage_view_ensure_shadowfb_blit_pipeline (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
if (priv->shadowfb_pipeline)
return;
priv->shadowfb_pipeline =
clutter_stage_view_create_framebuffer_pipeline (priv->shadowfb);
}
void
@ -132,48 +162,93 @@ clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view)
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
g_clear_pointer (&priv->pipeline, cogl_object_unref);
g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
}
void
clutter_stage_view_blit_offscreen (ClutterStageView *view,
const cairo_rectangle_int_t *rect)
static void
clutter_stage_view_copy_to_framebuffer (ClutterStageView *view,
const cairo_rectangle_int_t *rect,
CoglPipeline *pipeline,
CoglFramebuffer *src_framebuffer,
CoglFramebuffer *dst_framebuffer,
gboolean can_blit)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
CoglMatrix matrix;
clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix);
if (cogl_matrix_is_identity (&matrix))
/* First, try with blit */
if (can_blit)
{
int fb_width = cogl_framebuffer_get_width (priv->framebuffer);
int fb_height = cogl_framebuffer_get_height (priv->framebuffer);
if (cogl_blit_framebuffer (priv->offscreen,
priv->framebuffer,
if (cogl_blit_framebuffer (src_framebuffer,
dst_framebuffer,
0, 0,
0, 0,
fb_width, fb_height,
cogl_framebuffer_get_width (dst_framebuffer),
cogl_framebuffer_get_height (dst_framebuffer),
NULL))
return;
}
clutter_stage_view_ensure_offscreen_blit_pipeline (view);
cogl_framebuffer_push_matrix (priv->framebuffer);
/* If blit fails, fallback to the slower painting method */
cogl_framebuffer_push_matrix (dst_framebuffer);
/* Set transform so 0,0 is on the top left corner and 1,1 on
* the bottom right corner.
*/
cogl_matrix_init_identity (&matrix);
cogl_matrix_translate (&matrix, -1, 1, 0);
cogl_matrix_scale (&matrix, 2, -2, 0);
cogl_framebuffer_set_projection_matrix (priv->framebuffer, &matrix);
cogl_framebuffer_set_projection_matrix (dst_framebuffer, &matrix);
cogl_framebuffer_draw_rectangle (priv->framebuffer,
priv->pipeline,
cogl_framebuffer_draw_rectangle (dst_framebuffer,
pipeline,
0, 0, 1, 1);
cogl_framebuffer_pop_matrix (priv->framebuffer);
cogl_framebuffer_pop_matrix (dst_framebuffer);
}
void
clutter_stage_view_after_paint (ClutterStageView *view,
const cairo_rectangle_int_t *rect)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
if (priv->offscreen)
{
gboolean can_blit;
CoglMatrix matrix;
clutter_stage_view_ensure_offscreen_blit_pipeline (view);
clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix);
can_blit = cogl_matrix_is_identity (&matrix);
if (priv->shadowfb)
{
clutter_stage_view_copy_to_framebuffer (view,
rect,
priv->offscreen_pipeline,
priv->offscreen,
priv->shadowfb,
can_blit);
}
else
{
clutter_stage_view_copy_to_framebuffer (view,
rect,
priv->offscreen_pipeline,
priv->offscreen,
priv->framebuffer,
can_blit);
}
}
if (priv->shadowfb)
{
clutter_stage_view_ensure_shadowfb_blit_pipeline (view);
clutter_stage_view_copy_to_framebuffer (view,
rect,
priv->shadowfb_pipeline,
priv->shadowfb,
priv->framebuffer,
TRUE);
}
}
float
@ -273,6 +348,9 @@ clutter_stage_view_get_property (GObject *object,
case PROP_OFFSCREEN:
g_value_set_boxed (value, priv->offscreen);
break;
case PROP_SHADOWFB:
g_value_set_boxed (value, priv->shadowfb);
break;
case PROP_SCALE:
g_value_set_float (value, priv->scale);
break;
@ -318,6 +396,9 @@ clutter_stage_view_set_property (GObject *object,
case PROP_OFFSCREEN:
priv->offscreen = g_value_dup_boxed (value);
break;
case PROP_SHADOWFB:
priv->shadowfb = g_value_dup_boxed (value);
break;
case PROP_SCALE:
priv->scale = g_value_get_float (value);
break;
@ -334,8 +415,10 @@ clutter_stage_view_dispose (GObject *object)
clutter_stage_view_get_instance_private (view);
g_clear_pointer (&priv->framebuffer, cogl_object_unref);
g_clear_pointer (&priv->shadowfb, cogl_object_unref);
g_clear_pointer (&priv->offscreen, cogl_object_unref);
g_clear_pointer (&priv->pipeline, cogl_object_unref);
g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
g_clear_pointer (&priv->shadowfb_pipeline, cogl_object_unref);
G_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object);
}
@ -390,6 +473,15 @@ clutter_stage_view_class_init (ClutterStageViewClass *klass)
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_SHADOWFB] =
g_param_spec_boxed ("shadowfb",
"Shadow framebuffer",
"Framebuffer used as intermediate shadow buffer",
COGL_TYPE_HANDLE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_SCALE] =
g_param_spec_float ("scale",
"View scale",

View File

@ -235,19 +235,35 @@ _clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window)
return TRUE;
}
gboolean
_clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
cairo_rectangle_int_t *stage_clip)
cairo_region_t *
_clutter_stage_window_get_redraw_clip (ClutterStageWindow *window)
{
ClutterStageWindowInterface *iface;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->get_redraw_clip_bounds != NULL)
return iface->get_redraw_clip_bounds (window, stage_clip);
if (iface->get_redraw_clip != NULL)
return iface->get_redraw_clip (window);
return FALSE;
return NULL;
}
gboolean
_clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
cairo_rectangle_int_t *stage_clip)
{
cairo_region_t *redraw_clip;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
redraw_clip = _clutter_stage_window_get_redraw_clip (window);
if (!redraw_clip)
return FALSE;
cairo_region_get_extents (redraw_clip, stage_clip);
cairo_region_destroy (redraw_clip);
return TRUE;
}
void

View File

@ -55,9 +55,7 @@ struct _ClutterStageWindowInterface
cairo_rectangle_int_t *stage_rectangle);
gboolean (* has_redraw_clips) (ClutterStageWindow *stage_window);
gboolean (* ignoring_redraw_clips) (ClutterStageWindow *stage_window);
gboolean (* get_redraw_clip_bounds) (ClutterStageWindow *stage_window,
cairo_rectangle_int_t *clip);
cairo_region_t * (* get_redraw_clip) (ClutterStageWindow *stage_window);
void (* set_accept_focus) (ClutterStageWindow *stage_window,
gboolean accept_focus);
@ -102,6 +100,7 @@ gboolean _clutter_stage_window_has_redraw_clips (ClutterStageWin
gboolean _clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window);
gboolean _clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
cairo_rectangle_int_t *clip);
cairo_region_t * _clutter_stage_window_get_redraw_clip (ClutterStageWindow *window);
void _clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
gboolean accept_focus);

View File

@ -78,26 +78,6 @@
#include "cogl/cogl.h"
#include "cogl/cogl-trace.h"
/* <private>
* ClutterStageHint:
* @CLUTTER_STAGE_NONE: No hint set
* @CLUTTER_STAGE_NO_CLEAR_ON_PAINT: When this hint is set, the stage
* should not clear the viewport; this flag is useful when painting
* fully opaque actors covering the whole visible area of the stage,
* i.e. when no blending with the stage color happens over the whole
* stage viewport
*
* A series of hints that enable or disable behaviours on the stage
*/
typedef enum /*< prefix=CLUTTER_STAGE >*/
{
CLUTTER_STAGE_HINT_NONE = 0,
CLUTTER_STAGE_NO_CLEAR_ON_PAINT = 1 << 0
} ClutterStageHint;
#define STAGE_NO_CLEAR_ON_PAINT(s) ((((ClutterStage *) (s))->priv->stage_hints & CLUTTER_STAGE_NO_CLEAR_ON_PAINT) != 0)
struct _ClutterStageQueueRedrawEntry
{
ClutterActor *actor;
@ -134,8 +114,6 @@ struct _ClutterStagePrivate
GQueue *event_queue;
ClutterStageHint stage_hints;
GArray *paint_volume_stack;
ClutterPlane current_clip_planes[4];
@ -190,7 +168,6 @@ enum
PROP_TITLE,
PROP_USE_ALPHA,
PROP_KEY_FOCUS,
PROP_NO_CLEAR_HINT,
PROP_ACCEPT_FOCUS,
PROP_LAST
};
@ -719,17 +696,6 @@ clutter_stage_allocate (ClutterActor *self,
flags | CLUTTER_DELEGATE_LAYOUT);
}
/* XXX: Until Cogl becomes fully responsible for backend windows
* Clutter need to manually keep it informed of the current window
* size. We do this after the allocation above so that the stage
* window has a chance to update the window size based on the
* allocation.
*/
_clutter_stage_window_get_geometry (priv->impl, &window_size);
cogl_onscreen_clutter_backend_set_size (window_size.width,
window_size.height);
/* reset the viewport if the allocation effectively changed */
clutter_actor_get_allocation_box (self, &alloc);
clutter_actor_box_get_size (&alloc, &new_width, &new_height);
@ -892,9 +858,9 @@ _clutter_stage_update_active_framebuffer (ClutterStage *stage,
* be able to cull them.
*/
static void
clutter_stage_do_paint_view (ClutterStage *stage,
ClutterStageView *view,
const cairo_rectangle_int_t *clip)
setup_view_for_pick_or_paint (ClutterStage *stage,
ClutterStageView *view,
const cairo_rectangle_int_t *clip)
{
ClutterStagePrivate *priv = stage->priv;
CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
@ -949,6 +915,14 @@ clutter_stage_do_paint_view (ClutterStage *stage,
_clutter_stage_paint_volume_stack_free_all (stage);
_clutter_stage_update_active_framebuffer (stage, framebuffer);
}
static void
clutter_stage_do_paint_view (ClutterStage *stage,
ClutterStageView *view,
const cairo_rectangle_int_t *clip)
{
setup_view_for_pick_or_paint (stage, view, clip);
clutter_actor_paint (CLUTTER_ACTOR (stage));
}
@ -1011,7 +985,7 @@ clutter_stage_pick (ClutterActor *self)
*/
clutter_actor_iter_init (&iter, self);
while (clutter_actor_iter_next (&iter, &child))
clutter_actor_paint (child);
clutter_actor_pick (child);
}
static gboolean
@ -1638,6 +1612,26 @@ _clutter_stage_has_full_redraw_queued (ClutterStage *stage)
return FALSE;
}
cairo_region_t *
clutter_stage_get_redraw_clip (ClutterStage *stage)
{
ClutterStagePrivate *priv;
cairo_rectangle_int_t clip;
cairo_region_t *region;
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
priv = stage->priv;
region = _clutter_stage_window_get_redraw_clip (priv->impl);
if (region)
return region;
/* Set clip to the full extents of the stage */
_clutter_stage_window_get_geometry (priv->impl, &clip);
return cairo_region_create_rectangle (&clip);
}
/**
* clutter_stage_get_redraw_clip_bounds:
* @stage: A #ClutterStage
@ -1694,7 +1688,8 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
cogl_push_framebuffer (fb);
context->pick_mode = mode;
clutter_stage_do_paint_view (stage, view, NULL);
setup_view_for_pick_or_paint (stage, view, NULL);
clutter_actor_pick (CLUTTER_ACTOR (stage));
context->pick_mode = CLUTTER_PICK_NONE;
priv->cached_pick_mode = mode;
@ -1873,10 +1868,6 @@ clutter_stage_set_property (GObject *object,
clutter_stage_set_key_focus (stage, g_value_get_object (value));
break;
case PROP_NO_CLEAR_HINT:
clutter_stage_set_no_clear_hint (stage, g_value_get_boolean (value));
break;
case PROP_ACCEPT_FOCUS:
clutter_stage_set_accept_focus (stage, g_value_get_boolean (value));
break;
@ -1927,15 +1918,6 @@ clutter_stage_get_property (GObject *gobject,
g_value_set_object (value, priv->key_focused_actor);
break;
case PROP_NO_CLEAR_HINT:
{
gboolean hint =
(priv->stage_hints & CLUTTER_STAGE_NO_CLEAR_ON_PAINT) != 0;
g_value_set_boolean (value, hint);
}
break;
case PROP_ACCEPT_FOCUS:
g_value_set_boolean (value, priv->accept_focus);
break;
@ -2138,23 +2120,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
CLUTTER_TYPE_ACTOR,
CLUTTER_PARAM_READWRITE);
/**
* ClutterStage:no-clear-hint:
*
* Whether or not the #ClutterStage should clear its contents
* before each paint cycle.
*
* See clutter_stage_set_no_clear_hint() for further information.
*
* Since: 1.4
*/
obj_props[PROP_NO_CLEAR_HINT] =
g_param_spec_boolean ("no-clear-hint",
P_("No Clear Hint"),
P_("Whether the stage should clear its contents"),
FALSE,
CLUTTER_PARAM_READWRITE);
/**
* ClutterStage:accept-focus:
*
@ -3772,72 +3737,6 @@ _clutter_stage_clear_update_time (ClutterStage *stage)
_clutter_stage_window_clear_update_time (stage_window);
}
/**
* clutter_stage_set_no_clear_hint:
* @stage: a #ClutterStage
* @no_clear: %TRUE if the @stage should not clear itself on every
* repaint cycle
*
* Sets whether the @stage should clear itself at the beginning
* of each paint cycle or not.
*
* Clearing the #ClutterStage can be a costly operation, especially
* if the stage is always covered - for instance, in a full-screen
* video player or in a game with a background texture.
*
* This setting is a hint; Clutter might discard this hint
* depending on its internal state.
*
* If parts of the stage are visible and you disable clearing you
* might end up with visual artifacts while painting the contents of
* the stage.
*
* Since: 1.4
*/
void
clutter_stage_set_no_clear_hint (ClutterStage *stage,
gboolean no_clear)
{
ClutterStagePrivate *priv;
ClutterStageHint new_hints;
g_return_if_fail (CLUTTER_IS_STAGE (stage));
priv = stage->priv;
new_hints = priv->stage_hints;
if (no_clear)
new_hints |= CLUTTER_STAGE_NO_CLEAR_ON_PAINT;
else
new_hints &= ~CLUTTER_STAGE_NO_CLEAR_ON_PAINT;
if (priv->stage_hints == new_hints)
return;
priv->stage_hints = new_hints;
g_object_notify_by_pspec (G_OBJECT (stage), obj_props[PROP_NO_CLEAR_HINT]);
}
/**
* clutter_stage_get_no_clear_hint:
* @stage: a #ClutterStage
*
* Retrieves the hint set with clutter_stage_set_no_clear_hint()
*
* Return value: %TRUE if the stage should not clear itself on every paint
* cycle, and %FALSE otherwise
*
* Since: 1.4
*/
gboolean
clutter_stage_get_no_clear_hint (ClutterStage *stage)
{
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
return (stage->priv->stage_hints & CLUTTER_STAGE_NO_CLEAR_ON_PAINT) != 0;
}
ClutterPaintVolume *
_clutter_stage_paint_volume_stack_allocate (ClutterStage *stage)
{

View File

@ -164,11 +164,6 @@ void clutter_stage_get_minimum_size (ClutterStage
guint *width,
guint *height);
CLUTTER_EXPORT
void clutter_stage_set_no_clear_hint (ClutterStage *stage,
gboolean no_clear);
CLUTTER_EXPORT
gboolean clutter_stage_get_no_clear_hint (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_set_use_alpha (ClutterStage *stage,
gboolean use_alpha);
CLUTTER_EXPORT
@ -214,6 +209,8 @@ CLUTTER_EXPORT
void clutter_stage_get_redraw_clip_bounds (ClutterStage *stage,
cairo_rectangle_int_t *clip);
CLUTTER_EXPORT
cairo_region_t * clutter_stage_get_redraw_clip (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_ensure_viewport (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_ensure_redraw (ClutterStage *stage);

View File

@ -46,8 +46,7 @@ G_BEGIN_DECLS
* @CLUTTER_TEXTURE_ERROR_NO_YUV: YUV operation attempted but no YUV support
* found
* @CLUTTER_TEXTURE_ERROR_BAD_FORMAT: The requested format for
* clutter_texture_set_from_rgb_data or
* clutter_texture_set_from_yuv_data is unsupported.
* clutter_texture_set_from_rgb_data is unsupported.
*
* Error enumeration for #ClutterTexture
*

View File

@ -104,7 +104,6 @@ typedef union _ClutterEvent ClutterEvent;
*/
typedef struct _ClutterEventSequence ClutterEventSequence;
typedef struct _ClutterBehaviour ClutterBehaviour; /* deprecated */
typedef struct _ClutterShader ClutterShader; /* deprecated */
/**

View File

@ -56,7 +56,7 @@ typedef struct _ClutterStageViewCoglPrivate
*/
#define DAMAGE_HISTORY_MAX 16
#define DAMAGE_HISTORY(x) ((x) & (DAMAGE_HISTORY_MAX - 1))
cairo_rectangle_int_t damage_history[DAMAGE_HISTORY_MAX];
cairo_region_t * damage_history[DAMAGE_HISTORY_MAX];
unsigned int damage_index;
} ClutterStageViewCoglPrivate;
@ -296,13 +296,10 @@ clutter_stage_cogl_has_redraw_clips (ClutterStageWindow *stage_window)
/* NB: at the start of each new frame there is an implied clip that
* clips everything (i.e. nothing would be drawn) so we need to make
* sure we return True in the un-initialized case here.
*
* NB: a clip width of 0 means a full stage redraw has been queued
* so we effectively don't have any redraw clips in that case.
*/
if (!stage_cogl->initialized_redraw_clip ||
(stage_cogl->initialized_redraw_clip &&
stage_cogl->bounding_redraw_clip.width != 0))
stage_cogl->redraw_clip))
return TRUE;
else
return FALSE;
@ -313,9 +310,9 @@ clutter_stage_cogl_ignoring_redraw_clips (ClutterStageWindow *stage_window)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
/* NB: a clip width of 0 means a full stage redraw is required */
/* NB: a NULL clip means a full stage redraw is required */
if (stage_cogl->initialized_redraw_clip &&
stage_cogl->bounding_redraw_clip.width == 0)
!stage_cogl->redraw_clip)
return TRUE;
else
return FALSE;
@ -346,11 +343,11 @@ clutter_stage_cogl_add_redraw_clip (ClutterStageWindow *stage_window,
return;
/* A NULL stage clip means a full stage redraw has been queued and
* we keep track of this by setting a zero width
* stage_cogl->bounding_redraw_clip */
* we keep track of this by setting a NULL redraw_clip.
*/
if (stage_clip == NULL)
{
stage_cogl->bounding_redraw_clip.width = 0;
g_clear_pointer (&stage_cogl->redraw_clip, cairo_region_destroy);
stage_cogl->initialized_redraw_clip = TRUE;
return;
}
@ -359,34 +356,27 @@ clutter_stage_cogl_add_redraw_clip (ClutterStageWindow *stage_window,
if (stage_clip->width == 0 || stage_clip->height == 0)
return;
if (!stage_cogl->initialized_redraw_clip)
if (!stage_cogl->redraw_clip)
{
stage_cogl->bounding_redraw_clip = *stage_clip;
stage_cogl->redraw_clip = cairo_region_create_rectangle (stage_clip);
}
else if (stage_cogl->bounding_redraw_clip.width > 0)
else
{
_clutter_util_rectangle_union (&stage_cogl->bounding_redraw_clip,
stage_clip,
&stage_cogl->bounding_redraw_clip);
cairo_region_union_rectangle (stage_cogl->redraw_clip, stage_clip);
}
stage_cogl->initialized_redraw_clip = TRUE;
}
static gboolean
clutter_stage_cogl_get_redraw_clip_bounds (ClutterStageWindow *stage_window,
cairo_rectangle_int_t *stage_clip)
static cairo_region_t *
clutter_stage_cogl_get_redraw_clip (ClutterStageWindow *stage_window)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
if (stage_cogl->using_clipped_redraw)
{
*stage_clip = stage_cogl->bounding_redraw_clip;
if (stage_cogl->using_clipped_redraw && stage_cogl->redraw_clip)
return cairo_region_copy (stage_cogl->redraw_clip);
return TRUE;
}
return FALSE;
return NULL;
}
static inline gboolean
@ -403,37 +393,47 @@ valid_buffer_age (ClutterStageViewCogl *view_cogl,
}
static void
paint_damage_region (ClutterStageWindow *stage_window,
ClutterStageView *view,
cairo_rectangle_int_t *swap_region)
paint_damage_region (ClutterStageWindow *stage_window,
ClutterStageView *view,
cairo_region_t *swap_region)
{
CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view);
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
static CoglPipeline *overlay_blue = NULL;
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
ClutterActor *actor = CLUTTER_ACTOR (stage_cogl->wrapper);
float x_1 = swap_region->x;
float x_2 = swap_region->x + swap_region->width;
float y_1 = swap_region->y;
float y_2 = swap_region->y + swap_region->height;
CoglMatrix modelview;
CoglMatrix transform;
int n_rects, i;
cogl_framebuffer_push_matrix (framebuffer);
clutter_actor_get_transform (actor, &transform);
cogl_framebuffer_transform (framebuffer, &transform);
/* Blue for the swap region */
if (G_UNLIKELY (overlay_blue == NULL))
{
overlay_blue = cogl_pipeline_new (ctx);
cogl_pipeline_set_color4ub (overlay_blue, 0x00, 0x00, 0x33, 0x33);
}
cogl_framebuffer_push_matrix (framebuffer);
cogl_matrix_init_identity (&modelview);
_clutter_actor_apply_modelview_transform (actor, &modelview);
cogl_framebuffer_set_modelview_matrix (framebuffer, &modelview);
n_rects = cairo_region_num_rectangles (swap_region);
for (i = 0; i < n_rects; i++)
{
cairo_rectangle_int_t rect;
float x_1, x_2, y_1, y_2;
/* Blue for the swap region */
cogl_framebuffer_draw_rectangle (framebuffer, overlay_blue, x_1, y_1, x_2, y_2);
cairo_region_get_rectangle (swap_region, i, &rect);
x_1 = rect.x;
x_2 = rect.x + rect.width;
y_1 = rect.y;
y_2 = rect.y + rect.height;
cogl_framebuffer_draw_rectangle (framebuffer, overlay_blue, x_1, y_1, x_2, y_2);
}
/* Red for the clip */
if (stage_cogl->initialized_redraw_clip)
if (stage_cogl->initialized_redraw_clip &&
stage_cogl->redraw_clip)
{
static CoglPipeline *overlay_red = NULL;
@ -443,55 +443,63 @@ paint_damage_region (ClutterStageWindow *stage_window,
cogl_pipeline_set_color4ub (overlay_red, 0x33, 0x00, 0x00, 0x33);
}
x_1 = stage_cogl->bounding_redraw_clip.x;
x_2 = stage_cogl->bounding_redraw_clip.x + stage_cogl->bounding_redraw_clip.width;
y_1 = stage_cogl->bounding_redraw_clip.y;
y_2 = stage_cogl->bounding_redraw_clip.y + stage_cogl->bounding_redraw_clip.height;
n_rects = cairo_region_num_rectangles (stage_cogl->redraw_clip);
for (i = 0; i < n_rects; i++)
{
cairo_rectangle_int_t rect;
float x_1, x_2, y_1, y_2;
cogl_framebuffer_draw_rectangle (framebuffer, overlay_red, x_1, y_1, x_2, y_2);
cairo_region_get_rectangle (stage_cogl->redraw_clip, i, &rect);
x_1 = rect.x;
x_2 = rect.x + rect.width;
y_1 = rect.y;
y_2 = rect.y + rect.height;
cogl_framebuffer_draw_rectangle (framebuffer, overlay_red, x_1, y_1, x_2, y_2);
}
}
cogl_framebuffer_pop_matrix (framebuffer);
}
static gboolean
swap_framebuffer (ClutterStageWindow *stage_window,
ClutterStageView *view,
cairo_rectangle_int_t *swap_region,
gboolean swap_with_damage)
swap_framebuffer (ClutterStageWindow *stage_window,
ClutterStageView *view,
cairo_region_t *swap_region,
gboolean swap_with_damage)
{
CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view);
int damage[4], ndamage;
damage[0] = swap_region->x;
damage[1] = swap_region->y;
damage[2] = swap_region->width;
damage[3] = swap_region->height;
if (swap_region->width != 0)
ndamage = 1;
else
ndamage = 0;
int *damage, n_rects, i;
if (G_UNLIKELY ((clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION)))
paint_damage_region (stage_window, view, swap_region);
n_rects = cairo_region_num_rectangles (swap_region);
damage = g_newa (int, n_rects * 4);
for (i = 0; i < n_rects; i++)
{
cairo_rectangle_int_t rect;
cairo_region_get_rectangle (swap_region, i, &rect);
damage[i * 4] = rect.x;
damage[i * 4 + 1] = rect.y;
damage[i * 4 + 2] = rect.width;
damage[i * 4 + 3] = rect.height;
}
if (cogl_is_onscreen (framebuffer))
{
CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
/* push on the screen */
if (ndamage == 1 && !swap_with_damage)
if (n_rects > 0 && !swap_with_damage)
{
CLUTTER_NOTE (BACKEND,
"cogl_onscreen_swap_region (onscreen: %p, "
"x: %d, y: %d, "
"width: %d, height: %d)",
onscreen,
damage[0], damage[1], damage[2], damage[3]);
"cogl_onscreen_swap_region (onscreen: %p)",
onscreen);
cogl_onscreen_swap_region (onscreen,
damage, ndamage);
damage, n_rects);
return FALSE;
}
@ -501,7 +509,7 @@ swap_framebuffer (ClutterStageWindow *stage_window,
onscreen);
cogl_onscreen_swap_buffers_with_damage (onscreen,
damage, ndamage);
damage, n_rects);
return TRUE;
}
@ -517,80 +525,121 @@ swap_framebuffer (ClutterStageWindow *stage_window,
}
static void
paint_stage (ClutterStageCogl *stage_cogl,
ClutterStageView *view,
const cairo_rectangle_int_t *clip)
scale_and_clamp_rect (const graphene_rect_t *rect,
float scale,
cairo_rectangle_int_t *dest)
{
ClutterStage *stage = stage_cogl->wrapper;
graphene_rect_t tmp = *rect;
_clutter_stage_maybe_setup_viewport (stage, view);
_clutter_stage_paint_view (stage, view, clip);
if (clutter_stage_view_get_onscreen (view) !=
clutter_stage_view_get_framebuffer (view))
{
clutter_stage_view_blit_offscreen (view, clip);
}
graphene_rect_scale (&tmp, scale, scale, &tmp);
_clutter_util_rectangle_int_extents (&tmp, dest);
}
static void
fill_current_damage_history_and_step (ClutterStageView *view)
paint_stage (ClutterStageCogl *stage_cogl,
ClutterStageView *view,
cairo_region_t *clip)
{
ClutterStage *stage = stage_cogl->wrapper;
cairo_rectangle_int_t clip_rect;
cairo_rectangle_int_t paint_rect;
cairo_rectangle_int_t view_rect;
graphene_rect_t rect;
float fb_scale;
clutter_stage_view_get_layout (view, &view_rect);
fb_scale = clutter_stage_view_get_scale (view);
cairo_region_get_extents (clip, &clip_rect);
_clutter_util_rect_from_rectangle (&clip_rect, &rect);
scale_and_clamp_rect (&rect, 1.0f / fb_scale, &paint_rect);
_clutter_util_rectangle_offset (&paint_rect,
view_rect.x,
view_rect.y,
&paint_rect);
_clutter_stage_maybe_setup_viewport (stage, view);
_clutter_stage_paint_view (stage, view, &paint_rect);
clutter_stage_view_after_paint (view, &paint_rect);
}
static void
fill_current_damage_history (ClutterStageView *view,
cairo_region_t *damage)
{
ClutterStageViewCogl *view_cogl = CLUTTER_STAGE_VIEW_COGL (view);
ClutterStageViewCoglPrivate *view_priv =
clutter_stage_view_cogl_get_instance_private (view_cogl);
cairo_rectangle_int_t view_rect;
float fb_scale;
cairo_rectangle_int_t *current_fb_damage;
cairo_region_t **current_fb_damage;
current_fb_damage =
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index)];
clutter_stage_view_get_layout (view, &view_rect);
fb_scale = clutter_stage_view_get_scale (view);
*current_fb_damage = (cairo_rectangle_int_t) {
.x = 0,
.y = 0,
.width = ceilf (view_rect.width * fb_scale),
.height = ceilf (view_rect.height * fb_scale)
};
g_clear_pointer (current_fb_damage, cairo_region_destroy);
*current_fb_damage = cairo_region_copy (damage);
view_priv->damage_index++;
}
static void
transform_swap_region_to_onscreen (ClutterStageView *view,
cairo_rectangle_int_t *swap_region)
fill_current_damage_history_rectangle (ClutterStageView *view,
const cairo_rectangle_int_t *rect)
{
cairo_region_t *damage;
damage = cairo_region_create_rectangle (rect);
fill_current_damage_history (view, damage);
cairo_region_destroy (damage);
}
static cairo_region_t *
transform_swap_region_to_onscreen (ClutterStageView *view,
cairo_region_t *swap_region)
{
CoglFramebuffer *framebuffer;
cairo_rectangle_int_t layout;
gfloat x1, y1, x2, y2;
gint width, height;
int n_rects, i;
cairo_rectangle_int_t *rects;
cairo_region_t *transformed_region;
framebuffer = clutter_stage_view_get_onscreen (view);
clutter_stage_view_get_layout (view, &layout);
x1 = (float) swap_region->x / layout.width;
y1 = (float) swap_region->y / layout.height;
x2 = (float) (swap_region->x + swap_region->width) / layout.width;
y2 = (float) (swap_region->y + swap_region->height) / layout.height;
clutter_stage_view_transform_to_onscreen (view, &x1, &y1);
clutter_stage_view_transform_to_onscreen (view, &x2, &y2);
width = cogl_framebuffer_get_width (framebuffer);
height = cogl_framebuffer_get_height (framebuffer);
x1 = floor (x1 * width);
y1 = floor (height - (y1 * height));
x2 = ceil (x2 * width);
y2 = ceil (height - (y2 * height));
n_rects = cairo_region_num_rectangles (swap_region);
rects = g_newa (cairo_rectangle_int_t, n_rects);
for (i = 0; i < n_rects; i++)
{
gfloat x1, y1, x2, y2;
*swap_region = (cairo_rectangle_int_t) {
.x = x1,
.y = y1,
.width = x2 - x1,
.height = y2 - y1
};
cairo_region_get_rectangle (swap_region, i, &rects[i]);
x1 = (float) rects[i].x / layout.width;
y1 = (float) rects[i].y / layout.height;
x2 = (float) (rects[i].x + rects[i].width) / layout.width;
y2 = (float) (rects[i].y + rects[i].height) / layout.height;
clutter_stage_view_transform_to_onscreen (view, &x1, &y1);
clutter_stage_view_transform_to_onscreen (view, &x2, &y2);
x1 = floor (x1 * width);
y1 = floor (height - (y1 * height));
x2 = ceil (x2 * width);
y2 = ceil (height - (y2 * height));
rects[i].x = x1;
rects[i].y = y1;
rects[i].width = x2 - x1;
rects[i].height = y2 - y1;
}
transformed_region = cairo_region_create_rectangles (rects, n_rects);
return transformed_region;
}
static void
@ -624,18 +673,6 @@ is_buffer_age_enabled (void)
cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE);
}
static void
scale_and_clamp_rect (const graphene_rect_t *rect,
float scale,
cairo_rectangle_int_t *dest)
{
graphene_rect_t tmp = *rect;
graphene_rect_scale (&tmp, scale, scale, &tmp);
_clutter_util_rectangle_int_extents (&tmp, dest);
}
static gboolean
clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
ClutterStageView *view)
@ -654,9 +691,10 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
gboolean do_swap_buffer;
gboolean swap_with_damage;
ClutterActor *wrapper;
cairo_rectangle_int_t redraw_clip;
cairo_rectangle_int_t swap_region;
cairo_rectangle_int_t fb_clip_region;
cairo_region_t *redraw_clip;
cairo_region_t *fb_clip_region;
cairo_region_t *swap_region;
cairo_rectangle_int_t redraw_rect;
gboolean clip_region_empty;
float fb_scale;
int subpixel_compensation = 0;
@ -675,20 +713,19 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
has_buffer_age = cogl_is_onscreen (fb) && is_buffer_age_enabled ();
/* NB: a zero width redraw clip == full stage redraw */
if (stage_cogl->bounding_redraw_clip.width == 0)
/* NB: a NULL redraw clip == full stage redraw */
if (!stage_cogl->redraw_clip)
have_clip = FALSE;
else
{
redraw_clip = stage_cogl->bounding_redraw_clip;
_clutter_util_rectangle_intersection (&redraw_clip,
&view_rect,
&redraw_clip);
cairo_region_t *view_region;
redraw_clip = cairo_region_copy (stage_cogl->redraw_clip);
have_clip = !(redraw_clip.x == view_rect.x &&
redraw_clip.y == view_rect.y &&
redraw_clip.width == view_rect.width &&
redraw_clip.height == view_rect.height);
view_region = cairo_region_create_rectangle (&view_rect);
cairo_region_intersect (redraw_clip, view_region);
have_clip = !cairo_region_equal (redraw_clip, view_region);
cairo_region_destroy (view_region);
}
may_use_clipped_redraw = FALSE;
@ -700,25 +737,52 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
cogl_onscreen_get_frame_counter (COGL_ONSCREEN (fb)) > 3)
{
graphene_rect_t rect;
cairo_rectangle_int_t *rects;
int n_rects, i;
may_use_clipped_redraw = TRUE;
_clutter_util_rect_from_rectangle (&redraw_clip, &rect);
graphene_rect_offset (&rect, -view_rect.x, -view_rect.y);
scale_and_clamp_rect (&rect, fb_scale, &fb_clip_region);
fb_clip_region = cairo_region_create ();
n_rects = cairo_region_num_rectangles (redraw_clip);
rects = g_new (cairo_rectangle_int_t, n_rects);
for (i = 0; i < n_rects; i++)
{
cairo_rectangle_int_t new_fb_clip_rect;
cairo_region_get_rectangle (redraw_clip, i, &rects[i]);
_clutter_util_rect_from_rectangle (&rects[i], &rect);
graphene_rect_offset (&rect, -view_rect.x, -view_rect.y);
scale_and_clamp_rect (&rect, fb_scale, &new_fb_clip_rect);
cairo_region_union_rectangle (fb_clip_region, &new_fb_clip_rect);
}
g_free (rects);
if (fb_scale != floorf (fb_scale))
{
subpixel_compensation = ceilf (fb_scale);
fb_clip_region.x -= subpixel_compensation;
fb_clip_region.y -= subpixel_compensation;
fb_clip_region.width += 2 * subpixel_compensation;
fb_clip_region.height += 2 * subpixel_compensation;
n_rects = cairo_region_num_rectangles (fb_clip_region);
rects = g_newa (cairo_rectangle_int_t, n_rects);
for (i = 0; i < n_rects; i++)
{
cairo_region_get_rectangle (fb_clip_region, i, &rects[i]);
rects[i].x -= subpixel_compensation;
rects[i].y -= subpixel_compensation;
rects[i].width += 2 * subpixel_compensation;
rects[i].height += 2 * subpixel_compensation;
}
cairo_region_destroy (fb_clip_region);
fb_clip_region = cairo_region_create_rectangles (rects, n_rects);
}
}
else
{
fb_clip_region = (cairo_rectangle_int_t) { 0 };
cairo_rectangle_int_t rect = { 0, 0, view_rect.width, view_rect.height };
fb_clip_region = cairo_region_create_rectangle (&rect);
redraw_clip = cairo_region_copy (fb_clip_region);
}
if (may_use_clipped_redraw &&
@ -727,16 +791,14 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
else
use_clipped_redraw = FALSE;
clip_region_empty = may_use_clipped_redraw && fb_clip_region.width == 0;
clip_region_empty = may_use_clipped_redraw && cairo_region_is_empty (fb_clip_region);
swap_with_damage = FALSE;
if (has_buffer_age)
{
if (use_clipped_redraw && !clip_region_empty)
{
int age, i;
cairo_rectangle_int_t *current_fb_damage =
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index++)];
int age;
age = cogl_onscreen_get_buffer_age (COGL_ONSCREEN (fb));
@ -744,54 +806,66 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
{
graphene_rect_t rect;
cairo_rectangle_int_t damage_region;
cairo_rectangle_int_t *rects;
int n_rects, i;
*current_fb_damage = fb_clip_region;
fill_current_damage_history (view, fb_clip_region);
for (i = 1; i <= age; i++)
{
cairo_rectangle_int_t *fb_damage =
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - i - 1)];
_clutter_util_rectangle_union (&fb_clip_region,
fb_damage,
&fb_clip_region);
cairo_region_t *fb_damage =
view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - i - 1)];
cairo_region_union (fb_clip_region, fb_damage);
}
/* Update the bounding redraw clip state with the extra damage. */
_clutter_util_rect_from_rectangle (&fb_clip_region, &rect);
scale_and_clamp_rect (&rect, 1.0f / fb_scale, &damage_region);
_clutter_util_rectangle_offset (&damage_region,
view_rect.x,
view_rect.y,
&damage_region);
_clutter_util_rectangle_union (&stage_cogl->bounding_redraw_clip,
&damage_region,
&stage_cogl->bounding_redraw_clip);
/* Update the redraw clip state with the extra damage. */
n_rects = cairo_region_num_rectangles (fb_clip_region);
rects = g_newa (cairo_rectangle_int_t, n_rects);
for (i = 0; i < n_rects; i++)
{
cairo_region_get_rectangle (fb_clip_region, i, &rects[i]);
_clutter_util_rect_from_rectangle (&rects[i], &rect);
scale_and_clamp_rect (&rect, 1.0f / fb_scale, &damage_region);
_clutter_util_rectangle_offset (&damage_region,
view_rect.x,
view_rect.y,
&damage_region);
cairo_region_union_rectangle (stage_cogl->redraw_clip,
&damage_region);
}
CLUTTER_NOTE (CLIPPING, "Reusing back buffer(age=%d) - repairing region: x=%d, y=%d, width=%d, height=%d\n",
CLUTTER_NOTE (CLIPPING, "Reusing back buffer(age=%d) - repairing region: num rects: %d\n",
age,
fb_clip_region.x,
fb_clip_region.y,
fb_clip_region.width,
fb_clip_region.height);
cairo_region_num_rectangles (fb_clip_region));
swap_with_damage = TRUE;
}
else
{
cairo_rectangle_int_t fb_damage;
CLUTTER_NOTE (CLIPPING, "Invalid back buffer(age=%d): forcing full redraw\n", age);
use_clipped_redraw = FALSE;
*current_fb_damage = (cairo_rectangle_int_t) {
fb_damage = (cairo_rectangle_int_t) {
.x = 0,
.y = 0,
.width = view_rect.width * fb_scale,
.height = view_rect.height * fb_scale
.width = ceilf (view_rect.width * fb_scale),
.height = ceilf (view_rect.height * fb_scale)
};
fill_current_damage_history_rectangle (view, &fb_damage);
}
}
else if (!use_clipped_redraw)
{
fill_current_damage_history_and_step (view);
cairo_rectangle_int_t fb_damage;
fb_damage = (cairo_rectangle_int_t) {
.x = 0,
.y = 0,
.width = ceilf (view_rect.width * fb_scale),
.height = ceilf (view_rect.height * fb_scale)
};
fill_current_damage_history_rectangle (view, &fb_damage);
}
}
@ -802,11 +876,12 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
}
else if (use_clipped_redraw)
{
graphene_rect_t rect;
cairo_rectangle_int_t clip_rect;
cairo_rectangle_int_t scissor_rect;
cairo_rectangle_int_t paint_rect;
calculate_scissor_region (&fb_clip_region,
cairo_region_get_extents (fb_clip_region, &clip_rect);
calculate_scissor_region (&clip_rect,
subpixel_compensation,
fb_width, fb_height,
&scissor_rect);
@ -826,14 +901,8 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
scissor_rect.width,
scissor_rect.height);
_clutter_util_rect_from_rectangle (&fb_clip_region, &rect);
scale_and_clamp_rect (&rect, 1.0f / fb_scale, &paint_rect);
_clutter_util_rectangle_offset (&paint_rect,
view_rect.x,
view_rect.y,
&paint_rect);
paint_stage (stage_cogl, view, fb_clip_region);
paint_stage (stage_cogl, view, &paint_rect);
cogl_framebuffer_pop_clip (fb);
stage_cogl->using_clipped_redraw = FALSE;
@ -843,16 +912,17 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
CLUTTER_NOTE (CLIPPING, "Unclipped stage paint\n");
/* If we are trying to debug redraw issues then we want to pass
* the bounding_redraw_clip so it can be visualized */
* the redraw_clip so it can be visualized */
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS) &&
may_use_clipped_redraw &&
!clip_region_empty)
{
graphene_rect_t rect;
cairo_rectangle_int_t clip_rect;
cairo_rectangle_int_t scissor_rect;
cairo_rectangle_int_t paint_rect;
calculate_scissor_region (&fb_clip_region,
cairo_region_get_extents (fb_clip_region, &clip_rect);
calculate_scissor_region (&clip_rect,
subpixel_compensation,
fb_width, fb_height,
&scissor_rect);
@ -863,31 +933,40 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
scissor_rect.width,
scissor_rect.height);
_clutter_util_rect_from_rectangle (&fb_clip_region, &rect);
scale_and_clamp_rect (&rect, 1.0f / fb_scale, &paint_rect);
_clutter_util_rectangle_offset (&paint_rect,
view_rect.x,
view_rect.y,
&paint_rect);
paint_stage (stage_cogl, view, fb_clip_region);
paint_stage (stage_cogl, view, &paint_rect);
cogl_framebuffer_pop_clip (fb);
}
else
paint_stage (stage_cogl, view, &view_rect);
{
cairo_rectangle_int_t clip;
cairo_region_t *view_region;
clip = (cairo_rectangle_int_t) {
.x = 0,
.y = 0,
.width = ceilf (view_rect.width * fb_scale),
.height = ceilf (view_rect.height * fb_scale)
};
view_region = cairo_region_create_rectangle (&clip);
paint_stage (stage_cogl, view, view_region);
cairo_region_destroy (view_region);
}
}
cogl_pop_framebuffer ();
cairo_region_get_extents (redraw_clip, &redraw_rect);
if (may_use_clipped_redraw &&
G_UNLIKELY ((clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS)))
{
CoglContext *ctx = cogl_framebuffer_get_context (fb);
static CoglPipeline *outline = NULL;
ClutterActor *actor = CLUTTER_ACTOR (wrapper);
float x_1 = redraw_clip.x;
float x_2 = redraw_clip.x + redraw_clip.width;
float y_1 = redraw_clip.y;
float y_2 = redraw_clip.y + redraw_clip.height;
float x_1 = redraw_rect.x;
float x_2 = redraw_rect.x + redraw_rect.width;
float y_1 = redraw_rect.y;
float y_2 = redraw_rect.y + redraw_rect.height;
CoglVertexP2 quad[4] = {
{ x_1, y_1 },
{ x_2, y_1 },
@ -933,32 +1012,47 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
}
else
{
swap_region = fb_clip_region;
g_assert (swap_region.width > 0);
swap_region = cairo_region_copy (fb_clip_region);
do_swap_buffer = TRUE;
}
}
else
{
swap_region = (cairo_rectangle_int_t) { 0 };
swap_region = cairo_region_create ();
do_swap_buffer = TRUE;
}
if (redraw_clip)
cairo_region_destroy (redraw_clip);
if (fb_clip_region)
cairo_region_destroy (fb_clip_region);
if (do_swap_buffer)
{
gboolean res;
COGL_TRACE_BEGIN_SCOPED (ClutterStageCoglRedrawViewSwapFramebuffer,
"Paint (swap framebuffer)");
if (clutter_stage_view_get_onscreen (view) !=
clutter_stage_view_get_framebuffer (view))
{
transform_swap_region_to_onscreen (view, &swap_region);
cairo_region_t *transformed_swap_region;
transformed_swap_region =
transform_swap_region_to_onscreen (view, swap_region);
cairo_region_destroy (swap_region);
swap_region = transformed_swap_region;
}
return swap_framebuffer (stage_window,
view,
&swap_region,
swap_with_damage);
res = swap_framebuffer (stage_window,
view,
swap_region,
swap_with_damage);
cairo_region_destroy (swap_region);
return res;
}
else
{
@ -998,6 +1092,7 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
/* reset the redraw clipping for the next paint... */
stage_cogl->initialized_redraw_clip = FALSE;
g_clear_pointer (&stage_cogl->redraw_clip, cairo_region_destroy);
stage_cogl->frame_count++;
@ -1019,7 +1114,7 @@ clutter_stage_window_iface_init (ClutterStageWindowInterface *iface)
iface->add_redraw_clip = clutter_stage_cogl_add_redraw_clip;
iface->has_redraw_clips = clutter_stage_cogl_has_redraw_clips;
iface->ignoring_redraw_clips = clutter_stage_cogl_ignoring_redraw_clips;
iface->get_redraw_clip_bounds = clutter_stage_cogl_get_redraw_clip_bounds;
iface->get_redraw_clip = clutter_stage_cogl_get_redraw_clip;
iface->redraw = clutter_stage_cogl_redraw;
}

View File

@ -62,7 +62,7 @@ struct _ClutterStageCogl
gint last_sync_delay;
cairo_rectangle_int_t bounding_redraw_clip;
cairo_region_t *redraw_clip;
guint initialized_redraw_clip : 1;

View File

@ -39,9 +39,7 @@
* be available any more in the next major version of Clutter.
*
* A #ClutterAlpha binds a #ClutterTimeline to a progress function which
* translates the time T into an adimensional factor alpha. The factor can
* then be used to drive a #ClutterBehaviour, which will translate the
* alpha value into something meaningful for a #ClutterActor.
* translates the time T into an adimensional factor alpha.
*
* You should provide a #ClutterTimeline and bind it to the #ClutterAlpha
* instance using clutter_alpha_set_timeline(). You should also set an
@ -59,9 +57,6 @@
* pause, stop or resume the #ClutterAlpha from calling the alpha function by
* using the appropriate functions of the #ClutterTimeline object.
*
* #ClutterAlpha is used to "drive" a #ClutterBehaviour instance, and it
* is internally used by the #ClutterAnimation API.
*
* #ClutterAlpha is available since Clutter 0.2.
*
* #ClutterAlpha is deprecated since Clutter 1.12. #ClutterTimeline and
@ -78,9 +73,7 @@
*
* The following JSON fragment defines a #ClutterAlpha
* using a #ClutterTimeline with id "sine-timeline" and an alpha
* function called `my_sine_alpha`. The defined #ClutterAlpha
* instance can be reused in multiple #ClutterBehaviour
* definitions or for #ClutterAnimation definitions.
* function called `my_sine_alpha`.
*
* |[
* {
@ -645,9 +638,6 @@ clutter_alpha_get_timeline (ClutterAlpha *alpha)
* bind a #ClutterTimeline object to the #ClutterAlpha instance
* using clutter_alpha_set_timeline().
*
* You should use the newly created #ClutterAlpha instance inside
* a #ClutterBehaviour object.
*
* Return value: the newly created empty #ClutterAlpha instance.
*
* Since: 0.2

View File

@ -57,13 +57,6 @@
* #ClutterAnimatable interface it is possible for that instance to
* control the way the initial and final states are interpolated.
*
* #ClutterAnimations are distinguished from #ClutterBehaviours
* because the former can only control #GObject properties of a single
* #GObject instance, while the latter can control multiple properties
* using accessor functions inside the #ClutterBehaviour
* `alpha_notify` virtual function, and can control multiple #ClutterActors
* as well.
*
* For convenience, it is possible to use the clutter_actor_animate()
* function call which will take care of setting up and tearing down
* a #ClutterAnimation instance and animate an actor between its current

View File

@ -1,303 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "clutter-build-config.h"
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "deprecated/clutter-actor.h"
#include "clutter-alpha.h"
#include "clutter-behaviour.h"
#include "clutter-behaviour-depth.h"
#include "clutter-enum-types.h"
#include "clutter-main.h"
#include "clutter-debug.h"
#include "clutter-private.h"
/**
* SECTION:clutter-behaviour-depth
* @Title: ClutterBehaviourDepth
* @short_description: A behaviour controlling the Z position
* @Deprecated: 1.6: Use clutter_actor_animate() instead
*
* #ClutterBehaviourDepth is a simple #ClutterBehaviour controlling the
* depth of a set of actors between a start and end depth.
*
* #ClutterBehaviourDepth is available since Clutter 0.4.
*
* Deprecated: 1.6: Use the #ClutterActor:depth property and
* clutter_actor_animate(), or #ClutterAnimator, or #ClutterState
* instead.
*/
struct _ClutterBehaviourDepthPrivate
{
gint depth_start;
gint depth_end;
};
enum
{
PROP_0,
PROP_DEPTH_START,
PROP_DEPTH_END
};
G_DEFINE_TYPE_WITH_PRIVATE (ClutterBehaviourDepth,
clutter_behaviour_depth,
CLUTTER_TYPE_BEHAVIOUR)
static void
alpha_notify_foreach (ClutterBehaviour *behaviour,
ClutterActor *actor,
gpointer user_data)
{
clutter_actor_set_depth (actor, GPOINTER_TO_INT (user_data));
}
static void
clutter_behaviour_depth_alpha_notify (ClutterBehaviour *behaviour,
gdouble alpha_value)
{
ClutterBehaviourDepthPrivate *priv;
gint depth;
priv = CLUTTER_BEHAVIOUR_DEPTH (behaviour)->priv;
/* Need to create factor as to avoid borking signedness */
depth = (alpha_value * (priv->depth_end - priv->depth_start))
+ priv->depth_start;
CLUTTER_NOTE (ANIMATION, "alpha: %.4f, depth: %d", alpha_value, depth);
clutter_behaviour_actors_foreach (behaviour,
alpha_notify_foreach,
GINT_TO_POINTER (depth));
}
static void
clutter_behaviour_depth_applied (ClutterBehaviour *behaviour,
ClutterActor *actor)
{
ClutterBehaviourDepth *depth = CLUTTER_BEHAVIOUR_DEPTH (behaviour);
clutter_actor_set_depth (actor, depth->priv->depth_start);
}
static void
clutter_behaviour_depth_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourDepth *depth = CLUTTER_BEHAVIOUR_DEPTH (gobject);
switch (prop_id)
{
case PROP_DEPTH_START:
depth->priv->depth_start = g_value_get_int (value);
break;
case PROP_DEPTH_END:
depth->priv->depth_end = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_depth_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourDepth *depth = CLUTTER_BEHAVIOUR_DEPTH (gobject);
switch (prop_id)
{
case PROP_DEPTH_START:
g_value_set_int (value, depth->priv->depth_start);
break;
case PROP_DEPTH_END:
g_value_set_int (value, depth->priv->depth_end);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_depth_class_init (ClutterBehaviourDepthClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterBehaviourClass *behaviour_class = CLUTTER_BEHAVIOUR_CLASS (klass);
gobject_class->set_property = clutter_behaviour_depth_set_property;
gobject_class->get_property = clutter_behaviour_depth_get_property;
behaviour_class->alpha_notify = clutter_behaviour_depth_alpha_notify;
behaviour_class->applied = clutter_behaviour_depth_applied;
/**
* ClutterBehaviourDepth:depth-start:
*
* Start depth level to apply to the actors.
*
* Since: 0.4
*
* Deprecated: 1.6
*/
g_object_class_install_property (gobject_class,
PROP_DEPTH_START,
g_param_spec_int ("depth-start",
P_("Start Depth"),
P_("Initial depth to apply"),
G_MININT, G_MAXINT, 0,
CLUTTER_PARAM_READWRITE));
/**
* ClutterBehaviourDepth:depth-end:
*
* End depth level to apply to the actors.
*
* Since: 0.4
*
* Deprecated: 1.6
*/
g_object_class_install_property (gobject_class,
PROP_DEPTH_END,
g_param_spec_int ("depth-end",
P_("End Depth"),
P_("Final depth to apply"),
G_MININT, G_MAXINT, 0,
CLUTTER_PARAM_READWRITE));
}
static void
clutter_behaviour_depth_init (ClutterBehaviourDepth *depth)
{
depth->priv = clutter_behaviour_depth_get_instance_private (depth);
}
/**
* clutter_behaviour_depth_new:
* @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
* @depth_start: initial value of the depth
* @depth_end: final value of the depth
*
* Creates a new #ClutterBehaviourDepth which can be used to control
* the ClutterActor:depth property of a set of #ClutterActor<!-- -->s.
*
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
* of the #ClutterAlpha instance. In the case when @alpha is %NULL,
* it can be set later with clutter_behaviour_set_alpha().
*
* Return value: (transfer full): the newly created behaviour
*
* Since: 0.4
*
* Deprecated: 1.6
*/
ClutterBehaviour *
clutter_behaviour_depth_new (ClutterAlpha *alpha,
gint depth_start,
gint depth_end)
{
g_return_val_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha), NULL);
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_DEPTH,
"alpha", alpha,
"depth-start", depth_start,
"depth-end", depth_end,
NULL);
}
/**
* clutter_behaviour_depth_set_bounds:
* @behaviour: a #ClutterBehaviourDepth
* @depth_start: initial value of the depth
* @depth_end: final value of the depth
*
* Sets the boundaries of the @behaviour.
*
* Since: 0.6
*
* Deprecated: 1.6
*/
void
clutter_behaviour_depth_set_bounds (ClutterBehaviourDepth *behaviour,
gint depth_start,
gint depth_end)
{
ClutterBehaviourDepthPrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_DEPTH (behaviour));
priv = behaviour->priv;
g_object_freeze_notify (G_OBJECT (behaviour));
if (priv->depth_start != depth_start)
{
priv->depth_start = depth_start;
g_object_notify (G_OBJECT (behaviour), "depth-start");
}
if (priv->depth_end != depth_end)
{
priv->depth_end = depth_end;
g_object_notify (G_OBJECT (behaviour), "depth-end");
}
g_object_thaw_notify (G_OBJECT (behaviour));
}
/**
* clutter_behaviour_depth_get_bounds:
* @behaviour: a #ClutterBehaviourDepth
* @depth_start: (out): return location for the initial depth value, or %NULL
* @depth_end: (out): return location for the final depth value, or %NULL
*
* Gets the boundaries of the @behaviour
*
* Since: 0.6
*
* Deprecated: 1.6
*/
void
clutter_behaviour_depth_get_bounds (ClutterBehaviourDepth *behaviour,
gint *depth_start,
gint *depth_end)
{
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_DEPTH (behaviour));
if (depth_start)
*depth_start = behaviour->priv->depth_start;
if (depth_end)
*depth_end = behaviour->priv->depth_end;
}

View File

@ -1,101 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BEHAVIOUR_DEPTH__
#define __CLUTTER_BEHAVIOUR_DEPTH__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_BEHAVIOUR_DEPTH (clutter_behaviour_depth_get_type ())
#define CLUTTER_BEHAVIOUR_DEPTH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BEHAVIOUR_DEPTH, ClutterBehaviourDepth))
#define CLUTTER_IS_BEHAVIOUR_DEPTH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BEHAVIOUR_DEPTH))
#define CLUTTER_BEHAVIOUR_DEPTH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BEHAVIOUR_DEPTH, ClutterBehaviourDepthClass))
#define CLUTTER_IS_BEHAVIOUR_DEPTH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BEHAVIOUR_DEPTH))
#define CLUTTER_BEHAVIOUR_DEPTH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BEHAVIOUR_DEPTH, ClutterBehaviourDepthClass))
typedef struct _ClutterBehaviourDepth ClutterBehaviourDepth;
typedef struct _ClutterBehaviourDepthPrivate ClutterBehaviourDepthPrivate;
typedef struct _ClutterBehaviourDepthClass ClutterBehaviourDepthClass;
/**
* ClutterBehaviourDepth:
*
* The #ClutterBehaviourDepth structure contains only private data
* and should be accessed using the provided API
*
* Since: 0.2
*
* Deprecated: 1.6: Use clutter_actor_animate() with #ClutterActor:depth
* instead.
*/
struct _ClutterBehaviourDepth
{
/*< private >*/
ClutterBehaviour parent_instance;
ClutterBehaviourDepthPrivate *priv;
};
/**
* ClutterBehaviourDepthClass:
*
* The #ClutterBehaviourDepthClass structure contains only private data
*
* Since: 0.2
*
* Deprecated: 1.6
*/
struct _ClutterBehaviourDepthClass
{
/*< private >*/
ClutterBehaviourClass parent_class;
};
CLUTTER_DEPRECATED
GType clutter_behaviour_depth_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_FOR(clutter_actor_animate and ClutterActor:depth)
ClutterBehaviour *clutter_behaviour_depth_new (ClutterAlpha *alpha,
gint depth_start,
gint depth_end);
CLUTTER_DEPRECATED
void clutter_behaviour_depth_set_bounds (ClutterBehaviourDepth *behaviour,
gint depth_start,
gint depth_end);
CLUTTER_DEPRECATED
void clutter_behaviour_depth_get_bounds (ClutterBehaviourDepth *behaviour,
gint *depth_start,
gint *depth_end);
G_END_DECLS
#endif /* __CLUTTER_BEHAVIOUR_DEPTH__ */

View File

@ -1,310 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:clutter-behaviour-opacity
* @Title: ClutterBehaviourOpacity
* @short_description: A behaviour controlling opacity
* @Deprecated: 1.6: Use clutter_actor_animate() instead.
*
* #ClutterBehaviourOpacity controls the opacity of a set of actors.
*
* Since: 0.2
*
* Deprecated: 1.6: Use the #ClutterActor:opacity property and
* clutter_actor_animate(), or #ClutterAnimator, or #ClutterState
* instead.
*/
#include "clutter-build-config.h"
#include <math.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter-alpha.h"
#include "clutter-behaviour.h"
#include "clutter-behaviour-opacity.h"
#include "clutter-private.h"
#include "clutter-debug.h"
struct _ClutterBehaviourOpacityPrivate
{
guint8 opacity_start;
guint8 opacity_end;
};
enum
{
PROP_0,
PROP_OPACITY_START,
PROP_OPACITY_END,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST];
G_DEFINE_TYPE_WITH_PRIVATE (ClutterBehaviourOpacity,
clutter_behaviour_opacity,
CLUTTER_TYPE_BEHAVIOUR)
static void
alpha_notify_foreach (ClutterBehaviour *behaviour,
ClutterActor *actor,
gpointer data)
{
clutter_actor_set_opacity (actor, GPOINTER_TO_UINT(data));
}
static void
clutter_behaviour_alpha_notify (ClutterBehaviour *behave,
gdouble alpha_value)
{
ClutterBehaviourOpacityPrivate *priv;
guint8 opacity;
priv = CLUTTER_BEHAVIOUR_OPACITY (behave)->priv;
opacity = alpha_value
* (priv->opacity_end - priv->opacity_start)
+ priv->opacity_start;
CLUTTER_NOTE (ANIMATION, "alpha: %.4f, opacity: %u",
alpha_value,
opacity);
clutter_behaviour_actors_foreach (behave,
alpha_notify_foreach,
GUINT_TO_POINTER ((guint) opacity));
}
static void
clutter_behaviour_opacity_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourOpacity *self = CLUTTER_BEHAVIOUR_OPACITY (gobject);
switch (prop_id)
{
case PROP_OPACITY_START:
clutter_behaviour_opacity_set_bounds (self,
g_value_get_uint (value),
self->priv->opacity_end);
break;
case PROP_OPACITY_END:
clutter_behaviour_opacity_set_bounds (self,
self->priv->opacity_start,
g_value_get_uint (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_opacity_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourOpacity *self = CLUTTER_BEHAVIOUR_OPACITY (gobject);
switch (prop_id)
{
case PROP_OPACITY_START:
g_value_set_uint (value, self->priv->opacity_start);
break;
case PROP_OPACITY_END:
g_value_set_uint (value, self->priv->opacity_end);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_opacity_class_init (ClutterBehaviourOpacityClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass);
GParamSpec *pspec;
gobject_class->set_property = clutter_behaviour_opacity_set_property;
gobject_class->get_property = clutter_behaviour_opacity_get_property;
/**
* ClutterBehaviourOpacity:opacity-start:
*
* Initial opacity level of the behaviour.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
pspec = g_param_spec_uint ("opacity-start",
P_("Opacity Start"),
P_("Initial opacity level"),
0, 255,
0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_OPACITY_START] = pspec;
g_object_class_install_property (gobject_class, PROP_OPACITY_START, pspec);
/**
* ClutterBehaviourOpacity:opacity-end:
*
* Final opacity level of the behaviour.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
pspec = g_param_spec_uint ("opacity-end",
P_("Opacity End"),
P_("Final opacity level"),
0, 255,
0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_OPACITY_END] = pspec;
g_object_class_install_property (gobject_class, PROP_OPACITY_END, pspec);
behave_class->alpha_notify = clutter_behaviour_alpha_notify;
}
static void
clutter_behaviour_opacity_init (ClutterBehaviourOpacity *self)
{
self->priv = clutter_behaviour_opacity_get_instance_private (self);
}
/**
* clutter_behaviour_opacity_new:
* @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
* @opacity_start: minimum level of opacity
* @opacity_end: maximum level of opacity
*
* Creates a new #ClutterBehaviourOpacity object, driven by @alpha
* which controls the opacity property of every actor, making it
* change in the interval between @opacity_start and @opacity_end.
*
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
* of the #ClutterAlpha instance. In the case when @alpha is %NULL,
* it can be set later with clutter_behaviour_set_alpha().
*
* Return value: the newly created #ClutterBehaviourOpacity
*
* Since: 0.2
*
* Deprecated: 1.6
*/
ClutterBehaviour *
clutter_behaviour_opacity_new (ClutterAlpha *alpha,
guint8 opacity_start,
guint8 opacity_end)
{
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_OPACITY,
"alpha", alpha,
"opacity-start", opacity_start,
"opacity-end", opacity_end,
NULL);
}
/**
* clutter_behaviour_opacity_set_bounds:
* @behaviour: a #ClutterBehaviourOpacity
* @opacity_start: minimum level of opacity
* @opacity_end: maximum level of opacity
*
* Sets the initial and final levels of the opacity applied by @behaviour
* on each actor it controls.
*
* Since: 0.6
*
* Deprecated: 1.6
*/
void
clutter_behaviour_opacity_set_bounds (ClutterBehaviourOpacity *behaviour,
guint8 opacity_start,
guint8 opacity_end)
{
ClutterBehaviourOpacityPrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_OPACITY (behaviour));
priv = behaviour->priv;
g_object_freeze_notify (G_OBJECT (behaviour));
if (priv->opacity_start != opacity_start)
{
priv->opacity_start = opacity_start;
g_object_notify_by_pspec (G_OBJECT (behaviour), obj_props[PROP_OPACITY_START]);
}
if (priv->opacity_end != opacity_end)
{
priv->opacity_end = opacity_end;
g_object_notify_by_pspec (G_OBJECT (behaviour), obj_props[PROP_OPACITY_END]);
}
g_object_thaw_notify (G_OBJECT (behaviour));
}
/**
* clutter_behaviour_opacity_get_bounds:
* @behaviour: a #ClutterBehaviourOpacity
* @opacity_start: (out): return location for the minimum level of opacity, or %NULL
* @opacity_end: (out): return location for the maximum level of opacity, or %NULL
*
* Gets the initial and final levels of the opacity applied by @behaviour
* on each actor it controls.
*
* Since: 0.6
*
* Deprecated: 1.6
*/
void
clutter_behaviour_opacity_get_bounds (ClutterBehaviourOpacity *behaviour,
guint8 *opacity_start,
guint8 *opacity_end)
{
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_OPACITY (behaviour));
if (opacity_start)
*opacity_start = behaviour->priv->opacity_start;
if (opacity_end)
*opacity_end = behaviour->priv->opacity_end;
}

View File

@ -1,115 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BEHAVIOUR_OPACITY_H__
#define __CLUTTER_BEHAVIOUR_OPACITY_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_BEHAVIOUR_OPACITY (clutter_behaviour_opacity_get_type ())
#define CLUTTER_BEHAVIOUR_OPACITY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacity))
#define CLUTTER_BEHAVIOUR_OPACITY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacityClass))
#define CLUTTER_IS_BEHAVIOUR_OPACITY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY))
#define CLUTTER_IS_BEHAVIOUR_OPACITY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY))
#define CLUTTER_BEHAVIOUR_OPACITY_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacityClass))
typedef struct _ClutterBehaviourOpacity ClutterBehaviourOpacity;
typedef struct _ClutterBehaviourOpacityPrivate ClutterBehaviourOpacityPrivate;
typedef struct _ClutterBehaviourOpacityClass ClutterBehaviourOpacityClass;
/**
* ClutterBehaviourOpacity:
*
* The #ClutterBehaviourOpacity structure contains only private data and
* should be accessed using the provided API
*
* Since: 0.2
*
* Deprecated: 1.6: Use clutter_actor_animate() and #ClutterActor:opacity
* instead.
*/
struct _ClutterBehaviourOpacity
{
/*< private >*/
ClutterBehaviour parent;
ClutterBehaviourOpacityPrivate *priv;
};
/**
* ClutterBehaviourOpacityClass:
*
* The #ClutterBehaviourOpacityClass structure contains only private data
*
* Since: 0.2
*
* Deprecated: 1.6
*/
struct _ClutterBehaviourOpacityClass
{
/*< private >*/
ClutterBehaviourClass parent_class;
};
CLUTTER_DEPRECATED
GType clutter_behaviour_opacity_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_FOR(clutter_actor_animate and ClutterActor:opacity)
ClutterBehaviour *clutter_behaviour_opacity_new (ClutterAlpha *alpha,
guint8 opacity_start,
guint8 opacity_end);
CLUTTER_DEPRECATED
void clutter_behaviour_opacity_set_bounds (ClutterBehaviourOpacity *behaviour,
guint8 opacity_start,
guint8 opacity_end);
CLUTTER_DEPRECATED
void clutter_behaviour_opacity_get_bounds (ClutterBehaviourOpacity *behaviour,
guint8 *opacity_start,
guint8 *opacity_end);
G_END_DECLS
#endif /* __CLUTTER_BEHAVIOUR_OPACITY_H__ */

View File

@ -1,437 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:clutter-behaviour-scale
* @Title: ClutterBehaviourScale
* @short_description: A behaviour controlling scale
* @Deprecated: 1.6: Use clutter_actor_animate() with #ClutterActor:scale-x
* and #ClutterActor:scale-y instead.
*
* A #ClutterBehaviourScale interpolates actors size between two values.
*
* Deprecated: 1.6: Use the #ClutterActor:scale-x and #ClutterActor:scale-y
* properties, and clutter_actor_animate(), or #ClutterAnimator or
* #ClutterState instead.
*/
#include "clutter-build-config.h"
#include <math.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "deprecated/clutter-actor.h"
#include "clutter-alpha.h"
#include "clutter-behaviour.h"
#include "clutter-behaviour-scale.h"
#include "clutter-debug.h"
#include "clutter-main.h"
#include "clutter-private.h"
struct _ClutterBehaviourScalePrivate
{
gdouble x_scale_start;
gdouble y_scale_start;
gdouble x_scale_end;
gdouble y_scale_end;
};
enum
{
PROP_0,
PROP_X_SCALE_START,
PROP_Y_SCALE_START,
PROP_X_SCALE_END,
PROP_Y_SCALE_END,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST];
G_DEFINE_TYPE_WITH_PRIVATE (ClutterBehaviourScale,
clutter_behaviour_scale,
CLUTTER_TYPE_BEHAVIOUR)
typedef struct {
gdouble scale_x;
gdouble scale_y;
} ScaleFrameClosure;
static void
scale_frame_foreach (ClutterBehaviour *behaviour,
ClutterActor *actor,
gpointer data)
{
ScaleFrameClosure *closure = data;
clutter_actor_set_scale (actor, closure->scale_x, closure->scale_y);
}
static void
clutter_behaviour_scale_alpha_notify (ClutterBehaviour *behave,
gdouble alpha_value)
{
ClutterBehaviourScalePrivate *priv;
ScaleFrameClosure closure = { 0, };
priv = CLUTTER_BEHAVIOUR_SCALE (behave)->priv;
/* Fix the start/end values, avoids potential rounding errors on large
* values.
*/
if (alpha_value == 1.0)
{
closure.scale_x = priv->x_scale_end;
closure.scale_y = priv->y_scale_end;
}
else if (alpha_value == 0)
{
closure.scale_x = priv->x_scale_start;
closure.scale_y = priv->y_scale_start;
}
else
{
closure.scale_x = (priv->x_scale_end - priv->x_scale_start)
* alpha_value
+ priv->x_scale_start;
closure.scale_y = (priv->y_scale_end - priv->y_scale_start)
* alpha_value
+ priv->y_scale_start;
}
clutter_behaviour_actors_foreach (behave,
scale_frame_foreach,
&closure);
}
static void
clutter_behaviour_scale_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourScalePrivate *priv;
priv = CLUTTER_BEHAVIOUR_SCALE (gobject)->priv;
switch (prop_id)
{
case PROP_X_SCALE_START:
priv->x_scale_start = g_value_get_double (value);
break;
case PROP_X_SCALE_END:
priv->x_scale_end = g_value_get_double (value);
break;
case PROP_Y_SCALE_START:
priv->y_scale_start = g_value_get_double (value);
break;
case PROP_Y_SCALE_END:
priv->y_scale_end = g_value_get_double (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_scale_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourScalePrivate *priv;
priv = CLUTTER_BEHAVIOUR_SCALE (gobject)->priv;
switch (prop_id)
{
case PROP_X_SCALE_START:
g_value_set_double (value, priv->x_scale_start);
break;
case PROP_X_SCALE_END:
g_value_set_double (value, priv->x_scale_end);
break;
case PROP_Y_SCALE_START:
g_value_set_double (value, priv->y_scale_start);
break;
case PROP_Y_SCALE_END:
g_value_set_double (value, priv->y_scale_end);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_scale_class_init (ClutterBehaviourScaleClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass);
GParamSpec *pspec = NULL;
gobject_class->set_property = clutter_behaviour_scale_set_property;
gobject_class->get_property = clutter_behaviour_scale_get_property;
/**
* ClutterBehaviourScale:x-scale-start:
*
* The initial scaling factor on the X axis for the actors.
*
* Since: 0.6
*
* Deprecated: 1.6
*/
pspec = g_param_spec_double ("x-scale-start",
P_("X Start Scale"),
P_("Initial scale on the X axis"),
0.0, G_MAXDOUBLE,
1.0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_X_SCALE_START] = pspec;
g_object_class_install_property (gobject_class,
PROP_X_SCALE_START,
pspec);
/**
* ClutterBehaviourScale:x-scale-end:
*
* The final scaling factor on the X axis for the actors.
*
* Since: 0.6
*
* Deprecated: 1.6
*/
pspec = g_param_spec_double ("x-scale-end",
P_("X End Scale"),
P_("Final scale on the X axis"),
0.0, G_MAXDOUBLE,
1.0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_X_SCALE_END] = pspec;
g_object_class_install_property (gobject_class,
PROP_X_SCALE_END,
pspec);
/**
* ClutterBehaviourScale:y-scale-start:
*
* The initial scaling factor on the Y axis for the actors.
*
* Since: 0.6
*
* Deprecated: 1.6
*/
pspec = g_param_spec_double ("y-scale-start",
P_("Y Start Scale"),
P_("Initial scale on the Y axis"),
0.0, G_MAXDOUBLE,
1.0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_Y_SCALE_START] = pspec;
g_object_class_install_property (gobject_class,
PROP_Y_SCALE_START,
pspec);
/**
* ClutterBehaviourScale:y-scale-end:
*
* The final scaling factor on the Y axis for the actors.
*
* Since: 0.6
*
* Deprecated: 1.6
*/
pspec = g_param_spec_double ("y-scale-end",
P_("Y End Scale"),
P_("Final scale on the Y axis"),
0.0, G_MAXDOUBLE,
1.0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_Y_SCALE_END] = pspec;
g_object_class_install_property (gobject_class,
PROP_Y_SCALE_END,
pspec);
behave_class->alpha_notify = clutter_behaviour_scale_alpha_notify;
}
static void
clutter_behaviour_scale_init (ClutterBehaviourScale *self)
{
ClutterBehaviourScalePrivate *priv;
self->priv = priv = clutter_behaviour_scale_get_instance_private (self);
priv->x_scale_start = priv->x_scale_end = 1.0;
priv->y_scale_start = priv->y_scale_end = 1.0;
}
/**
* clutter_behaviour_scale_new:
* @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
* @x_scale_start: initial scale factor on the X axis
* @y_scale_start: initial scale factor on the Y axis
* @x_scale_end: final scale factor on the X axis
* @y_scale_end: final scale factor on the Y axis
*
* Creates a new #ClutterBehaviourScale instance.
*
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
* of the #ClutterAlpha instance. In the case when @alpha is %NULL,
* it can be set later with clutter_behaviour_set_alpha().
*
* Return value: (transfer full): the newly created #ClutterBehaviourScale
*
* Since: 0.2
*
* Deprecated: 1.6
*/
ClutterBehaviour *
clutter_behaviour_scale_new (ClutterAlpha *alpha,
gdouble x_scale_start,
gdouble y_scale_start,
gdouble x_scale_end,
gdouble y_scale_end)
{
g_return_val_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha), NULL);
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_SCALE,
"alpha", alpha,
"x-scale-start", x_scale_start,
"y-scale-start", y_scale_start,
"x-scale-end", x_scale_end,
"y-scale-end", y_scale_end,
NULL);
}
/**
* clutter_behaviour_scale_set_bounds:
* @scale: a #ClutterBehaviourScale
* @x_scale_start: initial scale factor on the X axis
* @y_scale_start: initial scale factor on the Y axis
* @x_scale_end: final scale factor on the X axis
* @y_scale_end: final scale factor on the Y axis
*
* Sets the bounds used by scale behaviour.
*
* Since: 0.6
*
* Deprecated: 1.6
*/
void
clutter_behaviour_scale_set_bounds (ClutterBehaviourScale *scale,
gdouble x_scale_start,
gdouble y_scale_start,
gdouble x_scale_end,
gdouble y_scale_end)
{
ClutterBehaviourScalePrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_SCALE (scale));
priv = scale->priv;
g_object_freeze_notify (G_OBJECT (scale));
if (priv->x_scale_start != x_scale_start)
{
priv->x_scale_start = x_scale_start;
g_object_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_X_SCALE_START]);
}
if (priv->y_scale_start != y_scale_start)
{
priv->y_scale_start = y_scale_start;
g_object_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_Y_SCALE_START]);
}
if (priv->x_scale_end != x_scale_end)
{
priv->x_scale_end = x_scale_end;
g_object_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_X_SCALE_END]);
}
if (priv->y_scale_end != y_scale_end)
{
priv->y_scale_end = y_scale_end;
g_object_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_Y_SCALE_END]);
}
g_object_thaw_notify (G_OBJECT (scale));
}
/**
* clutter_behaviour_scale_get_bounds:
* @scale: a #ClutterBehaviourScale
* @x_scale_start: (out): return location for the initial scale factor on the X
* axis, or %NULL
* @y_scale_start: (out): return location for the initial scale factor on the Y
* axis, or %NULL
* @x_scale_end: (out): return location for the final scale factor on the X axis,
* or %NULL
* @y_scale_end: (out): return location for the final scale factor on the Y axis,
* or %NULL
*
* Retrieves the bounds used by scale behaviour.
*
* Since: 0.4
*
* Deprecated: 1.6
*/
void
clutter_behaviour_scale_get_bounds (ClutterBehaviourScale *scale,
gdouble *x_scale_start,
gdouble *y_scale_start,
gdouble *x_scale_end,
gdouble *y_scale_end)
{
ClutterBehaviourScalePrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_SCALE (scale));
priv = scale->priv;
if (x_scale_start)
*x_scale_start = priv->x_scale_start;
if (x_scale_end)
*x_scale_end = priv->x_scale_end;
if (y_scale_start)
*y_scale_start = priv->y_scale_start;
if (y_scale_end)
*y_scale_end = priv->y_scale_end;
}

View File

@ -1,107 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BEHAVIOUR_SCALE_H__
#define __CLUTTER_BEHAVIOUR_SCALE_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_BEHAVIOUR_SCALE (clutter_behaviour_scale_get_type ())
#define CLUTTER_BEHAVIOUR_SCALE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScale))
#define CLUTTER_BEHAVIOUR_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScaleClass))
#define CLUTTER_IS_BEHAVIOUR_SCALE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BEHAVIOUR_SCALE))
#define CLUTTER_IS_BEHAVIOUR_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BEHAVIOUR_SCALE))
#define CLUTTER_BEHAVIOUR_SCALE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScaleClass))
typedef struct _ClutterBehaviourScale ClutterBehaviourScale;
typedef struct _ClutterBehaviourScalePrivate ClutterBehaviourScalePrivate;
typedef struct _ClutterBehaviourScaleClass ClutterBehaviourScaleClass;
/**
* ClutterBehaviourScale:
*
* The #ClutterBehaviourScale struct contains only private data and
* should be accessed using the provided API
*
* Since: 0.2
*
* Deprecated: 1.6: Use clutter_actor_animate() with #ClutterActor:scale-x
* and #ClutterActor:scale-y instead.
*/
struct _ClutterBehaviourScale
{
/*< private >*/
ClutterBehaviour parent_instance;
ClutterBehaviourScalePrivate *priv;
};
/**
* ClutterBehaviourScaleClass:
*
* The #ClutterBehaviourScaleClass struct contains only private data
*
* Since: 0.2
*
* Deprecated: 1.6
*/
struct _ClutterBehaviourScaleClass
{
/*< private >*/
ClutterBehaviourClass parent_class;
};
CLUTTER_DEPRECATED
GType clutter_behaviour_scale_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_FOR(clutter_actor_animate with ClutterActor:scale-x and ClutterActor:scale-y)
ClutterBehaviour *clutter_behaviour_scale_new (ClutterAlpha *alpha,
gdouble x_scale_start,
gdouble y_scale_start,
gdouble x_scale_end,
gdouble y_scale_end);
CLUTTER_DEPRECATED
void clutter_behaviour_scale_set_bounds (ClutterBehaviourScale *scale,
gdouble x_scale_start,
gdouble y_scale_start,
gdouble x_scale_end,
gdouble y_scale_end);
CLUTTER_DEPRECATED
void clutter_behaviour_scale_get_bounds (ClutterBehaviourScale *scale,
gdouble *x_scale_start,
gdouble *y_scale_start,
gdouble *x_scale_end,
gdouble *y_scale_end);
G_END_DECLS
#endif /* __CLUTTER_BEHAVIOUR_SCALE_H__ */

View File

@ -1,657 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:clutter-behaviour
* @Title: ClutterBehaviour
* @short_description: Class for providing behaviours to actors
* @Deprecated: 1.6: Use clutter_actor_animate(), #ClutterAnimator or
* #ClutterState instead
*
* #ClutterBehaviour is the base class for implementing behaviours. A
* behaviour is a controller object for #ClutterActor<!-- -->s; you can
* use a behaviour to control one or more properties of an actor (such
* as its opacity, or its position). A #ClutterBehaviour is driven by
* an "alpha function" stored inside a #ClutterAlpha object; an alpha
* function is a function depending solely on time. The alpha function
* computes a value which is then applied to the properties of the
* actors driven by a behaviour.
*
* Clutter provides some pre-defined behaviours, like #ClutterBehaviourPath,
* which controls the position of a set of actors making them "walk" along
* a set of nodes; #ClutterBehaviourOpacity, which controls the opacity
* of a set of actors; #ClutterBehaviourScale, which controls the width
* and height of a set of actors.
*
* To visualize the effects of different alpha functions on a
* #ClutterBehaviour implementation it is possible to take the
* #ClutterBehaviourPath as an example:
*
* ![](path-alpha-func.png)
*
* The actors position between the path's end points directly correlates
* to the #ClutterAlpha's current alpha value driving the behaviour. With
* the #ClutterAlpha's function set to a linear ramp the actor
* will follow the path at a constant velocity, but when changing to
* a sine wave the actor initially accelerates before quickly
* decelerating.
*
* In order to implement a new behaviour you should subclass #ClutterBehaviour
* and override the "alpha_notify" virtual function; inside the overridden
* function you should obtain the alpha value from the #ClutterAlpha
* instance bound to the behaviour and apply it to the desiderd property
* (or properties) of every actor controlled by the behaviour.
*
* #ClutterBehaviour is available since Clutter 0.2.
*
* #ClutterBehaviour and its sub-classes have been discouraged sing Clutter
* 1.0, and formally deprecated since Clutter 1.6. You should use the
* [implicit animation][clutter-actor-animation] support inside #ClutterActor
* if you still have code using #ClutterBehaviour.
*/
#include "clutter-build-config.h"
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter-behaviour.h"
#include "clutter-alpha.h"
#include "clutter-debug.h"
#include "clutter-main.h"
#include "clutter-marshal.h"
#include "clutter-private.h"
#include "clutter-scriptable.h"
#include "clutter-script-private.h"
struct _ClutterBehaviourPrivate
{
ClutterAlpha *alpha;
guint notify_id;
GSList *actors;
};
enum
{
PROP_0,
PROP_ALPHA,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST];
enum
{
APPLIED,
REMOVED,
LAST_SIGNAL
};
static guint behave_signals[LAST_SIGNAL] = { 0 };
static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (ClutterBehaviour,
clutter_behaviour,
G_TYPE_OBJECT,
G_ADD_PRIVATE (ClutterBehaviour)
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
clutter_scriptable_iface_init))
static gboolean
clutter_behaviour_parse_custom_node (ClutterScriptable *scriptable,
ClutterScript *script,
GValue *value,
const gchar *name,
JsonNode *node)
{
if (strncmp (name, "alpha", 5) == 0)
{
GObject *alpha;
alpha = _clutter_script_parse_alpha (script, node);
if (alpha != NULL)
{
g_value_init (value, CLUTTER_TYPE_ALPHA);
g_value_set_object (value, alpha);
return TRUE;
}
}
return FALSE;
}
static void
clutter_scriptable_iface_init (ClutterScriptableIface *iface)
{
iface->parse_custom_node = clutter_behaviour_parse_custom_node;
}
static void
clutter_behaviour_dispose (GObject *gobject)
{
ClutterBehaviour *self = CLUTTER_BEHAVIOUR (gobject);
clutter_behaviour_set_alpha (self, NULL);
clutter_behaviour_remove_all (self);
G_OBJECT_CLASS (clutter_behaviour_parent_class)->dispose (gobject);
}
static void
clutter_behaviour_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterBehaviour *behaviour = CLUTTER_BEHAVIOUR (object);
switch (prop_id)
{
case PROP_ALPHA:
clutter_behaviour_set_alpha (behaviour, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterBehaviour *behaviour = CLUTTER_BEHAVIOUR (object);
ClutterBehaviourPrivate *priv = behaviour->priv;
switch (prop_id)
{
case PROP_ALPHA:
g_value_set_object (value, priv->alpha);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_alpha_notify_unimplemented (ClutterBehaviour *behaviour,
gdouble alpha_value)
{
g_warning ("ClutterBehaviourClass::alpha_notify not implemented for '%s'",
g_type_name (G_TYPE_FROM_INSTANCE (behaviour)));
}
static void
clutter_behaviour_class_init (ClutterBehaviourClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = clutter_behaviour_dispose;
object_class->set_property = clutter_behaviour_set_property;
object_class->get_property = clutter_behaviour_get_property;
/**
* ClutterBehaviour:alpha:
*
* The #ClutterAlpha object used to drive this behaviour. A #ClutterAlpha
* object binds a #ClutterTimeline and a function which computes a value
* (the "alpha") depending on the time. Each time the alpha value changes
* the alpha-notify virtual function is called.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
obj_props[PROP_ALPHA] =
g_param_spec_object ("alpha",
P_("Alpha"),
P_("Alpha Object to drive the behaviour"),
CLUTTER_TYPE_ALPHA,
CLUTTER_PARAM_READWRITE);
g_object_class_install_properties (object_class,
PROP_LAST,
obj_props);
klass->alpha_notify = clutter_behaviour_alpha_notify_unimplemented;
/**
* ClutterBehaviour::applied:
* @behaviour: the #ClutterBehaviour that received the signal
* @actor: the actor the behaviour was applied to.
*
* The ::apply signal is emitted each time the behaviour is applied
* to an actor.
*
* Since: 0.4
*
* Deprecated: 1.6
*/
behave_signals[APPLIED] =
g_signal_new ("applied",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterBehaviourClass, applied),
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
/**
* ClutterBehaviour::removed:
* @behaviour: the #ClutterBehaviour that received the signal
* @actor: the removed actor
*
* The ::removed signal is emitted each time a behaviour is not applied
* to an actor anymore.
*
* Since: 0.4
*
* Deprecated: 1.6
*/
behave_signals[REMOVED] =
g_signal_new ("removed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterBehaviourClass, removed),
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
}
static void
clutter_behaviour_init (ClutterBehaviour *self)
{
self->priv = clutter_behaviour_get_instance_private (self);
}
static void
remove_actor_on_destroy (ClutterActor *actor,
ClutterBehaviour *behaviour)
{
clutter_behaviour_remove (behaviour, actor);
}
/**
* clutter_behaviour_apply:
* @behave: a #ClutterBehaviour
* @actor: a #ClutterActor
*
* Applies @behave to @actor. This function adds a reference on
* the actor.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
void
clutter_behaviour_apply (ClutterBehaviour *behave,
ClutterActor *actor)
{
ClutterBehaviourPrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
priv = behave->priv;
if (g_slist_find (priv->actors, actor))
{
g_warning ("The behaviour of type %s already applies "
"to the actor of type %s",
g_type_name (G_OBJECT_TYPE (behave)),
g_type_name (G_OBJECT_TYPE (actor)));
return;
}
priv->actors = g_slist_append (priv->actors, g_object_ref (actor));
g_signal_connect (actor, "destroy",
G_CALLBACK (remove_actor_on_destroy),
behave);
g_signal_emit (behave, behave_signals[APPLIED], 0, actor);
}
/**
* clutter_behaviour_is_applied:
* @behave: a #ClutterBehaviour
* @actor: a #ClutterActor
*
* Check if @behave applied to @actor.
*
* Return value: TRUE if actor has behaviour. FALSE otherwise.
*
* Since: 0.4
*
* Deprecated: 1.6
*/
gboolean
clutter_behaviour_is_applied (ClutterBehaviour *behave,
ClutterActor *actor)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), FALSE);
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE);
return (g_slist_find (behave->priv->actors, actor) != NULL);
}
/**
* clutter_behaviour_remove:
* @behave: a #ClutterBehaviour
* @actor: a #ClutterActor
*
* Removes @actor from the list of #ClutterActor<!-- -->s to which
* @behave applies. This function removes a reference on the actor.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
void
clutter_behaviour_remove (ClutterBehaviour *behave,
ClutterActor *actor)
{
ClutterBehaviourPrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
priv = behave->priv;
if (!g_slist_find (priv->actors, actor))
{
g_warning ("The behaviour of type %s is not applied "
"to the actor of type %s",
g_type_name (G_OBJECT_TYPE (behave)),
g_type_name (G_OBJECT_TYPE (actor)));
return;
}
g_signal_handlers_disconnect_by_func (actor,
G_CALLBACK (remove_actor_on_destroy),
behave);
priv->actors = g_slist_remove (priv->actors, actor);
g_signal_emit (behave, behave_signals[REMOVED], 0, actor);
g_object_unref (actor);
}
/**
* clutter_behaviour_get_n_actors:
* @behave: a #ClutterBehaviour
*
* Gets the number of actors this behaviour is applied too.
*
* Return value: The number of applied actors
*
* Since: 0.2
*
* Deprecated: 1.6
*/
gint
clutter_behaviour_get_n_actors (ClutterBehaviour *behave)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), 0);
return g_slist_length (behave->priv->actors);
}
/**
* clutter_behaviour_get_nth_actor:
* @behave: a #ClutterBehaviour
* @index_: the index of an actor this behaviour is applied too.
*
* Gets an actor the behaviour was applied to referenced by index num.
*
* Return value: (transfer none): A Clutter actor or NULL if @index_ is invalid.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
ClutterActor *
clutter_behaviour_get_nth_actor (ClutterBehaviour *behave,
gint index_)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), NULL);
return g_slist_nth_data (behave->priv->actors, index_);
}
/**
* clutter_behaviour_actors_foreach:
* @behave: a #ClutterBehaviour
* @func: (scope call): a function called for each actor
* @data: optional data to be passed to the function, or %NULL
*
* Calls @func for every actor driven by @behave.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
void
clutter_behaviour_actors_foreach (ClutterBehaviour *behave,
ClutterBehaviourForeachFunc func,
gpointer data)
{
GSList *l;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
g_return_if_fail (func != NULL);
for (l = behave->priv->actors; l != NULL; l = l->next)
{
ClutterActor *actor = l->data;
g_assert (CLUTTER_IS_ACTOR (actor));
func (behave, actor, data);
}
}
/**
* clutter_behaviour_get_alpha:
* @behave: a #ClutterBehaviour
*
* Retrieves the #ClutterAlpha object bound to @behave.
*
* Return value: (transfer none): a #ClutterAlpha object, or %NULL if no alpha
* object has been bound to this behaviour.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
ClutterAlpha *
clutter_behaviour_get_alpha (ClutterBehaviour *behave)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), NULL);
return behave->priv->alpha;
}
static void
notify_cb (GObject *object,
GParamSpec *param_spec,
ClutterBehaviour *behave)
{
ClutterBehaviourClass *klass;
klass = CLUTTER_BEHAVIOUR_GET_CLASS (behave);
CLUTTER_NOTE (ANIMATION, "notify::alpha");
/* no actors, we can stop right here */
if (behave->priv->actors == NULL)
return;
if (klass->alpha_notify != NULL)
{
gdouble alpha_value = clutter_alpha_get_alpha (behave->priv->alpha);
CLUTTER_NOTE (ANIMATION, "calling %s::alpha_notify (%p, %.4f)",
g_type_name (G_TYPE_FROM_CLASS (klass)),
behave, alpha_value);
klass->alpha_notify (behave, alpha_value);
}
}
/**
* clutter_behaviour_set_alpha:
* @behave: a #ClutterBehaviour
* @alpha: a #ClutterAlpha or %NULL to unset a previously set alpha
*
* Binds @alpha to a #ClutterBehaviour. The #ClutterAlpha object
* is what makes a behaviour work: for each tick of the timeline
* used by #ClutterAlpha a new value of the alpha parameter is
* computed by the alpha function; the value should be used by
* the #ClutterBehaviour to update one or more properties of the
* actors to which the behaviour applies.
*
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
* of the #ClutterAlpha instance.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
void
clutter_behaviour_set_alpha (ClutterBehaviour *behave,
ClutterAlpha *alpha)
{
ClutterBehaviourPrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
g_return_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha));
priv = behave->priv;
if (priv->alpha == alpha)
return;
if (priv->notify_id)
{
CLUTTER_NOTE (ANIMATION, "removing previous notify-id (%d)",
priv->notify_id);
g_signal_handler_disconnect (priv->alpha, priv->notify_id);
priv->notify_id = 0;
}
if (priv->alpha != NULL)
{
CLUTTER_NOTE (ANIMATION, "removing previous alpha object");
g_object_unref (priv->alpha);
priv->alpha = NULL;
}
if (alpha != NULL)
{
priv->alpha = g_object_ref_sink (alpha);
priv->notify_id = g_signal_connect (priv->alpha, "notify::alpha",
G_CALLBACK(notify_cb),
behave);
CLUTTER_NOTE (ANIMATION, "setting new alpha object (%p, notify:%d)",
priv->alpha, priv->notify_id);
}
g_object_notify_by_pspec (G_OBJECT (behave), obj_props[PROP_ALPHA]);
}
/**
* clutter_behaviour_get_actors:
* @behave: a #ClutterBehaviour
*
* Retrieves all the actors to which @behave applies. It is not recommended
* for derived classes to use this in there alpha notify method but use
* #clutter_behaviour_actors_foreach as it avoids alot of needless allocations.
*
* Return value: (transfer container) (element-type Clutter.Actor): a list of
* actors. You should free the returned list with g_slist_free() when
* finished using it.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
GSList *
clutter_behaviour_get_actors (ClutterBehaviour *behave)
{
ClutterBehaviourPrivate *priv;
GSList *retval, *l;
g_return_val_if_fail (CLUTTER_BEHAVIOUR (behave), NULL);
priv = behave->priv;
retval = NULL;
for (l = priv->actors; l != NULL; l = l->next)
retval = g_slist_prepend (retval, l->data);
return g_slist_reverse (retval);
}
/**
* clutter_behaviour_remove_all:
* @behave: a #ClutterBehaviour
*
* Removes every actor from the list that @behave holds.
*
* Since: 0.4
*
* Deprecated: 1.6
*/
void
clutter_behaviour_remove_all (ClutterBehaviour *behave)
{
ClutterBehaviourPrivate *priv;
GSList *l;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
priv = behave->priv;
for (l = priv->actors; l != NULL; l = l->next)
{
ClutterActor *actor = l->data;
g_signal_emit (behave, behave_signals[REMOVED], 0, actor);
g_signal_handlers_disconnect_by_func (actor,
G_CALLBACK (remove_actor_on_destroy),
behave);
g_object_unref (actor);
}
g_slist_free (priv->actors);
priv->actors = NULL;
}

View File

@ -1,170 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BEHAVIOUR_H__
#define __CLUTTER_BEHAVIOUR_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_BEHAVIOUR clutter_behaviour_get_type()
#define CLUTTER_BEHAVIOUR(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviour))
#define CLUTTER_BEHAVIOUR_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviourClass))
#define CLUTTER_IS_BEHAVIOUR(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
CLUTTER_TYPE_BEHAVIOUR))
#define CLUTTER_IS_BEHAVIOUR_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CLUTTER_TYPE_BEHAVIOUR))
#define CLUTTER_BEHAVIOUR_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviourClass))
typedef struct _ClutterBehaviourPrivate ClutterBehaviourPrivate;
typedef struct _ClutterBehaviourClass ClutterBehaviourClass;
/**
* ClutterBehaviourForeachFunc:
* @behaviour: the #ClutterBehaviour
* @actor: an actor driven by @behaviour
* @data: (closure): optional data passed to the function
*
* This function is passed to clutter_behaviour_actors_foreach() and
* will be called for each actor driven by @behaviour.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
typedef void (*ClutterBehaviourForeachFunc) (ClutterBehaviour *behaviour,
ClutterActor *actor,
gpointer data);
/**
* ClutterBehaviour:
*
* #ClutterBehaviour-struct contains only private data and should
* be accessed with the functions below.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
struct _ClutterBehaviour
{
/*< private >*/
GObject parent;
ClutterBehaviourPrivate *priv;
};
/**
* ClutterBehaviourClass:
* @alpha_notify: virtual function, called each time the #ClutterAlpha
* computes a new alpha value; the actors to which the behaviour applies
* should be changed in this function. Every subclass of #ClutterBehaviour
* must implement this virtual function
* @applied: signal class handler for the ClutterBehaviour::applied signal
* @removed: signal class handler for the ClutterBehaviour::removed signal
*
* Base class for behaviours.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
struct _ClutterBehaviourClass
{
/*< private >*/
GObjectClass parent_class;
/*< public >*/
/* vfunc, not signal */
void (*alpha_notify) (ClutterBehaviour *behave,
gdouble alpha_value);
/* signals */
void (*applied) (ClutterBehaviour *behave,
ClutterActor *actor);
void (*removed) (ClutterBehaviour *behave,
ClutterActor *actor);
/*< private >*/
/* padding, for future expansion */
void (*_clutter_behaviour1) (void);
void (*_clutter_behaviour2) (void);
void (*_clutter_behaviour3) (void);
void (*_clutter_behaviour4) (void);
void (*_clutter_behaviour5) (void);
void (*_clutter_behaviour6) (void);
};
CLUTTER_DEPRECATED
GType clutter_behaviour_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED
void clutter_behaviour_apply (ClutterBehaviour *behave,
ClutterActor *actor);
CLUTTER_DEPRECATED
void clutter_behaviour_remove (ClutterBehaviour *behave,
ClutterActor *actor);
CLUTTER_DEPRECATED
void clutter_behaviour_remove_all (ClutterBehaviour *behave);
CLUTTER_DEPRECATED
void clutter_behaviour_actors_foreach (ClutterBehaviour *behave,
ClutterBehaviourForeachFunc func,
gpointer data);
CLUTTER_DEPRECATED
gint clutter_behaviour_get_n_actors (ClutterBehaviour *behave);
CLUTTER_DEPRECATED
ClutterActor *clutter_behaviour_get_nth_actor (ClutterBehaviour *behave,
gint index_);
CLUTTER_DEPRECATED
GSList * clutter_behaviour_get_actors (ClutterBehaviour *behave);
CLUTTER_DEPRECATED
ClutterAlpha *clutter_behaviour_get_alpha (ClutterBehaviour *behave);
CLUTTER_DEPRECATED
void clutter_behaviour_set_alpha (ClutterBehaviour *behave,
ClutterAlpha *alpha);
CLUTTER_DEPRECATED
gboolean clutter_behaviour_is_applied (ClutterBehaviour *behave,
ClutterActor *actor);
G_END_DECLS
#endif /* __CLUTTER_BEHAVIOUR_H__ */

View File

@ -298,7 +298,7 @@ clutter_group_real_pick (ClutterActor *actor)
/* Chain up so we get a bounding box pained (if we are reactive) */
CLUTTER_ACTOR_CLASS (clutter_group_parent_class)->pick (actor);
g_list_foreach (priv->children, (GFunc) clutter_actor_paint, NULL);
g_list_foreach (priv->children, (GFunc) clutter_actor_pick, NULL);
}
static void

View File

@ -1,87 +0,0 @@
#include "clutter-build-config.h"
#include "clutter-layout-manager.h"
/**
* clutter_layout_manager_begin_animation:
* @manager: a #ClutterLayoutManager
* @duration: the duration of the animation, in milliseconds
* @mode: the easing mode of the animation
*
* Begins an animation of @duration milliseconds, using the provided
* easing @mode
*
* The easing mode can be specified either as a #ClutterAnimationMode
* or as a logical id returned by clutter_alpha_register_func()
*
* The result of this function depends on the @manager implementation
*
* Return value: (transfer none): The #ClutterAlpha created by the
* layout manager; the returned instance is owned by the layout
* manager and should not be unreferenced
*
* Since: 1.2
*
* Deprecated: 1.12
*/
ClutterAlpha *
clutter_layout_manager_begin_animation (ClutterLayoutManager *manager,
guint duration,
gulong mode)
{
ClutterLayoutManagerClass *klass;
g_return_val_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager), NULL);
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
return klass->begin_animation (manager, duration, mode);
}
/**
* clutter_layout_manager_end_animation:
* @manager: a #ClutterLayoutManager
*
* Ends an animation started by clutter_layout_manager_begin_animation()
*
* The result of this call depends on the @manager implementation
*
* Since: 1.2
*
* Deprecated: 1.12
*/
void
clutter_layout_manager_end_animation (ClutterLayoutManager *manager)
{
g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager)->end_animation (manager);
}
/**
* clutter_layout_manager_get_animation_progress:
* @manager: a #ClutterLayoutManager
*
* Retrieves the progress of the animation, if one has been started by
* clutter_layout_manager_begin_animation()
*
* The returned value has the same semantics of the #ClutterAlpha:alpha
* value
*
* Return value: the progress of the animation
*
* Since: 1.2
*
* Deprecated: 1.12
*/
gdouble
clutter_layout_manager_get_animation_progress (ClutterLayoutManager *manager)
{
ClutterLayoutManagerClass *klass;
g_return_val_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager), 1.0);
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
return klass->get_animation_progress (manager);
}

View File

@ -1595,67 +1595,6 @@ clutter_texture_set_from_rgb_data (ClutterTexture *texture,
error);
}
/**
* clutter_texture_set_from_yuv_data:
* @texture: A #ClutterTexture
* @data: (array): Image data in YUV type colorspace.
* @width: Width in pixels of image data.
* @height: Height in pixels of image data
* @flags: #ClutterTextureFlags
* @error: Return location for a #GError, or %NULL.
*
* Sets a #ClutterTexture from YUV image data. If an error occurred,
* %FALSE is returned and @error is set.
*
* The YUV support depends on the driver; the format supported by the
* few drivers exposing this capability are not really useful.
*
* The proper way to convert image data in any YUV colorspace to any
* RGB colorspace is to use a fragment shader associated with the
* #ClutterTexture material.
*
* Return value: %TRUE if the texture was successfully updated
*
* Since: 0.4
*
* Deprecated: 1.10: Use a custom #ClutterContent implementation and
* set up the Cogl pipeline using a #ClutterPipelineNode with a
* fragment shader instead.
*/
gboolean
clutter_texture_set_from_yuv_data (ClutterTexture *texture,
const guchar *data,
gint width,
gint height,
ClutterTextureFlags flags,
GError **error)
{
g_return_val_if_fail (CLUTTER_IS_TEXTURE (texture), FALSE);
if (!clutter_feature_available (CLUTTER_FEATURE_TEXTURE_YUV))
{
g_set_error (error, CLUTTER_TEXTURE_ERROR,
CLUTTER_TEXTURE_ERROR_NO_YUV,
"YUV textures are not supported");
return FALSE;
}
/* Convert the flags to a CoglPixelFormat */
if ((flags & CLUTTER_TEXTURE_YUV_FLAG_YUV2))
{
g_set_error (error, CLUTTER_TEXTURE_ERROR,
CLUTTER_TEXTURE_ERROR_BAD_FORMAT,
"YUV2 textures are not supported");
return FALSE;
}
return clutter_texture_set_from_data (texture, data,
COGL_PIXEL_FORMAT_YUV,
width, height,
width * 3, 3,
error);
}
/*
* clutter_texture_async_load_complete:
* @self: a #ClutterTexture

View File

@ -123,14 +123,6 @@ gboolean clutter_texture_get_pick_with_alpha (ClutterTexture
CLUTTER_DEPRECATED_FOR(ClutterOffscreenEffect)
ClutterActor * clutter_texture_new_from_actor (ClutterActor *actor);
CLUTTER_DEPRECATED
gboolean clutter_texture_set_from_yuv_data (ClutterTexture *texture,
const guchar *data,
gint width,
gint height,
ClutterTextureFlags flags,
GError **error);
G_END_DECLS
#endif /* __CLUTTER_TEXTURE_DEPRECATED_H__ */

View File

@ -222,10 +222,6 @@ clutter_deprecated_headers = [
'deprecated/clutter-alpha.h',
'deprecated/clutter-animatable.h',
'deprecated/clutter-animation.h',
'deprecated/clutter-behaviour.h',
'deprecated/clutter-behaviour-depth.h',
'deprecated/clutter-behaviour-opacity.h',
'deprecated/clutter-behaviour-scale.h',
'deprecated/clutter-bin-layout.h',
'deprecated/clutter-box.h',
'deprecated/clutter-cairo-texture.h',
@ -244,14 +240,9 @@ clutter_deprecated_headers = [
clutter_deprecated_sources = [
'deprecated/clutter-alpha.c',
'deprecated/clutter-animation.c',
'deprecated/clutter-behaviour.c',
'deprecated/clutter-behaviour-depth.c',
'deprecated/clutter-behaviour-opacity.c',
'deprecated/clutter-behaviour-scale.c',
'deprecated/clutter-box.c',
'deprecated/clutter-cairo-texture.c',
'deprecated/clutter-group.c',
'deprecated/clutter-layout-manager-deprecated.c',
'deprecated/clutter-rectangle.c',
'deprecated/clutter-state.c',
'deprecated/clutter-table-layout.c',

View File

@ -276,6 +276,7 @@ emit_vertex_buffer_geometry (CoglFramebuffer *fb,
gboolean allocated = FALSE;
CoglAttribute *attributes[2];
CoglPrimitive *prim;
CoglIndices *indices;
int i;
n_verts = node->d.texture.rectangles->len * 4;
@ -354,22 +355,11 @@ emit_vertex_buffer_geometry (CoglFramebuffer *fb,
attributes,
2 /* n_attributes */);
#ifdef CLUTTER_COGL_HAS_GL
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUADS))
cogl_primitive_set_mode (prim, GL_QUADS);
else
#endif
{
/* GLES doesn't support GL_QUADS so instead we use a VBO
with indexed vertices to generate GL_TRIANGLES from the
quads */
indices =
cogl_get_rectangle_indices (ctx, node->d.texture.rectangles->len);
CoglIndices *indices =
cogl_get_rectangle_indices (ctx, node->d.texture.rectangles->len);
cogl_primitive_set_indices (prim, indices,
node->d.texture.rectangles->len * 6);
}
cogl_primitive_set_indices (prim, indices,
node->d.texture.rectangles->len * 6);
node->d.texture.primitive = prim;

View File

@ -729,18 +729,6 @@ allocate_space (CoglAtlasTexture *atlas_tex,
return FALSE;
}
/* If we can't use FBOs then it will be too slow to migrate textures
and we shouldn't use the atlas */
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN))
{
g_set_error_literal (error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_UNSUPPORTED,
"Atlasing disabled because migrations "
"would be too slow");
return FALSE;
}
/* Look for an existing atlas that can hold the texture */
for (l = ctx->atlases; l; l = l->next)
{
@ -1034,6 +1022,5 @@ cogl_atlas_texture_vtable =
_cogl_atlas_texture_gl_flush_legacy_texobj_wrap_modes,
_cogl_atlas_texture_get_format,
_cogl_atlas_texture_get_gl_format,
NULL, /* is_foreign */
NULL /* set_auto_mipmap */
};

View File

@ -42,7 +42,6 @@
#include "cogl-framebuffer-private.h"
#include "cogl-blit.h"
#include "cogl-private.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
#include <stdlib.h>

View File

@ -46,10 +46,6 @@
#include "cogl-indices-private.h"
#include "cogl-private.h"
#include "cogl-gtype-private.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
#ifdef COGL_PIPELINE_PROGEND_GLSL
#include "driver/gl/cogl-pipeline-progend-glsl-private.h"
#endif
#include <string.h>
#include <stdio.h>

View File

@ -177,24 +177,6 @@ _cogl_bitmap_map (CoglBitmap *bitmap,
void
_cogl_bitmap_unmap (CoglBitmap *bitmap);
/* These two are replacements for map and unmap that should used when
* the pointer is going to be passed to GL for pixel packing or
* unpacking. The address might not be valid for reading if the bitmap
* was created with new_from_buffer but it will however be good to
* pass to glTexImage2D for example. The access should be READ for
* unpacking and WRITE for packing. It can not be both
*
* TODO: split this bind/unbind functions out into a GL specific file
*/
uint8_t *
_cogl_bitmap_gl_bind (CoglBitmap *bitmap,
CoglBufferAccess access,
CoglBufferMapHint hints,
GError **error);
void
_cogl_bitmap_gl_unbind (CoglBitmap *bitmap);
CoglContext *
_cogl_bitmap_get_context (CoglBitmap *bitmap);

View File

@ -38,7 +38,6 @@
#include "cogl-pixel-buffer.h"
#include "cogl-context-private.h"
#include "cogl-gtype-private.h"
#include "driver/gl/cogl-buffer-gl-private.h"
#include <string.h>
@ -443,86 +442,6 @@ _cogl_bitmap_unmap (CoglBitmap *bitmap)
cogl_buffer_unmap (bitmap->buffer);
}
uint8_t *
_cogl_bitmap_gl_bind (CoglBitmap *bitmap,
CoglBufferAccess access,
CoglBufferMapHint hints,
GError **error)
{
uint8_t *ptr;
GError *internal_error = NULL;
g_return_val_if_fail (access & (COGL_BUFFER_ACCESS_READ |
COGL_BUFFER_ACCESS_WRITE),
NULL);
/* Divert to another bitmap if this data is shared */
if (bitmap->shared_bmp)
return _cogl_bitmap_gl_bind (bitmap->shared_bmp, access, hints, error);
g_return_val_if_fail (!bitmap->bound, NULL);
/* If the bitmap wasn't created from a buffer then the
implementation of bind is the same as map */
if (bitmap->buffer == NULL)
{
uint8_t *data = _cogl_bitmap_map (bitmap, access, hints, error);
if (data)
bitmap->bound = TRUE;
return data;
}
if (access == COGL_BUFFER_ACCESS_READ)
ptr = _cogl_buffer_gl_bind (bitmap->buffer,
COGL_BUFFER_BIND_TARGET_PIXEL_UNPACK,
&internal_error);
else if (access == COGL_BUFFER_ACCESS_WRITE)
ptr = _cogl_buffer_gl_bind (bitmap->buffer,
COGL_BUFFER_BIND_TARGET_PIXEL_PACK,
&internal_error);
else
{
ptr = NULL;
g_assert_not_reached ();
return NULL;
}
/* NB: _cogl_buffer_gl_bind() may return NULL in non-error
* conditions so we have to explicitly check internal_error to see
* if an exception was thrown */
if (internal_error)
{
g_propagate_error (error, internal_error);
return NULL;
}
bitmap->bound = TRUE;
/* The data pointer actually stores the offset */
return ptr + GPOINTER_TO_INT (bitmap->data);
}
void
_cogl_bitmap_gl_unbind (CoglBitmap *bitmap)
{
/* Divert to another bitmap if this data is shared */
if (bitmap->shared_bmp)
{
_cogl_bitmap_gl_unbind (bitmap->shared_bmp);
return;
}
g_assert (bitmap->bound);
bitmap->bound = FALSE;
/* If the bitmap wasn't created from a pixel array then the
implementation of unbind is the same as unmap */
if (bitmap->buffer)
_cogl_buffer_gl_unbind (bitmap->buffer);
else
_cogl_bitmap_unmap (bitmap);
}
CoglContext *
_cogl_bitmap_get_context (CoglBitmap *bitmap)
{

View File

@ -216,16 +216,6 @@ validate_blend_statements (CoglBlendStringStatement *statements,
_COGL_GET_CONTEXT (ctx, 0);
if (n_statements == 2 &&
!ctx->glBlendEquationSeparate &&
statements[0].function->type != statements[1].function->type)
{
error_string = "Separate blend functions for the RGB an A "
"channels isn't supported by the driver";
detail = COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR;
goto error;
}
for (i = 0; i < n_statements; i++)
for (j = 0; j < statements[i].function->argc; j++)
{
@ -245,17 +235,6 @@ validate_blend_statements (CoglBlendStringStatement *statements,
"for arg0 and DST_COLOR for arg1";
goto error;
}
if (!_cogl_has_private_feature (ctx,
COGL_PRIVATE_FEATURE_BLEND_CONSTANT) &&
arg->factor.is_color &&
(arg->factor.source.info->type ==
COGL_BLEND_STRING_COLOR_SOURCE_CONSTANT))
{
error_string = "Driver doesn't support constant blend factors";
detail = COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR;
goto error;
}
}
return TRUE;

View File

@ -137,12 +137,6 @@ _cogl_buffer_initialize (CoglBuffer *buffer,
if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_PBOS))
use_malloc = TRUE;
}
else if (default_target == COGL_BUFFER_BIND_TARGET_ATTRIBUTE_BUFFER ||
default_target == COGL_BUFFER_BIND_TARGET_INDEX_BUFFER)
{
if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_VBOS))
use_malloc = TRUE;
}
if (use_malloc)
{

View File

@ -49,7 +49,6 @@
#include "cogl1-context.h"
#include "cogl-offscreen.h"
#include "cogl-matrix-stack.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
static void *
_cogl_clip_stack_push_entry (CoglClipStack *clip_stack,

View File

@ -1,133 +0,0 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2011 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
*/
#include "cogl-config.h"
#include "cogl-debug.h"
#include "cogl-config-private.h"
#include <glib.h>
char *_cogl_config_driver;
char *_cogl_config_renderer;
char *_cogl_config_disable_gl_extensions;
char *_cogl_config_override_gl_version;
/* Array of config options that just set a global string */
static const struct
{
const char *conf_name;
char **variable;
} cogl_config_string_options[] =
{
{ "COGL_DRIVER", &_cogl_config_driver },
{ "COGL_RENDERER", &_cogl_config_renderer },
{ "COGL_DISABLE_GL_EXTENSIONS", &_cogl_config_disable_gl_extensions },
{ "COGL_OVERRIDE_GL_VERSION", &_cogl_config_override_gl_version }
};
static void
_cogl_config_process (GKeyFile *key_file)
{
char *value;
int i;
value = g_key_file_get_string (key_file, "global", "COGL_DEBUG", NULL);
if (value)
{
_cogl_parse_debug_string (value,
TRUE /* enable the flags */,
TRUE /* ignore help option */);
g_free (value);
}
value = g_key_file_get_string (key_file, "global", "COGL_NO_DEBUG", NULL);
if (value)
{
_cogl_parse_debug_string (value,
FALSE /* disable the flags */,
TRUE /* ignore help option */);
g_free (value);
}
for (i = 0; i < G_N_ELEMENTS (cogl_config_string_options); i++)
{
const char *conf_name = cogl_config_string_options[i].conf_name;
char **variable = cogl_config_string_options[i].variable;
value = g_key_file_get_string (key_file, "global", conf_name, NULL);
if (value)
{
g_free (*variable);
*variable = value;
}
}
}
void
_cogl_config_read (void)
{
GKeyFile *key_file = g_key_file_new ();
const char * const *system_dirs = g_get_system_config_dirs ();
char *filename;
gboolean status = FALSE;
int i;
for (i = 0; system_dirs[i]; i++)
{
filename = g_build_filename (system_dirs[i], "cogl", "cogl.conf", NULL);
status = g_key_file_load_from_file (key_file,
filename,
0,
NULL);
g_free (filename);
if (status)
{
_cogl_config_process (key_file);
g_key_file_free (key_file);
key_file = g_key_file_new ();
break;
}
}
filename = g_build_filename (g_get_user_config_dir (), "cogl", "cogl.conf", NULL);
status = g_key_file_load_from_file (key_file,
filename,
0,
NULL);
g_free (filename);
if (status)
_cogl_config_process (key_file);
g_key_file_free (key_file);
}

View File

@ -97,7 +97,6 @@ struct _CoglContext
/* Features cache */
unsigned long features[COGL_FLAGS_N_LONGS_FOR_SIZE (_COGL_N_FEATURE_IDS)];
CoglFeatureFlags feature_flags; /* legacy/deprecated feature flags */
unsigned long private_features
[COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_N_PRIVATE_FEATURES)];
@ -293,7 +292,6 @@ struct _CoglContext
* the eglx backend doesn't yet have a corresponding Cogl winsys
* and so we wont have a renderer in that case. */
#ifdef COGL_HAS_XLIB_SUPPORT
int damage_base;
/* List of callback functions that will be given every Xlib event */
GSList *event_filters;
/* Current top of the XError trap state stack. The actual memory for

View File

@ -46,14 +46,10 @@
#include "cogl-attribute-private.h"
#include "cogl1-context.h"
#include "cogl-gpu-info-private.h"
#include "cogl-config-private.h"
#include "cogl-gtype-private.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
#include "driver/gl/cogl-util-gl-private.h"
#include "winsys/cogl-winsys-private.h"
#include "winsys/cogl-winsys-stub-private.h"
#include "deprecated/cogl-framebuffer-deprecated.h"
#include <string.h>
#include <stdlib.h>
@ -98,9 +94,6 @@ static CoglContext *_cogl_context = NULL;
static void
_cogl_init_feature_overrides (CoglContext *ctx)
{
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_VBOS)))
COGL_FLAGS_SET (ctx->private_features, COGL_PRIVATE_FEATURE_VBOS, FALSE);
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_PBOS)))
COGL_FLAGS_SET (ctx->private_features, COGL_PRIVATE_FEATURE_PBOS, FALSE);
}
@ -166,7 +159,6 @@ cogl_context_new (CoglDisplay *display,
/* Init default values */
memset (context->features, 0, sizeof (context->features));
context->feature_flags = 0;
memset (context->private_features, 0, sizeof (context->private_features));
memset (context->winsys_features, 0, sizeof (context->winsys_features));
@ -331,17 +323,6 @@ cogl_context_new (CoglDisplay *display,
context->window_buffer = NULL;
context->framebuffer_stack = _cogl_create_framebuffer_stack ();
/* XXX: In this case the Clutter backend is still responsible for
* the OpenGL binding API and for creating onscreen framebuffers and
* so we have to add a dummy framebuffer to represent the backend
* owned window... */
if (_cogl_context_get_winsys (context) == _cogl_winsys_stub_get_vtable ())
{
CoglOnscreen *window = _cogl_onscreen_new ();
cogl_set_framebuffer (COGL_FRAMEBUFFER (window));
cogl_object_unref (COGL_FRAMEBUFFER (window));
}
context->current_path = NULL;
context->stencil_pipeline = cogl_pipeline_new (context);
@ -411,8 +392,7 @@ cogl_context_new (CoglDisplay *display,
pipeline to track whether any layers have point sprite coords
enabled. We don't need to do this for GL3 or GLES2 because point
sprites are handled using a builtin varying in the shader. */
if (_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_GL_FIXED) &&
cogl_has_feature (context, COGL_FEATURE_ID_POINT_SPRITE))
if (_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_GL_FIXED))
GE (context, glEnable (GL_POINT_SPRITE));
_cogl_list_init (&context->fences);
@ -609,11 +589,9 @@ _cogl_context_get_gl_extensions (CoglContext *context)
ret = g_strsplit (all_extensions, " ", 0 /* max tokens */);
}
if ((env_disabled_extensions = g_getenv ("COGL_DISABLE_GL_EXTENSIONS"))
|| _cogl_config_disable_gl_extensions)
if ((env_disabled_extensions = g_getenv ("COGL_DISABLE_GL_EXTENSIONS")))
{
char **split_env_disabled_extensions;
char **split_conf_disabled_extensions;
char **src, **dst;
if (env_disabled_extensions)
@ -624,14 +602,6 @@ _cogl_context_get_gl_extensions (CoglContext *context)
else
split_env_disabled_extensions = NULL;
if (_cogl_config_disable_gl_extensions)
split_conf_disabled_extensions =
g_strsplit (_cogl_config_disable_gl_extensions,
",",
0 /* no max tokens */);
else
split_conf_disabled_extensions = NULL;
for (dst = ret, src = ret;
*src;
src++)
@ -642,10 +612,6 @@ _cogl_context_get_gl_extensions (CoglContext *context)
for (d = split_env_disabled_extensions; *d; d++)
if (!strcmp (*src, *d))
goto disabled;
if (split_conf_disabled_extensions)
for (d = split_conf_disabled_extensions; *d; d++)
if (!strcmp (*src, *d))
goto disabled;
*(dst++) = *src;
continue;
@ -659,8 +625,6 @@ _cogl_context_get_gl_extensions (CoglContext *context)
if (split_env_disabled_extensions)
g_strfreev (split_env_disabled_extensions);
if (split_conf_disabled_extensions)
g_strfreev (split_conf_disabled_extensions);
}
return ret;
@ -673,8 +637,6 @@ _cogl_context_get_gl_version (CoglContext *context)
if ((version_override = g_getenv ("COGL_OVERRIDE_GL_VERSION")))
return version_override;
else if (_cogl_config_override_gl_version)
return _cogl_config_override_gl_version;
else
return (const char *) context->glGetString (GL_VERSION);

View File

@ -177,33 +177,19 @@ cogl_is_context (void *object);
* @COGL_FEATURE_ID_TEXTURE_RG: Support for
* %COGL_TEXTURE_COMPONENTS_RG as the internal components of a
* texture.
* @COGL_FEATURE_ID_OFFSCREEN: Offscreen rendering support
* @COGL_FEATURE_ID_OFFSCREEN_MULTISAMPLE: Multisample support for
* offscreen framebuffers
* @COGL_FEATURE_ID_ONSCREEN_MULTIPLE: Multiple onscreen framebuffers
* supported.
* @COGL_FEATURE_ID_UNSIGNED_INT_INDICES: Set if
* %COGL_INDICES_TYPE_UNSIGNED_INT is supported in
* cogl_indices_new().
* @COGL_FEATURE_ID_DEPTH_RANGE: cogl_pipeline_set_depth_range() support
* @COGL_FEATURE_ID_POINT_SPRITE: Whether
* cogl_pipeline_set_layer_point_sprite_coords_enabled() is supported.
* @COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE: Whether cogl_point_size_in
* can be used as an attribute to set a per-vertex point size.
* @COGL_FEATURE_ID_MAP_BUFFER_FOR_READ: Whether cogl_buffer_map() is
* supported with CoglBufferAccess including read support.
* @COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE: Whether cogl_buffer_map() is
* supported with CoglBufferAccess including write support.
* @COGL_FEATURE_ID_MIRRORED_REPEAT: Whether
* %COGL_PIPELINE_WRAP_MODE_MIRRORED_REPEAT is supported.
* @COGL_FEATURE_ID_SWAP_BUFFERS_EVENT:
* Available if the window system supports reporting an event
* for swap buffer completions.
* @COGL_FEATURE_ID_BUFFER_AGE: Available if the age of #CoglOnscreen back
* buffers are tracked and so cogl_onscreen_get_buffer_age() can be
* expected to return age values other than 0.
* @COGL_FEATURE_ID_DEPTH_TEXTURE: Whether #CoglFramebuffer support rendering
* the depth buffer to a texture.
* @COGL_FEATURE_ID_PRESENTATION_TIME: Whether frame presentation
* time stamps will be recorded in #CoglFrameInfo objects.
*
@ -215,20 +201,12 @@ cogl_is_context (void *object);
*/
typedef enum _CoglFeatureID
{
COGL_FEATURE_ID_OFFSCREEN,
COGL_FEATURE_ID_OFFSCREEN_MULTISAMPLE,
COGL_FEATURE_ID_ONSCREEN_MULTIPLE,
COGL_FEATURE_ID_UNSIGNED_INT_INDICES,
COGL_FEATURE_ID_DEPTH_RANGE,
COGL_FEATURE_ID_POINT_SPRITE,
COGL_FEATURE_ID_MAP_BUFFER_FOR_READ,
COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE,
COGL_FEATURE_ID_MIRRORED_REPEAT,
COGL_FEATURE_ID_SWAP_BUFFERS_EVENT,
COGL_FEATURE_ID_DEPTH_TEXTURE,
COGL_FEATURE_ID_PRESENTATION_TIME,
COGL_FEATURE_ID_FENCE,
COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE,
COGL_FEATURE_ID_TEXTURE_RG,
COGL_FEATURE_ID_BUFFER_AGE,
COGL_FEATURE_ID_TEXTURE_EGL_IMAGE_EXTERNAL,

View File

@ -94,11 +94,6 @@ OPT (DISABLE_BATCHING,
"disable-batching",
N_("Disable Journal batching"),
N_("Disable batching of geometry in the Cogl Journal."))
OPT (DISABLE_VBOS,
N_("Root Cause"),
"disable-vbos",
N_("Disable GL Vertex Buffers"),
N_("Disable use of OpenGL vertex buffer objects"))
OPT (DISABLE_PBOS,
N_("Root Cause"),
"disable-pbos",

View File

@ -70,7 +70,6 @@ static const int n_cogl_log_debug_keys =
static const GDebugKey cogl_behavioural_debug_keys[] = {
{ "rectangles", COGL_DEBUG_RECTANGLES },
{ "disable-batching", COGL_DEBUG_DISABLE_BATCHING },
{ "disable-vbos", COGL_DEBUG_DISABLE_VBOS },
{ "disable-pbos", COGL_DEBUG_DISABLE_PBOS },
{ "disable-software-transform", COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM },
{ "dump-atlas-image", COGL_DEBUG_DUMP_ATLAS_IMAGE },

View File

@ -49,7 +49,6 @@ typedef enum
COGL_DEBUG_OBJECT,
COGL_DEBUG_BLEND_STRINGS,
COGL_DEBUG_DISABLE_BATCHING,
COGL_DEBUG_DISABLE_VBOS,
COGL_DEBUG_DISABLE_PBOS,
COGL_DEBUG_JOURNAL,
COGL_DEBUG_BATCHING,

View File

@ -1,43 +0,0 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2008,2009 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
*/
#ifndef COGL_DEPRECATED_H
#define cogl_color cogl_color_REPLACED_BY_cogl_set_source_color
#define cogl_enable_depth_test cogl_enable_depth_test_RENAMED_TO_cogl_set_depth_test_enabled
#define cogl_enable_backface_culling cogl_enable_backface_culling_RENAMED_TO_cogl_set_backface_culling_enabled
#define cogl_texture_rectangle cogl_texture_rectangle_REPLACE_BY_cogl_set_source_texture_AND_cogl_rectangle_with_texture_coords
#define cogl_texture_multiple_rectangles cogl_texture_multiple_rectangles_REPLACED_BY_cogl_set_source_texture_AND_cogl_rectangles_with_texture_coords
#define cogl_texture_polygon cogl_texture_polygon_REPLACED_BY_cogl_set_source_texture_AND_cogl_polygon
#endif

View File

@ -225,13 +225,6 @@ cogl_depth_state_get_test_function (CoglDepthState *state);
* mapped too although the range must still lye within the range [0,
* 1].
*
* If your driver does not support this feature (for example you are
* using GLES 1 drivers) then if you don't use the default range
* values you will get an error reported when calling
* cogl_pipeline_set_depth_state (). You can check ahead of time for
* the %COGL_FEATURE_ID_DEPTH_RANGE feature with
* cogl_has_feature() to know if this function will succeed.
*
* By default normalized device coordinate depth values are mapped to
* the full range of depth buffer values, [0, 1].
*

View File

@ -79,25 +79,14 @@ G_BEGIN_DECLS
EGLDisplay
cogl_egl_context_get_egl_display (CoglContext *context);
/**
* cogl_egl_context_get_egl_context:
* @context: A #CoglContext pointer
*
* If you have done a runtime check to determine that Cogl is using
* EGL internally then this API can be used to retrieve the EGLContext
* handle that was setup internally. The result is undefined if Cogl
* is not using EGL.
*
* Note: The current window system backend can be checked using
* cogl_renderer_get_winsys_id().
*
* Return value: The internally setup EGLDisplay handle.
* Since: 1.18
* Stability: unstable
*/
EGLContext
cogl_egl_context_get_egl_context (CoglContext *context);
gboolean cogl_egl_init_thread (void);
EGLContext
cogl_egl_create_context (EGLDisplay display,
EGLConfig config,
EGLContext shared_context,
const EGLint *attrib_list,
GError **error);
G_END_DECLS

View File

@ -196,7 +196,7 @@ error:
gles_availability, \
namespaces, extension_names) \
{ min_gl_major, min_gl_minor, gles_availability, namespaces, \
extension_names, 0, 0, 0, \
extension_names, 0, 0, \
cogl_ext_ ## name ## _funcs },
#undef COGL_EXT_FUNCTION
#define COGL_EXT_FUNCTION(ret, name, args)

View File

@ -77,8 +77,6 @@ struct _CoglFeatureData
extension is different from the namespace, you can specify it
with a ':' after the namespace */
const char *extension_names;
/* A set of feature flags to enable if the extension is available */
CoglFeatureFlags feature_flags;
/* A set of private feature flags to enable if the extension is
* available */
int feature_flags_private;

View File

@ -60,7 +60,6 @@ typedef struct
CoglSwapChain *swap_chain;
gboolean need_stencil;
int samples_per_pixel;
gboolean depth_texture_enabled;
gboolean stereo_enabled;
} CoglFramebufferConfig;

View File

@ -52,7 +52,6 @@
#include "cogl-private.h"
#include "cogl-primitives-private.h"
#include "cogl-gtype-private.h"
#include "driver/gl/cogl-texture-gl-private.h"
#include "winsys/cogl-winsys-private.h"
extern CoglObjectClass _cogl_onscreen_class;
@ -706,15 +705,6 @@ cogl_framebuffer_allocate (CoglFramebuffer *framebuffer,
if (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN)
{
if (framebuffer->config.depth_texture_enabled)
{
g_set_error_literal (error, COGL_FRAMEBUFFER_ERROR,
COGL_FRAMEBUFFER_ERROR_ALLOCATE,
"Can't allocate onscreen framebuffer with a "
"texture based depth buffer");
return FALSE;
}
if (!winsys->onscreen_init (onscreen, error))
return FALSE;
@ -729,14 +719,6 @@ cogl_framebuffer_allocate (CoglFramebuffer *framebuffer,
{
CoglOffscreen *offscreen = COGL_OFFSCREEN (framebuffer);
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN))
{
g_set_error_literal (error, COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_UNSUPPORTED,
"Offscreen framebuffers not supported by system");
return FALSE;
}
if (!cogl_texture_allocate (offscreen->texture, error))
return FALSE;
@ -1058,32 +1040,6 @@ cogl_framebuffer_set_dither_enabled (CoglFramebuffer *framebuffer,
framebuffer->dither_enabled = dither_enabled;
}
void
cogl_framebuffer_set_depth_texture_enabled (CoglFramebuffer *framebuffer,
gboolean enabled)
{
g_return_if_fail (!framebuffer->allocated);
framebuffer->config.depth_texture_enabled = enabled;
}
gboolean
cogl_framebuffer_get_depth_texture_enabled (CoglFramebuffer *framebuffer)
{
return framebuffer->config.depth_texture_enabled;
}
CoglTexture *
cogl_framebuffer_get_depth_texture (CoglFramebuffer *framebuffer)
{
/* lazily allocate the framebuffer... */
if (!cogl_framebuffer_allocate (framebuffer, NULL))
return NULL;
g_return_val_if_fail (cogl_is_offscreen (framebuffer), NULL);
return COGL_OFFSCREEN(framebuffer)->depth_texture;
}
int
cogl_framebuffer_get_samples_per_pixel (CoglFramebuffer *framebuffer)
{

View File

@ -837,65 +837,6 @@ void
cogl_framebuffer_set_stereo_mode (CoglFramebuffer *framebuffer,
CoglStereoMode stereo_mode);
/**
* cogl_framebuffer_set_depth_texture_enabled:
* @framebuffer: A #CoglFramebuffer
* @enabled: TRUE or FALSE
*
* If @enabled is #TRUE, the depth buffer used when rendering to @framebuffer
* is available as a texture. You can retrieve the texture with
* cogl_framebuffer_get_depth_texture().
*
* <note>It's possible that your GPU does not support depth textures. You
* should check the %COGL_FEATURE_ID_DEPTH_TEXTURE feature before using this
* function.</note>
* <note>It's not valid to call this function after the framebuffer has been
* allocated as the creation of the depth texture is done at allocation time.
* </note>
*
* Since: 1.14
* Stability: unstable
*/
void
cogl_framebuffer_set_depth_texture_enabled (CoglFramebuffer *framebuffer,
gboolean enabled);
/**
* cogl_framebuffer_get_depth_texture_enabled:
* @framebuffer: A #CoglFramebuffer
*
* Queries whether texture based depth buffer has been enabled via
* cogl_framebuffer_set_depth_texture_enabled().
*
* Return value: %TRUE if a depth texture has been enabled, else
* %FALSE.
*
* Since: 1.14
* Stability: unstable
*/
gboolean
cogl_framebuffer_get_depth_texture_enabled (CoglFramebuffer *framebuffer);
/**
* cogl_framebuffer_get_depth_texture:
* @framebuffer: A #CoglFramebuffer
*
* Retrieves the depth buffer of @framebuffer as a #CoglTexture. You need to
* call cogl_framebuffer_get_depth_texture(fb, TRUE); before using this
* function.
*
* <note>Calling this function implicitely allocates the framebuffer.</note>
* <note>The texture returned stays valid as long as the framebuffer stays
* valid.</note>
*
* Returns: (transfer none): the depth texture
*
* Since: 1.14
* Stability: unstable
*/
CoglTexture *
cogl_framebuffer_get_depth_texture (CoglFramebuffer *framebuffer);
/**
* cogl_framebuffer_set_samples_per_pixel:
* @framebuffer: A #CoglFramebuffer framebuffer

View File

@ -69,8 +69,6 @@ typedef struct _CoglGLXRenderer
unsigned long base_winsys_features
[COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_WINSYS_FEATURE_N_FEATURES)];
CoglFeatureFlags legacy_feature_flags;
/* Function pointers for core GLX functionality. We can't just link
against these directly because we need to conditionally load
libGL when we are using GLX so that it won't conflict with a GLES

View File

@ -58,26 +58,6 @@
#include <GL/glx.h>
#include <cogl/cogl-types.h>
G_BEGIN_DECLS
/**
* cogl_glx_context_get_glx_context:
* @context: A #CoglContext pointer
*
* If you have done a runtime check to determine that Cogl is using
* GLX internally then this API can be used to retrieve the GLXContext
* handle that was setup internally. The result is undefined if Cogl
* is not using GLX.
*
* Return value: The internally setup GLXContext handle.
* Since: 1.18
* Stability: unstable
*/
GLXContext
cogl_glx_context_get_glx_context (CoglContext *context);
G_END_DECLS
/* The gobject introspection scanner seems to parse public headers in
* isolation which means we need to be extra careful about how we
* define and undefine __COGL_H_INSIDE__ used to detect when internal

View File

@ -41,7 +41,6 @@
#include "cogl-point-in-poly-private.h"
#include "cogl-private.h"
#include "cogl1-context.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
#include "deprecated/cogl-vertex-buffer-private.h"
#include <string.h>
@ -305,46 +304,30 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
if (!_cogl_pipeline_get_real_blend_enabled (state->pipeline))
draw_flags |= COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE;
#ifdef HAVE_COGL_GL
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUADS))
if (batch_len > 1)
{
CoglVerticesMode mode = COGL_VERTICES_MODE_TRIANGLES;
int first_vertex = state->current_vertex * 6 / 4;
_cogl_framebuffer_draw_indexed_attributes (framebuffer,
state->pipeline,
mode,
first_vertex,
batch_len * 6,
state->indices,
attributes,
state->attributes->len,
draw_flags);
}
else
{
/* XXX: it's rather evil that we sneak in the GL_QUADS enum here... */
_cogl_framebuffer_draw_attributes (framebuffer,
state->pipeline,
GL_QUADS,
state->current_vertex, batch_len * 4,
COGL_VERTICES_MODE_TRIANGLE_FAN,
state->current_vertex, 4,
attributes,
state->attributes->len,
draw_flags);
}
else
#endif /* HAVE_COGL_GL */
{
if (batch_len > 1)
{
CoglVerticesMode mode = COGL_VERTICES_MODE_TRIANGLES;
int first_vertex = state->current_vertex * 6 / 4;
_cogl_framebuffer_draw_indexed_attributes (framebuffer,
state->pipeline,
mode,
first_vertex,
batch_len * 6,
state->indices,
attributes,
state->attributes->len,
draw_flags);
}
else
{
_cogl_framebuffer_draw_attributes (framebuffer,
state->pipeline,
COGL_VERTICES_MODE_TRIANGLE_FAN,
state->current_vertex, 4,
attributes,
state->attributes->len,
draw_flags);
}
}
/* DEBUGGING CODE XXX: This path will cause all rectangles to be
* drawn with a coloured outline. Each batch will be rendered with
@ -637,8 +620,7 @@ _cogl_journal_flush_vbo_offsets_and_entries (CoglJournalEntry *batch_start,
4,
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUADS))
state->indices = cogl_get_rectangle_indices (ctx, batch_len);
state->indices = cogl_get_rectangle_indices (ctx, batch_len);
/* We only create new Attributes when the stride within the
* AttributeBuffer changes. (due to a change in the number of pipeline
@ -1145,12 +1127,6 @@ create_attribute_buffer (CoglJournal *journal,
CoglAttributeBuffer *vbo;
CoglContext *ctx = journal->framebuffer->context;
/* If CoglBuffers are being emulated with malloc then there's not
really any point in using the pool so we'll just allocate the
buffer directly */
if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_VBOS))
return cogl_attribute_buffer_new_with_size (ctx, n_bytes);
vbo = journal->vbo_pool[journal->next_vbo_in_pool];
if (vbo == NULL)

View File

@ -161,13 +161,6 @@ typedef enum
COGL_MATRIX_TEXTURE
} CoglMatrixMode;
void
_cogl_matrix_entry_flush_to_gl_builtins (CoglContext *ctx,
CoglMatrixEntry *entry,
CoglMatrixMode mode,
CoglFramebuffer *framebuffer,
gboolean disable_flip);
void
_cogl_matrix_entry_cache_init (CoglMatrixEntryCache *cache);

View File

@ -781,127 +781,6 @@ cogl_matrix_entry_is_identity (CoglMatrixEntry *entry)
return entry ? entry->op == COGL_MATRIX_OP_LOAD_IDENTITY : FALSE;
}
static void
_cogl_matrix_flush_to_gl_builtin (CoglContext *ctx,
gboolean is_identity,
CoglMatrix *matrix,
CoglMatrixMode mode)
{
g_assert (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED));
#ifdef HAVE_COGL_GL
if (ctx->flushed_matrix_mode != mode)
{
GLenum gl_mode = 0;
switch (mode)
{
case COGL_MATRIX_MODELVIEW:
gl_mode = GL_MODELVIEW;
break;
case COGL_MATRIX_PROJECTION:
gl_mode = GL_PROJECTION;
break;
case COGL_MATRIX_TEXTURE:
gl_mode = GL_TEXTURE;
break;
}
GE (ctx, glMatrixMode (gl_mode));
ctx->flushed_matrix_mode = mode;
}
if (is_identity)
GE (ctx, glLoadIdentity ());
else
GE (ctx, glLoadMatrixf (cogl_matrix_get_array (matrix)));
#endif
}
void
_cogl_matrix_entry_flush_to_gl_builtins (CoglContext *ctx,
CoglMatrixEntry *entry,
CoglMatrixMode mode,
CoglFramebuffer *framebuffer,
gboolean disable_flip)
{
g_assert (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED));
#ifdef HAVE_COGL_GL
{
gboolean needs_flip;
CoglMatrixEntryCache *cache;
if (mode == COGL_MATRIX_PROJECTION)
{
/* Because Cogl defines texture coordinates to have a top left
* origin and because offscreen framebuffers may be used for
* rendering to textures we always render upside down to
* offscreen buffers. Also for some backends we need to render
* onscreen buffers upside-down too.
*/
if (disable_flip)
needs_flip = FALSE;
else
needs_flip = cogl_is_offscreen (framebuffer);
cache = &ctx->builtin_flushed_projection;
}
else
{
needs_flip = FALSE;
if (mode == COGL_MATRIX_MODELVIEW)
cache = &ctx->builtin_flushed_modelview;
else
cache = NULL;
}
/* We don't need to do anything if the state is the same */
if (!cache ||
_cogl_matrix_entry_cache_maybe_update (cache, entry, needs_flip))
{
gboolean is_identity;
CoglMatrix matrix;
if (entry->op == COGL_MATRIX_OP_LOAD_IDENTITY)
is_identity = TRUE;
else
{
is_identity = FALSE;
cogl_matrix_entry_get (entry, &matrix);
}
if (needs_flip)
{
CoglMatrix flipped_matrix;
cogl_matrix_multiply (&flipped_matrix,
&ctx->y_flip_matrix,
is_identity ?
&ctx->identity_matrix :
&matrix);
_cogl_matrix_flush_to_gl_builtin (ctx,
/* not identity */
FALSE,
&flipped_matrix,
mode);
}
else
{
_cogl_matrix_flush_to_gl_builtin (ctx,
is_identity,
&matrix,
mode);
}
}
}
#endif
}
gboolean
cogl_matrix_entry_equal (CoglMatrixEntry *entry0,
CoglMatrixEntry *entry1)

View File

@ -59,12 +59,6 @@ struct _CoglOnscreen
{
CoglFramebuffer _parent;
#ifdef COGL_HAS_X11_SUPPORT
uint32_t foreign_xid;
CoglOnscreenX11MaskCallback foreign_update_mask_callback;
void *foreign_update_mask_data;
#endif
CoglList frame_closures;
gboolean resizable;

View File

@ -411,54 +411,16 @@ cogl_onscreen_get_buffer_age (CoglOnscreen *onscreen)
}
#ifdef COGL_HAS_X11_SUPPORT
void
cogl_x11_onscreen_set_foreign_window_xid (CoglOnscreen *onscreen,
uint32_t xid,
CoglOnscreenX11MaskCallback update,
void *user_data)
{
/* We don't wan't applications to get away with being lazy here and not
* passing an update callback... */
g_return_if_fail (update);
onscreen->foreign_xid = xid;
onscreen->foreign_update_mask_callback = update;
onscreen->foreign_update_mask_data = user_data;
}
uint32_t
cogl_x11_onscreen_get_window_xid (CoglOnscreen *onscreen)
{
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer);
if (onscreen->foreign_xid)
return onscreen->foreign_xid;
else
{
const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer);
/* This should only be called for x11 onscreens */
g_return_val_if_fail (winsys->onscreen_x11_get_window_xid != NULL, 0);
/* This should only be called for x11 onscreens */
g_return_val_if_fail (winsys->onscreen_x11_get_window_xid != NULL, 0);
return winsys->onscreen_x11_get_window_xid (onscreen);
}
}
uint32_t
cogl_x11_onscreen_get_visual_xid (CoglOnscreen *onscreen)
{
CoglContext *ctx = COGL_FRAMEBUFFER (onscreen)->context;
XVisualInfo *visinfo;
uint32_t id;
/* This should only be called for xlib based onscreens */
visinfo = cogl_xlib_renderer_get_visual_info (ctx->display->renderer);
if (visinfo == NULL)
return 0;
id = (uint32_t)visinfo->visualid;
return id;
return winsys->onscreen_x11_get_window_xid (onscreen);
}
#endif /* COGL_HAS_X11_SUPPORT */

View File

@ -75,67 +75,6 @@ CoglOnscreen *
cogl_onscreen_new (CoglContext *context, int width, int height);
#ifdef COGL_HAS_X11
typedef void (*CoglOnscreenX11MaskCallback) (CoglOnscreen *onscreen,
uint32_t event_mask,
void *user_data);
/**
* cogl_x11_onscreen_set_foreign_window_xid:
* @onscreen: The unallocated framebuffer to associated with an X
* window.
* @xid: The XID of an existing X window
* @update: (scope async): A callback that notifies of updates to what Cogl
* requires to be in the core X protocol event mask.
* @user_data: user data passed to @update
*
* Ideally we would recommend that you let Cogl be responsible for
* creating any X window required to back an onscreen framebuffer but
* if you really need to target a window created manually this
* function can be called before @onscreen has been allocated to set a
* foreign XID for your existing X window.
*
* Since Cogl needs, for example, to track changes to the size of an X
* window it requires that certain events be selected for via the core
* X protocol. This requirement may also be changed asynchronously so
* you must pass in an @update callback to inform you of Cogl's
* required event mask.
*
* For example if you are using Xlib you could use this API roughly
* as follows:
* [{
* static void
* my_update_cogl_x11_event_mask (CoglOnscreen *onscreen,
* uint32_t event_mask,
* void *user_data)
* {
* XSetWindowAttributes attrs;
* MyData *data = user_data;
* attrs.event_mask = event_mask | data->my_event_mask;
* XChangeWindowAttributes (data->xdpy,
* data->xwin,
* CWEventMask,
* &attrs);
* }
*
* {
* *snip*
* cogl_x11_onscreen_set_foreign_window_xid (onscreen,
* data->xwin,
* my_update_cogl_x11_event_mask,
* data);
* *snip*
* }
* }]
*
* Since: 2.0
* Stability: Unstable
*/
void
cogl_x11_onscreen_set_foreign_window_xid (CoglOnscreen *onscreen,
uint32_t xid,
CoglOnscreenX11MaskCallback update,
void *user_data);
/**
* cogl_x11_onscreen_get_window_xid:
* @onscreen: A #CoglOnscreen framebuffer
@ -156,10 +95,6 @@ cogl_x11_onscreen_set_foreign_window_xid (CoglOnscreen *onscreen,
uint32_t
cogl_x11_onscreen_get_window_xid (CoglOnscreen *onscreen);
/* XXX: we should maybe remove this, since nothing currently uses
* it and the current implementation looks dubious. */
uint32_t
cogl_x11_onscreen_get_visual_xid (CoglOnscreen *onscreen);
#endif /* COGL_HAS_X11 */
/**

View File

@ -1,36 +0,0 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2011 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
*/
#ifndef __COGL_PANGO_H_COMPAT__
#define __COGL_PANGO_H_COMPAT__
#warning "#include <cogl/cogl-pango.h> is deprecated; please #include <cogl-pango/cogl-pango.h>"
#include <cogl-pango/cogl-pango.h>
#endif /* __COGL_PANGO_H_COMPAT__ */

View File

@ -613,30 +613,6 @@ cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline,
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
/* Don't allow point sprite coordinates to be enabled if the driver
doesn't support it */
if (enable && !cogl_has_feature (ctx, COGL_FEATURE_ID_POINT_SPRITE))
{
if (error)
{
g_set_error_literal (error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_UNSUPPORTED,
"Point sprite texture coordinates are enabled for "
"a layer but the GL driver does not support it.");
}
else
{
static gboolean warning_seen = FALSE;
if (!warning_seen)
g_warning ("Point sprite texture coordinates are enabled "
"for a layer but the GL driver does not support it.");
warning_seen = TRUE;
}
return FALSE;
}
/* Note: this will ensure that the layer exists, creating one if it
* doesn't already.
*

View File

@ -432,10 +432,6 @@ cogl_pipeline_get_layer_mag_filter (CoglPipeline *pipeline,
* have 1.0,1.0. If @enable is %FALSE then the coordinates will be
* fixed for the entire point.
*
* This function will only work if %COGL_FEATURE_ID_POINT_SPRITE is
* available. If the feature is not available then the function will
* return %FALSE and set @error.
*
* Return value: %TRUE if the function succeeds, %FALSE otherwise.
* Since: 2.0
* Stability: unstable

View File

@ -77,7 +77,6 @@ typedef enum
COGL_PIPELINE_STATE_COLOR_INDEX,
COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX,
COGL_PIPELINE_STATE_LAYERS_INDEX,
COGL_PIPELINE_STATE_LIGHTING_INDEX,
COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX,
COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE_INDEX,
COGL_PIPELINE_STATE_BLEND_INDEX,
@ -118,8 +117,6 @@ typedef enum _CoglPipelineState
COGL_PIPELINE_STATE_LAYERS =
1L<<COGL_PIPELINE_STATE_LAYERS_INDEX,
COGL_PIPELINE_STATE_LIGHTING =
1L<<COGL_PIPELINE_STATE_LIGHTING_INDEX,
COGL_PIPELINE_STATE_ALPHA_FUNC =
1L<<COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX,
COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE =
@ -165,15 +162,13 @@ typedef enum _CoglPipelineState
(COGL_PIPELINE_STATE_COLOR | \
COGL_PIPELINE_STATE_BLEND_ENABLE | \
COGL_PIPELINE_STATE_LAYERS | \
COGL_PIPELINE_STATE_LIGHTING | \
COGL_PIPELINE_STATE_BLEND | \
COGL_PIPELINE_STATE_USER_SHADER | \
COGL_PIPELINE_STATE_VERTEX_SNIPPETS | \
COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS)
#define COGL_PIPELINE_STATE_NEEDS_BIG_STATE \
(COGL_PIPELINE_STATE_LIGHTING | \
COGL_PIPELINE_STATE_ALPHA_FUNC | \
(COGL_PIPELINE_STATE_ALPHA_FUNC | \
COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE | \
COGL_PIPELINE_STATE_BLEND | \
COGL_PIPELINE_STATE_USER_SHADER | \
@ -188,7 +183,6 @@ typedef enum _CoglPipelineState
#define COGL_PIPELINE_STATE_MULTI_PROPERTY \
(COGL_PIPELINE_STATE_LAYERS | \
COGL_PIPELINE_STATE_LIGHTING | \
COGL_PIPELINE_STATE_BLEND | \
COGL_PIPELINE_STATE_DEPTH | \
COGL_PIPELINE_STATE_CULL_FACE | \
@ -196,25 +190,6 @@ typedef enum _CoglPipelineState
COGL_PIPELINE_STATE_VERTEX_SNIPPETS | \
COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS)
typedef enum
{
COGL_PIPELINE_LIGHTING_STATE_PROPERTY_AMBIENT = 1,
COGL_PIPELINE_LIGHTING_STATE_PROPERTY_DIFFUSE,
COGL_PIPELINE_LIGHTING_STATE_PROPERTY_SPECULAR,
COGL_PIPELINE_LIGHTING_STATE_PROPERTY_EMISSION,
COGL_PIPELINE_LIGHTING_STATE_PROPERTY_SHININESS
} CoglPipelineLightingStateProperty;
typedef struct
{
/* Standard OpenGL lighting model attributes */
float ambient[4];
float diffuse[4];
float specular[4];
float emission[4];
float shininess;
} CoglPipelineLightingState;
typedef struct
{
/* Determines what fragments are discarded based on their alpha */
@ -267,7 +242,6 @@ typedef struct
typedef struct
{
CoglPipelineLightingState lighting_state;
CoglPipelineAlphaFuncState alpha_state;
CoglPipelineBlendState blend_state;
CoglHandle user_program;

View File

@ -53,10 +53,6 @@ gboolean
_cogl_pipeline_color_equal (CoglPipeline *authority0,
CoglPipeline *authority1);
gboolean
_cogl_pipeline_lighting_state_equal (CoglPipeline *authority0,
CoglPipeline *authority1);
gboolean
_cogl_pipeline_alpha_func_state_equal (CoglPipeline *authority0,
CoglPipeline *authority1);
@ -120,10 +116,6 @@ void
_cogl_pipeline_hash_layers_state (CoglPipeline *authority,
CoglPipelineHashState *state);
void
_cogl_pipeline_hash_lighting_state (CoglPipeline *authority,
CoglPipelineHashState *state);
void
_cogl_pipeline_hash_alpha_func_state (CoglPipeline *authority,
CoglPipelineHashState *state);

View File

@ -69,27 +69,6 @@ _cogl_pipeline_color_equal (CoglPipeline *authority0,
return cogl_color_equal (&authority0->color, &authority1->color);
}
gboolean
_cogl_pipeline_lighting_state_equal (CoglPipeline *authority0,
CoglPipeline *authority1)
{
CoglPipelineLightingState *state0 = &authority0->big_state->lighting_state;
CoglPipelineLightingState *state1 = &authority1->big_state->lighting_state;
if (memcmp (state0->ambient, state1->ambient, sizeof (float) * 4) != 0)
return FALSE;
if (memcmp (state0->diffuse, state1->diffuse, sizeof (float) * 4) != 0)
return FALSE;
if (memcmp (state0->specular, state1->specular, sizeof (float) * 4) != 0)
return FALSE;
if (memcmp (state0->emission, state1->emission, sizeof (float) * 4) != 0)
return FALSE;
if (state0->shininess != state1->shininess)
return FALSE;
return TRUE;
}
gboolean
_cogl_pipeline_alpha_func_state_equal (CoglPipeline *authority0,
CoglPipeline *authority1)
@ -478,264 +457,6 @@ _cogl_pipeline_set_blend_enabled (CoglPipeline *pipeline,
pipeline->dirty_real_blend_enable = TRUE;
}
void
cogl_pipeline_get_ambient (CoglPipeline *pipeline,
CoglColor *ambient)
{
CoglPipeline *authority;
g_return_if_fail (cogl_is_pipeline (pipeline));
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING);
cogl_color_init_from_4fv (ambient,
authority->big_state->lighting_state.ambient);
}
void
cogl_pipeline_set_ambient (CoglPipeline *pipeline,
const CoglColor *ambient)
{
CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING;
CoglPipeline *authority;
CoglPipelineLightingState *lighting_state;
g_return_if_fail (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state);
lighting_state = &authority->big_state->lighting_state;
if (cogl_color_equal (ambient, &lighting_state->ambient))
return;
/* - Flush journal primitives referencing the current state.
* - Make sure the pipeline has no dependants so it may be modified.
* - If the pipeline isn't currently an authority for the state being
* changed, then initialize that state from the current authority.
*/
_cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE);
lighting_state = &pipeline->big_state->lighting_state;
lighting_state->ambient[0] = cogl_color_get_red_float (ambient);
lighting_state->ambient[1] = cogl_color_get_green_float (ambient);
lighting_state->ambient[2] = cogl_color_get_blue_float (ambient);
lighting_state->ambient[3] = cogl_color_get_alpha_float (ambient);
_cogl_pipeline_update_authority (pipeline, authority, state,
_cogl_pipeline_lighting_state_equal);
pipeline->dirty_real_blend_enable = TRUE;
}
void
cogl_pipeline_get_diffuse (CoglPipeline *pipeline,
CoglColor *diffuse)
{
CoglPipeline *authority;
g_return_if_fail (cogl_is_pipeline (pipeline));
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING);
cogl_color_init_from_4fv (diffuse,
authority->big_state->lighting_state.diffuse);
}
void
cogl_pipeline_set_diffuse (CoglPipeline *pipeline,
const CoglColor *diffuse)
{
CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING;
CoglPipeline *authority;
CoglPipelineLightingState *lighting_state;
g_return_if_fail (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state);
lighting_state = &authority->big_state->lighting_state;
if (cogl_color_equal (diffuse, &lighting_state->diffuse))
return;
/* - Flush journal primitives referencing the current state.
* - Make sure the pipeline has no dependants so it may be modified.
* - If the pipeline isn't currently an authority for the state being
* changed, then initialize that state from the current authority.
*/
_cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE);
lighting_state = &pipeline->big_state->lighting_state;
lighting_state->diffuse[0] = cogl_color_get_red_float (diffuse);
lighting_state->diffuse[1] = cogl_color_get_green_float (diffuse);
lighting_state->diffuse[2] = cogl_color_get_blue_float (diffuse);
lighting_state->diffuse[3] = cogl_color_get_alpha_float (diffuse);
_cogl_pipeline_update_authority (pipeline, authority, state,
_cogl_pipeline_lighting_state_equal);
pipeline->dirty_real_blend_enable = TRUE;
}
void
cogl_pipeline_set_ambient_and_diffuse (CoglPipeline *pipeline,
const CoglColor *color)
{
cogl_pipeline_set_ambient (pipeline, color);
cogl_pipeline_set_diffuse (pipeline, color);
}
void
cogl_pipeline_get_specular (CoglPipeline *pipeline,
CoglColor *specular)
{
CoglPipeline *authority;
g_return_if_fail (cogl_is_pipeline (pipeline));
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING);
cogl_color_init_from_4fv (specular,
authority->big_state->lighting_state.specular);
}
void
cogl_pipeline_set_specular (CoglPipeline *pipeline, const CoglColor *specular)
{
CoglPipeline *authority;
CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING;
CoglPipelineLightingState *lighting_state;
g_return_if_fail (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state);
lighting_state = &authority->big_state->lighting_state;
if (cogl_color_equal (specular, &lighting_state->specular))
return;
/* - Flush journal primitives referencing the current state.
* - Make sure the pipeline has no dependants so it may be modified.
* - If the pipeline isn't currently an authority for the state being
* changed, then initialize that state from the current authority.
*/
_cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE);
lighting_state = &pipeline->big_state->lighting_state;
lighting_state->specular[0] = cogl_color_get_red_float (specular);
lighting_state->specular[1] = cogl_color_get_green_float (specular);
lighting_state->specular[2] = cogl_color_get_blue_float (specular);
lighting_state->specular[3] = cogl_color_get_alpha_float (specular);
_cogl_pipeline_update_authority (pipeline, authority, state,
_cogl_pipeline_lighting_state_equal);
pipeline->dirty_real_blend_enable = TRUE;
}
float
cogl_pipeline_get_shininess (CoglPipeline *pipeline)
{
CoglPipeline *authority;
g_return_val_if_fail (cogl_is_pipeline (pipeline), 0);
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING);
return authority->big_state->lighting_state.shininess;
}
void
cogl_pipeline_set_shininess (CoglPipeline *pipeline,
float shininess)
{
CoglPipeline *authority;
CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING;
CoglPipelineLightingState *lighting_state;
g_return_if_fail (cogl_is_pipeline (pipeline));
if (shininess < 0.0)
{
g_warning ("Out of range shininess %f supplied for pipeline\n",
shininess);
return;
}
authority = _cogl_pipeline_get_authority (pipeline, state);
lighting_state = &authority->big_state->lighting_state;
if (lighting_state->shininess == shininess)
return;
/* - Flush journal primitives referencing the current state.
* - Make sure the pipeline has no dependants so it may be modified.
* - If the pipeline isn't currently an authority for the state being
* changed, then initialize that state from the current authority.
*/
_cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE);
lighting_state = &pipeline->big_state->lighting_state;
lighting_state->shininess = shininess;
_cogl_pipeline_update_authority (pipeline, authority, state,
_cogl_pipeline_lighting_state_equal);
}
void
cogl_pipeline_get_emission (CoglPipeline *pipeline,
CoglColor *emission)
{
CoglPipeline *authority;
g_return_if_fail (cogl_is_pipeline (pipeline));
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING);
cogl_color_init_from_4fv (emission,
authority->big_state->lighting_state.emission);
}
void
cogl_pipeline_set_emission (CoglPipeline *pipeline, const CoglColor *emission)
{
CoglPipeline *authority;
CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING;
CoglPipelineLightingState *lighting_state;
g_return_if_fail (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state);
lighting_state = &authority->big_state->lighting_state;
if (cogl_color_equal (emission, &lighting_state->emission))
return;
/* - Flush journal primitives referencing the current state.
* - Make sure the pipeline has no dependants so it may be modified.
* - If the pipeline isn't currently an authority for the state being
* changed, then initialize that state from the current authority.
*/
_cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE);
lighting_state = &pipeline->big_state->lighting_state;
lighting_state->emission[0] = cogl_color_get_red_float (emission);
lighting_state->emission[1] = cogl_color_get_green_float (emission);
lighting_state->emission[2] = cogl_color_get_blue_float (emission);
lighting_state->emission[3] = cogl_color_get_alpha_float (emission);
_cogl_pipeline_update_authority (pipeline, authority, state,
_cogl_pipeline_lighting_state_equal);
pipeline->dirty_real_blend_enable = TRUE;
}
static void
_cogl_pipeline_set_alpha_test_function (CoglPipeline *pipeline,
CoglPipelineAlphaFunc alpha_func)
@ -1014,9 +735,6 @@ cogl_pipeline_set_blend_constant (CoglPipeline *pipeline,
g_return_if_fail (cogl_is_pipeline (pipeline));
if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_BLEND_CONSTANT))
return;
#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL)
{
CoglPipelineState state = COGL_PIPELINE_STATE_BLEND;
@ -1350,16 +1068,6 @@ cogl_pipeline_set_per_vertex_point_size (CoglPipeline *pipeline,
if (authority->big_state->per_vertex_point_size == enable)
return TRUE;
if (enable && !cogl_has_feature (ctx, COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE))
{
g_set_error_literal (error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_UNSUPPORTED,
"Per-vertex point size is not supported");
return FALSE;
}
/* - Flush journal primitives referencing the current state.
* - Make sure the pipeline has no dependants so it may be modified.
* - If the pipeline isn't currently an authority for the state being
@ -1682,17 +1390,6 @@ _cogl_pipeline_hash_blend_enable_state (CoglPipeline *authority,
state->hash = _cogl_util_one_at_a_time_hash (state->hash, &blend_enable, 1);
}
void
_cogl_pipeline_hash_lighting_state (CoglPipeline *authority,
CoglPipelineHashState *state)
{
CoglPipelineLightingState *lighting_state =
&authority->big_state->lighting_state;
state->hash =
_cogl_util_one_at_a_time_hash (state->hash, lighting_state,
sizeof (CoglPipelineLightingState));
}
void
_cogl_pipeline_hash_alpha_func_state (CoglPipeline *authority,
CoglPipelineHashState *state)

View File

@ -120,189 +120,6 @@ void
cogl_pipeline_get_color (CoglPipeline *pipeline,
CoglColor *color);
/**
* cogl_pipeline_set_ambient:
* @pipeline: A #CoglPipeline object
* @ambient: The components of the desired ambient color
*
* Sets the pipeline's ambient color, in the standard OpenGL lighting
* model. The ambient color affects the overall color of the object.
*
* Since the diffuse color will be intense when the light hits the surface
* directly, the ambient will be most apparent where the light hits at a
* slant.
*
* The default value is (0.2, 0.2, 0.2, 1.0)
*
* Since: 2.0
* Stability: Unstable
*/
void
cogl_pipeline_set_ambient (CoglPipeline *pipeline,
const CoglColor *ambient);
/**
* cogl_pipeline_get_ambient:
* @pipeline: A #CoglPipeline object
* @ambient: The location to store the ambient color
*
* Retrieves the current ambient color for @pipeline
*
* Since: 2.0
* Stability: Unstable
*/
void
cogl_pipeline_get_ambient (CoglPipeline *pipeline,
CoglColor *ambient);
/**
* cogl_pipeline_set_diffuse:
* @pipeline: A #CoglPipeline object
* @diffuse: The components of the desired diffuse color
*
* Sets the pipeline's diffuse color, in the standard OpenGL lighting
* model. The diffuse color is most intense where the light hits the
* surface directly - perpendicular to the surface.
*
* The default value is (0.8, 0.8, 0.8, 1.0)
*
* Since: 2.0
* Stability: Unstable
*/
void
cogl_pipeline_set_diffuse (CoglPipeline *pipeline,
const CoglColor *diffuse);
/**
* cogl_pipeline_get_diffuse:
* @pipeline: A #CoglPipeline object
* @diffuse: The location to store the diffuse color
*
* Retrieves the current diffuse color for @pipeline
*
* Since: 2.0
* Stability: Unstable
*/
void
cogl_pipeline_get_diffuse (CoglPipeline *pipeline,
CoglColor *diffuse);
/**
* cogl_pipeline_set_ambient_and_diffuse:
* @pipeline: A #CoglPipeline object
* @color: The components of the desired ambient and diffuse colors
*
* Conveniently sets the diffuse and ambient color of @pipeline at the same
* time. See cogl_pipeline_set_ambient() and cogl_pipeline_set_diffuse().
*
* The default ambient color is (0.2, 0.2, 0.2, 1.0)
*
* The default diffuse color is (0.8, 0.8, 0.8, 1.0)
*
* Since: 2.0
* Stability: Unstable
*/
void
cogl_pipeline_set_ambient_and_diffuse (CoglPipeline *pipeline,
const CoglColor *color);
/**
* cogl_pipeline_set_specular:
* @pipeline: A #CoglPipeline object
* @specular: The components of the desired specular color
*
* Sets the pipeline's specular color, in the standard OpenGL lighting
* model. The intensity of the specular color depends on the viewport
* position, and is brightest along the lines of reflection.
*
* The default value is (0.0, 0.0, 0.0, 1.0)
*
* Since: 2.0
* Stability: Unstable
*/
void
cogl_pipeline_set_specular (CoglPipeline *pipeline,
const CoglColor *specular);
/**
* cogl_pipeline_get_specular:
* @pipeline: A #CoglPipeline object
* @specular: The location to store the specular color
*
* Retrieves the pipelines current specular color.
*
* Since: 2.0
* Stability: Unstable
*/
void
cogl_pipeline_get_specular (CoglPipeline *pipeline,
CoglColor *specular);
/**
* cogl_pipeline_set_shininess:
* @pipeline: A #CoglPipeline object
* @shininess: The desired shininess; must be >= 0.0
*
* Sets the shininess of the pipeline, in the standard OpenGL lighting
* model, which determines the size of the specular highlights. A
* higher @shininess will produce smaller highlights which makes the
* object appear more shiny.
*
* The default value is 0.0
*
* Since: 2.0
* Stability: Unstable
*/
void
cogl_pipeline_set_shininess (CoglPipeline *pipeline,
float shininess);
/**
* cogl_pipeline_get_shininess:
* @pipeline: A #CoglPipeline object
*
* Retrieves the pipelines current emission color.
*
* Return value: The pipelines current shininess value
*
* Since: 2.0
* Stability: Unstable
*/
float
cogl_pipeline_get_shininess (CoglPipeline *pipeline);
/**
* cogl_pipeline_set_emission:
* @pipeline: A #CoglPipeline object
* @emission: The components of the desired emissive color
*
* Sets the pipeline's emissive color, in the standard OpenGL lighting
* model. It will look like the surface is a light source emitting this
* color.
*
* The default value is (0.0, 0.0, 0.0, 1.0)
*
* Since: 2.0
* Stability: Unstable
*/
void
cogl_pipeline_set_emission (CoglPipeline *pipeline,
const CoglColor *emission);
/**
* cogl_pipeline_get_emission:
* @pipeline: A #CoglPipeline object
* @emission: The location to store the emission color
*
* Retrieves the pipelines current emission color.
*
* Since: 2.0
* Stability: Unstable
*/
void
cogl_pipeline_get_emission (CoglPipeline *pipeline,
CoglColor *emission);
/**
* CoglPipelineAlphaFunc:
* @COGL_PIPELINE_ALPHA_FUNC_NEVER: Never let the fragment through.
@ -544,11 +361,6 @@ cogl_pipeline_get_point_size (CoglPipeline *pipeline);
* and cogl_point_size_out is not written to then the results are
* undefined.
*
* Note that enabling this will only work if the
* %COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE feature is available. If
* this is not available then the function will return %FALSE and set
* a #GError.
*
* Since: 2.0
* Stability: Unstable
* Return value: %TRUE if the change suceeded or %FALSE otherwise

View File

@ -49,7 +49,6 @@
#include "cogl-depth-state-private.h"
#include "cogl1-context.h"
#include "cogl-gtype-private.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
#include <glib.h>
#include <glib/gprintf.h>
@ -96,7 +95,6 @@ _cogl_pipeline_init_default_pipeline (void)
/* XXX: NB: It's important that we zero this to avoid polluting
* pipeline hash values with un-initialized data */
CoglPipelineBigState *big_state = g_slice_new0 (CoglPipelineBigState);
CoglPipelineLightingState *lighting_state = &big_state->lighting_state;
CoglPipelineAlphaFuncState *alpha_state = &big_state->alpha_state;
CoglPipelineBlendState *blend_state = &big_state->blend_state;
CoglPipelineCullFaceState *cull_face_state = &big_state->cull_face_state;
@ -143,29 +141,6 @@ _cogl_pipeline_init_default_pipeline (void)
/* Use the same defaults as the GL spec... */
cogl_color_init_from_4ub (&pipeline->color, 0xff, 0xff, 0xff, 0xff);
/* Use the same defaults as the GL spec... */
lighting_state->ambient[0] = 0.2;
lighting_state->ambient[1] = 0.2;
lighting_state->ambient[2] = 0.2;
lighting_state->ambient[3] = 1.0;
lighting_state->diffuse[0] = 0.8;
lighting_state->diffuse[1] = 0.8;
lighting_state->diffuse[2] = 0.8;
lighting_state->diffuse[3] = 1.0;
lighting_state->specular[0] = 0;
lighting_state->specular[1] = 0;
lighting_state->specular[2] = 0;
lighting_state->specular[3] = 1.0;
lighting_state->emission[0] = 0;
lighting_state->emission[1] = 0;
lighting_state->emission[2] = 0;
lighting_state->emission[3] = 1.0;
lighting_state->shininess = 0.0f;
/* Use the same defaults as the GL spec... */
alpha_state->alpha_func = COGL_PIPELINE_ALPHA_FUNC_ALWAYS;
alpha_state->alpha_func_reference = 0.0;
@ -765,32 +740,6 @@ _cogl_pipeline_change_implies_transparency (CoglPipeline *pipeline,
return TRUE;
}
/* XXX: we should only need to look at these if lighting is enabled
*/
if (changes & COGL_PIPELINE_STATE_LIGHTING)
{
/* XXX: This stuff is showing up in sysprof reports which is
* silly because lighting isn't currently actually supported
* by Cogl except for these token properties. When we actually
* expose lighting support we can avoid these checks when
* lighting is disabled. */
#if 0
CoglColor tmp;
cogl_pipeline_get_ambient (pipeline, &tmp);
if (cogl_color_get_alpha_byte (&tmp) != 0xff)
return TRUE;
cogl_pipeline_get_diffuse (pipeline, &tmp);
if (cogl_color_get_alpha_byte (&tmp) != 0xff)
return TRUE;
cogl_pipeline_get_specular (pipeline, &tmp);
if (cogl_color_get_alpha_byte (&tmp) != 0xff)
return TRUE;
cogl_pipeline_get_emission (pipeline, &tmp);
if (cogl_color_get_alpha_byte (&tmp) != 0xff)
return TRUE;
#endif
}
if (changes & COGL_PIPELINE_STATE_LAYERS)
{
/* has_alpha tracks the alpha status of the GL_PREVIOUS layer.
@ -964,13 +913,6 @@ _cogl_pipeline_copy_differences (CoglPipeline *dest,
else
goto check_for_blending_change;
if (differences & COGL_PIPELINE_STATE_LIGHTING)
{
memcpy (&big_state->lighting_state,
&src->big_state->lighting_state,
sizeof (CoglPipelineLightingState));
}
if (differences & COGL_PIPELINE_STATE_ALPHA_FUNC)
big_state->alpha_state.alpha_func =
src->big_state->alpha_state.alpha_func;
@ -1096,13 +1038,6 @@ _cogl_pipeline_init_multi_property_sparse_state (CoglPipeline *pipeline,
pipeline->n_layers = authority->n_layers;
pipeline->layer_differences = NULL;
break;
case COGL_PIPELINE_STATE_LIGHTING:
{
memcpy (&pipeline->big_state->lighting_state,
&authority->big_state->lighting_state,
sizeof (CoglPipelineLightingState));
break;
}
case COGL_PIPELINE_STATE_BLEND:
{
memcpy (&pipeline->big_state->blend_state,
@ -2213,11 +2148,6 @@ _cogl_pipeline_equal (CoglPipeline *pipeline0,
&authorities1[bit]->color))
goto done;
break;
case COGL_PIPELINE_STATE_LIGHTING_INDEX:
if (!_cogl_pipeline_lighting_state_equal (authorities0[bit],
authorities1[bit]))
goto done;
break;
case COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX:
if (!_cogl_pipeline_alpha_func_state_equal (authorities0[bit],
authorities1[bit]))
@ -2673,8 +2603,6 @@ _cogl_pipeline_init_state_hash_functions (void)
_cogl_pipeline_hash_blend_enable_state;
state_hash_functions[COGL_PIPELINE_STATE_LAYERS_INDEX] =
_cogl_pipeline_hash_layers_state;
state_hash_functions[COGL_PIPELINE_STATE_LIGHTING_INDEX] =
_cogl_pipeline_hash_lighting_state;
state_hash_functions[COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX] =
_cogl_pipeline_hash_alpha_func_state;
state_hash_functions[COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE_INDEX] =
@ -2702,7 +2630,7 @@ _cogl_pipeline_init_state_hash_functions (void)
{
/* So we get a big error if we forget to update this code! */
_COGL_STATIC_ASSERT (COGL_PIPELINE_STATE_SPARSE_COUNT == 16,
_COGL_STATIC_ASSERT (COGL_PIPELINE_STATE_SPARSE_COUNT == 15,
"Make sure to install a hash function for "
"newly added pipeline state and update assert "
"in _cogl_pipeline_init_state_hash_functions");

View File

@ -42,7 +42,6 @@
#include "cogl-framebuffer-private.h"
#include "cogl1-context.h"
#include "cogl-primitives-private.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
#include "deprecated/cogl-vertex-buffer-private.h"
#include <string.h>

View File

@ -43,9 +43,7 @@ typedef enum
COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE,
COGL_PRIVATE_FEATURE_MESA_PACK_INVERT,
COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER,
COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES,
COGL_PRIVATE_FEATURE_PBOS,
COGL_PRIVATE_FEATURE_VBOS,
COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL,
COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL,
COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_BGRA8888,
@ -54,8 +52,6 @@ typedef enum
COGL_PRIVATE_FEATURE_READ_PIXELS_ANY_FORMAT,
COGL_PRIVATE_FEATURE_ALPHA_TEST,
COGL_PRIVATE_FEATURE_FORMAT_CONVERSION,
COGL_PRIVATE_FEATURE_QUADS,
COGL_PRIVATE_FEATURE_BLEND_CONSTANT,
COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS,
COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM,
COGL_PRIVATE_FEATURE_QUERY_TEXTURE_PARAMETERS,

View File

@ -43,12 +43,9 @@
#include "cogl-renderer.h"
#include "cogl-renderer-private.h"
#include "cogl-display-private.h"
#include "cogl-config-private.h"
#include "cogl-gtype-private.h"
#include "driver/gl/cogl-util-gl-private.h"
#include "winsys/cogl-winsys-private.h"
#include "winsys/cogl-winsys-stub-private.h"
#ifdef COGL_HAS_EGL_PLATFORM_XLIB_SUPPORT
#include "winsys/cogl-winsys-egl-x11-private.h"
@ -143,7 +140,6 @@ static CoglWinsysVtableGetter _cogl_winsys_vtable_getters[] =
#ifdef COGL_HAS_EGL_PLATFORM_XLIB_SUPPORT
_cogl_winsys_egl_xlib_get_vtable,
#endif
_cogl_winsys_stub_get_vtable,
};
static void _cogl_renderer_free (CoglRenderer *renderer);
@ -231,7 +227,7 @@ cogl_xlib_renderer_set_foreign_display (CoglRenderer *renderer,
/* If the application is using a foreign display then we can assume
it will also do its own event retrieval */
cogl_xlib_renderer_set_event_retrieval_enabled (renderer, FALSE);
renderer->xlib_enable_event_retrieval = FALSE;
}
Display *
@ -242,17 +238,6 @@ cogl_xlib_renderer_get_foreign_display (CoglRenderer *renderer)
return renderer->foreign_xdpy;
}
void
cogl_xlib_renderer_set_event_retrieval_enabled (CoglRenderer *renderer,
gboolean enable)
{
g_return_if_fail (cogl_is_renderer (renderer));
/* NB: Renderers are considered immutable once connected */
g_return_if_fail (!renderer->connected);
renderer->xlib_enable_event_retrieval = enable;
}
void
cogl_xlib_renderer_request_reset_on_video_memory_purge (CoglRenderer *renderer,
gboolean enable)
@ -409,9 +394,6 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer,
const CoglDriverDescription *desc;
int i;
if (!driver_name)
driver_name = _cogl_config_driver;
if (driver_name)
{
driver_override = driver_name_to_id (driver_name);
@ -582,8 +564,6 @@ cogl_renderer_connect (CoglRenderer *renderer, GError **error)
else
{
char *user_choice = getenv ("COGL_RENDERER");
if (!user_choice)
user_choice = _cogl_config_renderer;
if (user_choice &&
g_ascii_strcasecmp (winsys->name, user_choice) != 0)
continue;
@ -734,20 +714,6 @@ _cogl_renderer_get_proc_address (CoglRenderer *renderer,
return winsys->renderer_get_proc_address (renderer, name, in_core);
}
int
cogl_renderer_get_n_fragment_texture_units (CoglRenderer *renderer)
{
int n = 0;
_COGL_GET_CONTEXT (ctx, 0);
#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES2)
GE (ctx, glGetIntegerv (GL_MAX_TEXTURE_IMAGE_UNITS, &n));
#endif
return n;
}
void
cogl_renderer_add_constraint (CoglRenderer *renderer,
CoglRendererConstraint constraint)

View File

@ -202,20 +202,6 @@ cogl_renderer_set_winsys_id (CoglRenderer *renderer,
CoglWinsysID
cogl_renderer_get_winsys_id (CoglRenderer *renderer);
/**
* cogl_renderer_get_n_fragment_texture_units:
* @renderer: A #CoglRenderer
*
* Queries how many texture units can be used from fragment programs
*
* Returns: the number of texture image units.
*
* Since: 1.8
* Stability: Unstable
*/
int
cogl_renderer_get_n_fragment_texture_units (CoglRenderer *renderer);
/**
* cogl_renderer_check_onscreen_template: (skip)
* @renderer: A #CoglRenderer

View File

@ -294,8 +294,7 @@ G_BEGIN_DECLS
* will be the bottom right. Note that there is currently a bug in
* Cogl where when rendering to an offscreen buffer these
* coordinates will be upside-down. The value is undefined when not
* rendering points. This builtin can only be used if the
* %COGL_FEATURE_ID_POINT_SPRITE feature is available.
* rendering points.
* </para></glossdef>
* </glossentry>
* </glosslist>

View File

@ -436,6 +436,5 @@ cogl_sub_texture_vtable =
_cogl_sub_texture_gl_flush_legacy_texobj_wrap_modes,
_cogl_sub_texture_get_format,
_cogl_sub_texture_get_gl_format,
NULL, /* is_foreign */
NULL /* set_auto_mipmap */
};

View File

@ -1,78 +0,0 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2012 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
*/
#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION)
#error "Only <cogl/cogl.h> can be included directly."
#endif
#ifndef _COGL_TEXTURE_2D_GL_H_
#define _COGL_TEXTURE_2D_GL_H_
#include "cogl-context.h"
#include "cogl-texture-2d.h"
G_BEGIN_DECLS
/**
* cogl_texture_2d_gl_new_from_foreign:
* @ctx: A #CoglContext
* @gl_handle: A GL handle for a GL_TEXTURE_2D texture object
* @width: Width of the foreign GL texture
* @height: Height of the foreign GL texture
* @format: The format of the texture
*
* Wraps an existing GL_TEXTURE_2D texture object as a #CoglTexture2D.
* This can be used for integrating Cogl with software using OpenGL
* directly.
*
* The texture is still configurable until it has been allocated so
* for example you can declare whether the texture is premultiplied
* with cogl_texture_set_premultiplied().
*
* <note>The results are undefined for passing an invalid @gl_handle
* or if @width or @height don't have the correct texture
* geometry.</note>
*
* Returns: (transfer full): A newly allocated #CoglTexture2D
*
* Since: 2.0
*/
CoglTexture2D *
cogl_texture_2d_gl_new_from_foreign (CoglContext *ctx,
unsigned int gl_handle,
int width,
int height,
CoglPixelFormat format);
G_END_DECLS
#endif /* _COGL_TEXTURE_2D_GL_H_ */

View File

@ -46,7 +46,6 @@ struct _CoglTexture2D
gboolean auto_mipmap;
gboolean mipmaps_dirty;
gboolean is_foreign;
gboolean is_get_data_supported;
/* TODO: factor out these OpenGL specific members into some form

View File

@ -49,16 +49,6 @@ struct _CoglTexture2DSliced
CoglPixelFormat internal_format;
};
CoglTexture2DSliced *
_cogl_texture_2d_sliced_new_from_foreign (CoglContext *context,
unsigned int gl_handle,
unsigned int gl_target,
int width,
int height,
int x_pot_waste,
int y_pot_waste,
CoglPixelFormat format);
CoglTexture2DSliced *
_cogl_texture_2d_sliced_new_from_bitmap (CoglBitmap *bmp,
int max_waste,

View File

@ -41,7 +41,6 @@
#include "cogl-bitmap.h"
#include "cogl-bitmap-private.h"
#include "cogl-texture-private.h"
#include "cogl-texture-2d-gl.h"
#include "cogl-texture-2d-private.h"
#include "cogl-texture-2d-sliced-private.h"
#include "cogl-texture-driver.h"
@ -52,8 +51,6 @@
#include "cogl-primitive-texture.h"
#include "cogl-gtype-private.h"
#include "driver/gl/cogl-texture-gl-private.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
#include "driver/gl/cogl-texture-gl-private.h"
#include <string.h>
#include <stdlib.h>
@ -919,50 +916,6 @@ cogl_texture_2d_sliced_new_from_bitmap (CoglBitmap *bmp,
FALSE);
}
CoglTexture2DSliced *
_cogl_texture_2d_sliced_new_from_foreign (CoglContext *ctx,
unsigned int gl_handle,
unsigned int gl_target,
int width,
int height,
int x_pot_waste,
int y_pot_waste,
CoglPixelFormat format)
{
CoglTextureLoader *loader;
/* NOTE: width, height and internal format are not queriable
* in GLES, hence such a function prototype.
*/
/* This should only be called when the texture target is 2D. */
g_return_val_if_fail (gl_target == GL_TEXTURE_2D, NULL);
/* Assert it is a valid GL texture object */
g_return_val_if_fail (ctx->glIsTexture (gl_handle), FALSE);
/* Validate width and height */
g_return_val_if_fail (width > 0 && height > 0, NULL);
/* Validate pot waste */
g_return_val_if_fail (x_pot_waste >= 0 && x_pot_waste < width &&
y_pot_waste >= 0 && y_pot_waste < height,
NULL);
loader = _cogl_texture_create_loader ();
loader->src_type = COGL_TEXTURE_SOURCE_TYPE_GL_FOREIGN;
loader->src.gl_foreign.gl_handle = gl_handle;
loader->src.gl_foreign.width = width + x_pot_waste;
loader->src.gl_foreign.height = height + y_pot_waste;
loader->src.gl_foreign.format = format;
return _cogl_texture_2d_sliced_create_base (ctx,
width,
height,
0, /* max waste */
format, loader);
}
CoglTexture2DSliced *
cogl_texture_2d_sliced_new_from_data (CoglContext *ctx,
int width,
@ -1108,71 +1061,6 @@ allocate_from_bitmap (CoglTexture2DSliced *tex_2ds,
return TRUE;
}
static gboolean
allocate_from_gl_foreign (CoglTexture2DSliced *tex_2ds,
CoglTextureLoader *loader,
GError **error)
{
CoglTexture *tex = COGL_TEXTURE (tex_2ds);
CoglContext *ctx = tex->context;
CoglPixelFormat format = loader->src.gl_foreign.format;
int gl_width = loader->src.gl_foreign.width;
int gl_height = loader->src.gl_foreign.height;
int x_pot_waste = gl_width - tex->width;
int y_pot_waste = gl_height - tex->height;
CoglSpan x_span;
CoglSpan y_span;
CoglTexture2D *tex_2d =
cogl_texture_2d_gl_new_from_foreign (ctx,
loader->src.gl_foreign.gl_handle,
gl_width,
gl_height,
format);
if (!cogl_texture_allocate (COGL_TEXTURE (tex_2d), error))
{
cogl_object_unref (tex_2d);
return FALSE;
}
/* The texture 2d backend may use a different pixel format if it
queries the actual texture so we'll refetch the format it
actually used */
format = _cogl_texture_get_format (tex);
tex_2ds->internal_format = format;
/* Create slice arrays */
tex_2ds->slice_x_spans =
g_array_sized_new (FALSE, FALSE, sizeof (CoglSpan), 1);
tex_2ds->slice_y_spans =
g_array_sized_new (FALSE, FALSE, sizeof (CoglSpan), 1);
tex_2ds->slice_textures =
g_array_sized_new (FALSE, FALSE, sizeof (CoglTexture2D *), 1);
/* Store info for a single slice */
x_span.start = 0;
x_span.size = gl_width;
x_span.waste = x_pot_waste;
g_array_append_val (tex_2ds->slice_x_spans, x_span);
y_span.start = 0;
y_span.size = gl_height;
y_span.waste = y_pot_waste;
g_array_append_val (tex_2ds->slice_y_spans, y_span);
g_array_append_val (tex_2ds->slice_textures, tex_2d);
_cogl_texture_set_allocated (tex,
format,
tex->width,
tex->height);
return TRUE;
}
static gboolean
_cogl_texture_2d_sliced_allocate (CoglTexture *tex,
GError **error)
@ -1188,8 +1076,6 @@ _cogl_texture_2d_sliced_allocate (CoglTexture *tex,
return allocate_with_size (tex_2ds, loader, error);
case COGL_TEXTURE_SOURCE_TYPE_BITMAP:
return allocate_from_bitmap (tex_2ds, loader, error);
case COGL_TEXTURE_SOURCE_TYPE_GL_FOREIGN:
return allocate_from_gl_foreign (tex_2ds, loader, error);
default:
break;
}
@ -1197,21 +1083,6 @@ _cogl_texture_2d_sliced_allocate (CoglTexture *tex,
g_return_val_if_reached (FALSE);
}
static gboolean
_cogl_texture_2d_sliced_is_foreign (CoglTexture *tex)
{
CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex);
CoglTexture2D *slice_tex;
/* Make sure slices were created */
if (tex_2ds->slice_textures == NULL)
return FALSE;
/* Pass the call on to the first slice */
slice_tex = g_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0);
return _cogl_texture_is_foreign (COGL_TEXTURE (slice_tex));
}
static int
_cogl_texture_2d_sliced_get_max_waste (CoglTexture *tex)
{
@ -1468,6 +1339,5 @@ cogl_texture_2d_sliced_vtable =
_cogl_texture_2d_sliced_gl_flush_legacy_texobj_wrap_modes,
_cogl_texture_2d_sliced_get_format,
_cogl_texture_2d_sliced_get_gl_format,
_cogl_texture_2d_sliced_is_foreign,
NULL /* set_auto_mipmap */
};

View File

@ -44,7 +44,6 @@
#include "cogl-framebuffer-private.h"
#include "cogl-gtype-private.h"
#include "driver/gl/cogl-texture-2d-gl-private.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
#ifdef COGL_HAS_EGL_SUPPORT
#include "winsys/cogl-winsys-egl-private.h"
#endif
@ -110,8 +109,6 @@ _cogl_texture_2d_create_base (CoglContext *ctx,
tex_2d->gl_target = GL_TEXTURE_2D;
tex_2d->is_foreign = FALSE;
ctx->driver_vtable->texture_2d_init (tex_2d);
return _cogl_texture_2d_object_new (tex_2d);
@ -487,12 +484,6 @@ _cogl_texture_2d_get_gl_format (CoglTexture *tex)
return COGL_TEXTURE_2D (tex)->gl_internal_format;
}
static gboolean
_cogl_texture_2d_is_foreign (CoglTexture *tex)
{
return COGL_TEXTURE_2D (tex)->is_foreign;
}
static const CoglTextureVtable
cogl_texture_2d_vtable =
{
@ -514,6 +505,5 @@ cogl_texture_2d_vtable =
_cogl_texture_2d_gl_flush_legacy_texobj_wrap_modes,
_cogl_texture_2d_get_format,
_cogl_texture_2d_get_gl_format,
_cogl_texture_2d_is_foreign,
_cogl_texture_2d_set_auto_mipmap
};

Some files were not shown because too many files have changed in this diff Show More