Compare commits

...

80 Commits

Author SHA1 Message Date
Florian Müllner
82233cce65 Bump version to 3.35.2
Update NEWS.
2019-12-11 18:53:50 +01:00
Benjamin Berg
2e97ba316d ci: Change instructions to use podman
Podman can also be used to create the image. The only thing to keep in
mind with podman is to add --format docker, so that the image will be
compatible with all CI runners.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/966
2019-12-11 12:56:28 +01:00
Bruce Cowan
7186d09085 Update British English translation
(cherry picked from commit c05328f76a)
2019-12-11 10:25:52 +00:00
Jonas Ådahl
4fccc903b5 xwayland: Don't queue frame callbacks when role assigned
'xwayland: Do not queue frame callbacks unconditionally' changed the
frame callback behavior of Xwayland surfaces so that they behave the
same way as other actor surfaces (e.g. xdg-shell ones), except for the
case when they are initially assigned.

Remove this special casing as well including the now incorrect comment,
so that the Xwayland surfaces behave the same as the others in this
regard also when assigning.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/964
2019-12-10 09:15:49 +00:00
Robert Mader
06fa131235 clutter-timeline: Fix some indentation
In Gnome Builder this looks very odd, much worse than in git.
We'll probably not touch the code soon, so fix indentation
for better readability.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/965
2019-12-09 17:53:51 +01:00
Jonas Ådahl
132fbf49d7 wayland: Let MetaWaylandXdgPopup dismiss incorrectly placed popups
It's a xdg_popup detail, and not until the actual position is finalized
is the actual correctness known.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/907
2019-12-09 10:09:40 +01:00
Jonas Ådahl
d02c124e1d wayland/surface-role: Rename commit() vfunc apply_state()
The vfunc is not called when a surface commits its state, but when the
state is applied. Make this clearer by changing the name to
"apply_state" (and "pre_apply_state").

https://gitlab.gnome.org/GNOME/mutter/merge_requests/907
2019-12-09 10:09:40 +01:00
Jonas Ådahl
554644f9e0 wayland: Rework asynchronous window configuration
This changes how asynchronous window configuration works. Prior to this
commit, it worked by MetaWindowWayland remembering the last
configuration it sent, then when the Wayland client got back to it, it
tried to figure out whether it was a acknowledgment of the configuration
or not, and finish the move. This failed if the client had acknowledged
a configuration older than the last one sent, and it had hacks to
somewhat deal with wl_shell's lack of configuration serial numbers.

This commits scraps that and makes the MetaWindowWayland take ownership
of sent configurations, including generating serial numbers. The
wl_shell implementation is changed to emulate serial numbers (assuming
each commit acknowledges the last sent configure event). Each
configuration sent to the client is kept around until the client one. At
this point, the position used for that particular configuration is used
when applying the acknowledged state, meaning cases where we have
already sent a new configuration when the client acknowledges a previous
one, we'll still use the correct position for the window.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/907
2019-12-09 10:09:40 +01:00
Jonas Ådahl
cc444d4991 window/wayland: Use G_DECLARE_FINAL_TYPE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/907
2019-12-09 10:09:40 +01:00
Jonas Ådahl
4bf5b7d78d window: Don't constrain an acked window geometry
In Wayland, window configuration is asynchronous. Window geometry is
constrained, the constrained geometry is sent to the client, and the
client will adapt its surface and acknowledge the configuration. When
acknowledged, we shouldn't reconstrain again, as that may invalidate the
constraint calculated for the configured size.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/907
2019-12-09 10:09:40 +01:00
Jonas Ådahl
cb91f44ba4 wayland/wl-shell: Use input region as window geometry if set
Historically, wl_shell clients used to pretend the input region was
equivalent to the window geometry, so for "correctness" lets do that
here too. This makes wl_shell clients with drop shadow behave marginally
better than before.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/907
2019-12-09 10:09:40 +01:00
Jonas Ådahl
f7e256e9a1 wayland/surface: Make cached subsurface state generic
This moves the cached subsurface surface state into the generic
MetaWaylandSurface namespace. Eventually it'll be used by other surface
roles which as well aim to implement synhcronization.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/907
2019-12-09 10:09:40 +01:00
Jonas Ådahl
bbec8abb68 wayland/surface: Rename MetaWaylandPendingState to MetaWaylandSurfaceState
The name didn't communicate it was about surface state, and it somewhat
confusingly had the name "pending" in it, which could be confused with
the fact that while it's used to collect pending state, it's also used
to cache previously committed pending state.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/907
2019-12-09 10:09:40 +01:00
Jonas Ådahl
d60d671fec wayland: Use helper to access pending state from the outside
With the eventual aim of exposing the internals of MetaWaylandSurface
outside of meta-wayland-surface.c, make users of the pending state use a
helper to fetch it. While at it, rename the struct field to something
more descriptive.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/907
2019-12-09 10:09:40 +01:00
Jonas Ådahl
8dc730e5ca wayland/surface: Move subsurface synchronization logic to role
It's an implementation detail of subsurfaces when to cache state
and when not to, so move that logic to the subsurface role
implementation.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/907
2019-12-09 10:09:40 +01:00
Jonas Ådahl
0cf98c5641 wayland/surface: Emit signal before applying state
Will be used to invalidate depending state that should be updated as
part of a surface state being applied.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/907
2019-12-09 10:09:40 +01:00
Jonas Ådahl
4bacb3621b window/wayland: Make .._wayland_move_resize() name more explanatory
The intention of meta_window_wayland_move_resize() is to finish a
move-resize requested previously, e.g. by a state change, or a
interactive resize. Make the function name carry this intention, by
renaming it to meta_window_wayland_finish_move_resize().

https://gitlab.gnome.org/GNOME/mutter/merge_requests/907
2019-12-09 10:09:40 +01:00
Jonas Ådahl
aef865afc4 wayland/xdg-shell: Scope variable better
A window geometry rectangle was declared in the wrong scope. Both
xdg-shell and legacy xdg-shell had the same issue.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/907
2019-12-09 10:09:40 +01:00
Tim Crawford
d70ddc65ea backends/native: Fix double free of error
error is an autoptr, so must not be explicitly freed.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1852
Fixes: 5c500ad402 ("backend: Move GPU ownership from the monitor manager to the backend")

https://gitlab.gnome.org/GNOME/mutter/merge_requests/960
2019-12-06 11:33:26 -07:00
Pekka Paalanen
832a522cce kms-impl/simple: Fix meta_set_fallback_feedback_idle
Presumably this function is supposed to be like
meta_kms_impl_simple_handle_page_flip_callback() but the condition in the
if-statement is inverted. Fix the inversion to make these two functions look
alike.

This is part 2 of 2 fixing a complete desktop freeze when drmModePageFlip()
fails with EINVAL and the fallback to drmModeSetCrtc() succeeds but the success
is not registered correctly as completed "flip". The freeze occurs under
wait_for_pending_flips() which calls down into meta_kms_impl_device_dispatch()
which ends up poll()'ing the DRM fd even though drmModeSetCrtc() will not
produce a DRM event, hence the poll() never returns. The freeze was observed
when hotplugging a DisplayLink dock for the first time on Ubuntu 19.10.

This patch makes meta_set_fallback_feedback_idle() actually end up calling into
notify_view_crtc_presented() which decrements
secondary_gpu_state->pending_flips so that wait_for_pending_flips() can finish.

CC stable: gnome-3-34

https://gitlab.gnome.org/GNOME/mutter/merge_requests/953
2019-12-06 15:55:35 +00:00
Pekka Paalanen
79491df2b8 kms: Process impl idle callbacks before pre dispatch flush
mode_set_fallback() schedules a call to mode_set_fallback_feedback_idle(), but
it is possible for Mutter to repaint before the idle callbacks are dispatched.
If that happens, mode_set_fallback_feedback_idle() does not get called before
Mutter enters wait_for_pending_flips(), leading to a deadlock.

Add the needed interfaces so that meta_kms_device_dispatch_sync() can flush all
the implementation idle callbacks before it checks if any "events" are
available. This prevents the deadlock by ensuring
mode_set_fallback_feedback_idle() does get called before potentially waiting
for actual DRM events.

Presumably this call would not be needed if the implementation was running in
its own thread, since it would eventually dispatch its idle callbacks before
going to sleep polling on the DRM fd. This call might even be unnecessary
overhead in that case, synchronizing with the implementation thread needlessly.
But the thread does not exist yet, so this is needed for now.

This is part 1 of 2 fixing a complete desktop freeze when drmModePageFlip()
fails with EINVAL and the fallback to drmModeSetCrtc() succeeds but the success
is not registered correctly as completed "flip". The freeze occurs under
wait_for_pending_flips() which calls down into meta_kms_impl_device_dispatch()
which ends up poll()'ing the DRM fd even though drmModeSetCrtc() will not
produce a DRM event, hence the poll() never returns. The freeze was observed
when hotplugging a DisplayLink dock for the first time on Ubuntu 19.10.

CC stable: gnome-3-34

https://gitlab.gnome.org/GNOME/mutter/merge_requests/953
2019-12-06 15:55:35 +00:00
Christian Rauch
9f50b2cef2 startup: Fix build with 'startup_notification=false'
https://gitlab.gnome.org/GNOME/mutter/merge_requests/958
2019-12-05 01:27:14 +00:00
Robert Mader
96e1883361 xwayland: Do not queue frame callbacks unconditionally
The removed comment is not longer true: XWayland schedules its VSYNC
from frame callbacks nowadays. Only sending callbacks when the surface
actor is unobscured makes XWayland throttle its VSYNC to 1/sec,
reducing repaints in many cases.

Follow up of https://gitlab.gnome.org/GNOME/mutter/merge_requests/918

https://gitlab.gnome.org/GNOME/mutter/merge_requests/956
2019-12-04 18:59:24 +01:00
Georges Basile Stavracas Neto
0d1c18a4ce paint-context: Expose push and pop framebuffer
When rendering on-stage, it might be necessary to push offscreen
framebuffers to the paint context by external consumers, such as
GNOME Shell effects.

Expose clutter_paint_context_push|pop_framebuffer().

https://gitlab.gnome.org/GNOME/mutter/merge_requests/955
2019-12-03 16:41:34 -03:00
Jonas Ådahl
40205d8f1b cogl: Make pipeline creation introspectable
This means CoglContext is now also introspected, although its
constructor and some getters are skipped to avoid having to expose even
more types. This makes it possible to create pipelines using Javascript.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
4ede6ea8c5 cogl: Remove the framebuffer and source stacks
They have been deprecated for a long time, and all their uses in clutter
and mutter has been removed. This also removes some no longer needed
legacy state tracking, as they were only ever excercised in certain
circumstances when there was sources (pipelines or materials) on the now
removed source stack.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
77b3c0d670 cogl: Remove API implicitly switching between built in pipelines
This means cogl_set_source_color*() that switches to the opaque or
blending pipeline, or cogl_source_set_texture() which switches to the
texture pipeline.

Left is the opaque pipeline, as it is still used to compare other
pipelines to check whether they are opaque or not, and as the default
pipeline still pushed to the source stack during initialization.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
3819291cb7 cogl: Remove API implicitly using framebuffer stack
E.g. cogl_frustum(), cogl_push_matrix(), etc.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
30964051fe cogl: Remove declaration for long gone function
It was removed in 2011, but the declaration lingered. Until now.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
ae4ae61a5f cogl: Remove deprecated primitives functions
Such as cogl_rectangle() and cogl_polygon().

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
a91138c8f8 cogl/context: Remove unusued window_buffer field
It kept track of the last "window" (i.e. CoglOnscreen) was the active
on. It was used by API removed in the past, so also remove the left over
field.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
27b6d1892f cogl/path: Remove API using deprecated Cogl API
The implicit stacks are going away, so remove API that depend on it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
2a8f0c2801 cogl/tests: Port away from legacy implicit stack based API
Use the new API where state (framebuffer, pipeline) is always passed as
parameters, instead of using the implicit material and framebuffer
stack.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
9e2e44c0c2 cogl/tests/warp-modes: Test CoglPrimitive instead of cogl_polygon()
Change the warp modes test to sanity check CoglPrimitive based polygon
drawing instead of cogl_polygon(). This removes some checks, as
cogl_polygon() has explicitly documented special behaviour for automatic
wrap modes, which CoglPrimitive does not.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
5e117b3f5a cogl/tests: Remove testing of legacy API
Some tests just test that deprecated API still work as they should.
Those APIs are being removed, so prepare by removing their tests.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
294b4eda4c cogl/tests/backface-culling: Port to non-deprecated API
Usage of cogl_polygon() was ported to CoglPrimitive, and implicit
framebuffer stack API was ported to explicit framebuffer based API.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
7faf9f91db cogl/tests/backface-culling: Stop testing legacy state
It's going away, so stop testing it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
4b5abdc988 cogl/tests: Remove test-materials
It wasn't compiled, nor ported to the new test suite, and tests
deprecated functionality that are being removed. Lets drop it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
629dc4c770 clutter/paint-nodes: Add missing newline
https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
3f65837e0d clutter, core: Stop using the Cogl framebuffer stack
The Cogl framebuffer stack is going away; replace all its uses by the
framebuffer stack carried by the paint context.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
549f60fe49 texture-tower: Don't use implicit framebuffer stack Cogl API
Replace it with the non-deprecated counterparts.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
26147afb08 shadow-factory: Don't set implicit Cogl material
We only draw with non-deprecated API already, so there is no reason to
set the source material.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
fd0ce66ac1 clutter/paint-nodes: Stop using implicit framebuffer stack Cogl API
Stop using API that uses the implicit Cogl framebuffer stack, (e.g.
cogl_push_matrix()) and replace usage by the corresponding API taking an
explicit framebuffer (e.g. cogl_framebuffer_push_matrix()).

For offscreens etc, the offscreen framebuffer is still pushed to and
popped from the Cogl framebuffer stack, so that paint nodes still draw
to the right framebuffer.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
c621d4d571 clutter/offscreen-effect: Don't use implicit framebuffer Cogl APIs
While we still push and pop to the Cogl framebuffer stack, as so is
still needed to render the actors correctly, don't use the API using the
implicit framebuffer stack ourself in the offscreen effect code.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
6f30cf0004 tests/clutter/cogl-tex-polygon: Port to CoglPrimitive
Instead of using cogl_polygon(), which uses deprecated API, implement
polygon drawing using the CoglPrimitive API family. While the test might
have been used to explicitly test cogl_polygon() it could still be
useful to test the non-deprecated way of rendering polygons.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
8c7ec44681 tests/clutter: Port to using non-implicit framebuffer Cogl API
Port tests to use API such as cogl_framebuffer_push_matrix() instead of
cogl_push_matrix() all over the Clutter tests, with one exception:
cogl_polygon(). It'll be ported over in a separate commit, as it is less
straight forward.

Implicitly set CoglMaterial properties are changed to explicitly created
and destructed CoglPipelines with the equivalent properties set.
cogl_push|pop_framebuffer() is replaced by explicitly passing the right
framebuffer, but tests still rely on cogl_get_draw_framebuffer() to get
the target framebuffer.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
8329c6b069 clutter/paint-node: Use non-deprecated Cogl API when drawing operations
The paint node drawing partly used deprecated Cogl implicit stack APIs.
Port that over to the non-deprecated variants.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
f11170fecb clutter/paint-node: Have caller of .._get_framebuffer() handle fallback
clutter_paint_node_get_framebuffer() fell back on
cogl_get_draw_framebuffer() when the root node didn't have a custom
get_framebuffer vfunc. As this relies on deprecated implicit Cogl stack
API, it needs to go away, so handle this in the caller that knows more
about the context.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
48e6fccc95 clutter/pipeline-paint-node: Use draw framebuffer when drawing primitives
As with all the other draw operations, use the current draw framebuffer
to draw the primitives.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
61026d181b clutter/root-node: Require non-null framebuffer on construction
It's the only way it's used, and it removes a usage of deprecated Cogl
implicit stack API.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
5145b33e01 clutter/paint-node: Remove unnecessary NULL check in get_framebuffer()
The only way we would ever get NULL there is if the node passed to the
function is NULL, and that is invalid input to begin with.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
8ce3b3d99e clutter/actor: Remove unnecessary NULL check from paint_node()
The function is static, only has one caller, that always passes a
non-NULL pointer, so the NULL check just adds confusion.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
e696f639ab cogl/pixel-buffer: Remove declaration hidden behind #if
Doesn't lead to anywhere, isn't used anywhere, so lets remove it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
9c43b12206 clutter/stage: Remove "active framebuffer" state
It has been replaced by the base framebuffer of the paint context.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
78a7c93802 clutter: Use paint context to get paint target framebuffer
Instead of using the intermediate stage state "active framebuffer" to
find the framebuffer a paint eventually targets, use the "base
framebuffer" of the paint context, as this more correctly corresponds to
the end point of a paint. It also means we can then later remove this
intermediate state from the stage.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
5c68596744 clutter/paint-context: Add API to get base framebuffer
This corresponds to the framebuffer the paint targets. For regular stage
redraws, this means the framebuffer of the stage view.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
61b1ead1a2 clutter: Use pick context to track the framebuffer
Instead of pushing and popping the Cogl framebuffer stack, use the
framebuffer passed around using the pick context. This removes usage of
the deprecated framebuffer stack when picking.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
138907c480 clutter/actor: Use paint context when culling to check render target
Rendering off stage we never cull, and previously this was checked by
comparing the "active framebuffer" of the stage, to the current
framebuffer in the cogl stack. Replace this by checking whether the
current paint context is currently drawing on stage or not.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
66f02ae93d cogl/pango: Remove deprecated API using implicit fb stack
Remove the implicit framebuffer stack using cogl_pango_render_*() API
that was replaced with the newer cogl_pango_show_*() API.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
455535128a clutter/actor: Change comment to refer to non-deprecated API
https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
53431fce2a clutter/paint-nodes: Stop using deprecated cogl_pango API
As with ClutterText, use the one where you pass the framebuffer
explicitly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
339372ac99 clutter/text: Stop using deprecated cogl-pango API
Use the one passing a framebuffer instead of the one using the
deprecated implicit framebuffer stack.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
cb9d6b79ef clutter: Introduce pick contexts
Just as with painting, add a pick context that carries pick related
temporary state when doing actor picking. It is currently unused, and
will at least at first still carry around a framebuffer to deal track
view transforms etc.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
e8e5ccf82d cogl/tests: Remove test-fixed
It was a non-built non-ported test case for removed code.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
3f2a6f58eb tests/clutter: Remove unneeded gitignore files
We're using meson, so everything built ends up in the build directory.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
98c0fe934b cogl: Remove CoglVertexBuffer
It was deprecated, relied on deprecated API (implicit framebuffers,
mateiarls etc), and was unused. Lets remove it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
49c8d42317 clutter: Introduce paint contexts
When painting, actors rely on semi global state tracked by the state to
get various things needed for painting, such as the current draw
framebuffer. Having state hidden in such ways can be very deceiving as
it's hard to follow changes spread out, and adding more and more state
that should be tracked during a paint gets annoying as they will not
change in isolation but one by one in their own places. To do this
better, introduce a paint context that is passed along in paint calls
that contains the necessary state needed during painting.

The paint context implements a framebuffer stack just as Cogl works,
which is currently needed for offscreen rendering used by clutter.

The same context is passed around for paint nodes, contents and effects
as well.

In this commit, the context is only introduced, but not used. It aims to
replace the Cogl framebuffer stack, and will allow actors to know what
view it is currently painted on.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Niels De Graef
5c986060f0 wayland: Add documentation to wayland_shell_init
Especially preventing the confusion that it might only initalize the
wl_shell interface.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/871
2019-12-03 14:43:43 +01:00
Niels De Graef
404e713227 wayland: Add documentation to the WaylandBuffer object
https://gitlab.gnome.org/GNOME/mutter/merge_requests/871
2019-12-03 14:43:43 +01:00
Niels De Graef
542bad60ba wayland: Add documentation for dma-buf namespace
It's not always clear how the dma-buf functions work (e.g. where memory
is allocated) without actually going in-depth in the code. This just
adds a few commments to more quickly gain understanding.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/871
2019-12-03 14:43:43 +01:00
Carlos Garnacho
6f4c7d66a4 x11: Check wacom button flags to determine whether button is mode switch
Checking the leds is not really accurate, since some devices have mode
switch buttons without leds. Check in the button flags whether they are
mode switch buttons for any of ring/ring2/strip/strip2, and return the
appropriate group.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/952
2019-11-29 18:10:14 +00:00
Florian Müllner
c843102eec stack: Delegate layer calculation to a window vfunc
While most of the code to compute a window's layer isn't explicitly
windowing backend specific, it is in practice: On wayland there are
no DESKTOP windows(*), docks(*) or groups.

Reflect that by introducing a calculate_layer() vfunc that computes
(and sets) a window's layer.

(*) they shall burn in hell, amen!

https://gitlab.gnome.org/GNOME/mutter/merge_requests/949
2019-11-29 15:14:38 +01:00
Florian Müllner
b753213f9b window: Add get_default_layer() helper
Most of the layer computation that the stack does actually depends
on the windowing backend, so we will move it to a vfunc.

However before we do that, split out the bit that will be shared.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/949
2019-11-29 15:14:38 +01:00
Florian Müllner
599d8e3287 stack: Move HAS_TRANSIENT_TYPE macro to window-private
We'll soon need it elsewhere, so move it to a shared location.
While at it, convert it to a function.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/949
2019-11-29 15:14:38 +01:00
Florian Müllner
1c89fce30e stack: Allow promoting transient windows to their parent's layer
When a window that should be stacked above another one is placed in a lower
layer than the other window, we currently allow promoting it to the higher
layer when it has a "transient type". We should do the same when the window
is an actual transient of the other window.

This is particularly relevant for wayland windows, where types play a
much smaller role: Transient windows like non-modal dialogs (and since
commit 666bef7a, popup windows as well) currently end up underneath their
always-on-top parent.

https://gitlab.gnome.org/GNOME/mutter/issues/587
2019-11-28 21:10:47 +01:00
Robert Mader
0247d35e5a shaped-texture: Do not invalidate content on set_cogl_texture()
This was wrongly introduced in 75cffd0ec4. As the comment above explains, we
only want to queue redraws in response to surface/buffer damage.

This triggered a full redraw when using DMA buffers on Wayland as we currently
create a new texture on every buffer_attach(), breaking partial invalidation.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/947
2019-11-26 21:35:50 +01:00
Marco Trevisan (Treviño)
427670cc63 device-manager-x11: Ignore events if no source device is set
There might be some inconsistent event for which we don't have a known
source device.

In the current state we don't handle them and we could crash when getting
the current device tool.

So, add an utility function that retrieves the source device for an event
that warns if no device is found, and use this for Motion, Key and Button
events.

In case we don't have a valid source in such case, just return early instead
of trying to generate invalid clutter events.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/823
2019-11-23 01:38:16 +00:00
Jonas Ådahl
4af4b79123 window: Assert we have an up to date monitor after they changed
Add an assert that we don't have a MetaWindow::monitor pointer that
points to an old MetaLogicalMonitor. After this, and the other
monitors-changed callbacks have been called, the old MetaLogicalMonitor
will be destoryed, thus if we didn't update the pointer here, we'll
point to freed memory, and will eventually crash later on.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/929
2019-11-23 00:58:19 +00:00
Corentin Noël
5582d7b3be background: set_file accepts NULL files
https://gitlab.gnome.org/GNOME/mutter/merge_requests/941
2019-11-22 22:13:35 +00:00
Corentin Noël
4cccba5cac workspace-manager: get_workspace_by_index can return NULL
https://gitlab.gnome.org/GNOME/mutter/merge_requests/941
2019-11-22 22:13:35 +00:00
181 changed files with 2809 additions and 7756 deletions

View File

@@ -1,8 +1,8 @@
# Rebuild and push with
#
# cd .gitlab-ci/
# docker build --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v3 .
# docker push registry.gitlab.gnome.org/gnome/mutter/master:v3
# podman build --format docker --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v3 .
# podman push registry.gitlab.gnome.org/gnome/mutter/master:v3
#
FROM fedora:31

50
NEWS
View File

@@ -1,3 +1,53 @@
3.35.2
======
* Don't emit focus event after destruction [Marco; gnome-shell#1704, !860]
* Add a notion of pixel format planes [Niels; !858]
* Replace various Cogl/Clutter types with Graphene [Georges; !458]
* Improve CoglJournal [Georges, Jasper; !402]
* Split pick and paint [Georges; !865]
* Remove deprecated/unused cogl/clutter APIs [Adam; !866, !878, !879, !880,
!885, !900, !902, !904, !896, !913, !922, !883, !903, !921, !933, !819]
* Fix hang when opening not-responding dialog on Xorg [Carlos; !876]
* Allow changing Clutter debug flags at runtime [Georges; !862]
* Fix frozen grabs on Xorg after weeks of inactivity [Jonas; !886]
* Fix triggering popups from stylus devices o wayland [Carlos; #886]
* Fix fallback to GLES2 [Adam; #635]
* Fix buffer age checks on multiple monitors [Carlos; !906]
* Adjust to Sysprof API change [Christian; !908]
* Improve support for (X11) fullscreen games under wayland [Hans; !739]
* Support shadow framebuffers for offscreen rendering [Olivier; !877]
* Fix hang after interacting with desktop icons on X11 [Marco; !909]
* Don't double scale when getting absolute surface coordinates [Xiang; !915]
* Respect NET_WM_TRANSIENT_FOR for override-redirect windows [Marco; !920]
* Kill window effects on destroy [Robert; !924]
* Remove deprecated ClutterTexture [Jonas; !932]
* Use regions instead of bounding box for clipping and culling [Carlos; !867]
* Use partial damage for dma-buf and EGLImage buffers on wayland [Robert; #947]
* Do not stack transients underneath their always-on-top parent [Florian; #587]
* Add explicit paint/pick contexts [Jonas; !935]
* Fix KMS freeze after pageflip fallback [Pekka; !953]
* Fixed crashes [Robert, Carlos, Jonas, Marco, Hans, Tim; !856, !869, !912,
!895, !928, #591, !823, !960]
* Plugged memory leaks [Niels, Robert, Carlos, Marco; !847, !868, !873, #908]
* Misc. bug fixes and cleanups [Niels, Robert, Jonas, Marco, Carlos, Daniel,
Jan, Adam, Cosimo, Florian, Thomas, Georges, Hans, Corentin, Christian,
Benjamin; !853, !822, !451, !854, !816, !857, !859, !734, !844, !851, #876,
!874, !673, !692, !888, !889, !894, !901, !905, !872, !898, !911, !918, !863,
#878, !811, !893, !925, !926, !890, !931, !927, !934, !938, !940, !947, !941,
!929, !949, !952, !871, !955, !956, !958, !907, !965, !964, !966]
Contributors:
Marco Trevisan (Treviño), Jan Alexander Steffens (heftig),
Thomas Hindoe Paaboel Andersen, Benjamin Berg, Cosimo Cecchi, Tim Crawford,
Piotr Drąg, Xiang Fan, Olivier Fourdan, Carlos Garnacho, Hans de Goede,
Niels De Graef, Christian Hergert, Adam Jackson, Robert Mader,
Florian Müllner, Georges Basile Stavracas Neto, Bastien Nocera, Corentin Noël,
Pekka Paalanen, Jasper St. Pierre, Christian Rauch, Daniel van Vugt,
Jonas Ådahl
Translators:
Bruce Cowan [en_GB]
3.35.1
======
* Fix immediate screen blank after releaseing inhibitor [Tim; #573]

View File

@@ -315,7 +315,6 @@ void _clutter_actor_queue_relayout_on_clones
void _clutter_actor_queue_only_relayout (ClutterActor *actor);
void _clutter_actor_queue_update_resource_scale_recursive (ClutterActor *actor);
CoglFramebuffer * _clutter_actor_get_active_framebuffer (ClutterActor *actor);
gboolean _clutter_actor_get_real_resource_scale (ClutterActor *actor,
float *resource_scale);

View File

@@ -643,6 +643,7 @@
#include "clutter-main.h"
#include "clutter-marshal.h"
#include "clutter-mutter.h"
#include "clutter-paint-context-private.h"
#include "clutter-paint-nodes.h"
#include "clutter-paint-node-private.h"
#include "clutter-paint-volume-private.h"
@@ -1286,10 +1287,12 @@ clutter_actor_verify_map_state (ClutterActor *self)
static gboolean
_clutter_actor_transform_local_box_to_stage (ClutterActor *self,
ClutterStage *stage,
ClutterPickContext *pick_context,
const ClutterActorBox *box,
graphene_point_t vertices[4])
{
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
CoglFramebuffer *fb =
clutter_pick_context_get_framebuffer (pick_context);
CoglMatrix stage_transform, inv_stage_transform;
CoglMatrix modelview, transform_to_stage;
int v;
@@ -1330,6 +1333,7 @@ _clutter_actor_transform_local_box_to_stage (ClutterActor *self,
/**
* clutter_actor_pick_box:
* @self: The #ClutterActor being "pick" painted.
* @pick_context: The #ClutterPickContext
* @box: A rectangle in the actor's own local coordinates.
*
* Logs (does a virtual paint of) a rectangle for picking. Note that @box is
@@ -1340,6 +1344,7 @@ _clutter_actor_transform_local_box_to_stage (ClutterActor *self,
*/
void
clutter_actor_pick_box (ClutterActor *self,
ClutterPickContext *pick_context,
const ClutterActorBox *box)
{
ClutterStage *stage;
@@ -1353,12 +1358,14 @@ clutter_actor_pick_box (ClutterActor *self,
stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self));
if (_clutter_actor_transform_local_box_to_stage (self, stage, box, vertices))
if (_clutter_actor_transform_local_box_to_stage (self, stage, pick_context,
box, vertices))
clutter_stage_log_pick (stage, vertices, self);
}
static gboolean
_clutter_actor_push_pick_clip (ClutterActor *self,
ClutterPickContext *pick_context,
const ClutterActorBox *clip)
{
ClutterStage *stage;
@@ -1366,7 +1373,8 @@ _clutter_actor_push_pick_clip (ClutterActor *self,
stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self));
if (!_clutter_actor_transform_local_box_to_stage (self, stage, clip, vertices))
if (!_clutter_actor_transform_local_box_to_stage (self, stage, pick_context,
clip, vertices))
return FALSE;
clutter_stage_push_pick_clip (stage, vertices);
@@ -2321,7 +2329,8 @@ _clutter_actor_rerealize (ClutterActor *self,
}
static void
clutter_actor_real_pick (ClutterActor *self)
clutter_actor_real_pick (ClutterActor *self,
ClutterPickContext *pick_context)
{
if (clutter_actor_should_pick_paint (self))
{
@@ -2332,7 +2341,7 @@ clutter_actor_real_pick (ClutterActor *self)
.y2 = clutter_actor_get_height (self),
};
clutter_actor_pick_box (self, &box);
clutter_actor_pick_box (self, pick_context, &box);
}
/* XXX - this thoroughly sucks, but we need to maintain compatibility
@@ -2349,7 +2358,7 @@ clutter_actor_real_pick (ClutterActor *self)
for (iter = self->priv->first_child;
iter != NULL;
iter = iter->priv->next_sibling)
clutter_actor_pick (iter);
clutter_actor_pick (iter, pick_context);
}
}
@@ -3591,8 +3600,9 @@ in_clone_paint (void)
* means there's no point in trying to cull descendants of the current
* node. */
static gboolean
cull_actor (ClutterActor *self,
ClutterCullResult *result_out)
cull_actor (ClutterActor *self,
ClutterPaintContext *paint_context,
ClutterCullResult *result_out)
{
ClutterActorPrivate *priv = self->priv;
ClutterStage *stage;
@@ -3619,10 +3629,10 @@ cull_actor (ClutterActor *self,
return FALSE;
}
if (cogl_get_draw_framebuffer () != _clutter_stage_get_active_framebuffer (stage))
if (clutter_paint_context_is_drawing_off_stage (paint_context))
{
CLUTTER_NOTE (CLIPPING, "Bail from cull_actor without culling (%s): "
"Current framebuffer doesn't correspond to stage",
"Drawing off stage",
_clutter_actor_get_debug_name (self));
return FALSE;
}
@@ -3760,7 +3770,8 @@ add_or_remove_flatten_effect (ClutterActor *self)
}
static void
clutter_actor_real_paint (ClutterActor *actor)
clutter_actor_real_paint (ClutterActor *actor,
ClutterPaintContext *paint_context)
{
ClutterActorPrivate *priv = actor->priv;
ClutterActor *iter;
@@ -3777,21 +3788,19 @@ clutter_actor_real_paint (ClutterActor *actor)
iter->priv->allocation.x2 - iter->priv->allocation.x1,
iter->priv->allocation.y2 - iter->priv->allocation.y1);
clutter_actor_paint (iter);
clutter_actor_paint (iter, paint_context);
}
}
static gboolean
clutter_actor_paint_node (ClutterActor *actor,
ClutterPaintNode *root)
clutter_actor_paint_node (ClutterActor *actor,
ClutterPaintNode *root,
ClutterPaintContext *paint_context)
{
ClutterActorPrivate *priv = actor->priv;
ClutterActorBox box;
ClutterColor bg_color;
if (root == NULL)
return FALSE;
box.x1 = 0.f;
box.y1 = 0.f;
box.x2 = clutter_actor_box_get_width (&priv->allocation);
@@ -3805,7 +3814,7 @@ clutter_actor_paint_node (ClutterActor *actor,
CoglFramebuffer *fb;
CoglBufferBit clear_flags;
fb = _clutter_stage_get_active_framebuffer (CLUTTER_STAGE (actor));
fb = clutter_paint_context_get_base_framebuffer (paint_context);
if (clutter_stage_get_use_alpha (CLUTTER_STAGE (actor)))
{
@@ -3847,7 +3856,7 @@ clutter_actor_paint_node (ClutterActor *actor,
}
if (priv->content != NULL)
_clutter_content_paint_content (priv->content, actor, root);
_clutter_content_paint_content (priv->content, actor, root, paint_context);
if (CLUTTER_ACTOR_GET_CLASS (actor)->paint_node != NULL)
CLUTTER_ACTOR_GET_CLASS (actor)->paint_node (actor, root);
@@ -3863,7 +3872,7 @@ clutter_actor_paint_node (ClutterActor *actor,
}
#endif /* CLUTTER_ENABLE_DEBUG */
clutter_paint_node_paint (root);
clutter_paint_node_paint (root, paint_context);
return TRUE;
}
@@ -3887,7 +3896,8 @@ clutter_actor_paint_node (ClutterActor *actor,
* unless it is performing a pick paint.
*/
void
clutter_actor_paint (ClutterActor *self)
clutter_actor_paint (ClutterActor *self,
ClutterPaintContext *paint_context)
{
g_autoptr (ClutterPaintNode) actor_node = NULL;
g_autoptr (ClutterPaintNode) root_node = NULL;
@@ -4052,7 +4062,7 @@ clutter_actor_paint (ClutterActor *self)
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS)))
_clutter_actor_update_last_paint_volume (self);
success = cull_actor (self, &result);
success = cull_actor (self, paint_context, &result);
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS))
_clutter_actor_paint_cull_result (self, success, result, actor_node);
@@ -4069,7 +4079,7 @@ clutter_actor_paint (ClutterActor *self)
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES))
_clutter_actor_draw_paint_volume (self, actor_node);
clutter_paint_node_paint (root_node);
clutter_paint_node_paint (root_node, paint_context);
/* 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 */
@@ -4089,7 +4099,8 @@ clutter_actor_paint (ClutterActor *self)
* Since: 1.8
*/
void
clutter_actor_continue_paint (ClutterActor *self)
clutter_actor_continue_paint (ClutterActor *self,
ClutterPaintContext *paint_context)
{
ClutterActorPrivate *priv;
@@ -4109,6 +4120,7 @@ clutter_actor_continue_paint (ClutterActor *self)
actual actor */
if (priv->next_effect_to_paint == NULL)
{
CoglFramebuffer *framebuffer;
ClutterPaintNode *dummy;
/* XXX - this will go away in 2.0, when we can get rid of this
@@ -4116,21 +4128,22 @@ clutter_actor_continue_paint (ClutterActor *self)
* for the entire frame, starting from the Stage; the paint()
* virtual function can then be called directly.
*/
dummy = _clutter_dummy_node_new (self);
framebuffer = clutter_paint_context_get_base_framebuffer (paint_context);
dummy = _clutter_dummy_node_new (self, framebuffer);
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_actor_paint_node (self, dummy, paint_context);
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);
g_signal_emit (self, actor_signals[PAINT], 0, paint_context);
else
CLUTTER_ACTOR_GET_CLASS (self)->paint (self);
CLUTTER_ACTOR_GET_CLASS (self)->paint (self, paint_context);
}
else
{
@@ -4157,7 +4170,7 @@ clutter_actor_continue_paint (ClutterActor *self)
run_flags |= CLUTTER_EFFECT_PAINT_ACTOR_DIRTY;
}
_clutter_effect_paint (priv->current_effect, run_flags);
_clutter_effect_paint (priv->current_effect, paint_context, run_flags);
priv->current_effect = old_current_effect;
}
@@ -4170,9 +4183,11 @@ clutter_actor_continue_paint (ClutterActor *self)
* Asks @actor to perform a pick.
*/
void
clutter_actor_pick (ClutterActor *actor)
clutter_actor_pick (ClutterActor *actor,
ClutterPickContext *pick_context)
{
ClutterActorPrivate *priv;
CoglFramebuffer *framebuffer;
ClutterActorBox clip;
gboolean clip_set = FALSE;
@@ -4192,15 +4207,16 @@ clutter_actor_pick (ClutterActor *actor)
/* mark that we are in the paint process */
CLUTTER_SET_PRIVATE_FLAGS (actor, CLUTTER_IN_PICK);
cogl_push_matrix ();
framebuffer = clutter_pick_context_get_framebuffer (pick_context);
cogl_framebuffer_push_matrix (framebuffer);
if (priv->enable_model_view_transform)
{
CoglMatrix matrix;
cogl_get_modelview_matrix (&matrix);
cogl_framebuffer_get_modelview_matrix (framebuffer, &matrix);
_clutter_actor_apply_modelview_transform (actor, &matrix);
cogl_set_modelview_matrix (&matrix);
cogl_framebuffer_set_modelview_matrix (framebuffer, &matrix);
}
if (priv->has_clip)
@@ -4221,7 +4237,7 @@ clutter_actor_pick (ClutterActor *actor)
}
if (clip_set)
clip_set = _clutter_actor_push_pick_clip (actor, &clip);
clip_set = _clutter_actor_push_pick_clip (actor, pick_context, &clip);
priv->next_effect_to_paint = NULL;
if (priv->effects)
@@ -4230,12 +4246,12 @@ clutter_actor_pick (ClutterActor *actor)
_clutter_meta_group_peek_metas (priv->effects);
}
clutter_actor_continue_pick (actor);
clutter_actor_continue_pick (actor, pick_context);
if (clip_set)
_clutter_actor_pop_pick_clip (actor);
cogl_pop_matrix ();
cogl_framebuffer_pop_matrix (framebuffer);
/* paint sequence complete */
CLUTTER_UNSET_PRIVATE_FLAGS (actor, CLUTTER_IN_PICK);
@@ -4252,7 +4268,8 @@ clutter_actor_pick (ClutterActor *actor)
* is the last effect in the chain.
*/
void
clutter_actor_continue_pick (ClutterActor *actor)
clutter_actor_continue_pick (ClutterActor *actor,
ClutterPickContext *pick_context)
{
ClutterActorPrivate *priv;
@@ -4278,9 +4295,9 @@ clutter_actor_continue_pick (ClutterActor *actor)
*/
if (g_signal_has_handler_pending (actor, actor_signals[PICK],
0, TRUE))
g_signal_emit (actor, actor_signals[PICK], 0);
g_signal_emit (actor, actor_signals[PICK], 0, pick_context);
else
CLUTTER_ACTOR_GET_CLASS (actor)->pick (actor);
CLUTTER_ACTOR_GET_CLASS (actor)->pick (actor, pick_context);
}
else
{
@@ -4294,7 +4311,7 @@ clutter_actor_continue_pick (ClutterActor *actor)
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);
_clutter_effect_pick (priv->current_effect, pick_context);
priv->current_effect = old_current_effect;
}
@@ -8534,6 +8551,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
/**
* ClutterActor::paint:
* @actor: the #ClutterActor that received the signal
* @paint_context: a #ClutterPaintContext
*
* The ::paint signal is emitted each time an actor is being painted.
*
@@ -8561,7 +8579,8 @@ clutter_actor_class_init (ClutterActorClass *klass)
G_SIGNAL_DEPRECATED,
G_STRUCT_OFFSET (ClutterActorClass, paint),
NULL, NULL, NULL,
G_TYPE_NONE, 0);
G_TYPE_NONE, 1,
CLUTTER_TYPE_PAINT_CONTEXT);
/**
* ClutterActor::realize:
* @actor: the #ClutterActor that received the signal
@@ -8604,6 +8623,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
/**
* ClutterActor::pick:
* @actor: the #ClutterActor that received the signal
* @pick_context: a #ClutterPickContext
*
* The ::pick signal is emitted each time an actor is being painted
* in "pick mode". The pick mode is used to identify the actor during
@@ -8625,7 +8645,8 @@ clutter_actor_class_init (ClutterActorClass *klass)
G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED,
G_STRUCT_OFFSET (ClutterActorClass, pick),
NULL, NULL, NULL,
G_TYPE_NONE, 0);
G_TYPE_NONE, 1,
CLUTTER_TYPE_PICK_CONTEXT);
/**
* ClutterActor::allocation-changed:
@@ -15660,7 +15681,7 @@ update_pango_context (ClutterBackend *backend,
* stored by the #ClutterBackend change.
*
* You can use the returned #PangoContext to create a #PangoLayout
* and render text using cogl_pango_render_layout() to reuse the
* and render text using cogl_pango_show_layout() to reuse the
* glyphs cache also used by Clutter.
*
* Return value: (transfer none): the #PangoContext for a #ClutterActor.
@@ -20793,32 +20814,6 @@ clutter_actor_has_mapped_clones (ClutterActor *self)
return FALSE;
}
CoglFramebuffer *
_clutter_actor_get_active_framebuffer (ClutterActor *self)
{
ClutterStage *stage;
if (!CLUTTER_ACTOR_IN_PAINT (self))
{
g_critical ("The active framebuffer of actor '%s' can only be "
"retrieved during the paint sequence. Please, check "
"your code.",
_clutter_actor_get_debug_name (self));
return NULL;
}
stage = (ClutterStage *) _clutter_actor_get_stage_internal (self);
if (stage == NULL)
{
g_critical ("The active framebuffer of actor '%s' is only available "
"if the actor is associated to a ClutterStage.",
_clutter_actor_get_debug_name (self));
return NULL;
}
return _clutter_stage_get_active_framebuffer (stage);
}
static void
clutter_actor_child_model__items_changed (GListModel *model,
guint position,

View File

@@ -39,6 +39,8 @@
#include <clutter/clutter-types.h>
#include <clutter/clutter-event.h>
#include <clutter/clutter-paint-context.h>
#include <clutter/clutter-pick-context.h>
G_BEGIN_DECLS
@@ -228,12 +230,14 @@ struct _ClutterActorClass
void (* unrealize) (ClutterActor *self);
void (* map) (ClutterActor *self);
void (* unmap) (ClutterActor *self);
void (* paint) (ClutterActor *self);
void (* paint) (ClutterActor *self,
ClutterPaintContext *paint_context);
void (* parent_set) (ClutterActor *actor,
ClutterActor *old_parent);
void (* destroy) (ClutterActor *self);
void (* pick) (ClutterActor *actor);
void (* pick) (ClutterActor *actor,
ClutterPickContext *pick_context);
gboolean (* queue_redraw) (ClutterActor *actor,
ClutterActor *leaf_that_queued,
@@ -349,13 +353,17 @@ void clutter_actor_map
CLUTTER_EXPORT
void clutter_actor_unmap (ClutterActor *self);
CLUTTER_EXPORT
void clutter_actor_paint (ClutterActor *self);
void clutter_actor_paint (ClutterActor *self,
ClutterPaintContext *paint_context);
CLUTTER_EXPORT
void clutter_actor_continue_paint (ClutterActor *self);
void clutter_actor_continue_paint (ClutterActor *self,
ClutterPaintContext *paint_context);
CLUTTER_EXPORT
void clutter_actor_pick (ClutterActor *actor);
void clutter_actor_pick (ClutterActor *actor,
ClutterPickContext *pick_context);
CLUTTER_EXPORT
void clutter_actor_continue_pick (ClutterActor *actor);
void clutter_actor_continue_pick (ClutterActor *actor,
ClutterPickContext *pick_context);
CLUTTER_EXPORT
void clutter_actor_queue_redraw (ClutterActor *self);
CLUTTER_EXPORT
@@ -907,6 +915,7 @@ void clutter_actor_bind_model_with_properties
CLUTTER_EXPORT
void clutter_actor_pick_box (ClutterActor *self,
ClutterPickContext *pick_context,
const ClutterActorBox *box);
G_END_DECLS

View File

@@ -90,6 +90,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorBox, clutter_actor_box_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColor, clutter_color_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMargin, clutter_margin_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMatrix, clutter_matrix_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintContext, clutter_paint_context_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintNode, clutter_paint_node_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintVolume, clutter_paint_volume_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPathNode, clutter_path_node_free)

View File

@@ -141,9 +141,6 @@ gint32 _clutter_backend_get_units_serial (Clutter
PangoDirection _clutter_backend_get_keymap_direction (ClutterBackend *backend);
CLUTTER_EXPORT
void _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend);
void clutter_set_allowed_drivers (const char *drivers);
CLUTTER_EXPORT

View File

@@ -1009,27 +1009,6 @@ _clutter_backend_get_keymap_direction (ClutterBackend *backend)
return PANGO_DIRECTION_NEUTRAL;
}
void
_clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend)
{
if (backend->dummy_onscreen == NULL)
{
GError *internal_error = NULL;
backend->dummy_onscreen = cogl_onscreen_new (backend->cogl_context, 1, 1);
if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (backend->dummy_onscreen),
&internal_error))
{
g_critical ("Unable to create dummy onscreen: %s", internal_error->message);
g_error_free (internal_error);
return;
}
}
cogl_set_framebuffer (COGL_FRAMEBUFFER (backend->dummy_onscreen));
}
void
clutter_set_allowed_drivers (const char *drivers)
{

View File

@@ -99,7 +99,8 @@ G_DEFINE_TYPE (ClutterBlurEffect,
CLUTTER_TYPE_OFFSCREEN_EFFECT);
static gboolean
clutter_blur_effect_pre_paint (ClutterEffect *effect)
clutter_blur_effect_pre_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (effect);
ClutterEffectClass *parent_class;
@@ -124,7 +125,7 @@ clutter_blur_effect_pre_paint (ClutterEffect *effect)
}
parent_class = CLUTTER_EFFECT_CLASS (clutter_blur_effect_parent_class);
if (parent_class->pre_paint (effect))
if (parent_class->pre_paint (effect, paint_context))
{
ClutterOffscreenEffect *offscreen_effect =
CLUTTER_OFFSCREEN_EFFECT (effect);
@@ -157,10 +158,12 @@ clutter_blur_effect_pre_paint (ClutterEffect *effect)
}
static void
clutter_blur_effect_paint_target (ClutterOffscreenEffect *effect)
clutter_blur_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (effect);
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
guint8 paint_opacity;
paint_opacity = clutter_actor_get_paint_opacity (self->actor);

View File

@@ -130,7 +130,8 @@ will_have_no_effect (ClutterBrightnessContrastEffect *self)
}
static gboolean
clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect)
clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
ClutterEffectClass *parent_class;
@@ -156,7 +157,7 @@ clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect)
parent_class =
CLUTTER_EFFECT_CLASS (clutter_brightness_contrast_effect_parent_class);
if (parent_class->pre_paint (effect))
if (parent_class->pre_paint (effect, paint_context))
{
ClutterOffscreenEffect *offscreen_effect =
CLUTTER_OFFSCREEN_EFFECT (effect);
@@ -175,10 +176,12 @@ clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect)
}
static void
clutter_brightness_contrast_effect_paint_target (ClutterOffscreenEffect *effect)
clutter_brightness_contrast_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
ClutterActor *actor;
guint8 paint_opacity;

View File

@@ -328,9 +328,10 @@ clutter_canvas_init (ClutterCanvas *self)
}
static void
clutter_canvas_paint_content (ClutterContent *content,
ClutterActor *actor,
ClutterPaintNode *root)
clutter_canvas_paint_content (ClutterContent *content,
ClutterActor *actor,
ClutterPaintNode *root,
ClutterPaintContext *paint_context)
{
ClutterCanvas *self = CLUTTER_CANVAS (content);
ClutterCanvasPrivate *priv = self->priv;

View File

@@ -152,7 +152,8 @@ clutter_clone_apply_transform (ClutterActor *self, CoglMatrix *matrix)
}
static void
clutter_clone_paint (ClutterActor *actor)
clutter_clone_paint (ClutterActor *actor,
ClutterPaintContext *paint_context)
{
ClutterClone *self = CLUTTER_CLONE (actor);
ClutterClonePrivate *priv = self->priv;
@@ -189,7 +190,7 @@ clutter_clone_paint (ClutterActor *actor)
if (clutter_actor_is_realized (priv->clone_source))
{
_clutter_actor_push_clone_paint ();
clutter_actor_paint (priv->clone_source);
clutter_actor_paint (priv->clone_source, paint_context);
_clutter_actor_pop_clone_paint ();
}

View File

@@ -105,7 +105,8 @@ G_DEFINE_TYPE (ClutterColorizeEffect,
CLUTTER_TYPE_OFFSCREEN_EFFECT);
static gboolean
clutter_colorize_effect_pre_paint (ClutterEffect *effect)
clutter_colorize_effect_pre_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterColorizeEffect *self = CLUTTER_COLORIZE_EFFECT (effect);
ClutterEffectClass *parent_class;
@@ -126,7 +127,7 @@ clutter_colorize_effect_pre_paint (ClutterEffect *effect)
}
parent_class = CLUTTER_EFFECT_CLASS (clutter_colorize_effect_parent_class);
if (parent_class->pre_paint (effect))
if (parent_class->pre_paint (effect, paint_context))
{
ClutterOffscreenEffect *offscreen_effect =
CLUTTER_OFFSCREEN_EFFECT (effect);
@@ -145,10 +146,12 @@ clutter_colorize_effect_pre_paint (ClutterEffect *effect)
}
static void
clutter_colorize_effect_paint_target (ClutterOffscreenEffect *effect)
clutter_colorize_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterColorizeEffect *self = CLUTTER_COLORIZE_EFFECT (effect);
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
ClutterActor *actor;
guint8 paint_opacity;

View File

@@ -34,9 +34,10 @@ void _clutter_content_attached (ClutterContent *conte
void _clutter_content_detached (ClutterContent *content,
ClutterActor *actor);
void _clutter_content_paint_content (ClutterContent *content,
ClutterActor *actor,
ClutterPaintNode *node);
void _clutter_content_paint_content (ClutterContent *content,
ClutterActor *actor,
ClutterPaintNode *node,
ClutterPaintContext *paint_context);
G_END_DECLS

View File

@@ -96,9 +96,10 @@ clutter_content_real_invalidate_size (ClutterContent *content)
}
static void
clutter_content_real_paint_content (ClutterContent *content,
ClutterActor *actor,
ClutterPaintNode *context)
clutter_content_real_paint_content (ClutterContent *content,
ClutterActor *actor,
ClutterPaintNode *context,
ClutterPaintContext *paint_context)
{
}
@@ -300,7 +301,8 @@ _clutter_content_detached (ClutterContent *content,
* _clutter_content_paint_content:
* @content: a #ClutterContent
* @actor: a #ClutterActor
* @context: a #ClutterPaintNode
* @node: a #ClutterPaintNode
* @paint_context: a #ClutterPaintContext
*
* Creates the render tree for the @content and @actor.
*
@@ -308,11 +310,13 @@ _clutter_content_detached (ClutterContent *content,
* virtual function.
*/
void
_clutter_content_paint_content (ClutterContent *content,
ClutterActor *actor,
ClutterPaintNode *node)
_clutter_content_paint_content (ClutterContent *content,
ClutterActor *actor,
ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
CLUTTER_CONTENT_GET_IFACE (content)->paint_content (content, actor, node);
CLUTTER_CONTENT_GET_IFACE (content)->paint_content (content, actor, node,
paint_context);
}
/**

View File

@@ -65,9 +65,10 @@ struct _ClutterContentInterface
gboolean (* get_preferred_size) (ClutterContent *content,
gfloat *width,
gfloat *height);
void (* paint_content) (ClutterContent *content,
ClutterActor *actor,
ClutterPaintNode *node);
void (* paint_content) (ClutterContent *content,
ClutterActor *actor,
ClutterPaintNode *node,
ClutterPaintContext *paint_context);
void (* attached) (ClutterContent *content,
ClutterActor *actor);

View File

@@ -166,14 +166,16 @@ clutter_deform_effect_set_actor (ClutterActorMeta *meta,
}
static void
clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect)
clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterDeformEffect *self= CLUTTER_DEFORM_EFFECT (effect);
ClutterDeformEffectPrivate *priv = self->priv;
CoglHandle material;
CoglPipeline *pipeline;
CoglDepthState depth_state;
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
CoglFramebuffer *fb =
clutter_paint_context_get_framebuffer (paint_context);
if (priv->is_dirty)
{

View File

@@ -112,7 +112,8 @@ G_DEFINE_TYPE (ClutterDesaturateEffect,
CLUTTER_TYPE_OFFSCREEN_EFFECT);
static gboolean
clutter_desaturate_effect_pre_paint (ClutterEffect *effect)
clutter_desaturate_effect_pre_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterDesaturateEffect *self = CLUTTER_DESATURATE_EFFECT (effect);
ClutterEffectClass *parent_class;
@@ -133,7 +134,7 @@ clutter_desaturate_effect_pre_paint (ClutterEffect *effect)
}
parent_class = CLUTTER_EFFECT_CLASS (clutter_desaturate_effect_parent_class);
if (parent_class->pre_paint (effect))
if (parent_class->pre_paint (effect, paint_context))
{
ClutterOffscreenEffect *offscreen_effect =
CLUTTER_OFFSCREEN_EFFECT (effect);
@@ -152,10 +153,12 @@ clutter_desaturate_effect_pre_paint (ClutterEffect *effect)
}
static void
clutter_desaturate_effect_paint_target (ClutterOffscreenEffect *effect)
clutter_desaturate_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterDesaturateEffect *self = CLUTTER_DESATURATE_EFFECT (effect);
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
ClutterActor *actor;
CoglHandle texture;
guint8 paint_opacity;

View File

@@ -5,14 +5,18 @@
G_BEGIN_DECLS
gboolean _clutter_effect_pre_paint (ClutterEffect *effect);
void _clutter_effect_post_paint (ClutterEffect *effect);
gboolean _clutter_effect_pre_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context);
void _clutter_effect_post_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context);
gboolean _clutter_effect_modify_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume);
gboolean _clutter_effect_has_custom_paint_volume (ClutterEffect *effect);
void _clutter_effect_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context,
ClutterEffectPaintFlags flags);
void _clutter_effect_pick (ClutterEffect *effect);
void _clutter_effect_pick (ClutterEffect *effect,
ClutterPickContext *pick_context);
G_END_DECLS

View File

@@ -177,13 +177,15 @@ G_DEFINE_ABSTRACT_TYPE (ClutterEffect,
CLUTTER_TYPE_ACTOR_META);
static gboolean
clutter_effect_real_pre_paint (ClutterEffect *effect)
clutter_effect_real_pre_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context)
{
return TRUE;
}
static void
clutter_effect_real_post_paint (ClutterEffect *effect)
clutter_effect_real_post_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context)
{
}
@@ -196,6 +198,7 @@ clutter_effect_real_modify_paint_volume (ClutterEffect *effect,
static void
clutter_effect_real_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context,
ClutterEffectPaintFlags flags)
{
ClutterActorMeta *actor_meta = CLUTTER_ACTOR_META (effect);
@@ -206,23 +209,24 @@ clutter_effect_real_paint (ClutterEffect *effect,
effects that haven't migrated to use the 'paint' virtual yet. This
just calls the old pre and post virtuals before chaining on */
pre_paint_succeeded = _clutter_effect_pre_paint (effect);
pre_paint_succeeded = _clutter_effect_pre_paint (effect, paint_context);
actor = clutter_actor_meta_get_actor (actor_meta);
clutter_actor_continue_paint (actor);
clutter_actor_continue_paint (actor, paint_context);
if (pre_paint_succeeded)
_clutter_effect_post_paint (effect);
_clutter_effect_post_paint (effect, paint_context);
}
static void
clutter_effect_real_pick (ClutterEffect *effect)
clutter_effect_real_pick (ClutterEffect *effect,
ClutterPickContext *pick_context)
{
ClutterActorMeta *actor_meta = CLUTTER_ACTOR_META (effect);
ClutterActor *actor;
actor = clutter_actor_meta_get_actor (actor_meta);
clutter_actor_continue_pick (actor);
clutter_actor_continue_pick (actor, pick_context);
}
static void
@@ -262,36 +266,40 @@ clutter_effect_init (ClutterEffect *self)
}
gboolean
_clutter_effect_pre_paint (ClutterEffect *effect)
_clutter_effect_pre_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context)
{
g_return_val_if_fail (CLUTTER_IS_EFFECT (effect), FALSE);
return CLUTTER_EFFECT_GET_CLASS (effect)->pre_paint (effect);
return CLUTTER_EFFECT_GET_CLASS (effect)->pre_paint (effect, paint_context);
}
void
_clutter_effect_post_paint (ClutterEffect *effect)
_clutter_effect_post_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context)
{
g_return_if_fail (CLUTTER_IS_EFFECT (effect));
CLUTTER_EFFECT_GET_CLASS (effect)->post_paint (effect);
CLUTTER_EFFECT_GET_CLASS (effect)->post_paint (effect, paint_context);
}
void
_clutter_effect_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context,
ClutterEffectPaintFlags flags)
{
g_return_if_fail (CLUTTER_IS_EFFECT (effect));
CLUTTER_EFFECT_GET_CLASS (effect)->paint (effect, flags);
CLUTTER_EFFECT_GET_CLASS (effect)->paint (effect, paint_context, flags);
}
void
_clutter_effect_pick (ClutterEffect *effect)
_clutter_effect_pick (ClutterEffect *effect,
ClutterPickContext *pick_context)
{
g_return_if_fail (CLUTTER_IS_EFFECT (effect));
CLUTTER_EFFECT_GET_CLASS (effect)->pick (effect);
CLUTTER_EFFECT_GET_CLASS (effect)->pick (effect, pick_context);
}
gboolean

View File

@@ -30,6 +30,8 @@
#endif
#include <clutter/clutter-actor-meta.h>
#include <clutter/clutter-paint-context.h>
#include <clutter/clutter-pick-context.h>
G_BEGIN_DECLS
@@ -74,15 +76,19 @@ struct _ClutterEffectClass
ClutterActorMetaClass parent_class;
/*< public >*/
gboolean (* pre_paint) (ClutterEffect *effect);
void (* post_paint) (ClutterEffect *effect);
gboolean (* pre_paint) (ClutterEffect *effect,
ClutterPaintContext *paint_context);
void (* post_paint) (ClutterEffect *effect,
ClutterPaintContext *paint_context);
gboolean (* modify_paint_volume) (ClutterEffect *effect,
ClutterPaintVolume *volume);
void (* paint) (ClutterEffect *effect,
ClutterPaintContext *paint_context,
ClutterEffectPaintFlags flags);
void (* pick) (ClutterEffect *effect);
void (* pick) (ClutterEffect *effect,
ClutterPickContext *pick_context);
/*< private >*/
void (* _clutter_effect4) (void);

View File

@@ -118,9 +118,10 @@ clutter_image_init (ClutterImage *self)
}
static void
clutter_image_paint_content (ClutterContent *content,
ClutterActor *actor,
ClutterPaintNode *root)
clutter_image_paint_content (ClutterContent *content,
ClutterActor *actor,
ClutterPaintNode *root,
ClutterPaintContext *paint_context)
{
ClutterImagePrivate *priv = CLUTTER_IMAGE (content)->priv;
ClutterPaintNode *node;

View File

@@ -74,6 +74,7 @@
#include "clutter-debug.h"
#include "clutter-private.h"
#include "clutter-stage-private.h"
#include "clutter-paint-context-private.h"
#include "clutter-paint-volume-private.h"
#include "clutter-actor-box-private.h"
@@ -237,7 +238,8 @@ update_fbo (ClutterEffect *effect,
}
static gboolean
clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
ClutterOffscreenEffectPrivate *priv = self->priv;
@@ -248,6 +250,7 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
CoglColor transparent;
gfloat stage_width, stage_height;
gfloat target_width = -1, target_height = -1;
CoglFramebuffer *framebuffer;
gfloat resource_scale;
gfloat ceiled_resource_scale;
graphene_point3d_t local_offset;
@@ -312,10 +315,10 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
if (!update_fbo (effect, target_width, target_height, resource_scale))
return FALSE;
cogl_get_modelview_matrix (&old_modelview);
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
cogl_framebuffer_get_modelview_matrix (framebuffer, &old_modelview);
/* let's draw offscreen */
cogl_push_framebuffer (priv->offscreen);
clutter_paint_context_push_framebuffer (paint_context, priv->offscreen);
/* We don't want the FBO contents to be transformed. That could waste memory
* (e.g. during zoom), or result in something that's not rectangular (clipped
@@ -325,7 +328,7 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
* contents on screen...
*/
clutter_actor_get_transform (priv->stage, &modelview);
cogl_set_modelview_matrix (&modelview);
cogl_framebuffer_set_modelview_matrix (priv->offscreen, &modelview);
/* Save the original viewport for calculating priv->position */
_clutter_stage_get_viewport (CLUTTER_STAGE (priv->stage),
@@ -337,10 +340,11 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
/* Set up the viewport so that it has the same size as the stage (avoid
* distortion), but translated to account for the FBO offset...
*/
cogl_set_viewport (-priv->fbo_offset_x,
-priv->fbo_offset_y,
stage_width,
stage_height);
cogl_framebuffer_set_viewport (priv->offscreen,
-priv->fbo_offset_x,
-priv->fbo_offset_y,
stage_width,
stage_height);
/* Copy the stage's projection matrix across to the framebuffer */
_clutter_stage_get_projection_matrix (CLUTTER_STAGE (priv->stage),
@@ -357,14 +361,15 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
&priv->position,
1);
cogl_set_projection_matrix (&projection);
cogl_framebuffer_set_projection_matrix (priv->offscreen, &projection);
cogl_color_init_from_4ub (&transparent, 0, 0, 0, 0);
cogl_clear (&transparent,
COGL_BUFFER_BIT_COLOR |
COGL_BUFFER_BIT_DEPTH);
cogl_framebuffer_clear (priv->offscreen,
COGL_BUFFER_BIT_COLOR |
COGL_BUFFER_BIT_DEPTH,
&transparent);
cogl_push_matrix ();
cogl_framebuffer_push_matrix (priv->offscreen);
/* Override the actor's opacity to fully opaque - we paint the offscreen
* texture with the actor's paint opacity, so we need to do this to avoid
@@ -378,10 +383,12 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
}
static void
clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect)
clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterOffscreenEffectPrivate *priv = effect->priv;
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
guint8 paint_opacity;
paint_opacity = clutter_actor_get_paint_opacity (priv->actor);
@@ -407,18 +414,21 @@ clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect)
}
static void
clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect)
clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterOffscreenEffectPrivate *priv = effect->priv;
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
CoglMatrix modelview;
float resource_scale;
cogl_push_matrix ();
cogl_framebuffer_push_matrix (framebuffer);
/* The current modelview matrix is *almost* perfect already. It's only
* missing a correction for the expanded FBO and offset rendering within...
*/
cogl_get_modelview_matrix (&modelview);
cogl_framebuffer_get_modelview_matrix (framebuffer, &modelview);
if (clutter_actor_get_resource_scale (priv->actor, &resource_scale) &&
resource_scale != 1.0f)
@@ -431,21 +441,23 @@ clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect)
priv->fbo_offset_x,
priv->fbo_offset_y,
0.0f);
cogl_set_modelview_matrix (&modelview);
cogl_framebuffer_set_modelview_matrix (framebuffer, &modelview);
/* paint the target material; this is virtualized for
* sub-classes that require special hand-holding
*/
clutter_offscreen_effect_paint_target (effect);
clutter_offscreen_effect_paint_target (effect, paint_context);
cogl_pop_matrix ();
cogl_framebuffer_pop_matrix (framebuffer);
}
static void
clutter_offscreen_effect_post_paint (ClutterEffect *effect)
clutter_offscreen_effect_post_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
ClutterOffscreenEffectPrivate *priv = self->priv;
CoglFramebuffer *framebuffer;
if (priv->offscreen == NULL ||
priv->target == NULL ||
@@ -455,14 +467,16 @@ clutter_offscreen_effect_post_paint (ClutterEffect *effect)
/* Restore the previous opacity override */
clutter_actor_set_opacity_override (priv->actor, priv->old_opacity_override);
cogl_pop_matrix ();
cogl_pop_framebuffer ();
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
cogl_framebuffer_pop_matrix (framebuffer);
clutter_paint_context_pop_framebuffer (paint_context);
clutter_offscreen_effect_paint_texture (self);
clutter_offscreen_effect_paint_texture (self, paint_context);
}
static void
clutter_offscreen_effect_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context,
ClutterEffectPaintFlags flags)
{
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
@@ -476,10 +490,10 @@ clutter_offscreen_effect_paint (ClutterEffect *effect,
/* Chain up to the parent paint method which will call the pre and
post paint functions to update the image */
CLUTTER_EFFECT_CLASS (clutter_offscreen_effect_parent_class)->
paint (effect, flags);
paint (effect, paint_context, flags);
}
else
clutter_offscreen_effect_paint_texture (self);
clutter_offscreen_effect_paint_texture (self, paint_context);
}
static void
@@ -582,17 +596,20 @@ clutter_offscreen_effect_get_target (ClutterOffscreenEffect *effect)
/**
* clutter_offscreen_effect_paint_target:
* @effect: a #ClutterOffscreenEffect
* @paint_context: a #ClutterPaintContext
*
* Calls the paint_target() virtual function of the @effect
*
* Since: 1.4
*/
void
clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect)
clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
{
g_return_if_fail (CLUTTER_IS_OFFSCREEN_EFFECT (effect));
CLUTTER_OFFSCREEN_EFFECT_GET_CLASS (effect)->paint_target (effect);
CLUTTER_OFFSCREEN_EFFECT_GET_CLASS (effect)->paint_target (effect,
paint_context);
}
/**

View File

@@ -79,7 +79,8 @@ struct _ClutterOffscreenEffectClass
CoglHandle (* create_texture) (ClutterOffscreenEffect *effect,
gfloat width,
gfloat height);
void (* paint_target) (ClutterOffscreenEffect *effect);
void (* paint_target) (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context);
/*< private >*/
void (* _clutter_offscreen1) (void);
@@ -101,7 +102,8 @@ CLUTTER_EXPORT
CoglHandle clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *effect);
CLUTTER_EXPORT
void clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect);
void clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context);
CLUTTER_EXPORT
CoglHandle clutter_offscreen_effect_create_texture (ClutterOffscreenEffect *effect,
gfloat width,

View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 2019 Red Hat Inc.
*
* 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/>.
*/
#ifndef CLUTTER_PAINT_CONTEXT_PRIVATE_H
#define CLUTTER_PAINT_CONTEXT_PRIVATE_H
#include "clutter-paint-context.h"
ClutterPaintContext * clutter_paint_context_new_for_view (ClutterStageView *view);
gboolean clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context);
CoglFramebuffer * clutter_paint_context_get_base_framebuffer (ClutterPaintContext *paint_context);
#endif /* CLUTTER_PAINT_CONTEXT_PRIVATE_H */

View File

@@ -0,0 +1,161 @@
/*
* Copyright (C) 2019 Red Hat Inc.
*
* 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"
#include "clutter-paint-context-private.h"
struct _ClutterPaintContext
{
grefcount ref_count;
GList *framebuffers;
ClutterStageView *view;
};
G_DEFINE_BOXED_TYPE (ClutterPaintContext, clutter_paint_context,
clutter_paint_context_ref,
clutter_paint_context_unref)
ClutterPaintContext *
clutter_paint_context_new_for_view (ClutterStageView *view)
{
ClutterPaintContext *paint_context;
CoglFramebuffer *framebuffer;
paint_context = g_new0 (ClutterPaintContext, 1);
g_ref_count_init (&paint_context->ref_count);
paint_context->view = view;
framebuffer = clutter_stage_view_get_framebuffer (view);
clutter_paint_context_push_framebuffer (paint_context, framebuffer);
return paint_context;
}
/**
* clutter_paint_context_new_for_framebuffer: (skip)
*/
ClutterPaintContext *
clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer)
{
ClutterPaintContext *paint_context;
paint_context = g_new0 (ClutterPaintContext, 1);
g_ref_count_init (&paint_context->ref_count);
clutter_paint_context_push_framebuffer (paint_context, framebuffer);
return paint_context;
}
ClutterPaintContext *
clutter_paint_context_ref (ClutterPaintContext *paint_context)
{
g_ref_count_inc (&paint_context->ref_count);
return paint_context;
}
static void
clutter_paint_context_dispose (ClutterPaintContext *paint_context)
{
g_list_free_full (paint_context->framebuffers,
cogl_object_unref);
paint_context->framebuffers = NULL;
}
void
clutter_paint_context_unref (ClutterPaintContext *paint_context)
{
if (g_ref_count_dec (&paint_context->ref_count))
{
clutter_paint_context_dispose (paint_context);
g_free (paint_context);
}
}
void
clutter_paint_context_destroy (ClutterPaintContext *paint_context)
{
clutter_paint_context_dispose (paint_context);
clutter_paint_context_unref (paint_context);
}
void
clutter_paint_context_push_framebuffer (ClutterPaintContext *paint_context,
CoglFramebuffer *framebuffer)
{
paint_context->framebuffers = g_list_prepend (paint_context->framebuffers,
cogl_object_ref (framebuffer));
}
void
clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context)
{
g_return_if_fail (paint_context->framebuffers);
cogl_object_unref (paint_context->framebuffers->data);
paint_context->framebuffers =
g_list_delete_link (paint_context->framebuffers,
paint_context->framebuffers);
}
/**
* clutter_paint_context_get_framebuffer:
* @paint_context: The #ClutterPaintContext
*
* Returns: (transfer none): The #CoglFramebuffer used for drawing
*/
CoglFramebuffer *
clutter_paint_context_get_framebuffer (ClutterPaintContext *paint_context)
{
g_return_val_if_fail (paint_context->framebuffers, NULL);
return paint_context->framebuffers->data;
}
CoglFramebuffer *
clutter_paint_context_get_base_framebuffer (ClutterPaintContext *paint_context)
{
return g_list_last (paint_context->framebuffers)->data;
}
/**
* clutter_paint_context_get_stage_view: (skip)
*/
ClutterStageView *
clutter_paint_context_get_stage_view (ClutterPaintContext *paint_context)
{
return paint_context->view;
}
/**
* clutter_paint_context_is_drawing_off_stage: (skip)
*
* Return %TRUE if the paint context is currently drawing off stage.
* This happens if there are any framebuffers pushed, and the base framebuffer
* comes from the stage view.
*/
gboolean
clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context)
{
if (g_list_length (paint_context->framebuffers) > 1)
return TRUE;
return !paint_context->view;
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright (C) 2019 Red Hat Inc.
*
* 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/>.
*/
#ifndef CLUTTER_PAINT_CONTEXT_H
#define CLUTTER_PAINT_CONTEXT_H
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include <glib-object.h>
#include "clutter-macros.h"
#include "clutter-stage-view.h"
typedef struct _ClutterPaintContext ClutterPaintContext;
#define CLUTTER_TYPE_PAINT_CONTEXT (clutter_paint_context_get_type ())
CLUTTER_EXPORT
GType clutter_paint_context_get_type (void);
CLUTTER_EXPORT
ClutterPaintContext * clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer);
CLUTTER_EXPORT
ClutterPaintContext * clutter_paint_context_ref (ClutterPaintContext *paint_context);
CLUTTER_EXPORT
void clutter_paint_context_unref (ClutterPaintContext *paint_context);
CLUTTER_EXPORT
void clutter_paint_context_destroy (ClutterPaintContext *paint_context);
CLUTTER_EXPORT
CoglFramebuffer * clutter_paint_context_get_framebuffer (ClutterPaintContext *paint_context);
CLUTTER_EXPORT
ClutterStageView * clutter_paint_context_get_stage_view (ClutterPaintContext *paint_context);
CLUTTER_EXPORT
void clutter_paint_context_push_framebuffer (ClutterPaintContext *paint_context,
CoglFramebuffer *framebuffer);
CLUTTER_EXPORT
void clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context);
#endif /* CLUTTER_PAINT_CONTEXT_H */

View File

@@ -27,6 +27,7 @@
#include <glib-object.h>
#include <json-glib/json-glib.h>
#include <clutter/clutter-paint-context.h>
#include <clutter/clutter-paint-node.h>
G_BEGIN_DECLS
@@ -63,9 +64,12 @@ struct _ClutterPaintNodeClass
void (* finalize) (ClutterPaintNode *node);
gboolean (* pre_draw) (ClutterPaintNode *node);
void (* draw) (ClutterPaintNode *node);
void (* post_draw) (ClutterPaintNode *node);
gboolean (* pre_draw) (ClutterPaintNode *node,
ClutterPaintContext *paint_context);
void (* draw) (ClutterPaintNode *node,
ClutterPaintContext *paint_context);
void (* post_draw) (ClutterPaintNode *node,
ClutterPaintContext *paint_context);
JsonNode*(* serialize) (ClutterPaintNode *node);
@@ -111,7 +115,8 @@ void _clutter_paint_node_init_types (void);
gpointer _clutter_paint_node_create (GType gtype);
ClutterPaintNode * _clutter_transform_node_new (const CoglMatrix *matrix);
ClutterPaintNode * _clutter_dummy_node_new (ClutterActor *actor);
ClutterPaintNode * _clutter_dummy_node_new (ClutterActor *actor,
CoglFramebuffer *framebuffer);
void _clutter_paint_node_dump_tree (ClutterPaintNode *root);

View File

@@ -202,18 +202,21 @@ clutter_paint_node_real_finalize (ClutterPaintNode *node)
}
static gboolean
clutter_paint_node_real_pre_draw (ClutterPaintNode *node)
clutter_paint_node_real_pre_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
return FALSE;
}
static void
clutter_paint_node_real_draw (ClutterPaintNode *node)
clutter_paint_node_real_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
}
static void
clutter_paint_node_real_post_draw (ClutterPaintNode *node)
clutter_paint_node_real_post_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
}
@@ -997,29 +1000,30 @@ clutter_paint_node_add_primitive (ClutterPaintNode *node,
* its children, if any.
*/
void
clutter_paint_node_paint (ClutterPaintNode *node)
clutter_paint_node_paint (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
ClutterPaintNodeClass *klass = CLUTTER_PAINT_NODE_GET_CLASS (node);
ClutterPaintNode *iter;
gboolean res;
res = klass->pre_draw (node);
res = klass->pre_draw (node, paint_context);
if (res)
{
klass->draw (node);
klass->draw (node, paint_context);
}
for (iter = node->first_child;
iter != NULL;
iter = iter->next_sibling)
{
clutter_paint_node_paint (iter);
clutter_paint_node_paint (iter, paint_context);
}
if (res)
{
klass->post_draw (node);
klass->post_draw (node, paint_context);
}
}
@@ -1199,9 +1203,10 @@ clutter_paint_node_get_root (ClutterPaintNode *node)
* @node: a #ClutterPaintNode
*
* Retrieves the #CoglFramebuffer that @node will draw
* into.
* into, if it the root node has a custom framebuffer set.
*
* Returns: (transfer none): a #CoglFramebuffer
* Returns: (transfer none): a #CoglFramebuffer or %NULL if no custom one is
* set.
*/
CoglFramebuffer *
clutter_paint_node_get_framebuffer (ClutterPaintNode *node)
@@ -1209,12 +1214,9 @@ clutter_paint_node_get_framebuffer (ClutterPaintNode *node)
ClutterPaintNode *root = clutter_paint_node_get_root (node);
ClutterPaintNodeClass *klass;
if (root == NULL)
return NULL;
klass = CLUTTER_PAINT_NODE_GET_CLASS (root);
if (klass->get_framebuffer != NULL)
return klass->get_framebuffer (root);
return cogl_get_draw_framebuffer ();
else
return NULL;
}

View File

@@ -50,7 +50,8 @@ CLUTTER_EXPORT
void clutter_paint_node_unref (ClutterPaintNode *node);
CLUTTER_EXPORT
void clutter_paint_node_paint (ClutterPaintNode *node);
void clutter_paint_node_paint (ClutterPaintNode *node,
ClutterPaintContext *paint_context);
CLUTTER_EXPORT
void clutter_paint_node_set_name (ClutterPaintNode *node,

View File

@@ -44,6 +44,7 @@
#include "clutter-color.h"
#include "clutter-debug.h"
#include "clutter-private.h"
#include "clutter-paint-context-private.h"
#include "clutter-paint-nodes.h"
@@ -103,11 +104,12 @@ struct _ClutterRootNode
G_DEFINE_TYPE (ClutterRootNode, clutter_root_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean
clutter_root_node_pre_draw (ClutterPaintNode *node)
clutter_root_node_pre_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
ClutterRootNode *rnode = (ClutterRootNode *) node;
cogl_push_framebuffer (rnode->framebuffer);
clutter_paint_context_push_framebuffer (paint_context, rnode->framebuffer);
cogl_framebuffer_clear (rnode->framebuffer,
rnode->clear_flags,
@@ -117,9 +119,10 @@ clutter_root_node_pre_draw (ClutterPaintNode *node)
}
static void
clutter_root_node_post_draw (ClutterPaintNode *node)
clutter_root_node_post_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
cogl_pop_framebuffer ();
clutter_paint_context_pop_framebuffer (paint_context);
}
static void
@@ -163,6 +166,8 @@ clutter_root_node_new (CoglFramebuffer *framebuffer,
{
ClutterRootNode *res;
g_return_val_if_fail (framebuffer, NULL);
res = _clutter_paint_node_create (CLUTTER_TYPE_ROOT_NODE);
cogl_color_init_from_4ub (&res->clear_color,
@@ -172,11 +177,7 @@ clutter_root_node_new (CoglFramebuffer *framebuffer,
clear_color->alpha);
cogl_color_premultiply (&res->clear_color);
if (G_LIKELY (framebuffer != NULL))
res->framebuffer = cogl_object_ref (framebuffer);
else
res->framebuffer = cogl_object_ref (cogl_get_draw_framebuffer ());
res->framebuffer = cogl_object_ref (framebuffer);
res->clear_flags = clear_flags;
return (ClutterPaintNode *) res;
@@ -201,10 +202,12 @@ struct _ClutterTransformNodeClass
G_DEFINE_TYPE (ClutterTransformNode, clutter_transform_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean
clutter_transform_node_pre_draw (ClutterPaintNode *node)
clutter_transform_node_pre_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
ClutterTransformNode *transform_node = (ClutterTransformNode *) node;
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
CoglFramebuffer *fb =
clutter_paint_context_get_framebuffer (paint_context);
cogl_framebuffer_push_matrix (fb);
cogl_framebuffer_transform (fb, &transform_node->transform);
@@ -213,9 +216,11 @@ clutter_transform_node_pre_draw (ClutterPaintNode *node)
}
static void
clutter_transform_node_post_draw (ClutterPaintNode *node)
clutter_transform_node_post_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
CoglFramebuffer *fb =
clutter_paint_context_get_framebuffer (paint_context);
cogl_framebuffer_pop_matrix (fb);
}
@@ -278,7 +283,8 @@ struct _ClutterDummyNode
G_DEFINE_TYPE (ClutterDummyNode, clutter_dummy_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean
clutter_dummy_node_pre_draw (ClutterPaintNode *node)
clutter_dummy_node_pre_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
return TRUE;
}
@@ -315,6 +321,16 @@ clutter_dummy_node_get_framebuffer (ClutterPaintNode *node)
return dnode->framebuffer;
}
static void
clutter_dummy_node_finalize (ClutterPaintNode *node)
{
ClutterDummyNode *dnode = (ClutterDummyNode *) node;
cogl_clear_object (&dnode->framebuffer);
CLUTTER_PAINT_NODE_CLASS (clutter_dummy_node_parent_class)->finalize (node);
}
static void
clutter_dummy_node_class_init (ClutterDummyNodeClass *klass)
{
@@ -323,6 +339,7 @@ clutter_dummy_node_class_init (ClutterDummyNodeClass *klass)
node_class->pre_draw = clutter_dummy_node_pre_draw;
node_class->serialize = clutter_dummy_node_serialize;
node_class->get_framebuffer = clutter_dummy_node_get_framebuffer;
node_class->finalize = clutter_dummy_node_finalize;
}
static void
@@ -331,7 +348,8 @@ clutter_dummy_node_init (ClutterDummyNode *self)
}
ClutterPaintNode *
_clutter_dummy_node_new (ClutterActor *actor)
_clutter_dummy_node_new (ClutterActor *actor,
CoglFramebuffer *framebuffer)
{
ClutterPaintNode *res;
ClutterDummyNode *dnode;
@@ -340,7 +358,7 @@ _clutter_dummy_node_new (ClutterActor *actor)
dnode = (ClutterDummyNode *) res;
dnode->actor = actor;
dnode->framebuffer = _clutter_actor_get_active_framebuffer (actor);
dnode->framebuffer = cogl_object_ref (framebuffer);
return res;
}
@@ -383,22 +401,34 @@ clutter_pipeline_node_finalize (ClutterPaintNode *node)
}
static gboolean
clutter_pipeline_node_pre_draw (ClutterPaintNode *node)
clutter_pipeline_node_pre_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
ClutterPipelineNode *pnode = CLUTTER_PIPELINE_NODE (node);
if (node->operations != NULL &&
pnode->pipeline != NULL)
{
cogl_push_source (pnode->pipeline);
return TRUE;
}
return TRUE;
return FALSE;
}
static CoglFramebuffer *
get_target_framebuffer (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
CoglFramebuffer *framebuffer;
framebuffer = clutter_paint_node_get_framebuffer (node);
if (framebuffer)
return framebuffer;
return clutter_paint_context_get_framebuffer (paint_context);
}
static void
clutter_pipeline_node_draw (ClutterPaintNode *node)
clutter_pipeline_node_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
ClutterPipelineNode *pnode = CLUTTER_PIPELINE_NODE (node);
CoglFramebuffer *fb;
@@ -410,7 +440,7 @@ clutter_pipeline_node_draw (ClutterPaintNode *node)
if (node->operations == NULL)
return;
fb = clutter_paint_node_get_framebuffer (node);
fb = clutter_paint_context_get_framebuffer (paint_context);
for (i = 0; i < node->operations->len; i++)
{
@@ -424,18 +454,20 @@ clutter_pipeline_node_draw (ClutterPaintNode *node)
break;
case PAINT_OP_TEX_RECT:
cogl_rectangle_with_texture_coords (op->op.texrect[0],
op->op.texrect[1],
op->op.texrect[2],
op->op.texrect[3],
op->op.texrect[4],
op->op.texrect[5],
op->op.texrect[6],
op->op.texrect[7]);
cogl_framebuffer_draw_textured_rectangle (fb,
pnode->pipeline,
op->op.texrect[0],
op->op.texrect[1],
op->op.texrect[2],
op->op.texrect[3],
op->op.texrect[4],
op->op.texrect[5],
op->op.texrect[6],
op->op.texrect[7]);
break;
case PAINT_OP_MULTITEX_RECT:
cogl_framebuffer_draw_multitextured_rectangle (cogl_get_draw_framebuffer (),
cogl_framebuffer_draw_multitextured_rectangle (fb,
pnode->pipeline,
op->op.texrect[0],
op->op.texrect[1],
@@ -446,7 +478,7 @@ clutter_pipeline_node_draw (ClutterPaintNode *node)
break;
case PAINT_OP_PATH:
cogl_path_fill (op->op.path);
cogl_framebuffer_fill_path (fb, pnode->pipeline, op->op.path);
break;
case PAINT_OP_PRIMITIVE:
@@ -459,9 +491,9 @@ clutter_pipeline_node_draw (ClutterPaintNode *node)
}
static void
clutter_pipeline_node_post_draw (ClutterPaintNode *node)
clutter_pipeline_node_post_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
cogl_pop_source ();
}
static JsonNode *
@@ -780,7 +812,8 @@ clutter_text_node_finalize (ClutterPaintNode *node)
}
static gboolean
clutter_text_node_pre_draw (ClutterPaintNode *node)
clutter_text_node_pre_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
ClutterTextNode *tnode = CLUTTER_TEXT_NODE (node);
@@ -788,7 +821,8 @@ clutter_text_node_pre_draw (ClutterPaintNode *node)
}
static void
clutter_text_node_draw (ClutterPaintNode *node)
clutter_text_node_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
ClutterTextNode *tnode = CLUTTER_TEXT_NODE (node);
PangoRectangle extents;
@@ -798,7 +832,7 @@ clutter_text_node_draw (ClutterPaintNode *node)
if (node->operations == NULL)
return;
fb = clutter_paint_node_get_framebuffer (node);
fb = get_target_framebuffer (node, paint_context);
pango_layout_get_pixel_extents (tnode->layout, NULL, &extents);
@@ -831,11 +865,11 @@ clutter_text_node_draw (ClutterPaintNode *node)
clipped = TRUE;
}
cogl_pango_render_layout (tnode->layout,
op->op.texrect[0],
op->op.texrect[1],
&tnode->color,
0);
cogl_pango_show_layout (fb,
tnode->layout,
op->op.texrect[0],
op->op.texrect[1],
&tnode->color);
if (clipped)
cogl_framebuffer_pop_clip (fb);
@@ -974,7 +1008,8 @@ struct _ClutterClipNodeClass
G_DEFINE_TYPE (ClutterClipNode, clutter_clip_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean
clutter_clip_node_pre_draw (ClutterPaintNode *node)
clutter_clip_node_pre_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
gboolean retval = FALSE;
CoglFramebuffer *fb;
@@ -983,7 +1018,7 @@ clutter_clip_node_pre_draw (ClutterPaintNode *node)
if (node->operations == NULL)
return FALSE;
fb = clutter_paint_node_get_framebuffer (node);
fb = get_target_framebuffer (node, paint_context);
for (i = 0; i < node->operations->len; i++)
{
@@ -1018,7 +1053,8 @@ clutter_clip_node_pre_draw (ClutterPaintNode *node)
}
static void
clutter_clip_node_post_draw (ClutterPaintNode *node)
clutter_clip_node_post_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
CoglFramebuffer *fb;
guint i;
@@ -1026,7 +1062,7 @@ clutter_clip_node_post_draw (ClutterPaintNode *node)
if (node->operations == NULL)
return;
fb = clutter_paint_node_get_framebuffer (node);
fb = get_target_framebuffer (node, paint_context);
for (i = 0; i < node->operations->len; i++)
{
@@ -1100,7 +1136,8 @@ struct _ClutterActorNodeClass
G_DEFINE_TYPE (ClutterActorNode, clutter_actor_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean
clutter_actor_node_pre_draw (ClutterPaintNode *node)
clutter_actor_node_pre_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
@@ -1110,15 +1147,17 @@ clutter_actor_node_pre_draw (ClutterPaintNode *node)
}
static void
clutter_actor_node_draw (ClutterPaintNode *node)
clutter_actor_node_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
clutter_actor_continue_paint (actor_node->actor);
clutter_actor_continue_paint (actor_node->actor, paint_context);
}
static void
clutter_actor_node_post_draw (ClutterPaintNode *node)
clutter_actor_node_post_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
@@ -1143,6 +1182,7 @@ clutter_actor_node_serialize (ClutterPaintNode *node)
return json_builder_get_root (builder);
}
static void
clutter_actor_node_class_init (ClutterActorNodeClass *klass)
{
@@ -1217,9 +1257,11 @@ struct _ClutterLayerNodeClass
G_DEFINE_TYPE (ClutterLayerNode, clutter_layer_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean
clutter_layer_node_pre_draw (ClutterPaintNode *node)
clutter_layer_node_pre_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
ClutterLayerNode *lnode = (ClutterLayerNode *) node;
CoglFramebuffer *framebuffer;
CoglMatrix matrix;
/* if we were unable to create an offscreen buffer for this node, then
@@ -1235,9 +1277,10 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node)
/* copy the same modelview from the current framebuffer to the one we
* are going to use
*/
cogl_get_modelview_matrix (&matrix);
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
cogl_framebuffer_get_modelview_matrix (framebuffer, &matrix);
cogl_push_framebuffer (lnode->offscreen);
clutter_paint_context_push_framebuffer (paint_context, lnode->offscreen);
cogl_framebuffer_set_modelview_matrix (lnode->offscreen, &matrix);
@@ -1255,7 +1298,7 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node)
COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_DEPTH,
0.f, 0.f, 0.f, 0.f);
cogl_push_matrix ();
cogl_framebuffer_push_matrix (lnode->offscreen);
/* every draw operation after this point will happen an offscreen
* framebuffer
@@ -1265,17 +1308,18 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node)
}
static void
clutter_layer_node_post_draw (ClutterPaintNode *node)
clutter_layer_node_post_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
ClutterLayerNode *lnode = CLUTTER_LAYER_NODE (node);
CoglFramebuffer *fb;
guint i;
/* switch to the previous framebuffer */
cogl_pop_matrix ();
cogl_pop_framebuffer ();
cogl_framebuffer_pop_matrix (lnode->offscreen);
clutter_paint_context_pop_framebuffer (paint_context);
fb = cogl_get_draw_framebuffer ();
fb = clutter_paint_context_get_framebuffer (paint_context);
for (i = 0; i < node->operations->len; i++)
{
@@ -1289,20 +1333,20 @@ clutter_layer_node_post_draw (ClutterPaintNode *node)
case PAINT_OP_TEX_RECT:
/* now we need to paint the texture */
cogl_push_source (lnode->state);
cogl_rectangle_with_texture_coords (op->op.texrect[0],
op->op.texrect[1],
op->op.texrect[2],
op->op.texrect[3],
op->op.texrect[4],
op->op.texrect[5],
op->op.texrect[6],
op->op.texrect[7]);
cogl_pop_source ();
cogl_framebuffer_draw_textured_rectangle (fb,
lnode->state,
op->op.texrect[0],
op->op.texrect[1],
op->op.texrect[2],
op->op.texrect[3],
op->op.texrect[4],
op->op.texrect[5],
op->op.texrect[6],
op->op.texrect[7]);
break;
case PAINT_OP_MULTITEX_RECT:
cogl_framebuffer_draw_multitextured_rectangle (cogl_get_draw_framebuffer (),
cogl_framebuffer_draw_multitextured_rectangle (fb,
lnode->state,
op->op.texrect[0],
op->op.texrect[1],
@@ -1313,9 +1357,7 @@ clutter_layer_node_post_draw (ClutterPaintNode *node)
break;
case PAINT_OP_PATH:
cogl_push_source (lnode->state);
cogl_path_fill (op->op.path);
cogl_pop_source ();
cogl_framebuffer_fill_path (fb, lnode->state, op->op.path);
break;
case PAINT_OP_PRIMITIVE:

View File

@@ -0,0 +1,25 @@
/*
* Copyright (C) 2019 Red Hat Inc.
*
* 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/>.
*/
#ifndef CLUTTER_PICK_CONTEXT_PRIVATE_H
#define CLUTTER_PICK_CONTEXT_PRIVATE_H
#include "clutter-pick-context.h"
ClutterPickContext * clutter_pick_context_new_for_view (ClutterStageView *view);
#endif /* CLUTTER_PICK_CONTEXT_PRIVATE_H */

View File

@@ -0,0 +1,83 @@
/*
* Copyright (C) 2019 Red Hat Inc.
*
* 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"
#include "clutter-pick-context-private.h"
struct _ClutterPickContext
{
grefcount ref_count;
CoglFramebuffer *framebuffer;
};
G_DEFINE_BOXED_TYPE (ClutterPickContext, clutter_pick_context,
clutter_pick_context_ref,
clutter_pick_context_unref)
ClutterPickContext *
clutter_pick_context_new_for_view (ClutterStageView *view)
{
ClutterPickContext *pick_context;
pick_context = g_new0 (ClutterPickContext, 1);
g_ref_count_init (&pick_context->ref_count);
pick_context->framebuffer =
cogl_object_ref (clutter_stage_view_get_framebuffer (view));
return pick_context;
}
ClutterPickContext *
clutter_pick_context_ref (ClutterPickContext *pick_context)
{
g_ref_count_inc (&pick_context->ref_count);
return pick_context;
}
static void
clutter_pick_context_dispose (ClutterPickContext *pick_context)
{
g_clear_pointer (&pick_context->framebuffer, cogl_object_unref);
}
void
clutter_pick_context_unref (ClutterPickContext *pick_context)
{
if (g_ref_count_dec (&pick_context->ref_count))
{
clutter_pick_context_dispose (pick_context);
g_free (pick_context);
}
}
void
clutter_pick_context_destroy (ClutterPickContext *pick_context)
{
clutter_pick_context_dispose (pick_context);
clutter_pick_context_unref (pick_context);
}
/**
* clutter_pick_context_get_framebuffer: (skip)
*/
CoglFramebuffer *
clutter_pick_context_get_framebuffer (ClutterPickContext *pick_context)
{
return pick_context->framebuffer;
}

View File

@@ -0,0 +1,49 @@
/*
* Copyright (C) 2019 Red Hat Inc.
*
* 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/>.
*/
#ifndef CLUTTER_PICK_CONTEXT_H
#define CLUTTER_PICK_CONTEXT_H
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include <glib-object.h>
#include "clutter-macros.h"
#include "clutter-stage-view.h"
typedef struct _ClutterPickContext ClutterPickContext;
#define CLUTTER_TYPE_PICK_CONTEXT (clutter_pick_context_get_type ())
CLUTTER_EXPORT
GType clutter_pick_context_get_type (void);
CLUTTER_EXPORT
ClutterPickContext * clutter_pick_context_ref (ClutterPickContext *pick_context);
CLUTTER_EXPORT
void clutter_pick_context_unref (ClutterPickContext *pick_context);
CLUTTER_EXPORT
void clutter_pick_context_destroy (ClutterPickContext *pick_context);
CLUTTER_EXPORT
CoglFramebuffer * clutter_pick_context_get_framebuffer (ClutterPickContext *pick_context);
#endif /* CLUTTER_PICK_CONTEXT_H */

View File

@@ -395,7 +395,8 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
}
static void
clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect)
clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterShaderEffect *self = CLUTTER_SHADER_EFFECT (effect);
ClutterShaderEffectPrivate *priv = self->priv;
@@ -425,7 +426,7 @@ clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect)
out:
/* paint the offscreen buffer */
parent = CLUTTER_OFFSCREEN_EFFECT_CLASS (clutter_shader_effect_parent_class);
parent->paint_target (effect);
parent->paint_target (effect, paint_context);
}

View File

@@ -104,8 +104,6 @@ ClutterStageQueueRedrawEntry *_clutter_stage_queue_actor_redraw (Clut
const ClutterPaintVolume *clip);
void _clutter_stage_queue_redraw_entry_invalidate (ClutterStageQueueRedrawEntry *entry);
CoglFramebuffer *_clutter_stage_get_active_framebuffer (ClutterStage *stage);
void _clutter_stage_add_pointer_drag_actor (ClutterStage *stage,
ClutterInputDevice *device,
ClutterActor *actor);

View File

@@ -33,5 +33,7 @@ gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view);
void clutter_stage_view_set_dirty_projection (ClutterStageView *view,
gboolean dirty);
void clutter_stage_view_add_redraw_clip (ClutterStageView *view,
cairo_rectangle_int_t *clip);
#endif /* __CLUTTER_STAGE_VIEW_PRIVATE_H__ */

View File

@@ -68,7 +68,9 @@
#include "clutter-marshal.h"
#include "clutter-master-clock.h"
#include "clutter-mutter.h"
#include "clutter-paint-context-private.h"
#include "clutter-paint-volume-private.h"
#include "clutter-pick-context-private.h"
#include "clutter-private.h"
#include "clutter-stage-manager-private.h"
#include "clutter-stage-private.h"
@@ -120,8 +122,6 @@ struct _ClutterStagePrivate
GList *pending_queue_redraws;
CoglFramebuffer *active_framebuffer;
gint sync_delay;
GTimer *fps_timer;
@@ -838,20 +838,6 @@ _cogl_util_get_eye_planes_for_screen_poly (float *polygon,
graphene_vec3_normalize (&plane->n, &plane->n);
}
static void
_clutter_stage_update_active_framebuffer (ClutterStage *stage,
CoglFramebuffer *framebuffer)
{
ClutterStagePrivate *priv = stage->priv;
/* We track the CoglFramebuffer that corresponds to the stage itself
* so, for example, we can disable culling when rendering to an
* offscreen framebuffer.
*/
priv->active_framebuffer = framebuffer;
}
/* XXX: Instead of having a toplevel 2D clip region, it might be
* better to have a clip volume within the view frustum. This could
* allow us to avoid projecting actors into window coordinates to
@@ -863,7 +849,6 @@ setup_view_for_pick_or_paint (ClutterStage *stage,
const cairo_rectangle_int_t *clip)
{
ClutterStagePrivate *priv = stage->priv;
CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
cairo_rectangle_int_t view_layout;
float clip_poly[8];
float viewport[4];
@@ -914,7 +899,6 @@ setup_view_for_pick_or_paint (ClutterStage *stage,
priv->current_clip_planes);
_clutter_stage_paint_volume_stack_free_all (stage);
_clutter_stage_update_active_framebuffer (stage, framebuffer);
}
static void
@@ -922,8 +906,13 @@ clutter_stage_do_paint_view (ClutterStage *stage,
ClutterStageView *view,
const cairo_rectangle_int_t *clip)
{
ClutterPaintContext *paint_context;
paint_context = clutter_paint_context_new_for_view (view);
setup_view_for_pick_or_paint (stage, view, clip);
clutter_actor_paint (CLUTTER_ACTOR (stage));
clutter_actor_paint (CLUTTER_ACTOR (stage), paint_context);
clutter_paint_context_destroy (paint_context);
}
/* This provides a common point of entry for painting the scenegraph
@@ -963,18 +952,20 @@ _clutter_stage_emit_after_paint (ClutterStage *stage)
* respect the Z order as it uses our empty sort_depth_order.
*/
static void
clutter_stage_paint (ClutterActor *self)
clutter_stage_paint (ClutterActor *self,
ClutterPaintContext *paint_context)
{
ClutterActorIter iter;
ClutterActor *child;
clutter_actor_iter_init (&iter, self);
while (clutter_actor_iter_next (&iter, &child))
clutter_actor_paint (child);
clutter_actor_paint (child, paint_context);
}
static void
clutter_stage_pick (ClutterActor *self)
clutter_stage_pick (ClutterActor *self,
ClutterPickContext *pick_context)
{
ClutterActorIter iter;
ClutterActor *child;
@@ -985,7 +976,7 @@ clutter_stage_pick (ClutterActor *self)
*/
clutter_actor_iter_init (&iter, self);
while (clutter_actor_iter_next (&iter, &child))
clutter_actor_pick (child);
clutter_actor_pick (child, pick_context);
}
static gboolean
@@ -1638,24 +1629,25 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
{
ClutterMainContext *context = _clutter_context_get_default ();
ClutterStagePrivate *priv = stage->priv;
CoglFramebuffer *fb = clutter_stage_view_get_framebuffer (view);
int i;
g_assert (context->pick_mode == CLUTTER_PICK_NONE);
if (mode != priv->cached_pick_mode)
{
ClutterPickContext *pick_context;
_clutter_stage_clear_pick_stack (stage);
cogl_push_framebuffer (fb);
pick_context = clutter_pick_context_new_for_view (view);
context->pick_mode = mode;
setup_view_for_pick_or_paint (stage, view, NULL);
clutter_actor_pick (CLUTTER_ACTOR (stage));
clutter_actor_pick (CLUTTER_ACTOR (stage), pick_context);
context->pick_mode = CLUTTER_PICK_NONE;
priv->cached_pick_mode = mode;
cogl_pop_framebuffer ();
clutter_pick_context_destroy (pick_context);
add_pick_stack_weak_refs (stage);
}
@@ -2165,6 +2157,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
/**
* ClutterStage::after-paint:
* @stage: the stage that received the event
* @paint_Context: the paint context
*
* The ::after-paint signal is emitted after the stage is painted,
* but before the results are displayed on the screen.
@@ -2776,7 +2769,6 @@ clutter_stage_read_pixels (ClutterStage *stage,
return NULL;
framebuffer = clutter_stage_view_get_framebuffer (view);
cogl_push_framebuffer (framebuffer);
clutter_stage_do_paint_view (stage, view, &clip_rect);
view_scale = clutter_stage_view_get_scale (view);
@@ -2791,8 +2783,6 @@ clutter_stage_read_pixels (ClutterStage *stage,
COGL_PIXEL_FORMAT_RGBA_8888,
pixels);
cogl_pop_framebuffer ();
return pixels;
}
@@ -4012,18 +4002,6 @@ clutter_stage_get_motion_events_enabled (ClutterStage *stage)
return stage->priv->motion_events_enabled;
}
/* NB: The presumption shouldn't be that a stage can't be comprised
* of multiple internal framebuffers, so instead of simply naming
* this function _clutter_stage_get_framebuffer(), the "active"
* infix is intended to clarify that it gets the framebuffer that
* is currently in use/being painted.
*/
CoglFramebuffer *
_clutter_stage_get_active_framebuffer (ClutterStage *stage)
{
return stage->priv->active_framebuffer;
}
void
_clutter_stage_add_pointer_drag_actor (ClutterStage *stage,
ClutterInputDevice *device,
@@ -4433,7 +4411,6 @@ capture_view_into (ClutterStage *stage,
if (paint)
{
cogl_push_framebuffer (framebuffer);
_clutter_stage_maybe_setup_viewport (stage, view);
clutter_stage_do_paint_view (stage, view, rect);
}
@@ -4458,9 +4435,6 @@ capture_view_into (ClutterStage *stage,
COGL_READ_PIXELS_COLOR_BUFFER,
bitmap);
if (paint)
cogl_pop_framebuffer ();
cogl_object_unref (bitmap);
}

View File

@@ -1991,7 +1991,7 @@ selection_paint (ClutterText *self,
color->blue,
paint_opacity * color->alpha / 255);
cogl_pango_render_layout (layout, priv->text_x, 0, &cogl_color, 0);
cogl_pango_show_layout (fb, layout, priv->text_x, 0, &cogl_color);
cogl_framebuffer_pop_clip (fb);
}
@@ -2548,7 +2548,8 @@ clutter_text_compute_layout_offsets (ClutterText *self,
#define TEXT_PADDING 2
static void
clutter_text_paint (ClutterActor *self)
clutter_text_paint (ClutterActor *self,
ClutterPaintContext *paint_context)
{
ClutterText *text = CLUTTER_TEXT (self);
ClutterTextPrivate *priv = text->priv;
@@ -2566,7 +2567,7 @@ clutter_text_paint (ClutterActor *self)
float alloc_height;
float resource_scale;
fb = cogl_get_draw_framebuffer ();
fb = clutter_paint_context_get_framebuffer (paint_context);
/* Note that if anything in this paint method changes it needs to be
reflected in the get_paint_volume implementation which is tightly
@@ -2754,7 +2755,7 @@ clutter_text_paint (ClutterActor *self)
priv->text_color.green,
priv->text_color.blue,
real_opacity);
cogl_pango_render_layout (layout, priv->text_x, priv->text_y, &color, 0);
cogl_pango_show_layout (fb, layout, priv->text_x, priv->text_y, &color);
selection_paint (text, fb);

View File

@@ -1038,15 +1038,15 @@ clutter_timeline_do_frame (ClutterTimeline *timeline)
* to correpondingly reduce elapsed_time_delta to reflect the correct
* range of times */
if (priv->direction == CLUTTER_TIMELINE_FORWARD)
{
elapsed_time_delta -= (priv->elapsed_time - priv->duration);
priv->elapsed_time = priv->duration;
}
{
elapsed_time_delta -= (priv->elapsed_time - priv->duration);
priv->elapsed_time = priv->duration;
}
else if (priv->direction == CLUTTER_TIMELINE_BACKWARD)
{
elapsed_time_delta -= - priv->elapsed_time;
priv->elapsed_time = 0;
}
{
elapsed_time_delta -= - priv->elapsed_time;
priv->elapsed_time = 0;
}
end_msecs = priv->elapsed_time;
@@ -1756,12 +1756,12 @@ _clutter_timeline_do_tick (ClutterTimeline *timeline,
}
if (msecs != 0)
{
/* Avoid accumulating error */
{
/* Avoid accumulating error */
priv->last_frame_time += msecs;
priv->msecs_delta = msecs;
clutter_timeline_do_frame (timeline);
}
priv->msecs_delta = msecs;
clutter_timeline_do_frame (timeline);
}
}
}

View File

@@ -869,7 +869,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
}
}
cogl_push_framebuffer (fb);
if (use_clipped_redraw && clip_region_empty)
{
CLUTTER_NOTE (CLIPPING, "Empty stage output paint\n");
@@ -960,7 +959,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
cairo_region_destroy (view_region);
}
}
cogl_pop_framebuffer ();
cairo_region_get_extents (redraw_clip, &redraw_rect);

View File

@@ -277,28 +277,30 @@ clutter_container_iface_init (ClutterContainerIface *iface)
}
static void
clutter_group_real_paint (ClutterActor *actor)
clutter_group_real_paint (ClutterActor *actor,
ClutterPaintContext *paint_context)
{
ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv;
CLUTTER_NOTE (PAINT, "ClutterGroup paint enter '%s'",
_clutter_actor_get_debug_name (actor));
g_list_foreach (priv->children, (GFunc) clutter_actor_paint, NULL);
g_list_foreach (priv->children, (GFunc) clutter_actor_paint, paint_context);
CLUTTER_NOTE (PAINT, "ClutterGroup paint leave '%s'",
_clutter_actor_get_debug_name (actor));
}
static void
clutter_group_real_pick (ClutterActor *actor)
clutter_group_real_pick (ClutterActor *actor,
ClutterPickContext *pick_context)
{
ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv;
/* Chain up so we get a bounding box pained (if we are reactive) */
CLUTTER_ACTOR_CLASS (clutter_group_parent_class)->pick (actor);
CLUTTER_ACTOR_CLASS (clutter_group_parent_class)->pick (actor, pick_context);
g_list_foreach (priv->children, (GFunc) clutter_actor_pick, NULL);
g_list_foreach (priv->children, (GFunc) clutter_actor_pick, pick_context);
}
static void

View File

@@ -78,10 +78,12 @@ static const ClutterColor default_border_color = { 0, 0, 0, 255 };
G_DEFINE_TYPE_WITH_PRIVATE (ClutterRectangle, clutter_rectangle, CLUTTER_TYPE_ACTOR)
static void
clutter_rectangle_paint (ClutterActor *self)
clutter_rectangle_paint (ClutterActor *self,
ClutterPaintContext *paint_context)
{
ClutterRectanglePrivate *priv = CLUTTER_RECTANGLE (self)->priv;
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
static CoglPipeline *default_color_pipeline = NULL;
CoglPipeline *content_pipeline;
ClutterActorBox alloc;

View File

@@ -58,11 +58,13 @@ clutter_headers = [
'clutter-mutter.h',
'clutter-offscreen-effect.h',
'clutter-page-turn-effect.h',
'clutter-paint-context.h',
'clutter-paint-nodes.h',
'clutter-paint-node.h',
'clutter-pan-action.h',
'clutter-path-constraint.h',
'clutter-path.h',
'clutter-pick-context.h',
'clutter-property-transition.h',
'clutter-rotate-action.h',
'clutter-script.h',
@@ -146,11 +148,13 @@ clutter_sources = [
'clutter-master-clock-default.c',
'clutter-offscreen-effect.c',
'clutter-page-turn-effect.c',
'clutter-paint-context.c',
'clutter-paint-nodes.c',
'clutter-paint-node.c',
'clutter-pan-action.c',
'clutter-path-constraint.c',
'clutter-path.c',
'clutter-pick-context.c',
'clutter-property-transition.c',
'clutter-rotate-action.c',
'clutter-script.c',
@@ -200,6 +204,7 @@ clutter_private_headers = [
'clutter-master-clock.h',
'clutter-master-clock-default.h',
'clutter-offscreen-effect-private.h',
'clutter-paint-context-private.h',
'clutter-paint-node-private.h',
'clutter-paint-volume-private.h',
'clutter-private.h',

View File

@@ -454,34 +454,6 @@ cogl_pango_show_layout (CoglFramebuffer *fb,
}
}
void
cogl_pango_render_layout_subpixel (PangoLayout *layout,
int x,
int y,
const CoglColor *color,
int flags)
{
cogl_pango_show_layout (cogl_get_draw_framebuffer (),
layout,
x / (float) PANGO_SCALE,
y / (float) PANGO_SCALE,
color);
}
void
cogl_pango_render_layout (PangoLayout *layout,
int x,
int y,
const CoglColor *color,
int flags)
{
cogl_pango_render_layout_subpixel (layout,
x * PANGO_SCALE,
y * PANGO_SCALE,
color,
flags);
}
void
cogl_pango_show_layout_line (CoglFramebuffer *fb,
PangoLayoutLine *line,
@@ -519,19 +491,6 @@ cogl_pango_show_layout_line (CoglFramebuffer *fb,
priv->display_list = NULL;
}
void
cogl_pango_render_layout_line (PangoLayoutLine *line,
int x,
int y,
const CoglColor *color)
{
cogl_pango_show_layout_line (cogl_get_draw_framebuffer (),
line,
x / (float) PANGO_SCALE,
y / (float) PANGO_SCALE,
color);
}
void
_cogl_pango_renderer_clear_glyph_cache (CoglPangoRenderer *renderer)
{

View File

@@ -229,71 +229,6 @@ typedef struct _CoglPangoRendererClass CoglPangoRendererClass;
GType cogl_pango_renderer_get_type (void) G_GNUC_CONST;
/**
* cogl_pango_render_layout_subpixel:
* @layout: a #PangoLayout
* @x: X coordinate (in Pango units) to render the layout at
* @y: Y coordinate (in Pango units) to render the layout at
* @color: color to use when rendering the layout
* @flags:
*
* Draws a solidly coloured @layout on the given @framebuffer at (@x,
* @y) within the @framebuffer<!-- -->'s current model-view coordinate
* space.
*
* Since: 1.0
* Deprecated: 1.16: Use cogl_pango_show_layout() instead
*/
COGL_DEPRECATED_FOR (cogl_pango_show_layout)
void
cogl_pango_render_layout_subpixel (PangoLayout *layout,
int x,
int y,
const CoglColor *color,
int flags);
/**
* cogl_pango_render_layout:
* @layout: a #PangoLayout
* @x: X coordinate to render the layout at
* @y: Y coordinate to render the layout at
* @color: color to use when rendering the layout
* @flags:
*
* Draws a solidly coloured @layout on the given @framebuffer at (@x,
* @y) within the @framebuffer<!-- -->'s current model-view coordinate
* space.
*
* Since: 1.0
* Deprecated: 1.16: Use cogl_pango_show_layout() instead
*/
COGL_DEPRECATED_FOR (cogl_pango_show_layout)
void
cogl_pango_render_layout (PangoLayout *layout,
int x,
int y,
const CoglColor *color,
int flags);
/**
* cogl_pango_render_layout_line:
* @line: a #PangoLayoutLine
* @x: X coordinate to render the line at
* @y: Y coordinate to render the line at
* @color: color to use when rendering the line
*
* Renders @line at the given coordinates using the given color.
*
* Since: 1.0
* Deprecated: 1.16: Use cogl_pango_show_layout() instead
*/
COGL_DEPRECATED_FOR (cogl_pango_show_layout_line)
void
cogl_pango_render_layout_line (PangoLayoutLine *line,
int x,
int y,
const CoglColor *color);
G_END_DECLS
#endif /* __COGL_PANGO_H__ */

View File

@@ -7,6 +7,3 @@ cogl_pango_font_map_new
cogl_pango_font_map_set_resolution
cogl_pango_font_map_set_use_mipmapping
cogl_pango_renderer_get_type
cogl_pango_render_layout
cogl_pango_render_layout_line
cogl_pango_render_layout_subpixel

View File

@@ -422,26 +422,6 @@ cogl_path_set_fill_rule (CoglPath *path, CoglPathFillRule fill_rule);
CoglPathFillRule
cogl_path_get_fill_rule (CoglPath *path);
#define cogl_path_fill cogl2_path_fill
/**
* cogl_path_fill:
*
* Fills the interior of the constructed shape using the current
* drawing color.
*
* The interior of the shape is determined using the fill rule of the
* path. See %CoglPathFillRule for details.
*
* <note>The result of referencing sliced textures in your current
* pipeline when filling a path are undefined. You should pass
* the %COGL_TEXTURE_NO_SLICING flag when loading any texture you will
* use while filling a path.</note>
*
* Since: 2.0
*/
void
cogl_path_fill (CoglPath *path);
/**
* cogl_framebuffer_fill_path:
* @framebuffer: A #CoglFramebuffer
@@ -466,19 +446,6 @@ cogl_framebuffer_fill_path (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
CoglPath *path);
#define cogl_path_stroke cogl2_path_stroke
/**
* cogl_path_stroke:
*
* Strokes the constructed shape using the current drawing color and a
* width of 1 pixel (regardless of the current transformation
* matrix).
*
* Since: 2.0
*/
void
cogl_path_stroke (CoglPath *path);
/**
* cogl_framebuffer_stroke_path:
* @framebuffer: A #CoglFramebuffer
@@ -513,22 +480,6 @@ void
cogl_framebuffer_push_path_clip (CoglFramebuffer *framebuffer,
CoglPath *path);
#define cogl_clip_push_from_path cogl2_clip_push_from_path
/**
* cogl_clip_push_from_path:
* @path: The path to clip with.
*
* Sets a new clipping area using the silhouette of the specified,
* filled @path. The clipping area is intersected with the previous
* clipping area. To restore the previous clipping area, call
* call cogl_clip_pop().
*
* Since: 1.8
* Stability: Unstable
*/
void
cogl_clip_push_from_path (CoglPath *path);
G_END_DECLS
#endif /* __COGL_PATH_FUNCTIONS_H__ */

View File

@@ -385,38 +385,6 @@ _cogl_path_fill_nodes (CoglPath *path,
}
}
/* TODO: Update to the protoype used in the Cogl master branch.
* This is experimental API but not in sync with the cogl_path_fill()
* api in Cogl master which takes explicit framebuffer and pipeline
* arguments */
void
cogl2_path_fill (CoglPath *path)
{
g_return_if_fail (cogl_is_path (path));
_cogl_path_fill_nodes (path,
cogl_get_draw_framebuffer (),
cogl_get_source (),
0 /* flags */);
}
/* TODO: Update to the protoype used in the Cogl master branch.
* This is experimental API but not in sync with the cogl_path_fill()
* api in Cogl master which takes explicit framebuffer and pipeline
* arguments */
void
cogl2_path_stroke (CoglPath *path)
{
g_return_if_fail (cogl_is_path (path));
if (path->data->path_nodes->len == 0)
return;
_cogl_path_stroke_nodes (path,
cogl_get_draw_framebuffer (),
cogl_get_source ());
}
void
cogl2_path_move_to (CoglPath *path,
float x,
@@ -1504,12 +1472,6 @@ cogl_framebuffer_push_path_clip (CoglFramebuffer *framebuffer,
COGL_FRAMEBUFFER_STATE_CLIP;
}
void
cogl_clip_push_from_path (CoglPath *path)
{
cogl_framebuffer_push_path_clip (cogl_get_draw_framebuffer (), path);
}
static void
_cogl_path_build_stroke_attribute_buffer (CoglPath *path)
{

View File

@@ -90,17 +90,16 @@ typedef enum
COGL_DRAW_SKIP_JOURNAL_FLUSH = 1 << 0,
COGL_DRAW_SKIP_PIPELINE_VALIDATION = 1 << 1,
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH = 1 << 2,
COGL_DRAW_SKIP_LEGACY_STATE = 1 << 3,
/* By default the vertex attribute drawing code will assume that if
there is a color attribute array enabled then we can't determine
if the colors will be opaque so we need to enabling
blending. However when drawing from the journal we know what the
contents of the color array is so we can override this by passing
this flag. */
COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE = 1 << 4,
COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE = 1 << 3,
/* This forcibly disables the debug option to divert all drawing to
* wireframes */
COGL_DRAW_SKIP_DEBUG_WIREFRAME = 1 << 5
COGL_DRAW_SKIP_DEBUG_WIREFRAME = 1 << 4
} CoglDrawFlags;
/* During CoglContext initialization we register the "cogl_color_in"

View File

@@ -650,15 +650,6 @@ _cogl_flush_attributes_state (CoglFramebuffer *framebuffer,
* when the framebuffer really does get drawn to. */
_cogl_framebuffer_mark_clear_clip_dirty (framebuffer);
if (G_UNLIKELY (!(flags & COGL_DRAW_SKIP_LEGACY_STATE)) &&
G_UNLIKELY (ctx->legacy_state_set) &&
_cogl_get_enable_legacy_state ())
{
copy = cogl_pipeline_copy (pipeline);
pipeline = copy;
_cogl_pipeline_apply_legacy_state (pipeline);
}
ctx->driver_vtable->flush_attributes_state (framebuffer,
pipeline,
&layers_state,

View File

@@ -36,7 +36,6 @@
#include <glib.h>
#include "cogl-clip-stack.h"
#include "cogl-primitives.h"
#include "cogl-context-private.h"
#include "cogl-framebuffer-private.h"
#include "cogl-journal-private.h"

View File

@@ -39,7 +39,6 @@
#endif
#include "cogl-display-private.h"
#include "cogl-primitives.h"
#include "cogl-clip-stack.h"
#include "cogl-matrix-stack.h"
#include "cogl-pipeline-private.h"
@@ -146,16 +145,12 @@ struct _CoglContext
GArray *texture_units;
int active_texture_unit;
/* Pipelines */
CoglPipeline *opaque_color_pipeline; /* used for set_source_color */
CoglPipeline *blended_color_pipeline; /* used for set_source_color */
CoglPipeline *texture_pipeline; /* used for set_source_texture */
/* Only used for comparing other pipelines when reading pixels. */
CoglPipeline *opaque_color_pipeline;
GString *codegen_header_buffer;
GString *codegen_source_buffer;
GString *codegen_boilerplate_buffer;
GList *source_stack;
int legacy_state_set;
CoglPipelineCache *pipeline_cache;
@@ -192,8 +187,6 @@ struct _CoglContext
CoglBuffer *current_buffer[COGL_BUFFER_BIND_TARGET_COUNT];
/* Framebuffers */
GSList *framebuffer_stack;
CoglFramebuffer *window_buffer;
unsigned long current_draw_buffer_state_flushed;
unsigned long current_draw_buffer_changes;
CoglFramebuffer *current_draw_buffer;

View File

@@ -255,14 +255,10 @@ cogl_context_new (CoglDisplay *display,
}
context->opaque_color_pipeline = cogl_pipeline_new (context);
context->blended_color_pipeline = cogl_pipeline_new (context);
context->texture_pipeline = cogl_pipeline_new (context);
context->codegen_header_buffer = g_string_new ("");
context->codegen_source_buffer = g_string_new ("");
context->codegen_boilerplate_buffer = g_string_new ("");
context->source_stack = NULL;
context->legacy_state_set = 0;
context->default_gl_texture_2d_tex = NULL;
@@ -318,9 +314,6 @@ cogl_context_new (CoglDisplay *display,
for (i = 0; i < COGL_BUFFER_BIND_TARGET_COUNT; i++)
context->current_buffer[i] = NULL;
context->window_buffer = NULL;
context->framebuffer_stack = _cogl_create_framebuffer_stack ();
context->current_path = NULL;
context->stencil_pipeline = cogl_pipeline_new (context);
@@ -375,8 +368,6 @@ cogl_context_new (CoglDisplay *display,
white_pixel,
NULL); /* abort on error */
cogl_push_source (context->opaque_color_pipeline);
context->atlases = NULL;
g_hook_list_init (&context->atlas_reorganize_callbacks, sizeof (GHook));
@@ -405,8 +396,6 @@ _cogl_context_free (CoglContext *context)
winsys->context_deinit (context);
_cogl_free_framebuffer_stack (context->framebuffer_stack);
if (context->current_path)
cogl_object_unref (context->current_path);
@@ -415,10 +404,6 @@ _cogl_context_free (CoglContext *context)
if (context->opaque_color_pipeline)
cogl_object_unref (context->opaque_color_pipeline);
if (context->blended_color_pipeline)
cogl_object_unref (context->blended_color_pipeline);
if (context->texture_pipeline)
cogl_object_unref (context->texture_pipeline);
if (context->blit_texture_pipeline)
cogl_object_unref (context->blit_texture_pipeline);

View File

@@ -102,7 +102,7 @@ G_BEGIN_DECLS
GType cogl_context_get_gtype (void);
/**
* cogl_context_new: (constructor)
* cogl_context_new: (constructor) (skip)
* @display: (allow-none): A #CoglDisplay pointer
* @error: A GError return location.
*
@@ -118,7 +118,7 @@ cogl_context_new (CoglDisplay *display,
GError **error);
/**
* cogl_context_get_display:
* cogl_context_get_display: (skip)
* @context: A #CoglContext pointer
*
* Retrieves the #CoglDisplay that is internally associated with the
@@ -136,7 +136,7 @@ CoglDisplay *
cogl_context_get_display (CoglContext *context);
/**
* cogl_context_get_renderer:
* cogl_context_get_renderer: (skip)
* @context: A #CoglContext pointer
*
* Retrieves the #CoglRenderer that is internally associated with the

View File

@@ -341,21 +341,6 @@ _cogl_offscreen_new_with_texture_full (CoglTexture *texture,
CoglOffscreenFlags create_flags,
int level);
/*
* _cogl_push_framebuffers:
* @draw_buffer: A pointer to the buffer used for drawing
* @read_buffer: A pointer to the buffer used for reading back pixels
*
* Redirects drawing and reading to the specified framebuffers as in
* cogl_push_framebuffer() except that it allows the draw and read
* buffer to be different. The buffers are pushed as a pair so that
* they can later both be restored with a single call to
* cogl_pop_framebuffer().
*/
void
_cogl_push_framebuffers (CoglFramebuffer *draw_buffer,
CoglFramebuffer *read_buffer);
void
_cogl_framebuffer_push_projection (CoglFramebuffer *framebuffer);

View File

@@ -2172,8 +2172,7 @@ cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
CoglPrimitive *primitive)
{
_cogl_primitive_draw (primitive, framebuffer, pipeline,
COGL_DRAW_SKIP_LEGACY_STATE);
_cogl_primitive_draw (primitive, framebuffer, pipeline, 0);
}
void
@@ -2199,8 +2198,7 @@ cogl_framebuffer_draw_rectangle (CoglFramebuffer *framebuffer,
_cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
pipeline,
&rect,
1,
TRUE);
1);
}
void
@@ -2231,8 +2229,7 @@ cogl_framebuffer_draw_textured_rectangle (CoglFramebuffer *framebuffer,
_cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
pipeline,
&rect,
1,
TRUE);
1);
}
void
@@ -2260,8 +2257,7 @@ cogl_framebuffer_draw_multitextured_rectangle (CoglFramebuffer *framebuffer,
_cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
pipeline,
&rect,
1,
TRUE);
1);
}
void
@@ -2290,8 +2286,7 @@ cogl_framebuffer_draw_rectangles (CoglFramebuffer *framebuffer,
_cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
pipeline,
rects,
n_rectangles,
TRUE);
n_rectangles);
}
void
@@ -2320,6 +2315,5 @@ cogl_framebuffer_draw_textured_rectangles (CoglFramebuffer *framebuffer,
_cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
pipeline,
rects,
n_rectangles,
TRUE);
n_rectangles);
}

View File

@@ -987,7 +987,7 @@ cogl_framebuffer_resolve_samples_region (CoglFramebuffer *framebuffer,
int height);
/**
* cogl_framebuffer_get_context: (skip)
* cogl_framebuffer_get_context:
* @framebuffer: A #CoglFramebuffer
*
* Can be used to query the #CoglContext a given @framebuffer was
@@ -1463,19 +1463,6 @@ cogl_framebuffer_read_pixels (CoglFramebuffer *framebuffer,
CoglPixelFormat format,
uint8_t *pixels);
/**
* cogl_get_draw_framebuffer:
*
* Gets the current #CoglFramebuffer as set using
* cogl_push_framebuffer()
*
* Return value: (transfer none): The current #CoglFramebuffer
* Stability: unstable
* Since: 1.8
*/
CoglFramebuffer *
cogl_get_draw_framebuffer (void);
uint32_t
cogl_framebuffer_error_quark (void);

View File

@@ -280,8 +280,7 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
CoglAttribute **attributes;
CoglDrawFlags draw_flags = (COGL_DRAW_SKIP_JOURNAL_FLUSH |
COGL_DRAW_SKIP_PIPELINE_VALIDATION |
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH |
COGL_DRAW_SKIP_LEGACY_STATE);
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
COGL_STATIC_TIMER (time_flush_modelview_and_entries,
"flush: pipeline+entries", /* parent */

View File

@@ -161,9 +161,6 @@ _cogl_onscreen_free (CoglOnscreen *onscreen)
cogl_object_unref (frame_info);
g_queue_clear (&onscreen->pending_frame_infos);
if (framebuffer->context->window_buffer == COGL_FRAMEBUFFER (onscreen))
framebuffer->context->window_buffer = NULL;
winsys->onscreen_deinit (onscreen);
g_return_if_fail (onscreen->winsys == NULL);

View File

@@ -2388,37 +2388,6 @@ _cogl_pipeline_journal_unref (CoglPipeline *pipeline)
}
#ifdef COGL_DEBUG_ENABLED
void
_cogl_pipeline_apply_legacy_state (CoglPipeline *pipeline)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
/* It was a mistake that we ever copied the OpenGL style API for
* associating these things directly with the context when we
* originally wrote Cogl. Until the corresponding deprecated APIs
* can be removed though we now shoehorn the state changes through
* the cogl_pipeline API instead.
*/
/* A program explicitly set on the pipeline has higher precedence than
* one associated with the context using cogl_program_use() */
if (ctx->current_program &&
cogl_pipeline_get_user_program (pipeline) == NULL)
cogl_pipeline_set_user_program (pipeline, ctx->current_program);
if (ctx->legacy_depth_test_enabled)
{
CoglDepthState depth_state;
cogl_depth_state_init (&depth_state);
cogl_depth_state_set_test_enabled (&depth_state, TRUE);
cogl_pipeline_set_depth_state (pipeline, &depth_state, NULL);
}
if (ctx->legacy_backface_culling_enabled)
cogl_pipeline_set_cull_face_mode (pipeline,
COGL_PIPELINE_CULL_FACE_MODE_BACK);
}
void
_cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline,
const char *breadcrumb)

View File

@@ -72,7 +72,7 @@ G_BEGIN_DECLS
GType cogl_pipeline_get_gtype (void);
/**
* cogl_pipeline_new: (skip)
* cogl_pipeline_new: (constructor)
* @context: a #CoglContext
*
* Allocates and initializes a default simple pipeline that will color

View File

@@ -102,37 +102,6 @@ cogl_pixel_buffer_new (CoglContext *context,
gboolean
cogl_is_pixel_buffer (void *object);
#if 0
/*
* cogl_pixel_buffer_set_region:
* @buffer: A #CoglPixelBuffer object
* @data: pixel data to upload to @array
* @src_width: width in pixels of the region to update
* @src_height: height in pixels of the region to update
* @src_rowstride: row stride in bytes of the source array
* @dst_x: upper left destination horizontal coordinate
* @dst_y: upper left destination vertical coordinate
*
* Uploads new data into a pixel array. The source data pointed by @data can
* have a different stride than @array in which case the function will do the
* right thing for you. For performance reasons, it is recommended for the
* source data to have the same stride than @array.
*
* Return value: %TRUE if the upload succeeded, %FALSE otherwise
*
* Since: 1.2
* Stability: Unstable
*/
gboolean
cogl_pixel_buffer_set_region (CoglPixelBuffer *buffer,
uint8_t *data,
unsigned int src_width,
unsigned int src_height,
unsigned int src_rowstride,
unsigned int dst_x,
unsigned int dst_y);
#endif
G_END_DECLS
#endif /* __COGL_PIXEL_BUFFER_H__ */

View File

@@ -59,8 +59,7 @@ _cogl_framebuffer_draw_multitextured_rectangles (
CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
CoglMultiTexturedRect *rects,
int n_rects,
gboolean disable_legacy_state);
int n_rects);
G_END_DECLS

View File

@@ -629,8 +629,7 @@ _cogl_framebuffer_draw_multitextured_rectangles (
CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
CoglMultiTexturedRect *rects,
int n_rects,
gboolean disable_legacy_state)
int n_rects)
{
CoglContext *ctx = framebuffer->context;
CoglPipeline *original_pipeline;
@@ -654,18 +653,6 @@ _cogl_framebuffer_draw_multitextured_rectangles (
if (state.override_source)
pipeline = state.override_source;
if (!disable_legacy_state)
{
if (G_UNLIKELY (ctx->legacy_state_set) &&
_cogl_get_enable_legacy_state ())
{
/* If we haven't already made a pipeline copy */
if (pipeline == original_pipeline)
pipeline = cogl_pipeline_copy (pipeline);
_cogl_pipeline_apply_legacy_state (pipeline);
}
}
/*
* Emit geometry for each of the rectangles...
*/
@@ -720,136 +707,6 @@ _cogl_framebuffer_draw_multitextured_rectangles (
cogl_object_unref (pipeline);
}
static void
_cogl_rectangles_with_multitexture_coords (
CoglMultiTexturedRect *rects,
int n_rects)
{
_cogl_framebuffer_draw_multitextured_rectangles (cogl_get_draw_framebuffer (),
cogl_get_source (),
rects,
n_rects,
FALSE);
}
void
cogl_rectangles (const float *verts,
unsigned int n_rects)
{
CoglMultiTexturedRect *rects;
int i;
/* XXX: All the cogl_rectangle* APIs normalize their input into an array of
* CoglMultiTexturedRect rectangles and pass these on to our work horse;
* _cogl_rectangles_with_multitexture_coords.
*/
rects = g_alloca (n_rects * sizeof (CoglMultiTexturedRect));
for (i = 0; i < n_rects; i++)
{
rects[i].position = &verts[i * 4];
rects[i].tex_coords = NULL;
rects[i].tex_coords_len = 0;
}
_cogl_rectangles_with_multitexture_coords (rects, n_rects);
}
void
cogl_rectangles_with_texture_coords (const float *verts,
unsigned int n_rects)
{
CoglMultiTexturedRect *rects;
int i;
/* XXX: All the cogl_rectangle* APIs normalize their input into an array of
* CoglMultiTexturedRect rectangles and pass these on to our work horse;
* _cogl_rectangles_with_multitexture_coords.
*/
rects = g_alloca (n_rects * sizeof (CoglMultiTexturedRect));
for (i = 0; i < n_rects; i++)
{
rects[i].position = &verts[i * 8];
rects[i].tex_coords = &verts[i * 8 + 4];
rects[i].tex_coords_len = 4;
}
_cogl_rectangles_with_multitexture_coords (rects, n_rects);
}
void
cogl_rectangle_with_texture_coords (float x_1,
float y_1,
float x_2,
float y_2,
float tx_1,
float ty_1,
float tx_2,
float ty_2)
{
const float position[4] = {x_1, y_1, x_2, y_2};
const float tex_coords[4] = {tx_1, ty_1, tx_2, ty_2};
CoglMultiTexturedRect rect;
/* XXX: All the cogl_rectangle* APIs normalize their input into an array of
* CoglMultiTexturedRect rectangles and pass these on to our work horse;
* _cogl_rectangles_with_multitexture_coords.
*/
rect.position = position;
rect.tex_coords = tex_coords;
rect.tex_coords_len = 4;
_cogl_rectangles_with_multitexture_coords (&rect, 1);
}
void
cogl_rectangle_with_multitexture_coords (float x_1,
float y_1,
float x_2,
float y_2,
const float *user_tex_coords,
int user_tex_coords_len)
{
const float position[4] = {x_1, y_1, x_2, y_2};
CoglMultiTexturedRect rect;
/* XXX: All the cogl_rectangle* APIs normalize their input into an array of
* CoglMultiTexturedRect rectangles and pass these on to our work horse;
* _cogl_rectangles_with_multitexture_coords.
*/
rect.position = position;
rect.tex_coords = user_tex_coords;
rect.tex_coords_len = user_tex_coords_len;
_cogl_rectangles_with_multitexture_coords (&rect, 1);
}
void
cogl_rectangle (float x_1,
float y_1,
float x_2,
float y_2)
{
const float position[4] = {x_1, y_1, x_2, y_2};
CoglMultiTexturedRect rect;
/* XXX: All the cogl_rectangle* APIs normalize their input into an array of
* CoglMultiTexturedRect rectangles and pass these on to our work horse;
* _cogl_rectangles_with_multitexture_coords.
*/
rect.position = position;
rect.tex_coords = NULL;
rect.tex_coords_len = 0;
_cogl_rectangles_with_multitexture_coords (&rect, 1);
}
void
_cogl_rectangle_immediate (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
@@ -891,250 +748,9 @@ _cogl_rectangle_immediate (CoglFramebuffer *framebuffer,
1,
COGL_DRAW_SKIP_JOURNAL_FLUSH |
COGL_DRAW_SKIP_PIPELINE_VALIDATION |
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH |
COGL_DRAW_SKIP_LEGACY_STATE);
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
cogl_object_unref (attributes[0]);
cogl_object_unref (attribute_buffer);
}
typedef struct _AppendTexCoordsState
{
const CoglTextureVertex *vertices_in;
int vertex;
int layer;
float *vertices_out;
} AppendTexCoordsState;
static gboolean
append_tex_coord_attributes_cb (CoglPipeline *pipeline,
int layer_index,
void *user_data)
{
AppendTexCoordsState *state = user_data;
CoglTexture *texture;
float tx, ty;
float *t;
tx = state->vertices_in[state->vertex].tx;
ty = state->vertices_in[state->vertex].ty;
/* NULL textures will be handled in
* _cogl_pipeline_flush_layers_gl_state but there is no need to worry
* about scaling texture coordinates in this case */
texture = cogl_pipeline_get_layer_texture (pipeline, layer_index);
if (texture != NULL)
_cogl_texture_transform_coords_to_gl (texture, &tx, &ty);
/* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
t = state->vertices_out + 3 + 2 * state->layer;
t[0] = tx;
t[1] = ty;
state->layer++;
return TRUE;
}
typedef struct _ValidateState
{
CoglPipeline *original_pipeline;
CoglPipeline *pipeline;
} ValidateState;
static gboolean
_cogl_polygon_validate_layer_cb (CoglPipeline *pipeline,
int layer_index,
void *user_data)
{
ValidateState *state = user_data;
/* By default COGL_PIPELINE_WRAP_MODE_AUTOMATIC becomes
* GL_CLAMP_TO_EDGE but we want the polygon API to use GL_REPEAT to
* maintain compatibility with previous releases
*/
if (cogl_pipeline_get_layer_wrap_mode_s (pipeline, layer_index) ==
COGL_PIPELINE_WRAP_MODE_AUTOMATIC)
{
if (state->original_pipeline == state->pipeline)
state->pipeline = cogl_pipeline_copy (pipeline);
cogl_pipeline_set_layer_wrap_mode_s (state->pipeline, layer_index,
COGL_PIPELINE_WRAP_MODE_REPEAT);
}
if (cogl_pipeline_get_layer_wrap_mode_t (pipeline, layer_index) ==
COGL_PIPELINE_WRAP_MODE_AUTOMATIC)
{
if (state->original_pipeline == state->pipeline)
state->pipeline = cogl_pipeline_copy (pipeline);
cogl_pipeline_set_layer_wrap_mode_t (state->pipeline, layer_index,
COGL_PIPELINE_WRAP_MODE_REPEAT);
}
return TRUE;
}
void
cogl_polygon (const CoglTextureVertex *vertices,
unsigned int n_vertices,
gboolean use_color)
{
CoglPipeline *pipeline;
ValidateState validate_state;
int n_layers;
int n_attributes;
CoglAttribute **attributes;
int i;
unsigned int stride;
size_t stride_bytes;
CoglAttributeBuffer *attribute_buffer;
float *v;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
pipeline = cogl_get_source ();
validate_state.original_pipeline = pipeline;
validate_state.pipeline = pipeline;
cogl_pipeline_foreach_layer (pipeline,
_cogl_polygon_validate_layer_cb,
&validate_state);
pipeline = validate_state.pipeline;
n_layers = cogl_pipeline_get_n_layers (pipeline);
n_attributes = 1 + n_layers + (use_color ? 1 : 0);
attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes);
/* Our data is arranged like:
* [X, Y, Z, TX0, TY0, TX1, TY1..., R, G, B, A,...] */
stride = 3 + (2 * n_layers) + (use_color ? 1 : 0);
stride_bytes = stride * sizeof (float);
/* Make sure there is enough space in the global vertex array. This
* is used so we can render the polygon with a single call to OpenGL
* but still support any number of vertices */
g_array_set_size (ctx->polygon_vertices, n_vertices * stride);
attribute_buffer =
cogl_attribute_buffer_new (ctx, n_vertices * stride_bytes, NULL);
attributes[0] = cogl_attribute_new (attribute_buffer,
"cogl_position_in",
stride_bytes,
0,
3,
COGL_ATTRIBUTE_TYPE_FLOAT);
for (i = 0; i < n_layers; i++)
{
static const char *names[] = {
"cogl_tex_coord0_in",
"cogl_tex_coord1_in",
"cogl_tex_coord2_in",
"cogl_tex_coord3_in",
"cogl_tex_coord4_in",
"cogl_tex_coord5_in",
"cogl_tex_coord6_in",
"cogl_tex_coord7_in"
};
char *allocated_name = NULL;
const char *name;
if (i < 8)
name = names[i];
else
name = allocated_name = g_strdup_printf ("cogl_tex_coord%d_in", i);
attributes[i + 1] = cogl_attribute_new (attribute_buffer,
name,
stride_bytes,
/* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
12 + 8 * i,
2,
COGL_ATTRIBUTE_TYPE_FLOAT);
g_free (allocated_name);
}
if (use_color)
{
attributes[n_attributes - 1] =
cogl_attribute_new (attribute_buffer,
"cogl_color_in",
stride_bytes,
/* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
12 + 8 * n_layers,
4,
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
}
/* Convert the vertices into an array of float vertex attributes */
v = (float *)ctx->polygon_vertices->data;
for (i = 0; i < n_vertices; i++)
{
AppendTexCoordsState append_tex_coords_state;
uint8_t *c;
/* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
v[0] = vertices[i].x;
v[1] = vertices[i].y;
v[2] = vertices[i].z;
append_tex_coords_state.vertices_in = vertices;
append_tex_coords_state.vertex = i;
append_tex_coords_state.layer = 0;
append_tex_coords_state.vertices_out = v;
cogl_pipeline_foreach_layer (pipeline,
append_tex_coord_attributes_cb,
&append_tex_coords_state);
if (use_color)
{
/* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
c = (uint8_t *) (v + 3 + 2 * n_layers);
c[0] = cogl_color_get_red_byte (&vertices[i].color);
c[1] = cogl_color_get_green_byte (&vertices[i].color);
c[2] = cogl_color_get_blue_byte (&vertices[i].color);
c[3] = cogl_color_get_alpha_byte (&vertices[i].color);
}
v += stride;
}
v = (float *)ctx->polygon_vertices->data;
cogl_buffer_set_data (COGL_BUFFER (attribute_buffer),
0,
v,
ctx->polygon_vertices->len * sizeof (float));
/* XXX: although this may seem redundant, we need to do this since
* cogl_polygon() can be used with legacy state and its the source stack
* which track whether legacy state is enabled.
*
* (We only have a CoglDrawFlag to disable legacy state not one
* to enable it) */
cogl_push_source (pipeline);
_cogl_framebuffer_draw_attributes (cogl_get_draw_framebuffer (),
pipeline,
COGL_VERTICES_MODE_TRIANGLE_FAN,
0, n_vertices,
attributes,
n_attributes,
0 /* no draw flags */);
cogl_pop_source ();
if (pipeline != validate_state.original_pipeline)
cogl_object_unref (pipeline);
cogl_object_unref (attribute_buffer);
for (i = 0; i < n_attributes; i++)
cogl_object_unref (attributes[i]);
}

View File

@@ -1,197 +0,0 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2007,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_PRIMITIVES_H
#define __COGL_PRIMITIVES_H
#include <glib.h>
G_BEGIN_DECLS
/**
* SECTION:cogl-primitives
* @short_description: Functions that draw various primitive 3D shapes
*
* The primitives API provides utilities for drawing some
* common 3D shapes in a more convenient way than the CoglVertexBuffer
* API provides.
*/
/**
* cogl_rectangle:
* @x_1: X coordinate of the top-left corner
* @y_1: Y coordinate of the top-left corner
* @x_2: X coordinate of the bottom-right corner
* @y_2: Y coordinate of the bottom-right corner
*
* Fills a rectangle at the given coordinates with the current source material
**/
void
cogl_rectangle (float x_1,
float y_1,
float x_2,
float y_2);
/**
* cogl_rectangle_with_texture_coords:
* @x1: x coordinate upper left on screen.
* @y1: y coordinate upper left on screen.
* @x2: x coordinate lower right on screen.
* @y2: y coordinate lower right on screen.
* @tx1: x part of texture coordinate to use for upper left pixel
* @ty1: y part of texture coordinate to use for upper left pixel
* @tx2: x part of texture coordinate to use for lower right pixel
* @ty2: y part of texture coordinate to use for left pixel
*
* Draw a rectangle using the current material and supply texture coordinates
* to be used for the first texture layer of the material. To draw the entire
* texture pass in @tx1=0.0 @ty1=0.0 @tx2=1.0 @ty2=1.0.
*
* Since: 1.0
*/
void
cogl_rectangle_with_texture_coords (float x1,
float y1,
float x2,
float y2,
float tx1,
float ty1,
float tx2,
float ty2);
/**
* cogl_rectangle_with_multitexture_coords:
* @x1: x coordinate upper left on screen.
* @y1: y coordinate upper left on screen.
* @x2: x coordinate lower right on screen.
* @y2: y coordinate lower right on screen.
* @tex_coords: (in) (array) (transfer none): An array containing groups of
* 4 float values: [tx1, ty1, tx2, ty2] that are interpreted as two texture
* coordinates; one for the upper left texel, and one for the lower right
* texel. Each value should be between 0.0 and 1.0, where the coordinate
* (0.0, 0.0) represents the top left of the texture, and (1.0, 1.0) the
* bottom right.
* @tex_coords_len: The length of the tex_coords array. (e.g. for one layer
* and one group of texture coordinates, this would be 4)
*
* This function draws a rectangle using the current source material to
* texture or fill with. As a material may contain multiple texture layers
* this interface lets you supply texture coordinates for each layer of the
* material.
*
* The first pair of coordinates are for the first layer (with the smallest
* layer index) and if you supply less texture coordinates than there are
* layers in the current source material then default texture coordinates
* (0.0, 0.0, 1.0, 1.0) are generated.
*
* Since: 1.0
*/
void
cogl_rectangle_with_multitexture_coords (float x1,
float y1,
float x2,
float y2,
const float *tex_coords,
int tex_coords_len);
/**
* cogl_rectangles_with_texture_coords:
* @verts: (in) (array) (transfer none): an array of vertices
* @n_rects: number of rectangles to draw
*
* Draws a series of rectangles in the same way that
* cogl_rectangle_with_texture_coords() does. In some situations it can give a
* significant performance boost to use this function rather than
* calling cogl_rectangle_with_texture_coords() separately for each rectangle.
*
* @verts should point to an array of #float<!-- -->s with
* @n_rects * 8 elements. Each group of 8 values corresponds to the
* parameters x1, y1, x2, y2, tx1, ty1, tx2 and ty2 and have the same
* meaning as in cogl_rectangle_with_texture_coords().
*
* Since: 0.8.6
*/
void
cogl_rectangles_with_texture_coords (const float *verts,
unsigned int n_rects);
/**
* cogl_rectangles:
* @verts: (in) (array) (transfer none): an array of vertices
* @n_rects: number of rectangles to draw
*
* Draws a series of rectangles in the same way that
* cogl_rectangle() does. In some situations it can give a
* significant performance boost to use this function rather than
* calling cogl_rectangle() separately for each rectangle.
*
* @verts should point to an array of #float<!-- -->s with
* @n_rects * 4 elements. Each group of 4 values corresponds to the
* parameters x1, y1, x2, and y2, and have the same
* meaning as in cogl_rectangle().
*
* Since: 1.0
*/
void
cogl_rectangles (const float *verts,
unsigned int n_rects);
/**
* cogl_polygon:
* @vertices: An array of #CoglTextureVertex structs
* @n_vertices: The length of the vertices array
* @use_color: %TRUE if the color member of #CoglTextureVertex should be used
*
* Draws a convex polygon using the current source material to fill / texture
* with according to the texture coordinates passed.
*
* If @use_color is %TRUE then the color will be changed for each vertex using
* the value specified in the color member of #CoglTextureVertex. This can be
* used for example to make the texture fade out by setting the alpha value of
* the color.
*
* All of the texture coordinates must be in the range [0,1] and repeating the
* texture is not supported.
*
* Because of the way this function is implemented it will currently
* only work if either the texture is not sliced or the backend is not
* OpenGL ES and the minifying and magnifying functions are both set
* to COGL_MATERIAL_FILTER_NEAREST.
*
* Since: 1.0
*/
void
cogl_polygon (const CoglTextureVertex *vertices,
unsigned int n_vertices,
gboolean use_color);
G_END_DECLS
#endif /* __COGL_PRIMITIVES_H */

View File

@@ -94,18 +94,9 @@ _cogl_transform_point (const CoglMatrix *matrix_mv,
gboolean
_cogl_check_extension (const char *name, char * const *ext);
void
_cogl_clear (const CoglColor *color, unsigned long buffers);
void
_cogl_init (void);
void
_cogl_push_source (CoglPipeline *pipeline, gboolean enable_legacy);
gboolean
_cogl_get_enable_legacy_state (void);
#define _cogl_has_private_feature(ctx, feature) \
COGL_FLAGS_GET ((ctx)->private_features, (feature))

View File

@@ -52,7 +52,6 @@
#include "cogl-context-private.h"
#include "cogl-object-private.h"
#include "cogl-object-private.h"
#include "cogl-primitives.h"
#include "cogl-framebuffer-private.h"
#include "cogl1-context.h"
#include "cogl-sub-texture.h"

View File

@@ -53,8 +53,6 @@
#include "cogl-offscreen.h"
#include "winsys/cogl-winsys-private.h"
#include "deprecated/cogl-framebuffer-deprecated.h"
GCallback
cogl_get_proc_address (const char* name)
{
@@ -75,14 +73,6 @@ _cogl_check_extension (const char *name, char * const *ext)
return FALSE;
}
/* XXX: it's expected that we'll deprecated this with
* cogl_framebuffer_clear at some point. */
void
cogl_clear (const CoglColor *color, unsigned long buffers)
{
cogl_framebuffer_clear (cogl_get_draw_framebuffer (), buffers, color);
}
/* XXX: This API has been deprecated */
void
cogl_set_depth_test_enabled (gboolean setting)
@@ -93,10 +83,6 @@ cogl_set_depth_test_enabled (gboolean setting)
return;
ctx->legacy_depth_test_enabled = setting;
if (ctx->legacy_depth_test_enabled)
ctx->legacy_state_set++;
else
ctx->legacy_state_set--;
}
/* XXX: This API has been deprecated */
@@ -116,11 +102,6 @@ cogl_set_backface_culling_enabled (gboolean setting)
return;
ctx->legacy_backface_culling_enabled = setting;
if (ctx->legacy_backface_culling_enabled)
ctx->legacy_state_set++;
else
ctx->legacy_state_set--;
}
gboolean
@@ -131,57 +112,6 @@ cogl_get_backface_culling_enabled (void)
return ctx->legacy_backface_culling_enabled;
}
void
cogl_set_source_color (const CoglColor *color)
{
CoglPipeline *pipeline;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
if (cogl_color_get_alpha_byte (color) == 0xff)
{
cogl_pipeline_set_color (ctx->opaque_color_pipeline, color);
pipeline = ctx->opaque_color_pipeline;
}
else
{
CoglColor premultiplied = *color;
cogl_color_premultiply (&premultiplied);
cogl_pipeline_set_color (ctx->blended_color_pipeline, &premultiplied);
pipeline = ctx->blended_color_pipeline;
}
cogl_set_source (pipeline);
}
void
cogl_set_viewport (int x,
int y,
int width,
int height)
{
CoglFramebuffer *framebuffer;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
framebuffer = cogl_get_draw_framebuffer ();
cogl_framebuffer_set_viewport (framebuffer,
x,
y,
width,
height);
}
/* XXX: This should be deprecated, and we should expose a way to also
* specify an x and y viewport offset */
void
cogl_viewport (unsigned int width,
unsigned int height)
{
cogl_set_viewport (0, 0, width, height);
}
gboolean
cogl_has_feature (CoglContext *ctx, CoglFeatureID feature)
{
@@ -214,44 +144,6 @@ cogl_foreach_feature (CoglContext *ctx,
callback (i, user_data);
}
/* XXX: This function should either be replaced with one returning
* integers, or removed/deprecated and make the
* _cogl_framebuffer_get_viewport* functions public.
*/
void
cogl_get_viewport (float viewport[4])
{
CoglFramebuffer *framebuffer;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
framebuffer = cogl_get_draw_framebuffer ();
cogl_framebuffer_get_viewport4fv (framebuffer, viewport);
}
void
cogl_get_bitmasks (int *red,
int *green,
int *blue,
int *alpha)
{
CoglFramebuffer *framebuffer;
framebuffer = cogl_get_draw_framebuffer ();
if (red)
*red = cogl_framebuffer_get_red_bits (framebuffer);
if (green)
*green = cogl_framebuffer_get_green_bits (framebuffer);
if (blue)
*blue = cogl_framebuffer_get_blue_bits (framebuffer);
if (alpha)
*alpha = cogl_framebuffer_get_alpha_bits (framebuffer);
}
void
cogl_flush (void)
{
@@ -263,315 +155,12 @@ cogl_flush (void)
_cogl_framebuffer_flush_journal (l->data);
}
void
cogl_read_pixels (int x,
int y,
int width,
int height,
CoglReadPixelsFlags source,
CoglPixelFormat format,
uint8_t *pixels)
{
int bpp;
CoglBitmap *bitmap;
g_return_if_fail (format != COGL_PIXEL_FORMAT_ANY);
g_return_if_fail (cogl_pixel_format_get_n_planes (format) == 1);
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
bpp = cogl_pixel_format_get_bytes_per_pixel (format, 0);
bitmap = cogl_bitmap_new_for_data (ctx,
width, height,
format,
bpp * width, /* rowstride */
pixels);
cogl_framebuffer_read_pixels_into_bitmap (_cogl_get_read_framebuffer (),
x, y,
source,
bitmap);
cogl_object_unref (bitmap);
}
void
cogl_push_matrix (void)
{
cogl_framebuffer_push_matrix (cogl_get_draw_framebuffer ());
}
void
cogl_pop_matrix (void)
{
cogl_framebuffer_pop_matrix (cogl_get_draw_framebuffer ());
}
void
cogl_scale (float x, float y, float z)
{
cogl_framebuffer_scale (cogl_get_draw_framebuffer (), x, y, z);
}
void
cogl_translate (float x, float y, float z)
{
cogl_framebuffer_translate (cogl_get_draw_framebuffer (), x, y, z);
}
void
cogl_rotate (float angle, float x, float y, float z)
{
cogl_framebuffer_rotate (cogl_get_draw_framebuffer (), angle, x, y, z);
}
void
cogl_transform (const CoglMatrix *matrix)
{
cogl_framebuffer_transform (cogl_get_draw_framebuffer (), matrix);
}
void
cogl_perspective (float fov_y,
float aspect,
float z_near,
float z_far)
{
cogl_framebuffer_perspective (cogl_get_draw_framebuffer (),
fov_y, aspect, z_near, z_far);
}
void
cogl_frustum (float left,
float right,
float bottom,
float top,
float z_near,
float z_far)
{
cogl_framebuffer_frustum (cogl_get_draw_framebuffer (),
left, right, bottom, top, z_near, z_far);
}
void
cogl_ortho (float left,
float right,
float bottom,
float top,
float near,
float far)
{
cogl_framebuffer_orthographic (cogl_get_draw_framebuffer (),
left, top, right, bottom, near, far);
}
void
cogl_get_modelview_matrix (CoglMatrix *matrix)
{
cogl_framebuffer_get_modelview_matrix (cogl_get_draw_framebuffer (), matrix);
}
void
cogl_set_modelview_matrix (CoglMatrix *matrix)
{
cogl_framebuffer_set_modelview_matrix (cogl_get_draw_framebuffer (), matrix);
}
void
cogl_get_projection_matrix (CoglMatrix *matrix)
{
cogl_framebuffer_get_projection_matrix (cogl_get_draw_framebuffer (), matrix);
}
void
cogl_set_projection_matrix (CoglMatrix *matrix)
{
cogl_framebuffer_set_projection_matrix (cogl_get_draw_framebuffer (), matrix);
}
uint32_t
_cogl_driver_error_quark (void)
{
return g_quark_from_static_string ("cogl-driver-error-quark");
}
typedef struct _CoglSourceState
{
CoglPipeline *pipeline;
int push_count;
/* If this is TRUE then the pipeline will be copied and the legacy
state will be applied whenever the pipeline is used. This is
necessary because some internal Cogl code expects to be able to
push a temporary pipeline to put GL into a known state. For that
to work it also needs to prevent applying the legacy state */
gboolean enable_legacy;
} CoglSourceState;
static void
_push_source_real (CoglPipeline *pipeline, gboolean enable_legacy)
{
CoglSourceState *top = g_slice_new (CoglSourceState);
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
top->pipeline = cogl_object_ref (pipeline);
top->enable_legacy = enable_legacy;
top->push_count = 1;
ctx->source_stack = g_list_prepend (ctx->source_stack, top);
}
/* FIXME: This should take a context pointer for Cogl 2.0 Technically
* we could make it so we can retrieve a context reference from the
* pipeline, but this would not by symmetric with cogl_pop_source. */
void
cogl_push_source (void *material_or_pipeline)
{
CoglPipeline *pipeline = COGL_PIPELINE (material_or_pipeline);
g_return_if_fail (cogl_is_pipeline (pipeline));
_cogl_push_source (pipeline, TRUE);
}
/* This internal version of cogl_push_source is the same except it
never applies the legacy state. Some parts of Cogl use this
internally to set a temporary pipeline with a known state */
void
_cogl_push_source (CoglPipeline *pipeline, gboolean enable_legacy)
{
CoglSourceState *top;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (cogl_is_pipeline (pipeline));
if (ctx->source_stack)
{
top = ctx->source_stack->data;
if (top->pipeline == pipeline && top->enable_legacy == enable_legacy)
{
top->push_count++;
return;
}
else
_push_source_real (pipeline, enable_legacy);
}
else
_push_source_real (pipeline, enable_legacy);
}
/* FIXME: This needs to take a context pointer for Cogl 2.0 */
void
cogl_pop_source (void)
{
CoglSourceState *top;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (ctx->source_stack);
top = ctx->source_stack->data;
top->push_count--;
if (top->push_count == 0)
{
cogl_object_unref (top->pipeline);
g_slice_free (CoglSourceState, top);
ctx->source_stack = g_list_delete_link (ctx->source_stack,
ctx->source_stack);
}
}
/* FIXME: This needs to take a context pointer for Cogl 2.0 */
void *
cogl_get_source (void)
{
CoglSourceState *top;
_COGL_GET_CONTEXT (ctx, NULL);
g_return_val_if_fail (ctx->source_stack, NULL);
top = ctx->source_stack->data;
return top->pipeline;
}
gboolean
_cogl_get_enable_legacy_state (void)
{
CoglSourceState *top;
_COGL_GET_CONTEXT (ctx, FALSE);
g_return_val_if_fail (ctx->source_stack, FALSE);
top = ctx->source_stack->data;
return top->enable_legacy;
}
void
cogl_set_source (void *material_or_pipeline)
{
CoglSourceState *top;
CoglPipeline *pipeline = COGL_PIPELINE (material_or_pipeline);
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (cogl_is_pipeline (pipeline));
g_return_if_fail (ctx->source_stack);
top = ctx->source_stack->data;
if (top->pipeline == pipeline && top->enable_legacy)
return;
if (top->push_count == 1)
{
/* NB: top->pipeline may be only thing keeping pipeline
* alive currently so ref pipeline first... */
cogl_object_ref (pipeline);
cogl_object_unref (top->pipeline);
top->pipeline = pipeline;
top->enable_legacy = TRUE;
}
else
{
top->push_count--;
cogl_push_source (pipeline);
}
}
void
cogl_set_source_texture (CoglTexture *texture)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (texture != NULL);
cogl_pipeline_set_layer_texture (ctx->texture_pipeline, 0, texture);
cogl_set_source (ctx->texture_pipeline);
}
void
cogl_set_source_color4ub (uint8_t red,
uint8_t green,
uint8_t blue,
uint8_t alpha)
{
CoglColor c = { 0, };
cogl_color_init_from_4ub (&c, red, green, blue, alpha);
cogl_set_source_color (&c);
}
void
cogl_set_source_color4f (float red,
float green,
float blue,
float alpha)
{
CoglColor c = { 0, };
cogl_color_init_from_4f (&c, red, green, blue, alpha);
cogl_set_source_color (&c);
}
/* Scale from OpenGL normalized device coordinates (ranging from -1 to 1)
* to Cogl window/framebuffer coordinates (ranging from 0 to buffer-size) with
* (0,0) being top left. */

View File

@@ -65,7 +65,6 @@
#include <cogl/cogl-matrix-stack.h>
#include <cogl/cogl-offscreen.h>
#include <cogl/cogl-pixel-format.h>
#include <cogl/cogl-primitives.h>
#include <cogl/cogl-texture.h>
#include <cogl/cogl-types.h>
#include <cogl/cogl-version.h>
@@ -84,11 +83,9 @@
* they enable the experimental api... */
#include <cogl/deprecated/cogl-type-casts.h>
#include <cogl/deprecated/cogl-framebuffer-deprecated.h>
#include <cogl/deprecated/cogl-auto-texture.h>
#include <cogl/deprecated/cogl-shader.h>
#include <cogl/deprecated/cogl-material-compat.h>
#include <cogl/deprecated/cogl-vertex-buffer.h>
#ifdef COGL_ENABLE_MUTTER_API
#include <cogl/cogl-mutter.h>

View File

@@ -79,313 +79,6 @@ cogl_get_option_group (void);
GCallback
cogl_get_proc_address (const char *name);
/**
* cogl_get_bitmasks:
* @red: (out): Return location for the number of red bits or %NULL
* @green: (out): Return location for the number of green bits or %NULL
* @blue: (out): Return location for the number of blue bits or %NULL
* @alpha: (out): Return location for the number of alpha bits or %NULL
*
* Gets the number of bitplanes used for each of the color components
* in the color buffer. Pass %NULL for any of the arguments if the
* value is not required.
*
* Deprecated: 1.8: Use cogl_framebuffer_get_red/green/blue/alpha_bits()
* instead
*/
COGL_DEPRECATED_FOR (cogl_framebuffer_get_red_OR_green_OR_blue_OR_alpha_bits)
void
cogl_get_bitmasks (int *red,
int *green,
int *blue,
int *alpha);
/**
* cogl_perspective:
* @fovy: Vertical field of view angle in degrees.
* @aspect: The (width over height) aspect ratio for display
* @z_near: The distance to the near clipping plane (Must be positive)
* @z_far: The distance to the far clipping plane (Must be positive)
*
* Replaces the current projection matrix with a perspective matrix
* based on the provided values.
*
* <note>You should be careful not to have to great a @z_far / @z_near
* ratio since that will reduce the effectiveness of depth testing
* since there wont be enough precision to identify the depth of
* objects near to each other.</note>
*
* Deprecated: 1.10: Use cogl_framebuffer_perspective() instead
*/
COGL_DEPRECATED_FOR (cogl_framebuffer_perspective)
void
cogl_perspective (float fovy,
float aspect,
float z_near,
float z_far);
/**
* cogl_frustum:
* @left: X position of the left clipping plane where it
* intersects the near clipping plane
* @right: X position of the right clipping plane where it
* intersects the near clipping plane
* @bottom: Y position of the bottom clipping plane where it
* intersects the near clipping plane
* @top: Y position of the top clipping plane where it intersects
* the near clipping plane
* @z_near: The distance to the near clipping plane (Must be positive)
* @z_far: The distance to the far clipping plane (Must be positive)
*
* Replaces the current projection matrix with a perspective matrix
* for a given viewing frustum defined by 4 side clip planes that
* all cross through the origin and 2 near and far clip planes.
*
* Since: 0.8.2
* Deprecated: 1.10: Use cogl_framebuffer_frustum() instead
*/
COGL_DEPRECATED_FOR (cogl_framebuffer_frustum)
void
cogl_frustum (float left,
float right,
float bottom,
float top,
float z_near,
float z_far);
/**
* cogl_ortho:
* @left: The coordinate for the left clipping plane
* @right: The coordinate for the right clipping plane
* @bottom: The coordinate for the bottom clipping plane
* @top: The coordinate for the top clipping plane
* @near: The <emphasis>distance</emphasis> to the near clipping
* plane (negative if the plane is behind the viewer)
* @far: The <emphasis>distance</emphasis> for the far clipping
* plane (negative if the plane is behind the viewer)
*
* Replaces the current projection matrix with an orthographic projection
* matrix. See <xref linkend="cogl-ortho-matrix"/> to see how the matrix is
* calculated.
*
* <figure id="cogl-ortho-matrix">
* <title></title>
* <graphic fileref="cogl_ortho.png" format="PNG"/>
* </figure>
*
* <note>This function copies the arguments from OpenGL's glOrtho() even
* though they are unnecessarily confusing due to the z near and z far
* arguments actually being a "distance" from the origin, where
* negative values are behind the viewer, instead of coordinates for
* the z clipping planes which would have been consistent with the
* left, right bottom and top arguments.</note>
*
* Since: 1.0
* Deprecated: 1.10: Use cogl_framebuffer_orthographic() instead
*/
COGL_DEPRECATED_FOR (cogl_framebuffer_orthographic)
void
cogl_ortho (float left,
float right,
float bottom,
float top,
float near,
float far);
/**
* cogl_viewport:
* @width: Width of the viewport
* @height: Height of the viewport
*
* Replace the current viewport with the given values.
*
* Since: 0.8.2
* Deprecated: 1.8: Use cogl_framebuffer_set_viewport instead
*/
COGL_DEPRECATED_FOR (cogl_framebuffer_set_viewport)
void
cogl_viewport (unsigned int width,
unsigned int height);
/**
* cogl_set_viewport:
* @x: X offset of the viewport
* @y: Y offset of the viewport
* @width: Width of the viewport
* @height: Height of the viewport
*
* Replaces the current viewport with the given values.
*
* Since: 1.2
* Deprecated: 1.8: Use cogl_framebuffer_set_viewport() instead
*/
COGL_DEPRECATED_FOR (cogl_framebuffer_set_viewport)
void
cogl_set_viewport (int x,
int y,
int width,
int height);
/**
* cogl_push_matrix:
*
* Stores the current model-view matrix on the matrix stack. The matrix
* can later be restored with cogl_pop_matrix().
*
* Deprecated: 1.10: Use cogl_framebuffer_push_matrix() instead
*/
COGL_DEPRECATED_FOR (cogl_framebuffer_push_matrix)
void
cogl_push_matrix (void);
/**
* cogl_pop_matrix:
*
* Restores the current model-view matrix from the matrix stack.
*
* Deprecated: 1.10: Use cogl_framebuffer_pop_matrix() instead
*/
COGL_DEPRECATED_FOR (cogl_framebuffer_push_matrix)
void
cogl_pop_matrix (void);
/**
* cogl_scale:
* @x: Amount to scale along the x-axis
* @y: Amount to scale along the y-axis
* @z: Amount to scale along the z-axis
*
* Multiplies the current model-view matrix by one that scales the x,
* y and z axes by the given values.
*
* Deprecated: 1.10: Use cogl_framebuffer_pop_matrix() instead
*/
COGL_DEPRECATED_FOR (cogl_framebuffer_scale)
void
cogl_scale (float x,
float y,
float z);
/**
* cogl_translate:
* @x: Distance to translate along the x-axis
* @y: Distance to translate along the y-axis
* @z: Distance to translate along the z-axis
*
* Multiplies the current model-view matrix by one that translates the
* model along all three axes according to the given values.
*
* Deprecated: 1.10: Use cogl_framebuffer_translate() instead
*/
COGL_DEPRECATED_FOR (cogl_framebuffer_translate)
void
cogl_translate (float x,
float y,
float z);
/**
* cogl_rotate:
* @angle: Angle in degrees to rotate.
* @x: X-component of vertex to rotate around.
* @y: Y-component of vertex to rotate around.
* @z: Z-component of vertex to rotate around.
*
* Multiplies the current model-view matrix by one that rotates the
* model around the vertex specified by @x, @y and @z. The rotation
* follows the right-hand thumb rule so for example rotating by 10
* degrees about the vertex (0, 0, 1) causes a small counter-clockwise
* rotation.
*
* Deprecated: 1.10: Use cogl_framebuffer_rotate() instead
*/
COGL_DEPRECATED_FOR (cogl_framebuffer_rotate)
void
cogl_rotate (float angle,
float x,
float y,
float z);
/**
* cogl_transform:
* @matrix: the matrix to multiply with the current model-view
*
* Multiplies the current model-view matrix by the given matrix.
*
* Since: 1.4
* Deprecated: 1.10: Use cogl_framebuffer_transform() instead
*/
COGL_DEPRECATED_FOR (cogl_framebuffer_transform)
void
cogl_transform (const CoglMatrix *matrix);
/**
* cogl_get_modelview_matrix:
* @matrix: (out): return location for the model-view matrix
*
* Stores the current model-view matrix in @matrix.
*
* Deprecated: 1.10: Use cogl_framebuffer_get_modelview_matrix()
* instead
*/
COGL_DEPRECATED_FOR (cogl_framebuffer_get_modelview_matrix)
void
cogl_get_modelview_matrix (CoglMatrix *matrix);
/**
* cogl_set_modelview_matrix:
* @matrix: the new model-view matrix
*
* Loads @matrix as the new model-view matrix.
*
* Deprecated: 1.10: Use cogl_framebuffer_set_modelview_matrix()
* instead
*/
COGL_DEPRECATED_FOR (cogl_framebuffer_set_modelview_matrix)
void
cogl_set_modelview_matrix (CoglMatrix *matrix);
/**
* cogl_get_projection_matrix:
* @matrix: (out): return location for the projection matrix
*
* Stores the current projection matrix in @matrix.
*
* Deprecated: 1.10: Use cogl_framebuffer_get_projection_matrix()
* instead
*/
COGL_DEPRECATED_FOR (cogl_framebuffer_get_projection_matrix)
void
cogl_get_projection_matrix (CoglMatrix *matrix);
/**
* cogl_set_projection_matrix:
* @matrix: the new projection matrix
*
* Loads matrix as the new projection matrix.
*
* Deprecated: 1.10: Use cogl_framebuffer_set_projection_matrix()
* instead
*/
COGL_DEPRECATED_FOR (cogl_framebuffer_set_projection_matrix)
void
cogl_set_projection_matrix (CoglMatrix *matrix);
/**
* cogl_get_viewport:
* @v: (out) (array fixed-size=4): pointer to a 4 element array
* of #float<!-- -->s to receive the viewport dimensions.
*
* Stores the current viewport in @v. @v[0] and @v[1] get the x and y
* position of the viewport and @v[2] and @v[3] get the width and
* height.
*
* Deprecated: 1.10: Use cogl_framebuffer_get_viewport4fv()
* instead
*/
COGL_DEPRECATED_FOR (cogl_framebuffer_get_viewport4fv)
void
cogl_get_viewport (float v[4]);
/**
* cogl_set_depth_test_enabled:
* @setting: %TRUE to enable depth testing or %FALSE to disable.
@@ -445,200 +138,6 @@ COGL_DEPRECATED_FOR (cogl_pipeline_get_cull_face_mode)
gboolean
cogl_get_backface_culling_enabled (void);
/**
* cogl_clear:
* @color: Background color to clear to
* @buffers: A mask of #CoglBufferBit<!-- -->'s identifying which auxiliary
* buffers to clear
*
* Clears all the auxiliary buffers identified in the @buffers mask, and if
* that includes the color buffer then the specified @color is used.
*
* Deprecated: 1.16: Use cogl_framebuffer_clear() api instead
*/
COGL_DEPRECATED_FOR (cogl_framebuffer_clear)
void
cogl_clear (const CoglColor *color,
unsigned long buffers);
/**
* cogl_set_source:
* @material: A #CoglMaterial
*
* This function changes the material at the top of the source stack.
* The material at the top of this stack defines the GPU state used to
* process subsequent primitives, such as rectangles drawn with
* cogl_rectangle() or vertices drawn using cogl_vertex_buffer_draw().
*
* Since: 1.0
* Deprecated: 1.16: Latest drawing apis all take an explicit
* #CoglPipeline argument so this stack of
* #CoglMaterial<!-- -->s shouldn't be used.
*/
COGL_DEPRECATED
void
cogl_set_source (void *material);
/**
* cogl_get_source:
*
* Returns the current source material as previously set using
* cogl_set_source().
*
* <note>You should typically consider the returned material immutable
* and not try to change any of its properties unless you own a
* reference to that material. At times you may be able to get a
* reference to an internally managed materials and the result of
* modifying such materials is undefined.</note>
*
* Return value: The current source material.
*
* Since: 1.6
* Deprecated: 1.16: Latest drawing apis all take an explicit
* #CoglPipeline argument so this stack of
* #CoglMaterial<!-- -->s shouldn't be used.
*/
COGL_DEPRECATED
void *
cogl_get_source (void);
/**
* cogl_push_source:
* @material: A #CoglMaterial
*
* Pushes the given @material to the top of the source stack. The
* material at the top of this stack defines the GPU state used to
* process later primitives as defined by cogl_set_source().
*
* Since: 1.6
* Deprecated: 1.16: Latest drawing apis all take an explicit
* #CoglPipeline argument so this stack of
* #CoglMaterial<!-- -->s shouldn't be used.
*/
COGL_DEPRECATED
void
cogl_push_source (void *material);
/**
* cogl_pop_source:
*
* Removes the material at the top of the source stack. The material
* at the top of this stack defines the GPU state used to process
* later primitives as defined by cogl_set_source().
*
* Since: 1.6
* Deprecated: 1.16: Latest drawing apis all take an explicit
* #CoglPipeline argument so this stack of
* #CoglMaterial<!-- -->s shouldn't be used.
*/
COGL_DEPRECATED
void
cogl_pop_source (void);
/**
* cogl_set_source_color:
* @color: a #CoglColor
*
* This is a convenience function for creating a solid fill source material
* from the given color. This color will be used for any subsequent drawing
* operation.
*
* The color will be premultiplied by Cogl, so the color should be
* non-premultiplied. For example: use (1.0, 0.0, 0.0, 0.5) for
* semi-transparent red.
*
* See also cogl_set_source_color4ub() and cogl_set_source_color4f()
* if you already have the color components.
*
* Since: 1.0
* Deprecated: 1.16: Latest drawing apis all take an explicit
* #CoglPipeline argument so this stack of
* #CoglMaterial<!-- -->s shouldn't be used.
*/
COGL_DEPRECATED
void
cogl_set_source_color (const CoglColor *color);
/**
* cogl_set_source_color4ub:
* @red: value of the red channel, between 0 and 255
* @green: value of the green channel, between 0 and 255
* @blue: value of the blue channel, between 0 and 255
* @alpha: value of the alpha channel, between 0 and 255
*
* This is a convenience function for creating a solid fill source material
* from the given color using unsigned bytes for each component. This
* color will be used for any subsequent drawing operation.
*
* The value for each component is an unsigned byte in the range
* between 0 and 255.
*
* Since: 1.0
* Deprecated: 1.16: Latest drawing apis all take an explicit
* #CoglPipeline argument so this stack of
* #CoglMaterial<!-- -->s shouldn't be used.
*/
COGL_DEPRECATED
void
cogl_set_source_color4ub (uint8_t red,
uint8_t green,
uint8_t blue,
uint8_t alpha);
/**
* cogl_set_source_color4f:
* @red: value of the red channel, between 0 and %1.0
* @green: value of the green channel, between 0 and %1.0
* @blue: value of the blue channel, between 0 and %1.0
* @alpha: value of the alpha channel, between 0 and %1.0
*
* This is a convenience function for creating a solid fill source material
* from the given color using normalized values for each component. This color
* will be used for any subsequent drawing operation.
*
* The value for each component is a fixed point number in the range
* between 0 and %1.0. If the values passed in are outside that
* range, they will be clamped.
*
* Since: 1.0
* Deprecated: 1.16: Latest drawing apis all take an explicit
* #CoglPipeline argument so this stack of
* #CoglMaterial<!-- -->s shouldn't be used.
*/
COGL_DEPRECATED
void
cogl_set_source_color4f (float red,
float green,
float blue,
float alpha);
/**
* cogl_set_source_texture:
* @texture: The #CoglTexture you want as your source
*
* This is a convenience function for creating a material with the first
* layer set to @texture and setting that material as the source with
* cogl_set_source.
*
* Note: There is no interaction between calls to cogl_set_source_color
* and cogl_set_source_texture. If you need to blend a texture with a color then
* you can create a simple material like this:
* <programlisting>
* material = cogl_material_new ();
* cogl_material_set_color4ub (material, 0xff, 0x00, 0x00, 0x80);
* cogl_material_set_layer (material, 0, tex_handle);
* cogl_set_source (material);
* </programlisting>
*
* Since: 1.0
* Deprecated: 1.16: Latest drawing apis all take an explicit
* #CoglPipeline argument so this stack of
* #CoglMaterial<!-- -->s shouldn't be used.
*/
COGL_DEPRECATED
void
cogl_set_source_texture (CoglTexture *texture);
/**
* cogl_flush:
*

View File

@@ -160,8 +160,7 @@ cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
* data is actually allocated.
*
* Sub textures have undefined behaviour texture coordinates outside
* of the range [0,1] are used. They also do not work with
* CoglVertexBuffers.
* of the range [0,1] are used.
*
* The sub texture will keep a reference to the full texture so you do
* not need to keep one separately if you only want to use the sub

View File

@@ -1,260 +0,0 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2014 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.
*
*
*/
#include "cogl-config.h"
#include "cogl-types.h"
#include "cogl-context-private.h"
#include "cogl-framebuffer-private.h"
#include "cogl-framebuffer-deprecated.h"
typedef struct _CoglFramebufferStackEntry
{
CoglFramebuffer *draw_buffer;
CoglFramebuffer *read_buffer;
} CoglFramebufferStackEntry;
static CoglFramebufferStackEntry *
create_stack_entry (CoglFramebuffer *draw_buffer,
CoglFramebuffer *read_buffer)
{
CoglFramebufferStackEntry *entry = g_slice_new (CoglFramebufferStackEntry);
entry->draw_buffer = draw_buffer;
entry->read_buffer = read_buffer;
return entry;
}
GSList *
_cogl_create_framebuffer_stack (void)
{
CoglFramebufferStackEntry *entry;
GSList *stack = NULL;
entry = create_stack_entry (NULL, NULL);
return g_slist_prepend (stack, entry);
}
void
_cogl_free_framebuffer_stack (GSList *stack)
{
GSList *l;
for (l = stack; l != NULL; l = l->next)
{
CoglFramebufferStackEntry *entry = l->data;
if (entry->draw_buffer)
cogl_object_unref (entry->draw_buffer);
if (entry->read_buffer)
cogl_object_unref (entry->read_buffer);
g_slice_free (CoglFramebufferStackEntry, entry);
}
g_slist_free (stack);
}
static void
notify_buffers_changed (CoglFramebuffer *old_draw_buffer,
CoglFramebuffer *new_draw_buffer,
CoglFramebuffer *old_read_buffer,
CoglFramebuffer *new_read_buffer)
{
/* XXX: To support the deprecated cogl_set_draw_buffer API we keep
* track of the last onscreen framebuffer that was set so that it
* can be restored if the COGL_WINDOW_BUFFER enum is used. A
* reference isn't taken to the framebuffer because otherwise we
* would have a circular reference between the context and the
* framebuffer. Instead the pointer is set to NULL in
* _cogl_onscreen_free as a kind of a cheap weak reference */
if (new_draw_buffer &&
new_draw_buffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN)
new_draw_buffer->context->window_buffer = new_draw_buffer;
}
/* Set the current framebuffer without checking if it's already the
* current framebuffer. This is used by cogl_pop_framebuffer while
* the top of the stack is currently not up to date. */
static void
_cogl_set_framebuffers_real (CoglFramebuffer *draw_buffer,
CoglFramebuffer *read_buffer)
{
CoglFramebufferStackEntry *entry;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (ctx != NULL);
g_return_if_fail (draw_buffer && read_buffer ?
draw_buffer->context == read_buffer->context : TRUE);
entry = ctx->framebuffer_stack->data;
notify_buffers_changed (entry->draw_buffer,
draw_buffer,
entry->read_buffer,
read_buffer);
if (draw_buffer)
cogl_object_ref (draw_buffer);
if (entry->draw_buffer)
cogl_object_unref (entry->draw_buffer);
if (read_buffer)
cogl_object_ref (read_buffer);
if (entry->read_buffer)
cogl_object_unref (entry->read_buffer);
entry->draw_buffer = draw_buffer;
entry->read_buffer = read_buffer;
}
static void
_cogl_set_framebuffers (CoglFramebuffer *draw_buffer,
CoglFramebuffer *read_buffer)
{
CoglFramebuffer *current_draw_buffer;
CoglFramebuffer *current_read_buffer;
g_return_if_fail (cogl_is_framebuffer (draw_buffer));
g_return_if_fail (cogl_is_framebuffer (read_buffer));
current_draw_buffer = cogl_get_draw_framebuffer ();
current_read_buffer = _cogl_get_read_framebuffer ();
if (current_draw_buffer != draw_buffer ||
current_read_buffer != read_buffer)
_cogl_set_framebuffers_real (draw_buffer, read_buffer);
}
void
cogl_set_framebuffer (CoglFramebuffer *framebuffer)
{
_cogl_set_framebuffers (framebuffer, framebuffer);
}
CoglFramebuffer *
cogl_get_draw_framebuffer (void)
{
CoglFramebufferStackEntry *entry;
_COGL_GET_CONTEXT (ctx, NULL);
g_assert (ctx->framebuffer_stack);
entry = ctx->framebuffer_stack->data;
return entry->draw_buffer;
}
CoglFramebuffer *
_cogl_get_read_framebuffer (void)
{
CoglFramebufferStackEntry *entry;
_COGL_GET_CONTEXT (ctx, NULL);
g_assert (ctx->framebuffer_stack);
entry = ctx->framebuffer_stack->data;
return entry->read_buffer;
}
void
_cogl_push_framebuffers (CoglFramebuffer *draw_buffer,
CoglFramebuffer *read_buffer)
{
CoglContext *ctx;
CoglFramebuffer *old_draw_buffer, *old_read_buffer;
g_return_if_fail (cogl_is_framebuffer (draw_buffer));
g_return_if_fail (cogl_is_framebuffer (read_buffer));
ctx = draw_buffer->context;
g_return_if_fail (ctx != NULL);
g_return_if_fail (draw_buffer->context == read_buffer->context);
g_return_if_fail (ctx->framebuffer_stack != NULL);
/* Copy the top of the stack so that when we call cogl_set_framebuffer
it will still know what the old framebuffer was */
old_draw_buffer = cogl_get_draw_framebuffer ();
if (old_draw_buffer)
cogl_object_ref (old_draw_buffer);
old_read_buffer = _cogl_get_read_framebuffer ();
if (old_read_buffer)
cogl_object_ref (old_read_buffer);
ctx->framebuffer_stack =
g_slist_prepend (ctx->framebuffer_stack,
create_stack_entry (old_draw_buffer,
old_read_buffer));
_cogl_set_framebuffers (draw_buffer, read_buffer);
}
void
cogl_push_framebuffer (CoglFramebuffer *buffer)
{
_cogl_push_framebuffers (buffer, buffer);
}
void
cogl_pop_framebuffer (void)
{
CoglFramebufferStackEntry *to_pop;
CoglFramebufferStackEntry *to_restore;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_assert (ctx->framebuffer_stack != NULL);
g_assert (ctx->framebuffer_stack->next != NULL);
to_pop = ctx->framebuffer_stack->data;
to_restore = ctx->framebuffer_stack->next->data;
if (to_pop->draw_buffer != to_restore->draw_buffer ||
to_pop->read_buffer != to_restore->read_buffer)
notify_buffers_changed (to_pop->draw_buffer,
to_restore->draw_buffer,
to_pop->read_buffer,
to_restore->read_buffer);
cogl_object_unref (to_pop->draw_buffer);
cogl_object_unref (to_pop->read_buffer);
g_slice_free (CoglFramebufferStackEntry, to_pop);
ctx->framebuffer_stack =
g_slist_delete_link (ctx->framebuffer_stack,
ctx->framebuffer_stack);
}

View File

@@ -153,40 +153,6 @@ COGL_DEPRECATED
void
cogl_pop_framebuffer (void);
/**
* cogl_read_pixels:
* @x: The window x position to start reading from
* @y: The window y position to start reading from
* @width: The width of the rectangle you want to read
* @height: The height of the rectangle you want to read
* @source: Identifies which auxillary buffer you want to read
* (only COGL_READ_PIXELS_COLOR_BUFFER supported currently)
* @format: The pixel format you want the result in
* (only COGL_PIXEL_FORMAT_RGBA_8888 supported currently)
* @pixels: The location to write the pixel data.
*
* This reads a rectangle of pixels from the current framebuffer where
* position (0, 0) is the top left. The pixel at (x, y) is the first
* read, and the data is returned with a rowstride of (width * 4).
*
* Currently Cogl assumes that the framebuffer is in a premultiplied
* format so if @format is non-premultiplied it will convert it. To
* read the pixel values without any conversion you should either
* specify a format that doesn't use an alpha channel or use one of
* the formats ending in PRE.
*
* Deprecated: 1.16: Use cogl_framebuffer_read_pixels() instead
*/
COGL_DEPRECATED_FOR (cogl_framebuffer_read_pixels)
void
cogl_read_pixels (int x,
int y,
int width,
int height,
CoglReadPixelsFlags source,
CoglPixelFormat format,
uint8_t *pixels);
G_END_DECLS
#endif /* __COGL_FRAMEBUFFER_DEPRECATED_H__ */

View File

@@ -126,11 +126,6 @@ cogl_program_use (CoglHandle handle)
g_return_if_fail (handle == NULL || cogl_is_program (handle));
if (ctx->current_program == 0 && handle != 0)
ctx->legacy_state_set++;
else if (handle == 0 && ctx->current_program != 0)
ctx->legacy_state_set--;
if (handle != NULL)
cogl_object_ref (handle);
if (ctx->current_program != NULL)

View File

@@ -1,165 +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.
*
*
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
*/
#ifndef __COGL_VERTEX_BUFFER_H
#define __COGL_VERTEX_BUFFER_H
#include "cogl-object-private.h"
#include "cogl-primitive.h"
#include <glib.h>
/* Note we put quite a bit into the flags here to help keep
* the down size of the CoglVertexBufferAttrib struct below. */
typedef enum _CoglVertexBufferAttribFlags
{
/* Types */
/* NB: update the _TYPE_MASK below if these are changed */
COGL_VERTEX_BUFFER_ATTRIB_FLAG_COLOR_ARRAY = 1<<0,
COGL_VERTEX_BUFFER_ATTRIB_FLAG_NORMAL_ARRAY = 1<<1,
COGL_VERTEX_BUFFER_ATTRIB_FLAG_TEXTURE_COORD_ARRAY = 1<<2,
COGL_VERTEX_BUFFER_ATTRIB_FLAG_VERTEX_ARRAY = 1<<3,
COGL_VERTEX_BUFFER_ATTRIB_FLAG_CUSTOM_ARRAY = 1<<4,
COGL_VERTEX_BUFFER_ATTRIB_FLAG_INVALID = 1<<5,
COGL_VERTEX_BUFFER_ATTRIB_FLAG_NORMALIZED = 1<<6,
COGL_VERTEX_BUFFER_ATTRIB_FLAG_ENABLED = 1<<7,
/* Usage hints */
/* FIXME - flatten into one flag, since its used as a boolean */
COGL_VERTEX_BUFFER_ATTRIB_FLAG_INFREQUENT_RESUBMIT = 1<<8,
COGL_VERTEX_BUFFER_ATTRIB_FLAG_FREQUENT_RESUBMIT = 1<<9,
/* GL Data types */
/* NB: Update the _GL_TYPE_MASK below if these are changed */
COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_BYTE = 1<<10,
COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_UNSIGNED_BYTE = 1<<11,
COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_SHORT = 1<<12,
COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_UNSIGNED_SHORT = 1<<13,
COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_INT = 1<<14,
COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_UNSIGNED_INT = 1<<15,
COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_FLOAT = 1<<16,
COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_DOUBLE = 1<<17,
COGL_VERTEX_BUFFER_ATTRIB_FLAG_SUBMITTED = 1<<18,
COGL_VERTEX_BUFFER_ATTRIB_FLAG_UNUSED = 1<<19
/* XXX NB: If we need > 24 bits then look at changing the layout
* of struct _CoglVertexBufferAttrib below */
} CoglVertexBufferAttribFlags;
#define COGL_VERTEX_BUFFER_ATTRIB_FLAG_TYPE_MASK \
(COGL_VERTEX_BUFFER_ATTRIB_FLAG_COLOR_ARRAY \
| COGL_VERTEX_BUFFER_ATTRIB_FLAG_NORMAL_ARRAY \
| COGL_VERTEX_BUFFER_ATTRIB_FLAG_TEXTURE_COORD_ARRAY \
| COGL_VERTEX_BUFFER_ATTRIB_FLAG_VERTEX_ARRAY \
| COGL_VERTEX_BUFFER_ATTRIB_FLAG_CUSTOM_ARRAY \
| COGL_VERTEX_BUFFER_ATTRIB_FLAG_INVALID)
typedef struct _CoglVertexBufferAttrib
{
/* TODO: look at breaking up the flags into seperate
* bitfields and seperate enums */
CoglVertexBufferAttribFlags flags:24;
uint8_t id;
GQuark name;
char *name_without_detail;
union _u
{
const void *pointer;
size_t vbo_offset;
} u;
CoglAttributeType type;
size_t span_bytes;
uint16_t stride;
uint8_t n_components;
uint8_t texture_unit;
int attribute_first;
CoglAttribute *attribute;
} CoglVertexBufferAttrib;
typedef enum _CoglVertexBufferVBOFlags
{
COGL_VERTEX_BUFFER_VBO_FLAG_STRIDED = 1<<0,
COGL_VERTEX_BUFFER_VBO_FLAG_MULTIPACK = 1<<1,
/* FIXME - flatten into one flag, since its used as a boolean */
COGL_VERTEX_BUFFER_VBO_FLAG_INFREQUENT_RESUBMIT = 1<<3,
COGL_VERTEX_BUFFER_VBO_FLAG_FREQUENT_RESUBMIT = 1<<4,
COGL_VERTEX_BUFFER_VBO_FLAG_SUBMITTED = 1<<5
} CoglVertexBufferVBOFlags;
/*
* A CoglVertexBufferVBO represents one or more attributes in a single
* buffer object
*/
typedef struct _CoglVertexBufferVBO
{
CoglVertexBufferVBOFlags flags;
CoglAttributeBuffer *attribute_buffer;
size_t buffer_bytes;
GList *attributes;
} CoglVertexBufferVBO;
typedef struct _CoglVertexBufferIndices
{
CoglHandleObject _parent;
CoglIndices *indices;
} CoglVertexBufferIndices;
typedef struct _CoglVertexBuffer
{
CoglHandleObject _parent;
int n_vertices; /*!< The number of vertices in the buffer */
GList *submitted_vbos; /* The VBOs currently submitted to the GPU */
/* Note: new_attributes is normally NULL and only valid while
* modifying a buffer. */
GList *new_attributes; /*!< attributes pending submission */
gboolean dirty_attributes;
CoglPrimitive *primitive;
} CoglVertexBuffer;
#endif /* __COGL_VERTEX_BUFFER_H */

File diff suppressed because it is too large Load Diff

View File

@@ -1,425 +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.
*
*
*
* 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_VERTEX_BUFFER_H__
#define __COGL_VERTEX_BUFFER_H__
#include <glib.h>
#include <cogl/cogl-defines.h>
#include <cogl/cogl-types.h>
#include <cogl/cogl-macros.h>
G_BEGIN_DECLS
/**
* SECTION:cogl-vertex-buffer
* @short_description: An API for submitting extensible arrays of vertex
* attributes to be mapped into the GPU for fast drawing.
*
* For example to describe a textured triangle, you could create a new cogl
* vertex buffer with 3 vertices, and then you might add 2 attributes for each
* vertex:
* <orderedlist>
* <listitem>
* a "gl_Position" describing the (x,y,z) position for each vertex.
* </listitem>
* <listitem>
* a "gl_MultiTexCoord0" describing the (tx,ty) texture coordinates for each
* vertex.
* </listitem>
* </orderedlist>
*
* The Vertex Buffer API is designed to be a fairly raw mechanism for
* developers to be able to submit geometry to Cogl in a format that can be
* directly consumed by an OpenGL driver and mapped into your GPU for fast
* re-use. It is designed to avoid repeated validation of the attributes by the
* driver; to minimize transport costs (e.g. considering indirect GLX
* use-cases) and to potentially avoid repeated format conversions when
* attributes are supplied in a format that is not natively supported by the
* GPU.
*
* Although this API does allow you to modify attributes after they have been
* submitted to the GPU you should be aware that modification is not that
* cheap, since it implies validating the new data and potentially the
* OpenGL driver will need to reformat it for the GPU.
*
* If at all possible think of tricks that let you re-use static attributes,
* and if you do need to repeatedly update attributes (e.g. for some kind of
* morphing geometry) then only update and re-submit the specific attributes
* that have changed.
*/
/**
* cogl_vertex_buffer_new:
* @n_vertices: The number of vertices that your attributes will correspond to.
*
* Creates a new vertex buffer that you can use to add attributes.
*
* Return value: a new #CoglHandle
* Deprecated: 1.16: Use the #CoglPrimitive api instead
*/
COGL_DEPRECATED_FOR (cogl_primitive_API)
CoglHandle
cogl_vertex_buffer_new (unsigned int n_vertices);
/**
* cogl_vertex_buffer_get_n_vertices:
* @handle: A vertex buffer handle
*
* Retrieves the number of vertices that @handle represents
*
* Return value: the number of vertices
* Deprecated: 1.16: Use the #CoglPrimitive api instead
*/
COGL_DEPRECATED_FOR (cogl_primitive_API)
unsigned int
cogl_vertex_buffer_get_n_vertices (CoglHandle handle);
/**
* cogl_vertex_buffer_add:
* @handle: A vertex buffer handle
* @attribute_name: The name of your attribute. It should be a valid GLSL
* variable name and standard attribute types must use one of following
* built-in names: (Note: they correspond to the built-in names of GLSL)
* <itemizedlist>
* <listitem>"gl_Color"</listitem>
* <listitem>"gl_Normal"</listitem>
* <listitem>"gl_MultiTexCoord0, gl_MultiTexCoord1, ..."</listitem>
* <listitem>"gl_Vertex"</listitem>
* </itemizedlist>
* To support adding multiple variations of the same attribute the name
* can have a detail component, E.g. "gl_Color::active" or
* "gl_Color::inactive"
* @n_components: The number of components per attribute and must be 1, 2,
* 3 or 4
* @type: a #CoglAttributeType specifying the data type of each component.
* @normalized: If %TRUE, this specifies that values stored in an integer
* format should be mapped into the range [-1.0, 1.0] or [0.0, 1.0]
* for unsigned values. If %FALSE they are converted to floats
* directly.
* @stride: This specifies the number of bytes from the start of one attribute
* value to the start of the next value (for the same attribute). So, for
* example, with a position interleved with color like this:
* XYRGBAXYRGBAXYRGBA, then if each letter represents a byte, the
* stride for both attributes is 6. The special value 0 means the
* values are stored sequentially in memory.
* @pointer: This addresses the first attribute in the vertex array. This
* must remain valid until you either call cogl_vertex_buffer_submit() or
* issue a draw call.
*
* Adds an attribute to a buffer, or replaces a previously added
* attribute with the same name.
*
* You either can use one of the built-in names such as "gl_Vertex", or
* "gl_MultiTexCoord0" to add standard attributes, like positions, colors
* and normals, or you can add custom attributes for use in shaders.
*
* The number of vertices declared when calling cogl_vertex_buffer_new()
* determines how many attribute values will be read from the supplied
* @pointer.
*
* The data for your attribute isn't copied anywhere until you call
* cogl_vertex_buffer_submit(), or issue a draw call which automatically
* submits pending attribute changes. so the supplied pointer must remain
* valid until then. If you are updating an existing attribute (done by
* re-adding it) then you still need to re-call cogl_vertex_buffer_submit()
* to commit the changes to the GPU. Be carefull to minimize the number
* of calls to cogl_vertex_buffer_submit(), though.
*
* <note>If you are interleving attributes it is assumed that each interleaved
* attribute starts no farther than +- stride bytes from the other attributes
* it is interleved with. I.e. this is ok:
* <programlisting>
* |-0-0-0-0-0-0-0-0-0-0|
* </programlisting>
* This is not ok:
* <programlisting>
* |- - - - -0-0-0-0-0-0 0 0 0 0|
* </programlisting>
* (Though you can have multiple groups of interleved attributes)</note>
*
* Deprecated: 1.16: Use the #CoglPrimitive api instead
*/
COGL_DEPRECATED_FOR (cogl_primitive_API)
void
cogl_vertex_buffer_add (CoglHandle handle,
const char *attribute_name,
uint8_t n_components,
CoglAttributeType type,
gboolean normalized,
uint16_t stride,
const void *pointer);
/**
* cogl_vertex_buffer_delete:
* @handle: A vertex buffer handle
* @attribute_name: The name of a previously added attribute
*
* Deletes an attribute from a buffer. You will need to call
* cogl_vertex_buffer_submit() or issue a draw call to commit this
* change to the GPU.
*
* Deprecated: 1.16: Use the #CoglPrimitive api instead
*/
COGL_DEPRECATED_FOR (cogl_primitive_API)
void
cogl_vertex_buffer_delete (CoglHandle handle,
const char *attribute_name);
/**
* cogl_vertex_buffer_submit:
* @handle: A vertex buffer handle
*
* Submits all the user added attributes to the GPU; once submitted, the
* attributes can be used for drawing.
*
* You should aim to minimize calls to this function since it implies
* validating your data; it potentially incurs a transport cost (especially if
* you are using GLX indirect rendering) and potentially a format conversion
* cost if the GPU doesn't natively support any of the given attribute formats.
*
* Deprecated: 1.16: Use the #CoglPrimitive api instead
*/
COGL_DEPRECATED_FOR (cogl_primitive_API)
void
cogl_vertex_buffer_submit (CoglHandle handle);
/**
* cogl_vertex_buffer_disable:
* @handle: A vertex buffer handle
* @attribute_name: The name of the attribute you want to disable
*
* Disables a previosuly added attribute.
*
* Since it can be costly to add and remove new attributes to buffers; to make
* individual buffers more reuseable it is possible to enable and disable
* attributes before using a buffer for drawing.
*
* You don't need to call cogl_vertex_buffer_submit() after using this
* function.
*
* Deprecated: 1.16: Use the #CoglPrimitive api instead
*/
COGL_DEPRECATED_FOR (cogl_primitive_API)
void
cogl_vertex_buffer_disable (CoglHandle handle,
const char *attribute_name);
/**
* cogl_vertex_buffer_enable:
* @handle: A vertex buffer handle
* @attribute_name: The name of the attribute you want to enable
*
* Enables a previosuly disabled attribute.
*
* Since it can be costly to add and remove new attributes to buffers; to make
* individual buffers more reuseable it is possible to enable and disable
* attributes before using a buffer for drawing.
*
* You don't need to call cogl_vertex_buffer_submit() after using this function
*
* Deprecated: 1.16: Use the #CoglPrimitive api instead
*/
COGL_DEPRECATED_FOR (cogl_primitive_API)
void
cogl_vertex_buffer_enable (CoglHandle handle,
const char *attribute_name);
/**
* cogl_vertex_buffer_draw:
* @handle: A vertex buffer handle
* @mode: A #CoglVerticesMode specifying how the vertices should be
* interpreted.
* @first: Specifies the index of the first vertex you want to draw with
* @count: Specifies the number of vertices you want to draw.
*
* Allows you to draw geometry using all or a subset of the
* vertices in a vertex buffer.
*
* Any un-submitted attribute changes are automatically submitted before
* drawing.
*
* Deprecated: 1.16: Use the #CoglPrimitive api instead
*/
COGL_DEPRECATED_FOR (cogl_primitive_API)
void
cogl_vertex_buffer_draw (CoglHandle handle,
CoglVerticesMode mode,
int first,
int count);
/**
* cogl_vertex_buffer_indices_new: (skip)
* @indices_type: a #CoglIndicesType specifying the data type used for
* the indices.
* @indices_array: (array length=indices_len): Specifies the address of
* your array of indices
* @indices_len: The number of indices in indices_array
*
* Depending on how much geometry you are submitting it can be worthwhile
* optimizing the number of redundant vertices you submit. Using an index
* array allows you to reference vertices multiple times, for example
* during triangle strips.
*
* Return value: A CoglHandle for the indices which you can pass to
* cogl_vertex_buffer_draw_elements().
*
* Deprecated: 1.16: Use the #CoglPrimitive api instead
*/
COGL_DEPRECATED_FOR (cogl_primitive_API)
CoglHandle
cogl_vertex_buffer_indices_new (CoglIndicesType indices_type,
const void *indices_array,
int indices_len);
/**
* cogl_vertex_buffer_indices_get_type:
* @indices: An indices handle
*
* Queries back the data type used for the given indices
*
* Returns: The CoglIndicesType used
*
* Deprecated: 1.16: Use the #CoglPrimitive api instead
*/
COGL_DEPRECATED_FOR (cogl_primitive_API)
CoglIndicesType
cogl_vertex_buffer_indices_get_type (CoglHandle indices);
/**
* cogl_vertex_buffer_draw_elements:
* @handle: A vertex buffer handle
* @mode: A #CoglVerticesMode specifying how the vertices should be
* interpreted.
* @indices: A CoglHandle for a set of indices allocated via
* cogl_vertex_buffer_indices_new ()
* @min_index: Specifies the minimum vertex index contained in indices
* @max_index: Specifies the maximum vertex index contained in indices
* @indices_offset: An offset into named indices. The offset marks the first
* index to use for drawing.
* @count: Specifies the number of vertices you want to draw.
*
* This function lets you use an array of indices to specify the vertices
* within your vertex buffer that you want to draw. The indices themselves
* are created by calling cogl_vertex_buffer_indices_new ()
*
* Any un-submitted attribute changes are automatically submitted before
* drawing.
* Deprecated: 1.16: Use the #CoglPrimitive api instead
*/
COGL_DEPRECATED_FOR (cogl_primitive_API)
void
cogl_vertex_buffer_draw_elements (CoglHandle handle,
CoglVerticesMode mode,
CoglHandle indices,
int min_index,
int max_index,
int indices_offset,
int count);
/**
* cogl_vertex_buffer_indices_get_for_quads:
* @n_indices: the number of indices in the vertex buffer.
*
* Creates a vertex buffer containing the indices needed to draw pairs
* of triangles from a list of vertices grouped as quads. There will
* be at least @n_indices entries in the buffer (but there may be
* more).
*
* The indices will follow this pattern:
*
* 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7 ... etc
*
* For example, if you submit vertices for a quad like like that shown
* in <xref linkend="quad-indices-order"/> then you can request 6
* indices to render two triangles like those shown in <xref
* linkend="quad-indices-triangles"/>.
*
* <figure id="quad-indices-order">
* <title>Example of vertices submitted to form a quad</title>
* <graphic fileref="quad-indices-order.png" format="PNG"/>
* </figure>
*
* <figure id="quad-indices-triangles">
* <title>Illustration of the triangle indices that will be generated</title>
* <graphic fileref="quad-indices-triangles.png" format="PNG"/>
* </figure>
*
* Returns: A %CoglHandle containing the indices. The handled is
* owned by Cogl and should not be modified or unref'd.
*
* Deprecated: 1.16: Use the #CoglPrimitive api instead
*/
COGL_DEPRECATED_FOR (cogl_primitive_API)
CoglHandle
cogl_vertex_buffer_indices_get_for_quads (unsigned int n_indices);
/**
* cogl_is_vertex_buffer:
* @handle: a #CoglHandle for a vertex buffer object
*
* Checks whether @handle is a Vertex Buffer Object
*
* Return value: %TRUE if the handle is a VBO, and %FALSE
* otherwise
*
* Since: 1.0
* Deprecated: 1.16: Use the #CoglPrimitive api instead
*/
COGL_DEPRECATED_FOR (cogl_primitive_API)
gboolean
cogl_is_vertex_buffer (CoglHandle handle);
/**
* cogl_is_vertex_buffer_indices:
* @handle: a #CoglHandle
*
* Checks whether @handle is a handle to the indices for a vertex
* buffer object
*
* Return value: %TRUE if the handle is indices, and %FALSE
* otherwise
*
* Since: 1.4
* Deprecated: 1.16: Use the #CoglPrimitive api instead
*/
COGL_DEPRECATED_FOR (cogl_primitive_API)
gboolean
cogl_is_vertex_buffer_indices (CoglHandle handle);
G_END_DECLS
#endif /* __COGL_VERTEX_BUFFER_H__ */

View File

@@ -322,8 +322,7 @@ paint_primitive_silhouette (CoglFramebuffer *framebuffer,
pipeline,
COGL_DRAW_SKIP_JOURNAL_FLUSH |
COGL_DRAW_SKIP_PIPELINE_VALIDATION |
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH |
COGL_DRAW_SKIP_LEGACY_STATE);
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
}
static void

View File

@@ -985,7 +985,7 @@ fragend_add_layer_cb (CoglPipelineLayer *layer,
*
* Currently for textured rectangles we manually calculate the texture
* coords for each slice based on the users given coords, but this solution
* isn't ideal, and can't be used with CoglVertexBuffers.
* isn't ideal.
*/
void
_cogl_pipeline_flush_gl_state (CoglContext *ctx,

View File

@@ -43,7 +43,6 @@
#include "cogl-pipeline.h"
#include "cogl-context-private.h"
#include "cogl-object-private.h"
#include "cogl-primitives.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
#include "driver/gl/cogl-util-gl-private.h"
#include "driver/gl/cogl-texture-gl-private.h"

View File

@@ -43,7 +43,6 @@
#include "cogl-pipeline.h"
#include "cogl-context-private.h"
#include "cogl-object-private.h"
#include "cogl-primitives.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
#include "driver/gl/cogl-util-gl-private.h"
#include "driver/gl/cogl-texture-gl-private.h"

View File

@@ -65,21 +65,17 @@ built_headers += [cogl_gl_header_h]
cogl_deprecated_headers = [
'deprecated/cogl-material-compat.h',
'deprecated/cogl-vertex-buffer.h',
'deprecated/cogl-shader.h',
'deprecated/cogl-clutter.h',
'deprecated/cogl-type-casts.h',
'deprecated/cogl-auto-texture.h',
]
cogl_deprecated_nonintrospected_headers = [
'deprecated/cogl-framebuffer-deprecated.h',
]
cogl_headers = [
'cogl1-context.h',
'cogl-bitmap.h',
'cogl-color.h',
'cogl-context.h',
'cogl-framebuffer.h',
'cogl-matrix.h',
'cogl-object.h',
@@ -89,7 +85,6 @@ cogl_headers = [
'cogl-pipeline-state.h',
'cogl-pipeline-layer-state.h',
'cogl-pixel-format.h',
'cogl-primitives.h',
'cogl-texture.h',
'cogl-texture-2d.h',
'cogl-texture-2d-sliced.h',
@@ -102,7 +97,6 @@ cogl_nonintrospected_headers = [
'cogl-swap-chain.h',
'cogl-onscreen-template.h',
'cogl-display.h',
'cogl-context.h',
'cogl-snippet.h',
'cogl-index-buffer.h',
'cogl-attribute-buffer.h',
@@ -238,7 +232,6 @@ cogl_sources = [
'cogl-bitmap-conversion.c',
'cogl-bitmap-packing.h',
'cogl-primitives-private.h',
'cogl-primitives.h',
'cogl-primitives.c',
'cogl-bitmap-pixbuf.c',
'cogl-clip-stack.h',
@@ -352,8 +345,6 @@ cogl_sources = [
'cogl-closure-list.c',
'cogl-fence.c',
'cogl-fence-private.h',
'deprecated/cogl-vertex-buffer-private.h',
'deprecated/cogl-vertex-buffer.c',
'deprecated/cogl-material-compat.c',
'deprecated/cogl-program.c',
'deprecated/cogl-program-private.h',
@@ -361,7 +352,6 @@ cogl_sources = [
'deprecated/cogl-shader-private.h',
'deprecated/cogl-shader.c',
'deprecated/cogl-clutter.c',
'deprecated/cogl-framebuffer-deprecated.c',
'cogl-glib-source.c',
'cogl-mutter.h',
]
@@ -432,7 +422,6 @@ cogl_headers_all = [
cogl_introspected_headers,
cogl_nonintrospected_headers,
cogl_deprecated_headers,
cogl_deprecated_nonintrospected_headers,
]
cogl_test_deps = []
@@ -502,7 +491,6 @@ install_headers([
install_headers([
cogl_deprecated_headers,
cogl_deprecated_nonintrospected_headers,
],
subdir: join_paths(cogl_cogl_includesubdir, 'deprecated'))

View File

@@ -45,8 +45,6 @@ cogl_test_conformance_sources = [
]
#unported = [
# "test-fixed.c",
# "test-materials.c",
# "test-viewport.c",
# "test-multitexture.c",
# "test-npot-texture.c",
@@ -54,8 +52,6 @@ cogl_test_conformance_sources = [
# "test-readpixels.c",
# "test-texture-mipmaps.c",
# "test-texture-pixmap-x11.c",",
# "test-vertex-buffer-contiguous.c",
# "test-vertex-buffer-interleved.c",
#]
cogl_test_conformance_includes = [

View File

@@ -38,13 +38,12 @@ validate_part (CoglFramebuffer *framebuffer,
shown ? 0xff0000ff : 0x000000ff);
}
/* We draw everything 16 times. The draw number is used as a bitmask
to test all of the combinations of enabling legacy state, both
winding orders and all four culling modes */
/* We draw everything 8 times. The draw number is used as a bitmask
to test all of the combinations of enabling both winding orders and all four
culling modes */
#define USE_LEGACY_STATE(draw_num) (((draw_num) & 0x01) >> 0)
#define FRONT_WINDING(draw_num) (((draw_num) & 0x02) >> 1)
#define CULL_FACE_MODE(draw_num) (((draw_num) & 0x0c) >> 2)
#define FRONT_WINDING(draw_num) (((draw_num) & 0x01) >> 1)
#define CULL_FACE_MODE(draw_num) (((draw_num) & 0x06) >> 2)
static void
paint_test_backface_culling (TestState *state,
@@ -70,46 +69,47 @@ paint_test_backface_culling (TestState *state,
COGL_PIPELINE_FILTER_NEAREST,
COGL_PIPELINE_FILTER_NEAREST);
cogl_push_framebuffer (framebuffer);
/* Render the scene sixteen times to test all of the combinations of
cull face mode, legacy state and winding orders */
for (draw_num = 0; draw_num < 16; draw_num++)
for (draw_num = 0; draw_num < 8; draw_num++)
{
float x1 = 0, x2, y1 = 0, y2 = (float)(TEXTURE_RENDER_SIZE);
CoglTextureVertex verts[4];
CoglVertexP3T2 verts[4];
CoglPrimitive *primitive;
CoglPipeline *pipeline;
cogl_push_matrix ();
cogl_translate (0, TEXTURE_RENDER_SIZE * draw_num, 0);
cogl_framebuffer_push_matrix (framebuffer);
cogl_framebuffer_translate (framebuffer,
0,
TEXTURE_RENDER_SIZE * draw_num,
0);
pipeline = cogl_pipeline_copy (base_pipeline);
cogl_set_backface_culling_enabled (USE_LEGACY_STATE (draw_num));
cogl_pipeline_set_front_face_winding (pipeline, FRONT_WINDING (draw_num));
cogl_pipeline_set_cull_face_mode (pipeline, CULL_FACE_MODE (draw_num));
cogl_push_source (pipeline);
memset (verts, 0, sizeof (verts));
x2 = x1 + (float)(TEXTURE_RENDER_SIZE);
/* Draw a front-facing texture */
cogl_rectangle (x1, y1, x2, y2);
cogl_framebuffer_draw_rectangle (framebuffer, pipeline, x1, y1, x2, y2);
x1 = x2;
x2 = x1 + (float)(TEXTURE_RENDER_SIZE);
/* Draw a front-facing texture with flipped texcoords */
cogl_rectangle_with_texture_coords (x1, y1, x2, y2,
1.0, 0.0, 0.0, 1.0);
cogl_framebuffer_draw_textured_rectangle (framebuffer, pipeline,
x1, y1, x2, y2,
1.0, 0.0, 0.0, 1.0);
x1 = x2;
x2 = x1 + (float)(TEXTURE_RENDER_SIZE);
/* Draw a back-facing texture */
cogl_rectangle (x2, y1, x1, y2);
cogl_framebuffer_draw_rectangle (framebuffer, pipeline,
x2, y1, x1, y2);
x1 = x2;
x2 = x1 + (float)(TEXTURE_RENDER_SIZE);
@@ -117,18 +117,24 @@ paint_test_backface_culling (TestState *state,
/* If the texture is sliced then cogl_polygon doesn't work so
we'll just use a solid color instead */
if (cogl_texture_is_sliced (state->texture))
cogl_set_source_color4ub (255, 0, 0, 255);
cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255);
/* Draw a front-facing polygon */
verts[0].x = x1; verts[0].y = y2;
verts[1].x = x2; verts[1].y = y2;
verts[2].x = x2; verts[2].y = y1;
verts[3].x = x1; verts[3].y = y1;
verts[0].tx = 0; verts[0].ty = 0;
verts[1].tx = 1.0; verts[1].ty = 0;
verts[2].tx = 1.0; verts[2].ty = 1.0;
verts[3].tx = 0; verts[3].ty = 1.0;
cogl_polygon (verts, 4, FALSE);
verts[0].s = 0; verts[0].t = 0;
verts[1].s = 1.0; verts[1].t = 0;
verts[2].s = 1.0; verts[2].t = 1.0;
verts[3].s = 0; verts[3].t = 1.0;
primitive = cogl_primitive_new_p3t2 (test_ctx,
COGL_VERTICES_MODE_TRIANGLE_FAN,
4,
verts);
cogl_primitive_draw (primitive, framebuffer, pipeline);
cogl_object_unref (primitive);
x1 = x2;
x2 = x1 + (float)(TEXTURE_RENDER_SIZE);
@@ -138,23 +144,26 @@ paint_test_backface_culling (TestState *state,
verts[1].x = x2; verts[1].y = y1;
verts[2].x = x2; verts[2].y = y2;
verts[3].x = x1; verts[3].y = y2;
verts[0].tx = 0; verts[0].ty = 0;
verts[1].tx = 1.0; verts[1].ty = 0;
verts[2].tx = 1.0; verts[2].ty = 1.0;
verts[3].tx = 0; verts[3].ty = 1.0;
cogl_polygon (verts, 4, FALSE);
verts[0].s = 0; verts[0].t = 0;
verts[1].s = 1.0; verts[1].t = 0;
verts[2].s = 1.0; verts[2].t = 1.0;
verts[3].s = 0; verts[3].t = 1.0;
primitive = cogl_primitive_new_p3t2 (test_ctx,
COGL_VERTICES_MODE_TRIANGLE_FAN,
4,
verts);
cogl_primitive_draw (primitive, framebuffer, pipeline);
cogl_object_unref (primitive);
x1 = x2;
x2 = x1 + (float)(TEXTURE_RENDER_SIZE);
cogl_pop_matrix ();
cogl_framebuffer_pop_matrix (framebuffer);
cogl_pop_source ();
cogl_object_unref (pipeline);
}
cogl_pop_framebuffer ();
cogl_object_unref (base_pipeline);
}
@@ -163,15 +172,12 @@ validate_result (CoglFramebuffer *framebuffer, int y_offset)
{
int draw_num;
for (draw_num = 0; draw_num < 16; draw_num++)
for (draw_num = 0; draw_num < 8; draw_num++)
{
gboolean cull_front, cull_back;
CoglPipelineCullFaceMode cull_mode;
if (USE_LEGACY_STATE (draw_num))
cull_mode = COGL_PIPELINE_CULL_FACE_MODE_BACK;
else
cull_mode = CULL_FACE_MODE (draw_num);
cull_mode = CULL_FACE_MODE (draw_num);
switch (cull_mode)
{
@@ -242,13 +248,13 @@ paint (TestState *state)
cogl_pipeline_set_layer_texture (pipeline, 0, state->offscreen_tex);
cogl_framebuffer_draw_rectangle (test_fb,
pipeline,
0, TEXTURE_RENDER_SIZE * 16,
0, TEXTURE_RENDER_SIZE * 8,
state->width,
state->height + TEXTURE_RENDER_SIZE * 16);
state->height + TEXTURE_RENDER_SIZE * 8);
cogl_object_unref (pipeline);
validate_result (test_fb, 0);
validate_result (test_fb, 16);
validate_result (test_fb, 8);
}
static CoglTexture *

View File

@@ -53,7 +53,6 @@ test_blend_paint (TestState *state,
uint8_t Ba = MASK_ALPHA (blend_constant);
CoglColor blend_const_color;
CoglHandle material;
CoglPipeline *pipeline;
gboolean status;
GError *error = NULL;
@@ -64,11 +63,12 @@ test_blend_paint (TestState *state,
pipeline = cogl_pipeline_new (test_ctx);
cogl_pipeline_set_color4ub (pipeline, Dr, Dg, Db, Da);
cogl_pipeline_set_blend (pipeline, "RGBA = ADD (SRC_COLOR, 0)", NULL);
cogl_set_source (pipeline);
cogl_rectangle (x * QUAD_WIDTH,
y * QUAD_WIDTH,
x * QUAD_WIDTH + QUAD_WIDTH,
y * QUAD_WIDTH + QUAD_WIDTH);
cogl_framebuffer_draw_rectangle (test_fb,
pipeline,
x * QUAD_WIDTH,
y * QUAD_WIDTH,
x * QUAD_WIDTH + QUAD_WIDTH,
y * QUAD_WIDTH + QUAD_WIDTH);
cogl_object_unref (pipeline);
/*
@@ -95,11 +95,12 @@ test_blend_paint (TestState *state,
cogl_color_init_from_4ub (&blend_const_color, Br, Bg, Bb, Ba);
cogl_pipeline_set_blend_constant (pipeline, &blend_const_color);
cogl_set_source (pipeline);
cogl_rectangle (x * QUAD_WIDTH,
y * QUAD_WIDTH,
x * QUAD_WIDTH + QUAD_WIDTH,
y * QUAD_WIDTH + QUAD_WIDTH);
cogl_framebuffer_draw_rectangle (test_fb,
pipeline,
x * QUAD_WIDTH,
y * QUAD_WIDTH,
x * QUAD_WIDTH + QUAD_WIDTH,
y * QUAD_WIDTH + QUAD_WIDTH);
cogl_object_unref (pipeline);
/* See what we got... */
@@ -120,59 +121,6 @@ test_blend_paint (TestState *state,
}
test_utils_check_pixel (test_fb, x_off, y_off, expected_result);
/*
* Test with legacy API
*/
/* Clear previous work */
cogl_set_source_color4ub (0, 0, 0, 0xff);
cogl_rectangle (x * QUAD_WIDTH,
y * QUAD_WIDTH,
x * QUAD_WIDTH + QUAD_WIDTH,
y * QUAD_WIDTH + QUAD_WIDTH);
/* First write out the destination color without any blending... */
material = cogl_material_new ();
cogl_material_set_color4ub (material, Dr, Dg, Db, Da);
cogl_material_set_blend (material, "RGBA = ADD (SRC_COLOR, 0)", NULL);
cogl_set_source (material);
cogl_rectangle (x * QUAD_WIDTH,
y * QUAD_WIDTH,
x * QUAD_WIDTH + QUAD_WIDTH,
y * QUAD_WIDTH + QUAD_WIDTH);
cogl_object_unref (material);
/*
* Now blend a rectangle over our well defined destination:
*/
material = cogl_material_new ();
cogl_material_set_color4ub (material, Sr, Sg, Sb, Sa);
status = cogl_material_set_blend (material, blend_string, &error);
if (!status)
{
/* This is a failure as it must be equivalent to the new API */
g_warning ("Error setting blend string %s: %s",
blend_string, error->message);
g_assert_not_reached ();
}
cogl_color_init_from_4ub (&blend_const_color, Br, Bg, Bb, Ba);
cogl_material_set_blend_constant (material, &blend_const_color);
cogl_set_source (material);
cogl_rectangle (x * QUAD_WIDTH,
y * QUAD_WIDTH,
x * QUAD_WIDTH + QUAD_WIDTH,
y * QUAD_WIDTH + QUAD_WIDTH);
cogl_object_unref (material);
/* See what we got... */
test_utils_check_pixel (test_fb, x_off, y_off, expected_result);
}
static CoglTexture *
@@ -229,7 +177,7 @@ test_tex_combine (TestState *state,
uint8_t Ca = MASK_ALPHA (combine_constant);
CoglColor combine_const_color;
CoglHandle material;
CoglPipeline *pipeline;
gboolean status;
GError *error = NULL;
int y_off;
@@ -239,17 +187,17 @@ test_tex_combine (TestState *state,
tex0 = make_texture (tex0_color);
tex1 = make_texture (tex1_color);
material = cogl_material_new ();
pipeline = cogl_pipeline_new (test_ctx);
cogl_material_set_color4ub (material, 0x80, 0x80, 0x80, 0x80);
cogl_material_set_blend (material, "RGBA = ADD (SRC_COLOR, 0)", NULL);
cogl_pipeline_set_color4ub (pipeline, 0x80, 0x80, 0x80, 0x80);
cogl_pipeline_set_blend (pipeline, "RGBA = ADD (SRC_COLOR, 0)", NULL);
cogl_material_set_layer (material, 0, tex0);
cogl_material_set_layer_combine (material, 0,
cogl_pipeline_set_layer_texture (pipeline, 0, tex0);
cogl_pipeline_set_layer_combine (pipeline, 0,
"RGBA = REPLACE (TEXTURE)", NULL);
cogl_material_set_layer (material, 1, tex1);
status = cogl_material_set_layer_combine (material, 1,
cogl_pipeline_set_layer_texture (pipeline, 1, tex1);
status = cogl_pipeline_set_layer_combine (pipeline, 1,
combine_string, &error);
if (!status)
{
@@ -260,15 +208,16 @@ test_tex_combine (TestState *state,
}
cogl_color_init_from_4ub (&combine_const_color, Cr, Cg, Cb, Ca);
cogl_material_set_layer_combine_constant (material, 1, &combine_const_color);
cogl_pipeline_set_layer_combine_constant (pipeline, 1, &combine_const_color);
cogl_set_source (material);
cogl_rectangle (x * QUAD_WIDTH,
y * QUAD_WIDTH,
x * QUAD_WIDTH + QUAD_WIDTH,
y * QUAD_WIDTH + QUAD_WIDTH);
cogl_framebuffer_draw_rectangle (test_fb,
pipeline,
x * QUAD_WIDTH,
y * QUAD_WIDTH,
x * QUAD_WIDTH + QUAD_WIDTH,
y * QUAD_WIDTH + QUAD_WIDTH);
cogl_object_unref (material);
cogl_object_unref (pipeline);
cogl_object_unref (tex0);
cogl_object_unref (tex1);
@@ -351,7 +300,7 @@ paint (TestState *state)
"A = MODULATE (PREVIOUS, TEXTURE)", /* tex combine */
0xffffff20); /* expected */
/* XXX: we are assuming test_tex_combine creates a material with
/* XXX: we are assuming test_tex_combine creates a pipeline with
* a color of 0x80808080 (i.e. the "PRIMARY" color) */
test_tex_combine (state, 7, 0, /* position */
0xffffff80, /* texture 0 color (alpha = 0.5) */
@@ -419,11 +368,7 @@ test_blend_strings (void)
-1,
100);
/* XXX: we have to push/pop a framebuffer since this test currently
* uses the legacy cogl_rectangle() api. */
cogl_push_framebuffer (test_fb);
paint (&state);
cogl_pop_framebuffer ();
if (cogl_test_verbose ())
g_print ("OK\n");

View File

@@ -83,16 +83,22 @@ draw_rectangle (TestState *state,
}
else
{
cogl_push_framebuffer (test_fb);
cogl_push_matrix ();
cogl_set_source_color4ub (Cr, Cg, Cb, Ca);
cogl_translate (0, 0, rect_state->depth);
cogl_rectangle (x * QUAD_WIDTH,
y * QUAD_WIDTH,
x * QUAD_WIDTH + QUAD_WIDTH,
y * QUAD_WIDTH + QUAD_WIDTH);
cogl_pop_matrix ();
cogl_pop_framebuffer ();
CoglPipeline *legacy_pipeline;
legacy_pipeline = cogl_pipeline_new (test_ctx);
cogl_framebuffer_push_matrix (test_fb);
cogl_pipeline_set_color4ub (pipeline, Cr, Cg, Cb, Ca);
cogl_framebuffer_translate (test_fb, 0, 0, rect_state->depth);
cogl_framebuffer_draw_rectangle (test_fb,
pipeline,
x * QUAD_WIDTH,
y * QUAD_WIDTH,
x * QUAD_WIDTH + QUAD_WIDTH,
y * QUAD_WIDTH + QUAD_WIDTH);
cogl_framebuffer_pop_matrix (test_fb);
cogl_object_unref (legacy_pipeline);
}
cogl_object_unref (pipeline);
@@ -244,43 +250,6 @@ paint (TestState *state)
FALSE, /* legacy mode */
0xff0000ff); /* expected */
}
/* Test that the legacy cogl_set_depth_test_enabled() API still
* works... */
{
/* Nearest */
TestDepthState rect0_state = {
0xff0000ff, /* rgba color */
-10, /* depth */
FALSE, /* depth test enable */
COGL_DEPTH_TEST_FUNCTION_LESS,
TRUE, /* depth write enable */
TRUE, /* FB depth write enable */
0, 1 /* depth range */
};
/* Furthest */
TestDepthState rect1_state = {
0x00ff00ff, /* rgba color */
-70, /* depth */
FALSE, /* depth test enable */
COGL_DEPTH_TEST_FUNCTION_LESS,
TRUE, /* depth write enable */
TRUE, /* FB depth write enable */
0, 1 /* depth range */
};
cogl_set_depth_test_enabled (TRUE);
test_depth (state, 0, 2, /* position */
&rect0_state, &rect1_state, NULL,
TRUE, /* legacy mode */
0xff0000ff); /* expected */
cogl_set_depth_test_enabled (FALSE);
test_depth (state, 1, 2, /* position */
&rect0_state, &rect1_state, NULL,
TRUE, /* legacy mode */
0x00ff00ff); /* expected */
}
}
void

View File

@@ -1,18 +0,0 @@
#include <stdio.h>
#include <clutter/clutter.h>
#include "test-conform-common.h"
void
test_fixed (TestUtilsGTestFixture *fixture,
void *data)
{
g_assert_cmpint (COGL_FIXED_1, ==, COGL_FIXED_FROM_FLOAT (1.0));
g_assert_cmpint (COGL_FIXED_1, ==, COGL_FIXED_FROM_INT (1));
g_assert_cmpint (COGL_FIXED_0_5, ==, COGL_FIXED_FROM_FLOAT (0.5));
g_assert_cmpfloat (COGL_FIXED_TO_FLOAT (COGL_FIXED_1), ==, 1.0);
g_assert_cmpfloat (COGL_FIXED_TO_FLOAT (COGL_FIXED_0_5), ==, 0.5);
}

View File

@@ -27,76 +27,6 @@ create_dummy_texture (void)
data);
}
static void
paint_legacy (TestState *state)
{
CoglHandle material = cogl_material_new ();
CoglTexture *tex;
CoglColor color;
GError *error = NULL;
CoglHandle shader, program;
cogl_color_init_from_4ub (&color, 0, 0, 0, 255);
cogl_clear (&color, COGL_BUFFER_BIT_COLOR);
/* Set the primary vertex color as red */
cogl_color_init_from_4ub (&color, 0xff, 0x00, 0x00, 0xff);
cogl_material_set_color (material, &color);
/* Override the vertex color in the texture environment with a
constant green color provided by a texture */
tex = create_dummy_texture ();
cogl_material_set_layer (material, 0, tex);
cogl_object_unref (tex);
if (!cogl_material_set_layer_combine (material, 0,
"RGBA=REPLACE(TEXTURE)",
&error))
{
g_warning ("Error setting layer combine: %s", error->message);
g_assert_not_reached ();
}
/* Set up a dummy vertex shader that does nothing but the usual
fixed function transform */
shader = cogl_create_shader (COGL_SHADER_TYPE_VERTEX);
cogl_shader_source (shader,
"void\n"
"main ()\n"
"{\n"
" cogl_position_out = "
"cogl_modelview_projection_matrix * "
"cogl_position_in;\n"
" cogl_color_out = cogl_color_in;\n"
" cogl_tex_coord_out[0] = cogl_tex_coord_in;\n"
"}\n");
cogl_shader_compile (shader);
if (!cogl_shader_is_compiled (shader))
{
char *log = cogl_shader_get_info_log (shader);
g_warning ("Shader compilation failed:\n%s", log);
g_free (log);
g_assert_not_reached ();
}
program = cogl_create_program ();
cogl_program_attach_shader (program, shader);
cogl_program_link (program);
cogl_object_unref (shader);
/* Draw something using the material */
cogl_set_source (material);
cogl_rectangle (0, 0, 50, 50);
/* Draw it again using the program. It should look exactly the same */
cogl_program_use (program);
cogl_rectangle (50, 0, 100, 50);
cogl_program_use (NULL);
cogl_object_unref (material);
cogl_object_unref (program);
}
static void
paint (TestState *state)
{
@@ -107,7 +37,7 @@ paint (TestState *state)
CoglHandle shader, program;
cogl_color_init_from_4ub (&color, 0, 0, 0, 255);
cogl_clear (&color, COGL_BUFFER_BIT_COLOR);
cogl_framebuffer_clear (test_fb, COGL_BUFFER_BIT_COLOR, &color);
/* Set the primary vertex color as red */
cogl_color_init_from_4ub (&color, 0xff, 0x00, 0x00, 0xff);
@@ -155,14 +85,15 @@ paint (TestState *state)
cogl_object_unref (shader);
/* Draw something without the program */
cogl_set_source (pipeline);
cogl_rectangle (0, 0, 50, 50);
cogl_framebuffer_draw_rectangle (test_fb, pipeline,
0, 0, 50, 50);
/* Draw it again using the program. It should look exactly the same */
cogl_pipeline_set_user_program (pipeline, program);
cogl_object_unref (program);
cogl_rectangle (50, 0, 100, 50);
cogl_framebuffer_draw_rectangle (test_fb, pipeline,
50, 0, 100, 50);
cogl_pipeline_set_user_program (pipeline, NULL);
cogl_object_unref (pipeline);
@@ -189,18 +120,9 @@ test_just_vertex_shader (void)
-1,
100);
/* XXX: we have to push/pop a framebuffer since this test currently
* uses the legacy cogl_rectangle() api. */
cogl_push_framebuffer (test_fb);
paint_legacy (&state);
validate_result (test_fb);
paint (&state);
validate_result (test_fb);
cogl_pop_framebuffer ();
if (cogl_test_verbose ())
g_print ("OK\n");
}

View File

@@ -1,253 +0,0 @@
#include "cogl-config.h"
#include <clutter/clutter.h>
#include <cogl/cogl.h>
#include <string.h>
#include "test-conform-common.h"
static const ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
#define QUAD_WIDTH 20
#define RED 0
#define GREEN 1
#define BLUE 2
#define ALPHA 3
#define MASK_RED(COLOR) ((COLOR & 0xff000000) >> 24)
#define MASK_GREEN(COLOR) ((COLOR & 0xff0000) >> 16)
#define MASK_BLUE(COLOR) ((COLOR & 0xff00) >> 8)
#define MASK_ALPHA(COLOR) (COLOR & 0xff)
typedef struct _TestState
{
ClutterGeometry stage_geom;
} TestState;
static void
check_quad (int quad_x, int quad_y, uint32_t color)
{
test_utils_check_pixel (x * QUAD_WIDTH + (QUAD_WIDTH / 2),
y * QUAD_WIDTH + (QUAD_WIDTH / 2),
color);
}
static void
test_material_with_primitives (TestState *state,
int x, int y,
uint32_t color)
{
CoglTextureVertex verts[4] = {
{ .x = 0, .y = 0, .z = 0 },
{ .x = 0, .y = QUAD_WIDTH, .z = 0 },
{ .x = QUAD_WIDTH, .y = QUAD_WIDTH, .z = 0 },
{ .x = QUAD_WIDTH, .y = 0, .z = 0 },
};
CoglHandle vbo;
cogl_push_matrix ();
cogl_translate (x * QUAD_WIDTH, y * QUAD_WIDTH, 0);
cogl_rectangle (0, 0, QUAD_WIDTH, QUAD_WIDTH);
cogl_translate (0, QUAD_WIDTH, 0);
cogl_polygon (verts, 4, FALSE);
cogl_translate (0, QUAD_WIDTH, 0);
vbo = cogl_vertex_buffer_new (4);
cogl_vertex_buffer_add (vbo,
"gl_Vertex",
2, /* n components */
COGL_ATTRIBUTE_TYPE_FLOAT,
FALSE, /* normalized */
sizeof (CoglTextureVertex), /* stride */
verts);
cogl_vertex_buffer_draw (vbo,
COGL_VERTICES_MODE_TRIANGLE_FAN,
0, /* first */
4); /* count */
cogl_object_unref (vbo);
cogl_pop_matrix ();
check_quad (x, y, color);
check_quad (x, y+1, color);
check_quad (x, y+2, color);
}
static void
test_invalid_texture_layers (TestState *state, int x, int y)
{
CoglHandle material = cogl_material_new ();
/* explicitly create a layer with an invalid handle. This may be desireable
* if the user also sets a texture combine string that e.g. refers to a
* constant color. */
cogl_material_set_layer (material, 0, NULL);
cogl_set_source (material);
cogl_object_unref (material);
/* We expect a white fallback material to be used */
test_material_with_primitives (state, x, y, 0xffffffff);
}
static void
test_using_all_layers (TestState *state, int x, int y)
{
CoglHandle material = cogl_material_new ();
uint8_t white_pixel[] = { 0xff, 0xff, 0xff, 0xff };
uint8_t red_pixel[] = { 0xff, 0x00, 0x00, 0xff };
CoglHandle white_texture;
CoglHandle red_texture;
GLint n_layers;
int i;
/* Create a material that uses the maximum number of layers. All but
the last layer will use a solid white texture. The last layer
will use a red texture. The layers will all be modulated together
so the final fragment should be red. */
white_texture = test_utils_texture_new_from_data (1, 1, TEST_UTILS_TEXTURE_NONE,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
COGL_PIXEL_FORMAT_ANY,
4, white_pixel);
red_texture = test_utils_texture_new_from_data (1, 1, TEST_UTILS_TEXTURE_NONE,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
COGL_PIXEL_FORMAT_ANY,
4, red_pixel);
/* FIXME: Cogl doesn't provide a way to query the maximum number of
texture layers so for now we'll just ask GL directly. */
#ifdef HAVE_COGL_GLES2
{
GLint n_image_units, n_attribs;
/* GLES 2 doesn't have GL_MAX_TEXTURE_UNITS and it uses
GL_MAX_TEXTURE_IMAGE_UNITS instead */
glGetIntegerv (GL_MAX_TEXTURE_IMAGE_UNITS, &n_image_units);
/* Cogl needs a vertex attrib for each layer to upload the texture
coordinates */
glGetIntegerv (GL_MAX_VERTEX_ATTRIBS, &n_attribs);
/* We can't use two of the attribs because they are used by the
position and color */
n_attribs -= 2;
n_layers = MIN (n_attribs, n_image_units);
}
#else
glGetIntegerv (GL_MAX_TEXTURE_UNITS, &n_layers);
#endif
/* FIXME: is this still true? */
/* Cogl currently can't cope with more than 32 layers so we'll also
limit the maximum to that. */
if (n_layers > 32)
n_layers = 32;
for (i = 0; i < n_layers; i++)
{
cogl_material_set_layer_filters (material, i,
COGL_MATERIAL_FILTER_NEAREST,
COGL_MATERIAL_FILTER_NEAREST);
cogl_material_set_layer (material, i,
i == n_layers - 1 ? red_texture : white_texture);
}
cogl_set_source (material);
cogl_object_unref (material);
cogl_object_unref (white_texture);
cogl_object_unref (red_texture);
/* We expect the final fragment to be red */
test_material_with_primitives (state, x, y, 0xff0000ff);
}
static void
test_invalid_texture_layers_with_constant_colors (TestState *state,
int x, int y)
{
CoglHandle material = cogl_material_new ();
CoglColor constant_color;
/* explicitly create a layer with an invalid handle */
cogl_material_set_layer (material, 0, NULL);
/* ignore the fallback texture on the layer and use a constant color
instead */
cogl_color_init_from_4ub (&constant_color, 0, 0, 255, 255);
cogl_material_set_layer_combine (material, 0,
"RGBA=REPLACE(CONSTANT)",
NULL);
cogl_material_set_layer_combine_constant (material, 0, &constant_color);
cogl_set_source (material);
cogl_object_unref (material);
/* We expect the final fragments to be green */
test_material_with_primitives (state, x, y, 0x0000ffff);
}
static void
on_paint (ClutterActor *actor, TestState *state)
{
test_invalid_texture_layers (state,
0, 0 /* position */
);
test_invalid_texture_layers_with_constant_colors (state,
1, 0 /* position */
);
test_using_all_layers (state,
2, 0 /* position */
);
/* Comment this out if you want visual feedback for what this test paints */
#if 1
clutter_main_quit ();
#endif
}
static gboolean
queue_redraw (void *stage)
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
return TRUE;
}
void
test_materials (TestUtilsGTestFixture *fixture,
void *data)
{
TestState state;
ClutterActor *stage;
ClutterActor *group;
unsigned int idle_source;
stage = clutter_stage_get_default ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
clutter_actor_get_geometry (stage, &state.stage_geom);
group = clutter_group_new ();
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
/* We force continuous redrawing of the stage, since we need to skip
* the first few frames, and we wont be doing anything else that
* will trigger redrawing. */
idle_source = g_idle_add (queue_redraw, stage);
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
clutter_actor_show_all (stage);
clutter_main ();
g_clear_handle_id (&idle_source, g_source_remove);
if (cogl_test_verbose ())
g_print ("OK\n");
}

View File

@@ -99,7 +99,9 @@ make_texture (guchar ref)
}
static void
on_paint (ClutterActor *actor, TestState *state)
on_paint (ClutterActor *actor,
ClutterPaintContext *paint_context,
TestState *state)
{
CoglHandle tex0, tex1;
CoglHandle material;

View File

@@ -44,6 +44,8 @@ test_paint (TestState *state)
CoglTexture2D *tex_2d;
CoglTexture *tex;
CoglOffscreen *offscreen;
CoglPipeline *opaque_pipeline;
CoglPipeline *texture_pipeline;
tex_2d = cogl_texture_2d_new_with_size (test_ctx,
state->fb_width,
@@ -62,41 +64,41 @@ test_paint (TestState *state)
* quarter of the window size and slide it to the top right of the
* window.
*/
cogl_push_matrix ();
cogl_translate (0.5, 0.5, 0);
cogl_scale (-0.5, 0.5, 1);
cogl_framebuffer_push_matrix (test_fb);
cogl_framebuffer_translate (test_fb, 0.5, 0.5, 0);
cogl_framebuffer_scale (test_fb, -0.5, 0.5, 1);
cogl_push_framebuffer (offscreen);
/* Setup something other than the identity matrix for the modelview so we can
* verify it gets restored when we call cogl_pop_framebuffer () */
cogl_framebuffer_scale (test_fb, 2, 2, 1);
opaque_pipeline = cogl_pipeline_new (test_ctx);
/* red, top left */
cogl_pipeline_set_color4ub (opaque_pipeline, 0xff, 0x00, 0x00, 0xff);
cogl_framebuffer_draw_rectangle (offscreen, opaque_pipeline, -0.5, 0.5, 0, 0);
/* green, top right */
cogl_pipeline_set_color4ub (opaque_pipeline, 0x00, 0xff, 0x00, 0xff);
cogl_framebuffer_draw_rectangle (offscreen, opaque_pipeline, 0, 0.5, 0.5, 0);
/* blue, bottom left */
cogl_pipeline_set_color4ub (opaque_pipeline, 0x00, 0x00, 0xff, 0xff);
cogl_framebuffer_draw_rectangle (offscreen, opaque_pipeline, -0.5, 0, 0, -0.5);
/* white, bottom right */
cogl_pipeline_set_color4ub (opaque_pipeline, 0xff, 0xff, 0xff, 0xff);
cogl_framebuffer_draw_rectangle (offscreen, opaque_pipeline, 0, 0, 0.5, -0.5);
/* Cogl should release the last reference when we call cogl_pop_framebuffer()
*/
cogl_object_unref (offscreen);
/* Setup something other than the identity matrix for the modelview so we can
* verify it gets restored when we call cogl_pop_framebuffer () */
cogl_scale (2, 2, 1);
/* red, top left */
cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
cogl_rectangle (-0.5, 0.5, 0, 0);
/* green, top right */
cogl_set_source_color4ub (0x00, 0xff, 0x00, 0xff);
cogl_rectangle (0, 0.5, 0.5, 0);
/* blue, bottom left */
cogl_set_source_color4ub (0x00, 0x00, 0xff, 0xff);
cogl_rectangle (-0.5, 0, 0, -0.5);
/* white, bottom right */
cogl_set_source_color4ub (0xff, 0xff, 0xff, 0xff);
cogl_rectangle (0, 0, 0.5, -0.5);
cogl_pop_framebuffer ();
cogl_set_source_texture (tex);
cogl_rectangle (-1, 1, 1, -1);
texture_pipeline = cogl_pipeline_new (test_ctx);
cogl_pipeline_set_layer_texture (texture_pipeline, 0, tex);
cogl_framebuffer_draw_rectangle (test_fb, texture_pipeline, -1, 1, 1, -1);
cogl_object_unref (opaque_pipeline);
cogl_object_unref (texture_pipeline);
cogl_object_unref (tex_2d);
cogl_pop_matrix ();
cogl_framebuffer_pop_matrix (test_fb);
/* NB: The texture is drawn flipped horizontally and scaled to fit in the
* top right corner of the window. */
@@ -114,12 +116,16 @@ test_paint (TestState *state)
static void
test_flush (TestState *state)
{
CoglPipeline *pipeline;
CoglTexture2D *tex_2d;
CoglTexture *tex;
CoglOffscreen *offscreen;
CoglColor clear_color;
int i;
pipeline = cogl_pipeline_new (test_ctx);
cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255);
for (i = 0; i < 3; i++)
{
/* This tests that rendering to a framebuffer and then reading back
@@ -132,13 +138,10 @@ test_flush (TestState *state)
offscreen = cogl_offscreen_new_with_texture (tex);
cogl_push_framebuffer (offscreen);
cogl_color_init_from_4ub (&clear_color, 0, 0, 0, 255);
cogl_clear (&clear_color, COGL_BUFFER_BIT_COLOR);
cogl_framebuffer_clear (offscreen, COGL_BUFFER_BIT_COLOR, &clear_color);
cogl_set_source_color4ub (255, 0, 0, 255);
cogl_rectangle (-1, -1, 1, 1);
cogl_framebuffer_draw_rectangle (offscreen, pipeline, -1, -1, 1, 1);
if (i == 0)
/* First time check using read pixels on the offscreen */
@@ -161,13 +164,11 @@ test_flush (TestState *state)
0xff0000ff);
}
cogl_pop_framebuffer ();
if (i == 2)
{
/* Third time try drawing the texture to the screen */
cogl_set_source_texture (tex);
cogl_rectangle (-1, -1, 1, 1);
cogl_framebuffer_draw_rectangle (test_fb, pipeline,
-1, -1, 1, 1);
test_utils_check_region (test_fb,
2, 2, /* x/y */
state->fb_width - 4,
@@ -178,6 +179,8 @@ test_flush (TestState *state)
cogl_object_unref (tex_2d);
cogl_object_unref (offscreen);
}
cogl_object_unref (pipeline);
}
void
@@ -188,12 +191,8 @@ test_offscreen (void)
state.fb_width = cogl_framebuffer_get_width (test_fb);
state.fb_height = cogl_framebuffer_get_height (test_fb);
/* XXX: we have to push/pop a framebuffer since this test currently
* uses the legacy cogl_rectangle() api. */
cogl_push_framebuffer (test_fb);
test_paint (&state);
test_flush (&state);
cogl_pop_framebuffer ();
if (cogl_test_verbose ())
g_print ("OK\n");

View File

@@ -22,9 +22,7 @@ draw_path_at (CoglPath *path, CoglPipeline *pipeline, int x, int y)
cogl_framebuffer_push_matrix (test_fb);
cogl_framebuffer_translate (test_fb, x * BLOCK_SIZE, y * BLOCK_SIZE, 0.0f);
cogl_set_framebuffer (test_fb);
cogl_set_source (pipeline);
cogl_path_fill (path);
cogl_framebuffer_fill_path (test_fb, pipeline, path);
cogl_framebuffer_pop_matrix (test_fb);
}

View File

@@ -91,23 +91,11 @@ set_region (CoglTexture *tex,
static void
check_texture (CoglPipeline *pipeline,
CoglHandle material,
int x,
int y,
CoglTexture *tex,
uint32_t expected_result)
{
/* Legacy */
cogl_push_framebuffer (test_fb);
cogl_material_set_layer (material, 0, tex);
cogl_set_source (material);
cogl_rectangle (x * QUAD_WIDTH,
y * QUAD_WIDTH,
x * QUAD_WIDTH + QUAD_WIDTH,
y * QUAD_WIDTH + QUAD_WIDTH);
test_utils_check_pixel (test_fb, x * QUAD_WIDTH + QUAD_WIDTH / 2, y * QUAD_WIDTH + QUAD_WIDTH / 2, expected_result);
cogl_pop_framebuffer ();
/* New API */
cogl_pipeline_set_layer_texture (pipeline, 0, tex);
cogl_framebuffer_draw_rectangle (test_fb, pipeline,
@@ -122,7 +110,6 @@ void
test_premult (void)
{
CoglPipeline *pipeline;
CoglHandle material;
CoglTexture *tex;
cogl_framebuffer_orthographic (test_fb, 0, 0,
@@ -135,13 +122,6 @@ test_premult (void)
COGL_BUFFER_BIT_COLOR,
1.0f, 1.0f, 1.0f, 1.0f);
/* Legacy */
material = cogl_material_new ();
cogl_material_set_blend (material,
"RGBA = ADD (SRC_COLOR, 0)", NULL);
cogl_material_set_layer_combine (material, 0,
"RGBA = REPLACE (TEXTURE)", NULL);
/* New API */
pipeline = cogl_pipeline_new (test_ctx);
cogl_pipeline_set_blend (pipeline,
@@ -157,7 +137,7 @@ test_premult (void)
tex = make_texture (0xff00ff80,
COGL_PIXEL_FORMAT_RGBA_8888, /* src format */
TEXTURE_FLAG_SET_UNPREMULTIPLIED);
check_texture (pipeline, material, 0, 0, /* position */
check_texture (pipeline, 0, 0, /* position */
tex,
0xff00ff80); /* expected */
@@ -170,7 +150,7 @@ test_premult (void)
tex = make_texture (0xff00ff80,
COGL_PIXEL_FORMAT_RGBA_8888, /* src format */
TEXTURE_FLAG_SET_PREMULTIPLIED);
check_texture (pipeline, material, 1, 0, /* position */
check_texture (pipeline, 1, 0, /* position */
tex,
0x80008080); /* expected */
@@ -184,7 +164,7 @@ test_premult (void)
tex = make_texture (0xff00ff80,
COGL_PIXEL_FORMAT_RGBA_8888, /* src format */
0); /* default premultiplied status */
check_texture (pipeline, material, 2, 0, /* position */
check_texture (pipeline, 2, 0, /* position */
tex,
0x80008080); /* expected */
@@ -198,7 +178,7 @@ test_premult (void)
tex = make_texture (0x80008080,
COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */
TEXTURE_FLAG_SET_PREMULTIPLIED);
check_texture (pipeline, material, 3, 0, /* position */
check_texture (pipeline, 3, 0, /* position */
tex,
0x80008080); /* expected */
@@ -211,7 +191,7 @@ test_premult (void)
tex = make_texture (0x80008080,
COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */
TEXTURE_FLAG_SET_UNPREMULTIPLIED);
check_texture (pipeline, material, 4, 0, /* position */
check_texture (pipeline, 4, 0, /* position */
tex,
0xff00ff80); /* expected */
@@ -225,7 +205,7 @@ test_premult (void)
tex = make_texture (0x80008080,
COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */
0); /* default premultiplied status */
check_texture (pipeline, material, 5, 0, /* position */
check_texture (pipeline, 5, 0, /* position */
tex,
0x80008080); /* expected */
@@ -242,7 +222,7 @@ test_premult (void)
if (cogl_test_verbose ())
g_print ("set_region (0xff00ff80, RGBA_8888)\n");
set_region (tex, 0xff00ff80, COGL_PIXEL_FORMAT_RGBA_8888);
check_texture (pipeline, material, 6, 0, /* position */
check_texture (pipeline, 6, 0, /* position */
tex,
0xff00ff80); /* expected */
@@ -258,7 +238,7 @@ test_premult (void)
if (cogl_test_verbose ())
g_print ("set_region (0x80008080, RGBA_8888_PRE)\n");
set_region (tex, 0x80008080, COGL_PIXEL_FORMAT_RGBA_8888_PRE);
check_texture (pipeline, material, 7, 0, /* position */
check_texture (pipeline, 7, 0, /* position */
tex,
0xff00ff80); /* expected */
@@ -273,7 +253,7 @@ test_premult (void)
if (cogl_test_verbose ())
g_print ("set_region (0x80008080, RGBA_8888_PRE)\n");
set_region (tex, 0x80008080, COGL_PIXEL_FORMAT_RGBA_8888_PRE);
check_texture (pipeline, material, 8, 0, /* position */
check_texture (pipeline, 8, 0, /* position */
tex,
0x80008080); /* expected */
@@ -291,7 +271,7 @@ test_premult (void)
if (cogl_test_verbose ())
g_print ("set_region (0xff00ff80, RGBA_8888)\n");
set_region (tex, 0xff00ff80, COGL_PIXEL_FORMAT_RGBA_8888);
check_texture (pipeline, material, 9, 0, /* position */
check_texture (pipeline, 9, 0, /* position */
tex,
0x80008080); /* expected */

View File

@@ -15,7 +15,9 @@ static const ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
static void
on_paint (ClutterActor *actor, void *state)
on_paint (ClutterActor *actor,
ClutterPaintContext *paint_context,
void *state)
{
float saved_viewport[4];
CoglMatrix saved_projection;

View File

@@ -45,7 +45,9 @@ make_texture (void)
}
static void
on_paint (ClutterActor *actor, TestState *state)
on_paint (ClutterActor *actor,
ClutterPaintContext *paint_context,
TestState *state)
{
CoglHandle tex;
CoglHandle material;

View File

@@ -140,7 +140,9 @@ check_paint (TestState *state, int x, int y, int scale)
#define FRAME_COUNT_UPDATED 8
static void
on_paint (ClutterActor *actor, TestState *state)
on_paint (ClutterActor *actor,
ClutterPaintContext *paint_context,
TestState *state)
{
CoglHandle material;

View File

@@ -1,257 +0,0 @@
#include <clutter/clutter.h>
#include <cogl/cogl.h>
#include "test-conform-common.h"
/* This test verifies that the simplest usage of the vertex buffer API,
* where we add contiguous (x,y) GLfloat vertices, and RGBA GLubyte color
* attributes to a buffer, submit, and draw.
*
* It also tries to verify that the enable/disable attribute APIs are working
* too.
*
* If you want visual feedback of what this test paints for debugging purposes,
* then remove the call to clutter_main_quit() in validate_result.
*/
typedef struct _TestState
{
CoglHandle buffer;
CoglHandle texture;
CoglHandle material;
ClutterGeometry stage_geom;
} TestState;
static void
validate_result (TestState *state)
{
GLubyte pixel[4];
GLint y_off = 90;
if (cogl_test_verbose ())
g_print ("y_off = %d\n", y_off);
/* NB: We ignore the alpha, since we don't know if our render target is
* RGB or RGBA */
#define RED 0
#define GREEN 1
#define BLUE 2
/* Should see a blue pixel */
cogl_read_pixels (10, y_off, 1, 1,
COGL_READ_PIXELS_COLOR_BUFFER,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
pixel);
if (cogl_test_verbose ())
g_print ("pixel 0 = %x, %x, %x\n", pixel[RED], pixel[GREEN], pixel[BLUE]);
g_assert (pixel[RED] == 0 && pixel[GREEN] == 0 && pixel[BLUE] != 0);
/* Should see a red pixel */
cogl_read_pixels (110, y_off, 1, 1,
COGL_READ_PIXELS_COLOR_BUFFER,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
pixel);
if (cogl_test_verbose ())
g_print ("pixel 1 = %x, %x, %x\n", pixel[RED], pixel[GREEN], pixel[BLUE]);
g_assert (pixel[RED] != 0 && pixel[GREEN] == 0 && pixel[BLUE] == 0);
/* Should see a blue pixel */
cogl_read_pixels (210, y_off, 1, 1,
COGL_READ_PIXELS_COLOR_BUFFER,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
pixel);
if (cogl_test_verbose ())
g_print ("pixel 2 = %x, %x, %x\n", pixel[RED], pixel[GREEN], pixel[BLUE]);
g_assert (pixel[RED] == 0 && pixel[GREEN] == 0 && pixel[BLUE] != 0);
/* Should see a green pixel, at bottom of 4th triangle */
cogl_read_pixels (310, y_off, 1, 1,
COGL_READ_PIXELS_COLOR_BUFFER,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
pixel);
if (cogl_test_verbose ())
g_print ("pixel 3 = %x, %x, %x\n", pixel[RED], pixel[GREEN], pixel[BLUE]);
g_assert (pixel[GREEN] > pixel[RED] && pixel[GREEN] > pixel[BLUE]);
/* Should see a red pixel, at top of 4th triangle */
cogl_read_pixels (310, y_off - 70, 1, 1,
COGL_READ_PIXELS_COLOR_BUFFER,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
pixel);
if (cogl_test_verbose ())
g_print ("pixel 4 = %x, %x, %x\n", pixel[RED], pixel[GREEN], pixel[BLUE]);
g_assert (pixel[RED] > pixel[GREEN] && pixel[RED] > pixel[BLUE]);
#undef RED
#undef GREEN
#undef BLUE
/* Comment this out if you want visual feedback of what this test
* paints.
*/
clutter_main_quit ();
}
static void
on_paint (ClutterActor *actor, TestState *state)
{
/* Draw a faded blue triangle */
cogl_vertex_buffer_enable (state->buffer, "gl_Color::blue");
cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
cogl_vertex_buffer_draw (state->buffer,
GL_TRIANGLE_STRIP, /* mode */
0, /* first */
3); /* count */
/* Draw a red triangle */
/* Here we are testing that the disable attribute works; if it doesn't
* the triangle will remain faded blue */
cogl_translate (100, 0, 0);
cogl_vertex_buffer_disable (state->buffer, "gl_Color::blue");
cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
cogl_vertex_buffer_draw (state->buffer,
GL_TRIANGLE_STRIP, /* mode */
0, /* first */
3); /* count */
/* Draw a faded blue triangle */
/* Here we are testing that the re-enable works; if it doesn't
* the triangle will remain red */
cogl_translate (100, 0, 0);
cogl_vertex_buffer_enable (state->buffer, "gl_Color::blue");
cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
cogl_vertex_buffer_draw (state->buffer,
GL_TRIANGLE_STRIP, /* mode */
0, /* first */
3); /* count */
/* Draw a textured triangle */
cogl_translate (100, 0, 0);
cogl_vertex_buffer_disable (state->buffer, "gl_Color::blue");
cogl_set_source (state->material);
cogl_material_set_color4ub (state->material, 0xff, 0xff, 0xff, 0xff);
cogl_vertex_buffer_draw (state->buffer,
GL_TRIANGLE_STRIP, /* mode */
0, /* first */
3); /* count */
validate_result (state);
}
static gboolean
queue_redraw (gpointer stage)
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
return TRUE;
}
void
test_vertex_buffer_contiguous (TestUtilsGTestFixture *fixture,
void *data)
{
TestState state;
ClutterActor *stage;
ClutterColor stage_clr = {0x0, 0x0, 0x0, 0xff};
ClutterActor *group;
unsigned int idle_source;
guchar tex_data[] = {
0xff, 0x00, 0x00, 0xff,
0xff, 0x00, 0x00, 0xff,
0x00, 0xff, 0x00, 0xff,
0x00, 0xff, 0x00, 0xff
};
stage = clutter_stage_get_default ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
clutter_actor_get_geometry (stage, &state.stage_geom);
group = clutter_group_new ();
clutter_actor_set_size (group,
state.stage_geom.width,
state.stage_geom.height);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
/* We force continuous redrawing incase someone comments out the
* clutter_main_quit and wants visual feedback for the test since we
* wont be doing anything else that will trigger redrawing. */
idle_source = g_idle_add (queue_redraw, stage);
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
state.texture = cogl_texture_new_from_data (2, 2,
COGL_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_RGBA_8888,
COGL_PIXEL_FORMAT_ANY,
0, /* auto calc row stride */
tex_data);
state.material = cogl_material_new ();
cogl_material_set_color4ub (state.material, 0x00, 0xff, 0x00, 0xff);
cogl_material_set_layer (state.material, 0, state.texture);
{
GLfloat triangle_verts[3][2] =
{
{0.0, 0.0},
{100.0, 100.0},
{0.0, 100.0}
};
GLbyte triangle_colors[3][4] =
{
{0x00, 0x00, 0xff, 0xff}, /* blue */
{0x00, 0x00, 0xff, 0x00}, /* transparent blue */
{0x00, 0x00, 0xff, 0x00} /* transparent blue */
};
GLfloat triangle_tex_coords[3][2] =
{
{0.0, 0.0},
{1.0, 1.0},
{0.0, 1.0}
};
state.buffer = cogl_vertex_buffer_new (3 /* n vertices */);
cogl_vertex_buffer_add (state.buffer,
"gl_Vertex",
2, /* n components */
GL_FLOAT,
FALSE, /* normalized */
0, /* stride */
triangle_verts);
cogl_vertex_buffer_add (state.buffer,
"gl_Color::blue",
4, /* n components */
GL_UNSIGNED_BYTE,
FALSE, /* normalized */
0, /* stride */
triangle_colors);
cogl_vertex_buffer_add (state.buffer,
"gl_MultiTexCoord0",
2, /* n components */
GL_FLOAT,
FALSE, /* normalized */
0, /* stride */
triangle_tex_coords);
cogl_vertex_buffer_submit (state.buffer);
}
clutter_actor_show_all (stage);
clutter_main ();
cogl_object_unref (state.buffer);
cogl_object_unref (state.material);
cogl_object_unref (state.texture);
g_clear_handle_id (&idle_source, g_source_remove);
if (cogl_test_verbose ())
g_print ("OK\n");
}

View File

@@ -1,162 +0,0 @@
#include <clutter/clutter.h>
#include <cogl/cogl.h>
#include "test-conform-common.h"
/* This test verifies that interleved attributes work with the vertex buffer
* API. We add (x,y) GLfloat vertices, interleved with RGBA GLubyte color
* attributes to a buffer, submit and draw.
*
* If you want visual feedback of what this test paints for debugging purposes,
* then remove the call to clutter_main_quit() in validate_result.
*/
typedef struct _TestState
{
CoglHandle buffer;
ClutterGeometry stage_geom;
} TestState;
typedef struct _InterlevedVertex
{
GLfloat x;
GLfloat y;
GLubyte r;
GLubyte g;
GLubyte b;
GLubyte a;
} InterlevedVertex;
static void
validate_result (TestState *state)
{
GLubyte pixel[4];
GLint y_off = 90;
/* NB: We ignore the alpha, since we don't know if our render target is
* RGB or RGBA */
#define RED 0
#define GREEN 1
#define BLUE 2
/* Should see a blue pixel */
cogl_read_pixels (10, y_off, 1, 1,
COGL_READ_PIXELS_COLOR_BUFFER,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
pixel);
if (cogl_test_verbose ())
g_print ("pixel 0 = %x, %x, %x\n", pixel[RED], pixel[GREEN], pixel[BLUE]);
g_assert (pixel[RED] == 0 && pixel[GREEN] == 0 && pixel[BLUE] != 0);
#undef RED
#undef GREEN
#undef BLUE
/* Comment this out if you want visual feedback of what this test
* paints.
*/
clutter_main_quit ();
}
static void
on_paint (ClutterActor *actor, TestState *state)
{
/* Draw a faded blue triangle */
cogl_vertex_buffer_draw (state->buffer,
GL_TRIANGLE_STRIP, /* mode */
0, /* first */
3); /* count */
validate_result (state);
}
static gboolean
queue_redraw (gpointer stage)
{
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
return TRUE;
}
void
test_vertex_buffer_interleved (TestUtilsGTestFixture *fixture,
void *data)
{
TestState state;
ClutterActor *stage;
ClutterColor stage_clr = {0x0, 0x0, 0x0, 0xff};
ClutterActor *group;
unsigned int idle_source;
stage = clutter_stage_get_default ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
clutter_actor_get_geometry (stage, &state.stage_geom);
group = clutter_group_new ();
clutter_actor_set_size (group,
state.stage_geom.width,
state.stage_geom.height);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
/* We force continuous redrawing incase someone comments out the
* clutter_main_quit and wants visual feedback for the test since we
* wont be doing anything else that will trigger redrawing. */
idle_source = g_idle_add (queue_redraw, stage);
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
{
InterlevedVertex verts[3] =
{
{ /* .x = */ 0.0, /* .y = */ 0.0,
/* blue */
/* .r = */ 0x00, /* .g = */ 0x00, /* .b = */ 0xff, /* .a = */ 0xff },
{ /* .x = */ 100.0, /* .y = */ 100.0,
/* transparent blue */
/* .r = */ 0x00, /* .g = */ 0x00, /* .b = */ 0xff, /* .a = */ 0x00 },
{ /* .x = */ 0.0, /* .y = */ 100.0,
/* transparent blue */
/* .r = */ 0x00, /* .g = */ 0x00, /* .b = */ 0xff, /* .a = */ 0x00 },
};
/* We assume the compiler is doing no funny struct padding for this test:
*/
g_assert (sizeof (InterlevedVertex) == 12);
state.buffer = cogl_vertex_buffer_new (3 /* n vertices */);
cogl_vertex_buffer_add (state.buffer,
"gl_Vertex",
2, /* n components */
GL_FLOAT,
FALSE, /* normalized */
12, /* stride */
&verts[0].x);
cogl_vertex_buffer_add (state.buffer,
"gl_Color",
4, /* n components */
GL_UNSIGNED_BYTE,
FALSE, /* normalized */
12, /* stride */
&verts[0].r);
cogl_vertex_buffer_submit (state.buffer);
}
clutter_actor_show_all (stage);
clutter_main ();
cogl_object_unref (state.buffer);
g_clear_handle_id (&idle_source, g_source_remove);
if (cogl_test_verbose ())
g_print ("OK\n");
}

View File

@@ -66,7 +66,9 @@ assert_rectangle_color_and_black_border (int x,
static void
on_paint (ClutterActor *actor, void *state)
on_paint (ClutterActor *actor,
ClutterPaintContext *paint_context,
void *state)
{
float saved_viewport[4];
CoglMatrix saved_projection;

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