Compare commits

...

58 Commits

Author SHA1 Message Date
Niels De Graef
63e618479c cogl: Include DRM 4CC conversions into CoglPixelFormat
This is at the moment still part of both MetaRendererNative and
MetaDmaBuf, which means duplicated effort in code sections only barely
related to color formats. By doing this, we can keep more of the pixel
format code together, which is more future-proof as we want to add
support for new pixel formats (like YUV-based ones).

https://gitlab.gnome.org/GNOME/mutter/merge_requests/594
2019-06-24 13:51:27 +02:00
Niels De Graef
151c6fdd84 cogl: Split CoglTextureComponents into its own header
CoglTextureComponents is an enum that mostly makes sense in
`cogl_texture_set_components()`, but it's as prevalent as
`CoglPixelFormat` due to its intimate relation with it. For example: as
of now, there is no way to distinguish between ARGB and XRGB; this needs
an extra using CoglTextureComponents to enforce (not) using the alpha
channel.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/594
2019-06-24 13:51:27 +02:00
Marco Trevisan (Treviño)
e14613e74e window: Warn if try to focus unmanaging windows
https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
Marco Trevisan (Treviño)
f71151a5dd window-x11: Focus the default window with delay while waiting for take-focus
When requesting to a take-focus window to acquire the input, the client may or
may not respond with a SetInputFocus (this doesn't happen for no-input gtk
windows in fact [to be fixed there too]), in such case we were unsetting the
focus while waiting the reply.

In case the client won't respond, we wait for a small delay (set to 250 ms) for
the take-focus window to grab the input focus before setting it to the default
window.

Added a test for this behavior and for the case in which a window takes the
focus meanwhile we're waiting to focus the default window.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
Marco Trevisan (Treviño)
6022b23923 test-runner: Add 'dispatch' command
This will only wait for events to be dispatched and processed by the server
without waiting for client processing.

Reuse the code for the wait command too.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
Marco Trevisan (Treviño)
d08763c18c test-runner: Add 'sleep' command
This allows to sleep for a given timeout in milliseconds.

Rename test_case_before_redraw to test_case_loop_quit since it's a generic
function and use it for the timeout too.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
Marco Trevisan (Treviño)
fcb408ad5d tests: Verify focused window in closed-transient tests
Ensure that we have a focused window when closing transient windows with
no-focus or no-take-focus atoms

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
Marco Trevisan (Treviño)
51f9e04ef1 test-runner: Add 'assert_focused' command
This allows to verify which window should have the focus, which might not
be the same as the top of the stack.

It's possible to assert the case where there's no focused window using
"NONE" as parameter.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
Marco Trevisan (Treviño)
2fc7760cee tests, stacking: Add tests with no-input and no-take-focus windows
When a window with no frame, that doesn't accept focus and that has no
take-focus atom set is destroyed, we ended up in not changing the current_focus
window, causing a crash.

Added test cases that verify this situation.

Related to https://gitlab.gnome.org/GNOME/mutter/issues/308
https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
Marco Trevisan (Treviño)
f2d2d473b7 tests: Add 'can_take_focus' command to runner and client
Allow to set/unset WM_TAKE_FOCUS from client window.
This is added by default by gtk, but this might not happen in other toolkits,
so add an ability to (un)set this.

So fetch the protocols with XGetWMProtocols and unset the atom.

test-client now needs to depend on Xlib directly in meson build.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
Marco Trevisan (Treviño)
e1f839f48f tests: Add 'accept_focus' command to runner and client
Under the hood, calls gtk_window_set_accept_focus in the client

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
Marco Trevisan (Treviño)
eccc791f3b workspace: Focus only ancestors that are focusable
When destroying a window that has a parent, we initially try to focus one of
its ancestors. However if no ancestor can be focused, then we should instead
focus the default focus window instead of trying to request focus for a window
that can't get focus anyways.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/308
2019-06-24 09:42:07 +00:00
Ting-Wei Lan
6055f04814 display: Remove _XOPEN_SOURCE definition
There is no gethostname call in this file.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/638
2019-06-24 09:35:02 +00:00
Ting-Wei Lan
0185909ee3 window-x11: Fix _XOPEN_SOURCE usage for gethostname on FreeBSD
On FreeBSD, gethostname is guarded by '__POSIX_VISIBLE >= 200112', which
requires either '_POSIX_C_SOURCE >= 200112' or '_XOPEN_SOURCE >= 600'.
Defining _XOPEN_SOURCE to 500 does not break the build because of
implicit declaration, but it defeats the purpose of defining the macro.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/638
2019-06-24 09:35:02 +00:00
Ting-Wei Lan
c35e56196a xwayland: Use g_get_host_name instead of gethostname
Since the xauth file is never going to be changed after it is generated,
it is safe to use g_get_host_name here.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/626
https://gitlab.gnome.org/GNOME/mutter/merge_requests/638
2019-06-24 09:35:02 +00:00
Carlos Garnacho
181c7cab32 wayland: Use right sign for workspace ID
We get a signed integer (-1 meaning "no workspace specified"), store it in
an unsigned integer, check for >= 0 (of course it is!) and set as the window
workspace (signed integer, -1 meaning "show on all workspaces"). What could
possibly go wrong?

https://gitlab.gnome.org/GNOME/mutter/merge_requests/639
2019-06-24 09:21:49 +00:00
Ting-Wei Lan
740a62044e wayland/pointer-constraints: Fix build when native backend is disabled
https://gitlab.gnome.org/GNOME/mutter/merge_requests/636
2019-06-22 16:12:42 +00:00
Goran Vidović
0bf0366933 Update Croatian translation 2019-06-22 16:01:11 +00:00
Niels De Graef
70bacb9402 cogl: Remove CoglError wrapper
CoglError was added at a certain point to remove the hard dependency on
GLib, but since this can't be avoided inside mutter, let's remove this
whole abstraction.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/631
2019-06-20 18:25:04 +02:00
Jonas Ådahl
57dfe4696d kms-update: Seal updates when posting them
This makes sure that we won't accidentally change KMS transaction
updates after they have been posted.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
22a91f23ad backends/native: Add some KMS debug logging
Using the g_debug() macro. Set G_DEBUG_MESSAGES to "mutter" to activate
log.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
6aa1026600 kms: Add high level code documentation
Document the high level components of the KMS abstraction.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
75dff3e7c9 backend/native: Add and use transactional KMS API
This commit introduces, and makes use of, a transactional API used for
setting up KMS state, later to be applied, potentially atomically. From
an API point of view, so is always the case, but in the current
implementation, it still uses legacy drmMode* API to apply the state
non-atomically.

The API consists of various buliding blocks:

 * MetaKmsUpdate - a set of configuration changes, the higher level
handle for handing over configuration to the impl backend. It's used to
set mode, assign framebuffers to planes, queue page flips and set
connector properties.
 * MetaKmsPlaneAssignment - the assignment of a framebuffer to a plane.
Currently used to map a framebuffer to the primary plane of a CRTC. In
the legacy KMS implementation, the plane assignment is used to derive
the framebuffer used for mode setting and page flipping.

This also means various high level changes:

State, excluding configuring the cursor plane and creating/destroying
DRM framebuffer handles, are applied in the end of a clutter frame, in
one go. From an API point of view, this is done atomically, but as
mentioned, only the non-atomic implementation exists so far.

From MetaRendererNative's point of view, a page flip now initially
always succeeds; the handling of EBUSY errors are done asynchronously in
the MetaKmsImpl backend (still by retrying at refresh rate, but
postponing flip callbacks instead of manipulating the frame clock).
Handling of falling back to mode setting instead of page flipping is
notified after the fact by a more precise page flip feedback API.

EGLStream based page flipping relies on the impl backend not being
atomic, as the page flipping is done in the EGLStream backend (e.g.
nvidia driver). It uses a 'custom' page flip queueing method, keeping
the EGLStream logic inside meta-renderer-native.c.

Page flip handling is moved to meta-kms-impl-device.c from
meta-gpu-kms.c. It goes via an extra idle callback before reaching
meta-renderer-native.c to make sure callbacks are invoked outside of the
impl context.

While dummy power save page flipping is kept in meta-renderer-native.c, the
EBUSY handling is moved to meta-kms-impl-simple.c. Instead of freezing the
frame clock, actual page flip callbacks are postponed until all EBUSY retries
have either succeeded or failed due to some other error than EBUSY. This
effectively inhibits new frames to be drawn, meaning we won't stall waiting on
the file descriptor for pending page flips.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
bea7600471 logical-monitor: Pass output when iterating over CRTCs
While not currently used by any users, it'll be useful in future
commits.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
8932388dda backend/native: Move some KMS utilities to its own file
They are not strictly related to any of the KMS objects, and should be
reusable without adding a dependency on the non-meta-kms-* files in
meta-kms-*.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
2238c9f180 kms: Add API to register impl file descriptors
To let the MetaKmsImpl implementation register file descriptor GSource
where the invoke function is ensured to be executed in the impl context.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
ca21ca6745 kms: Add API to add a GSource that'll be invoked in the impl context
The MetaKmsImpl implementation may need to add a GSource that should be
invoked in the right context; e.g. a idle callback, timeout etc. It
cannot just add it itself, since it's the responsibility of MetaKms to
determine what is the impl context and what is the main context, so add
API to MetaKms to ensure the callback is invoked correctly.

It's the responsibility of the caller to eventually remove and destroy
the GSource.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
2bbd2e5563 kms: Add API to post callbacks out of the impl context
While the current impl context is in the same thread as the main
context, the separation still exists, and to post callbacks from the
impl context, it must pass MetaKms to make sure the callback is invoked
in the right context.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
691d58e69b gpu/kms: Remove unused typedef
https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
d84c7269b2 crtc/kms: Use MetaKmsPlane to check supported rotations and formats
Instead of manually retrieving supported transforms and formats from the
primary plane of the CRTC, use the MetaKmsPlane abstraction to find the
primary plane of the CRTC and check compatibility using the
MetaKmsPlane API. This removes the last user of direct KMS API usage
except for applying configuration.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
aba689312f gpu/kms: Init global mode list from MetaKmsConnectors
Instead of iterating over the available drmModeConnector objects to
construct a GPU wide mode list, use the state managed by
MetaKmsConnector. This also removes the last user of drmModeRes from
MetaGpuKms.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
f2d9a11013 output/kms: Outsource connector state fetching to MetaKmsConnector
As with CRTC state, variable connector state is now fetched via the
MetaKmsConnector. The existance of a connector state is equivalent of
the connector being connected. MetaOutputKms is changed to fetch
variable connector state via MetaKmsConnector intsead of KMS directly.
The drmModeConnector is still used for constructing the MetaOutputKms to
find properties used for applying configuration.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
Jonas Ådahl
596376c408 crtc/kms: Outsource CRTC state fetching to MetaKmsCrtc
Move reading state into a struct for MetaCrtcKms to use instead of
querying KMS itself. The state is fetched in the impl context, but
consists of only simple data types, so is made accessible publicly. As
of this, MetaCrtcKms construction does not involve any manual KMS
interaction outside of the MetaKms abstraction.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Jonas Ådahl
1f62a8dbd9 crtc/kms: Don't redefine META_MONITOR_N_TRANSFORMS
https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Jonas Ådahl
f59d62bc8f kms: Add connector representation
Represents drmModeConnector; both connected and disconnected. Currently
only provides non-changing meta data. MetaOutputKms is changed to use
MetaKmsConnector to get basic metadata, but variable metadata, those
changing depending on what is connected (e.g. physical dimension, EDID,
etc), are still manually retrieved by MetaOutputKms.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Jonas Ådahl
5d5d296551 gpu/kms: Fix connector id type in helper
It's a uint32_t, not a long.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Jonas Ådahl
065bf752f4 output/kms: Make drmModeEncoderPtr array local
It was only used within one function, where it was always created, but
still was kept around indefinitely for no reason. Lets get rid of it
from the MetaOutputKms struct.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Jonas Ådahl
4d3e804391 kms: Add plane representation
A plane is one of three possible: primary, overlay and cursor. Each
plane can have various properties, such as possible rotations, formats
etc. Each plane can also be used with a set of CRTCs.

A primary plane is the "backdrop" of a CRTC, i.e. the primary output for
the composited frame that covers the whole CRTC. In general, mutter
composites to a stage view frame onto a framebuffer that is then put on
the primary plane.

An overlay plane is a rectangular area that can be displayed on top of
the primary plane. Eventually it will be used to place non-fullscreen
surfaces, potentially avoiding stage redraws.

A cursor plane is a plane placed on top of all the other planes, usually
used to put the mouse cursor sprite.

Initially, we only fetch the rotation properties, and we so far
blacklist all rotations except ones that ends up with the same
dimensions as with no rotations. This is because non-180° rotations
doesn't work yet due to incorrect buffer modifiers. To make it possible
to use non-180° rotations, changes necessary include among other things
finding compatible modifiers using atomic modesetting. Until then,
simply blacklist the ones we know doesn't work.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Jonas Ådahl
15a2ccd21b kms: Add CRTC representation
Add MetaKmsCrtc to represent a CRTC on the associated device. Change
MetaCrtcKms to use the ones discovered by the KMS abstraction. It still
reads the resources handed over by MetaGpuKms, but eventually it will
use only MetaKmsCrtc.

MetaKmsCrtc is a type of object that is usable both from an impl task
and from outside. All the API exposed via the non-private header is
expected to be accessible from outside of the meta-kms namespace.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Jonas Ådahl
fef5753a19 backends/native: Add basic KMS abstraction building blocks
The intention with KMS abstraction is to hide away accessing the drm
functions behind an API that allows us to have different kind of KMS
implementations, including legacy non-atomic and atomic. The intention
is also that the code interacting with the drm device should be able to
be run in a different thread than the main thread. This means that we
need to make sure that all drm*() API usage must only occur from within
tasks that eventually can be run in the dedicated thread.

The idea here is that MetaKms provides a outward facing API other places
of mutter can use (e.g. MetaGpuKms and friends), while MetaKmsImpl is
an internal implementation that only gets interacted with via "tasks"
posted via the MetaKms object. These tasks will in the future
potentially be run on the dedicated KMS thread. Initially, we don't
create any new threads.

Likewise, MetaKmsDevice is a outward facing representation of a KMS
device, while MetaKmsImplDevice is the corresponding implementation,
which only runs from within the MetaKmsImpl tasks.

This commit only moves opening and closing the device to this new API,
while leaking the fd outside of the impl enclosure, effectively making
the isolation for drm*() calls pointless. This, however, is necessary to
allow gradual porting of drm interaction, and eventually the file
descriptor in MetaGpuKms will be removed. For now, it's harmless, since
everything still run in the main thread.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Jonas Ådahl
f3fd7cf92b gpu/kms: Remove max buffer size getter
It was unused.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Jonas Ådahl
5c500ad402 backend: Move GPU ownership from the monitor manager to the backend
Lets work towards making MetaMonitorManager about managing monitors, and
not about managing GPUs. This changes other units to keep a pointer to
the backend instead of a monitor manager, in case their ownership
changed, or their main usage of the monitor manager was to look up GPUs.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Jonas Ådahl
e7fd068a78 monitor-manager/kms: Use 'hotplug' event from MetaUdev
Instead of dealing with udev details here, use the newly added 'hotplug'
event emitted from MetaUdev.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Jonas Ådahl
171e5fc3c2 udev: Add 'hotplug' event
To be used my the monitor manager to handle hotplugs.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Jonas Ådahl
7b7d881386 udev: Add helpers to list DRM devices
Will be used to move out some udev related logic when adding GPUs.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Jonas Ådahl
44905d96da backends/native: Move some initialization from init() to initable_init()
This means we can report the errors properly, instead of logging a
warning and calling exit(1).

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Jonas Ådahl
73e8127d5d backends/native: Add udev abstraction layer
To be used to signal devices added, hotplugs and other udev events.
Currently the only event emitted is when a device is added.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Jonas Ådahl
11e2005563 backends/native: Remove instance private
The object struct definition itself is private, so the object instance
private serves no purpose. Thus, move the fields into the object struct
and remove the instance private struct.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
Olivier Fourdan
02fc0b4533 clutter/evdev: Implement togglekeys notification
Notify with a system sound when the modifiers lock state is changed.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/637
2019-06-20 11:40:13 +00:00
Olivier Fourdan
36155f72d0 clutter/evdev: Do not reset timers on togglekeys
The “togglekeys” setting is to emit a sounds whenever the state of one
of the modifiers keys (CAPS lock, NUM Lock, SCROLL lock) is changed, it
has nothing to do with the rest of the accessibility settings.

Therefore, there is no need to reset the various timers used by
accessibility whenever the “togglekeys” setting is changed.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/614
2019-06-20 11:40:13 +00:00
Olivier Fourdan
c63d0173b5 xwayland: Fix build without <sys/random.h>
The include <sys/random.h> was added to glibc-2.25, previously was
<linux/random.h>.

Adjust meson build and code to accomodate both.

Fixes: a8984a81c "xwayland: Generate a Xauth file and pass this to
                  Xwayland when starting it"

https://gitlab.gnome.org/GNOME/mutter/merge_requests/633
2019-06-20 12:37:18 +02:00
Hans de Goede
7fcdd60ac5 renderer-native: Fix compiler warning
Fix the following compiler warning:
../src/backends/native/meta-renderer-native.c: In function ‘meta_renderer_native_create_view’:
/usr/include/glib-2.0/glib/gmacros.h:523:17: warning: ‘formats’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  523 |     { if (_ptr) (cleanup) ((ParentName *) _ptr); }                                                              \
      |                 ^
../src/backends/native/meta-renderer-native.c:773:22: note: ‘formats’ was declared here
  773 |   g_autoptr (GArray) formats;
      |                      ^~~~~~~

https://gitlab.gnome.org/GNOME/mutter/merge_requests/632
2019-06-20 10:32:52 +02:00
Hans de Goede
a8984a81c2 xwayland: Generate a Xauth file and pass this to Xwayland when starting it
Before this commit, sudo x11-app, e.g. sudo gvim /etc/some-file, fails
when running a Wayland session. Where as doing this under a "GNOME on Xorg"
session works fine. For a user switching from the Xorg session to the
Wayland session, this is regression, which we want to avoid.

This commit fixes this by creating and passing an xauth file to Xwayland when
mutter starts it. Just like gdm or startx pass a xauth file to Xorg when they
start Xorg.

Fixes #643

https://gitlab.gnome.org/GNOME/mutter/issues/643
2019-06-20 10:16:21 +02:00
Niels De Graef
769a02b630 cogl: Drop _COGL_RETURN_VAL_IF_FAIL macro
This was introduced when the Cogl maintainers tried to move away from
GLib. Since we always require it, we can just use
`g_return_val_if_fail()` immediately.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/629
2019-06-19 21:46:22 +02:00
Niels De Graef
576330edce cogl: Drop _COGL_RETURN_IF_FAIL macro
This was introduced when the Cogl maintainers tried to move away from
GLib. Since we always require it, we can just use `g_return_if_fail()`
immediately.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/629
2019-06-19 21:36:19 +02:00
Niels De Graef
a2a114e79c cogl: Remove unused _COGL_TYPEDEF_ASSERT() macro
We can safely remove it since it's used nowhere in the code base. If you
would still like to use someting similar, there's `G_STATIC_ASSERT`.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/629
2019-06-19 21:03:31 +02:00
Niels De Graef
79e22853ea cogl: Remove cogl_util_ffs macro
Since commit 46942c24, we don't need the wrapper macro as we always
require its implementation to be available on the build system.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/629
2019-06-19 21:03:28 +02:00
Niels De Graef
be72b22964 cogl: Remove cogl_util_memmem() macro
`cogl_util_memmem` was used as a wrapper in case `memmem` wasn't
defined, but since commit 46942c24 these are required. In case of
`memmem`, we didn't explicitly require this in the meson build files, so
add that as well.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/629
2019-06-19 21:03:23 +02:00
238 changed files with 8394 additions and 4192 deletions

View File

@@ -1111,7 +1111,7 @@ _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend)
{
if (backend->dummy_onscreen == COGL_INVALID_HANDLE)
{
CoglError *internal_error = NULL;
GError *internal_error = NULL;
backend->dummy_onscreen = cogl_onscreen_new (backend->cogl_context, 1, 1);
@@ -1119,7 +1119,7 @@ _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend)
&internal_error))
{
g_critical ("Unable to create dummy onscreen: %s", internal_error->message);
cogl_error_free (internal_error);
g_error_free (internal_error);
return;
}
}

View File

@@ -1225,7 +1225,7 @@ clutter_input_device_evdev_apply_kbd_a11y_settings (ClutterInputDeviceEvdev *dev
update_internal_xkb_state (device, 0, 0);
}
if (changed_flags & (CLUTTER_A11Y_KEYBOARD_ENABLED | CLUTTER_A11Y_TOGGLE_KEYS_ENABLED))
if (changed_flags & CLUTTER_A11Y_KEYBOARD_ENABLED)
{
device->toggle_slowkeys_timer = 0;
device->shift_count = 0;
@@ -1246,6 +1246,13 @@ clutter_input_device_evdev_apply_kbd_a11y_settings (ClutterInputDeviceEvdev *dev
device->a11y_flags = settings->controls;
}
void
clutter_evdev_a11y_maybe_notify_toggle_keys (ClutterInputDeviceEvdev *device)
{
if (device->a11y_flags & CLUTTER_A11Y_TOGGLE_KEYS_ENABLED)
clutter_input_device_evdev_bell_notify ();
}
static void
release_device_touch_slot (gpointer value)
{

View File

@@ -150,6 +150,7 @@ void clutter_input_device_evdev_release_touch_state (Clutte
void clutter_input_device_evdev_release_touch_slots (ClutterInputDeviceEvdev *device_evdev,
uint64_t time_us);
void clutter_evdev_a11y_maybe_notify_toggle_keys (ClutterInputDeviceEvdev *);
G_END_DECLS

View File

@@ -326,6 +326,7 @@ clutter_seat_evdev_notify_key (ClutterSeatEvdev *seat,
backend = clutter_get_default_backend ();
g_signal_emit_by_name (clutter_backend_get_keymap (backend), "state-changed");
clutter_seat_evdev_sync_leds (seat);
clutter_evdev_a11y_maybe_notify_toggle_keys (CLUTTER_INPUT_DEVICE_EVDEV (seat->core_keyboard));
}
if (state == 0 || /* key release */

View File

@@ -94,7 +94,7 @@ cogl_pango_font_map_new (void)
PangoContext *
cogl_pango_font_map_create_context (CoglPangoFontMap *fm)
{
_COGL_RETURN_VAL_IF_FAIL (COGL_PANGO_IS_FONT_MAP (fm), NULL);
g_return_val_if_fail (COGL_PANGO_IS_FONT_MAP (fm), NULL);
#if PANGO_VERSION_CHECK (1, 22, 0)
/* We can just directly use the pango context from the Cairo font
@@ -138,7 +138,7 @@ void
cogl_pango_font_map_set_resolution (CoglPangoFontMap *font_map,
double dpi)
{
_COGL_RETURN_IF_FAIL (COGL_PANGO_IS_FONT_MAP (font_map));
g_return_if_fail (COGL_PANGO_IS_FONT_MAP (font_map));
pango_cairo_font_map_set_resolution (PANGO_CAIRO_FONT_MAP (font_map), dpi);
}

View File

@@ -217,7 +217,7 @@ cogl_pango_glyph_cache_add_to_global_atlas (CoglPangoGlyphCache *cache,
CoglPangoGlyphCacheValue *value)
{
CoglAtlasTexture *texture;
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
if (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SHARED_ATLAS))
return FALSE;
@@ -232,7 +232,7 @@ cogl_pango_glyph_cache_add_to_global_atlas (CoglPangoGlyphCache *cache,
value->draw_height);
if (!cogl_texture_allocate (COGL_TEXTURE (texture), &ignore_error))
{
cogl_error_free (ignore_error);
g_error_free (ignore_error);
return FALSE;
}

View File

@@ -153,7 +153,7 @@ cogl_pango_renderer_draw_glyph (CoglPangoRenderer *priv,
{
CoglPangoRendererSliceCbData data;
_COGL_RETURN_IF_FAIL (priv->display_list != NULL);
g_return_if_fail (priv->display_list != NULL);
data.display_list = priv->display_list;
data.x1 = x1;
@@ -577,7 +577,7 @@ cogl_pango_renderer_set_dirty_glyph (PangoFont *font,
/* Glyphs that don't take up any space will end up without a
texture. These should never become dirty so they shouldn't end up
here */
_COGL_RETURN_IF_FAIL (value->texture != NULL);
g_return_if_fail (value->texture != NULL);
if (_cogl_texture_get_format (value->texture) == COGL_PIXEL_FORMAT_A_8)
{
@@ -705,7 +705,7 @@ cogl_pango_ensure_glyph_cache_for_layout (PangoLayout *layout)
context = pango_layout_get_context (layout);
priv = cogl_pango_get_renderer_from_context (context);
_COGL_RETURN_IF_FAIL (PANGO_IS_LAYOUT (layout));
g_return_if_fail (PANGO_IS_LAYOUT (layout));
if ((iter = pango_layout_get_iter (layout)) == NULL)
return;
@@ -759,7 +759,7 @@ cogl_pango_renderer_draw_box (PangoRenderer *renderer,
{
CoglPangoRenderer *priv = COGL_PANGO_RENDERER (renderer);
_COGL_RETURN_IF_FAIL (priv->display_list != NULL);
g_return_if_fail (priv->display_list != NULL);
_cogl_pango_display_list_add_rectangle (priv->display_list,
x,
@@ -803,7 +803,7 @@ cogl_pango_renderer_draw_rectangle (PangoRenderer *renderer,
CoglPangoRenderer *priv = COGL_PANGO_RENDERER (renderer);
float x1, x2, y1, y2;
_COGL_RETURN_IF_FAIL (priv->display_list != NULL);
g_return_if_fail (priv->display_list != NULL);
cogl_pango_renderer_set_color_for_part (renderer, part);
@@ -830,7 +830,7 @@ cogl_pango_renderer_draw_trapezoid (PangoRenderer *renderer,
{
CoglPangoRenderer *priv = COGL_PANGO_RENDERER (renderer);
_COGL_RETURN_IF_FAIL (priv->display_list != NULL);
g_return_if_fail (priv->display_list != NULL);
cogl_pango_renderer_set_color_for_part (renderer, part);

View File

@@ -149,7 +149,7 @@ void
cogl2_path_set_fill_rule (CoglPath *path,
CoglPathFillRule fill_rule)
{
_COGL_RETURN_IF_FAIL (cogl_is_path (path));
g_return_if_fail (cogl_is_path (path));
if (path->data->fill_rule != fill_rule)
{
@@ -162,7 +162,7 @@ cogl2_path_set_fill_rule (CoglPath *path,
CoglPathFillRule
cogl2_path_get_fill_rule (CoglPath *path)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_path (path), COGL_PATH_FILL_RULE_NON_ZERO);
g_return_val_if_fail (cogl_is_path (path), COGL_PATH_FILL_RULE_NON_ZERO);
return path->data->fill_rule;
}
@@ -225,9 +225,9 @@ _cogl_path_stroke_nodes (CoglPath *path,
int path_num = 0;
CoglPathNode *node;
_COGL_RETURN_IF_FAIL (cogl_is_path (path));
_COGL_RETURN_IF_FAIL (cogl_is_framebuffer (framebuffer));
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_path (path));
g_return_if_fail (cogl_is_framebuffer (framebuffer));
g_return_if_fail (cogl_is_pipeline (pipeline));
data = path->data;
@@ -392,7 +392,7 @@ _cogl_path_fill_nodes (CoglPath *path,
void
cogl2_path_fill (CoglPath *path)
{
_COGL_RETURN_IF_FAIL (cogl_is_path (path));
g_return_if_fail (cogl_is_path (path));
_cogl_path_fill_nodes (path,
cogl_get_draw_framebuffer (),
@@ -407,7 +407,7 @@ cogl2_path_fill (CoglPath *path)
void
cogl2_path_stroke (CoglPath *path)
{
_COGL_RETURN_IF_FAIL (cogl_is_path (path));
g_return_if_fail (cogl_is_path (path));
if (path->data->path_nodes->len == 0)
return;
@@ -424,7 +424,7 @@ cogl2_path_move_to (CoglPath *path,
{
CoglPathData *data;
_COGL_RETURN_IF_FAIL (cogl_is_path (path));
g_return_if_fail (cogl_is_path (path));
_cogl_path_add_node (path, TRUE, x, y);
@@ -443,7 +443,7 @@ cogl2_path_rel_move_to (CoglPath *path,
{
CoglPathData *data;
_COGL_RETURN_IF_FAIL (cogl_is_path (path));
g_return_if_fail (cogl_is_path (path));
data = path->data;
@@ -459,7 +459,7 @@ cogl2_path_line_to (CoglPath *path,
{
CoglPathData *data;
_COGL_RETURN_IF_FAIL (cogl_is_path (path));
g_return_if_fail (cogl_is_path (path));
_cogl_path_add_node (path, FALSE, x, y);
@@ -476,7 +476,7 @@ cogl2_path_rel_line_to (CoglPath *path,
{
CoglPathData *data;
_COGL_RETURN_IF_FAIL (cogl_is_path (path));
g_return_if_fail (cogl_is_path (path));
data = path->data;
@@ -488,7 +488,7 @@ cogl2_path_rel_line_to (CoglPath *path,
void
cogl2_path_close (CoglPath *path)
{
_COGL_RETURN_IF_FAIL (cogl_is_path (path));
g_return_if_fail (cogl_is_path (path));
_cogl_path_add_node (path, FALSE, path->data->path_start.x,
path->data->path_start.y);
@@ -514,7 +514,7 @@ cogl2_path_polyline (CoglPath *path,
{
int c = 0;
_COGL_RETURN_IF_FAIL (cogl_is_path (path));
g_return_if_fail (cogl_is_path (path));
cogl2_path_move_to (path, coords[0], coords[1]);
@@ -639,7 +639,7 @@ cogl2_path_arc (CoglPath *path,
{
float angle_step = 10;
_COGL_RETURN_IF_FAIL (cogl_is_path (path));
g_return_if_fail (cogl_is_path (path));
/* it is documented that a move to is needed to create a freestanding
* arc
@@ -683,7 +683,7 @@ cogl2_path_ellipse (CoglPath *path,
{
float angle_step = 10;
_COGL_RETURN_IF_FAIL (cogl_is_path (path));
g_return_if_fail (cogl_is_path (path));
/* FIXME: if shows to be slow might be optimized
* by mirroring just a quarter of it */
@@ -709,7 +709,7 @@ cogl2_path_round_rectangle (CoglPath *path,
float inner_width = x_2 - x_1 - radius * 2;
float inner_height = y_2 - y_1 - radius * 2;
_COGL_RETURN_IF_FAIL (cogl_is_path (path));
g_return_if_fail (cogl_is_path (path));
cogl2_path_move_to (path, x_1, y_1 + radius);
_cogl_path_rel_arc (path,
@@ -860,7 +860,7 @@ cogl2_path_curve_to (CoglPath *path,
{
CoglBezCubic cubic;
_COGL_RETURN_IF_FAIL (cogl_is_path (path));
g_return_if_fail (cogl_is_path (path));
/* Prepare cubic curve */
cubic.p1 = path->data->path_pen;
@@ -890,7 +890,7 @@ cogl2_path_rel_curve_to (CoglPath *path,
{
CoglPathData *data;
_COGL_RETURN_IF_FAIL (cogl_is_path (path));
g_return_if_fail (cogl_is_path (path));
data = path->data;
@@ -932,7 +932,7 @@ cogl_path_copy (CoglPath *old_path)
{
CoglPath *new_path;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_path (old_path), NULL);
g_return_val_if_fail (cogl_is_path (old_path), NULL);
new_path = g_slice_new (CoglPath);
new_path->data = old_path->data;
@@ -1053,7 +1053,7 @@ cogl_rel_curve2_to (CoglPath *path,
{
CoglPathData *data;
_COGL_RETURN_IF_FAIL (cogl_is_path (path));
g_return_if_fail (cogl_is_path (path));
data = path->data;
@@ -1579,9 +1579,9 @@ cogl_framebuffer_fill_path (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
CoglPath *path)
{
_COGL_RETURN_IF_FAIL (cogl_is_framebuffer (framebuffer));
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
_COGL_RETURN_IF_FAIL (cogl_is_path (path));
g_return_if_fail (cogl_is_framebuffer (framebuffer));
g_return_if_fail (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_path (path));
_cogl_path_fill_nodes (path, framebuffer, pipeline, 0 /* flags */);
}
@@ -1591,9 +1591,9 @@ cogl_framebuffer_stroke_path (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
CoglPath *path)
{
_COGL_RETURN_IF_FAIL (cogl_is_framebuffer (framebuffer));
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
_COGL_RETURN_IF_FAIL (cogl_is_path (path));
g_return_if_fail (cogl_is_framebuffer (framebuffer));
g_return_if_fail (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_path (path));
_cogl_path_stroke_nodes (path, framebuffer, pipeline);
}

View File

@@ -47,7 +47,6 @@
#include "cogl-atlas.h"
#include "cogl1-context.h"
#include "cogl-sub-texture.h"
#include "cogl-error-private.h"
#include "cogl-gtype-private.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
#include "driver/gl/cogl-texture-gl-private.h"
@@ -453,7 +452,7 @@ _cogl_atlas_texture_set_region_with_border (CoglAtlasTexture *atlas_tex,
int dst_width,
int dst_height,
CoglBitmap *bmp,
CoglError **error)
GError **error)
{
CoglAtlas *atlas = atlas_tex->atlas;
@@ -524,7 +523,7 @@ _cogl_atlas_texture_convert_bitmap_for_upload (CoglAtlasTexture *atlas_tex,
CoglBitmap *bmp,
CoglPixelFormat internal_format,
gboolean can_convert_in_place,
CoglError **error)
GError **error)
{
CoglBitmap *upload_bmp;
CoglBitmap *override_bmp;
@@ -574,7 +573,7 @@ _cogl_atlas_texture_set_region (CoglTexture *tex,
int dst_height,
int level,
CoglBitmap *bmp,
CoglError **error)
GError **error)
{
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
@@ -694,7 +693,7 @@ cogl_atlas_texture_new_with_size (CoglContext *ctx,
/* We can't atlas zero-sized textures because it breaks the atlas
* data structure */
_COGL_RETURN_VAL_IF_FAIL (width > 0 && height > 0, NULL);
g_return_val_if_fail (width > 0 && height > 0, NULL);
loader = _cogl_texture_create_loader ();
loader->src_type = COGL_TEXTURE_SOURCE_TYPE_SIZED;
@@ -711,7 +710,7 @@ allocate_space (CoglAtlasTexture *atlas_tex,
int width,
int height,
CoglPixelFormat internal_format,
CoglError **error)
GError **error)
{
CoglTexture *tex = COGL_TEXTURE (atlas_tex);
CoglContext *ctx = tex->context;
@@ -723,10 +722,10 @@ allocate_space (CoglAtlasTexture *atlas_tex,
{
COGL_NOTE (ATLAS, "Texture can not be added because the "
"format is unsupported");
_cogl_set_error (error,
COGL_TEXTURE_ERROR,
COGL_TEXTURE_ERROR_FORMAT,
"Texture format unsuitable for atlasing");
g_set_error_literal (error,
COGL_TEXTURE_ERROR,
COGL_TEXTURE_ERROR_FORMAT,
"Texture format unsuitable for atlasing");
return FALSE;
}
@@ -734,11 +733,11 @@ allocate_space (CoglAtlasTexture *atlas_tex,
and we shouldn't use the atlas */
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN))
{
_cogl_set_error (error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_UNSUPPORTED,
"Atlasing disabled because migrations "
"would be too slow");
g_set_error_literal (error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_UNSUPPORTED,
"Atlasing disabled because migrations "
"would be too slow");
return FALSE;
}
@@ -777,10 +776,10 @@ allocate_space (CoglAtlasTexture *atlas_tex,
/* Ok, this means we really can't add it to the atlas */
cogl_object_unref (atlas);
_cogl_set_error (error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_NO_MEMORY,
"Not enough memory to atlas texture");
g_set_error_literal (error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_NO_MEMORY,
"Not enough memory to atlas texture");
return FALSE;
}
}
@@ -795,7 +794,7 @@ allocate_space (CoglAtlasTexture *atlas_tex,
static gboolean
allocate_with_size (CoglAtlasTexture *atlas_tex,
CoglTextureLoader *loader,
CoglError **error)
GError **error)
{
CoglTexture *tex = COGL_TEXTURE (atlas_tex);
CoglPixelFormat internal_format =
@@ -820,7 +819,7 @@ allocate_with_size (CoglAtlasTexture *atlas_tex,
static gboolean
allocate_from_bitmap (CoglAtlasTexture *atlas_tex,
CoglTextureLoader *loader,
CoglError **error)
GError **error)
{
CoglTexture *tex = COGL_TEXTURE (atlas_tex);
CoglBitmap *bmp = loader->src.bitmap.bitmap;
@@ -831,7 +830,7 @@ allocate_from_bitmap (CoglAtlasTexture *atlas_tex,
CoglPixelFormat internal_format;
CoglBitmap *upload_bmp;
_COGL_RETURN_VAL_IF_FAIL (atlas_tex->atlas == NULL, FALSE);
g_return_val_if_fail (atlas_tex->atlas == NULL, FALSE);
internal_format = _cogl_texture_determine_internal_format (tex, bmp_format);
@@ -880,12 +879,12 @@ allocate_from_bitmap (CoglAtlasTexture *atlas_tex,
static gboolean
_cogl_atlas_texture_allocate (CoglTexture *tex,
CoglError **error)
GError **error)
{
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
CoglTextureLoader *loader = tex->loader;
_COGL_RETURN_VAL_IF_FAIL (loader, FALSE);
g_return_val_if_fail (loader, FALSE);
switch (loader->src_type)
{
@@ -906,7 +905,7 @@ _cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp,
{
CoglTextureLoader *loader;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), NULL);
g_return_val_if_fail (cogl_is_bitmap (bmp), NULL);
loader = _cogl_texture_create_loader ();
loader->src_type = COGL_TEXTURE_SOURCE_TYPE_BITMAP;
@@ -933,13 +932,13 @@ cogl_atlas_texture_new_from_data (CoglContext *ctx,
CoglPixelFormat format,
int rowstride,
const uint8_t *data,
CoglError **error)
GError **error)
{
CoglBitmap *bmp;
CoglAtlasTexture *atlas_tex;
_COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL);
_COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL);
g_return_val_if_fail (format != COGL_PIXEL_FORMAT_ANY, NULL);
g_return_val_if_fail (data != NULL, NULL);
/* Rowstride from width if not given */
if (rowstride == 0)
@@ -969,12 +968,12 @@ cogl_atlas_texture_new_from_data (CoglContext *ctx,
CoglAtlasTexture *
cogl_atlas_texture_new_from_file (CoglContext *ctx,
const char *filename,
CoglError **error)
GError **error)
{
CoglBitmap *bmp;
CoglAtlasTexture *atlas_tex = NULL;
_COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
bmp = cogl_bitmap_new_from_file (filename, error);
if (bmp == NULL)

View File

@@ -117,7 +117,7 @@ cogl_atlas_texture_new_with_size (CoglContext *ctx,
* cogl_atlas_texture_new_from_file:
* @ctx: A #CoglContext
* @filename: the file to load
* @error: A #CoglError to catch exceptional errors or %NULL
* @error: A #GError to catch exceptional errors or %NULL
*
* Creates a #CoglAtlasTexture from an image file. A #CoglAtlasTexture
* represents a sub-region within one of Cogl's shared texture
@@ -149,7 +149,7 @@ cogl_atlas_texture_new_with_size (CoglContext *ctx,
CoglAtlasTexture *
cogl_atlas_texture_new_from_file (CoglContext *ctx,
const char *filename,
CoglError **error);
GError **error);
/**
* cogl_atlas_texture_new_from_data:
@@ -161,7 +161,7 @@ cogl_atlas_texture_new_from_file (CoglContext *ctx,
* row in @data. A value of 0 will make Cogl automatically
* calculate @rowstride from @width and @format.
* @data: pointer to the memory region where the source buffer resides
* @error: A #CoglError to catch exceptional errors or %NULL
* @error: A #GError to catch exceptional errors or %NULL
*
* Creates a new #CoglAtlasTexture texture based on data residing in
* memory. A #CoglAtlasTexture represents a sub-region within one of
@@ -198,7 +198,7 @@ cogl_atlas_texture_new_from_data (CoglContext *ctx,
CoglPixelFormat format,
int rowstride,
const uint8_t *data,
CoglError **error);
GError **error);
/**
* cogl_atlas_texture_new_from_bitmap:

View File

@@ -283,7 +283,7 @@ _cogl_atlas_create_texture (CoglAtlas *atlas,
int height)
{
CoglTexture2D *tex;
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
_COGL_GET_CONTEXT (ctx, NULL);
@@ -309,7 +309,7 @@ _cogl_atlas_create_texture (CoglAtlas *atlas,
if (!cogl_texture_allocate (COGL_TEXTURE (tex), &ignore_error))
{
cogl_error_free (ignore_error);
g_error_free (ignore_error);
cogl_object_unref (tex);
tex = NULL;
}
@@ -327,7 +327,7 @@ _cogl_atlas_create_texture (CoglAtlas *atlas,
if (!cogl_texture_allocate (COGL_TEXTURE (tex), &ignore_error))
{
cogl_error_free (ignore_error);
g_error_free (ignore_error);
cogl_object_unref (tex);
tex = NULL;
}
@@ -560,7 +560,7 @@ create_migration_texture (CoglContext *ctx,
CoglPixelFormat internal_format)
{
CoglTexture *tex;
CoglError *skip_error = NULL;
GError *skip_error = NULL;
/* First try creating a fast-path non-sliced texture */
tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, width, height));
@@ -573,7 +573,7 @@ create_migration_texture (CoglContext *ctx,
* lazily when uploading data. */
if (!cogl_texture_allocate (tex, &skip_error))
{
cogl_error_free (skip_error);
g_error_free (skip_error);
cogl_object_unref (tex);
tex = NULL;
}
@@ -605,7 +605,7 @@ _cogl_atlas_copy_rectangle (CoglAtlas *atlas,
{
CoglTexture *tex;
CoglBlitData blit_data;
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
_COGL_GET_CONTEXT (ctx, NULL);
@@ -613,7 +613,7 @@ _cogl_atlas_copy_rectangle (CoglAtlas *atlas,
tex = create_migration_texture (ctx, width, height, internal_format);
if (!cogl_texture_allocate (tex, &ignore_error))
{
cogl_error_free (ignore_error);
g_error_free (ignore_error);
cogl_object_unref (tex);
return NULL;
}

View File

@@ -71,7 +71,7 @@ cogl_attribute_buffer_new (CoglContext *context,
buffer = cogl_attribute_buffer_new_with_size (context, bytes);
/* Note: to keep the common cases simple this API doesn't throw
* CoglErrors, so developers can assume this function never returns
* GErrors, so developers can assume this function never returns
* NULL and we will simply abort on error.
*
* Developers wanting to catch errors can use

View File

@@ -309,7 +309,7 @@ _cogl_attribute_new_const (CoglContext *context,
/* FIXME: Up until GL[ES] 3 only square matrices were supported
* and we don't currently expose non-square matrices in Cogl.
*/
_COGL_RETURN_VAL_IF_FAIL (n_columns == n_components, NULL);
g_return_val_if_fail (n_columns == n_components, NULL);
_cogl_boxed_value_set_matrix (&attribute->d.constant.boxed,
n_columns,
1,
@@ -469,7 +469,7 @@ cogl_attribute_new_const_4x4fv (CoglContext *context,
gboolean
cogl_attribute_get_normalized (CoglAttribute *attribute)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_attribute (attribute), FALSE);
g_return_val_if_fail (cogl_is_attribute (attribute), FALSE);
return attribute->normalized;
}
@@ -490,7 +490,7 @@ void
cogl_attribute_set_normalized (CoglAttribute *attribute,
gboolean normalized)
{
_COGL_RETURN_IF_FAIL (cogl_is_attribute (attribute));
g_return_if_fail (cogl_is_attribute (attribute));
if (G_UNLIKELY (attribute->immutable_ref))
warn_about_midscene_changes ();
@@ -501,8 +501,8 @@ cogl_attribute_set_normalized (CoglAttribute *attribute,
CoglAttributeBuffer *
cogl_attribute_get_buffer (CoglAttribute *attribute)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_attribute (attribute), NULL);
_COGL_RETURN_VAL_IF_FAIL (attribute->is_buffered, NULL);
g_return_val_if_fail (cogl_is_attribute (attribute), NULL);
g_return_val_if_fail (attribute->is_buffered, NULL);
return attribute->d.buffered.attribute_buffer;
}
@@ -511,8 +511,8 @@ void
cogl_attribute_set_buffer (CoglAttribute *attribute,
CoglAttributeBuffer *attribute_buffer)
{
_COGL_RETURN_IF_FAIL (cogl_is_attribute (attribute));
_COGL_RETURN_IF_FAIL (attribute->is_buffered);
g_return_if_fail (cogl_is_attribute (attribute));
g_return_if_fail (attribute->is_buffered);
if (G_UNLIKELY (attribute->immutable_ref))
warn_about_midscene_changes ();
@@ -528,7 +528,7 @@ _cogl_attribute_immutable_ref (CoglAttribute *attribute)
{
CoglBuffer *buffer = COGL_BUFFER (attribute->d.buffered.attribute_buffer);
_COGL_RETURN_VAL_IF_FAIL (cogl_is_attribute (attribute), NULL);
g_return_val_if_fail (cogl_is_attribute (attribute), NULL);
attribute->immutable_ref++;
_cogl_buffer_immutable_ref (buffer);
@@ -540,8 +540,8 @@ _cogl_attribute_immutable_unref (CoglAttribute *attribute)
{
CoglBuffer *buffer = COGL_BUFFER (attribute->d.buffered.attribute_buffer);
_COGL_RETURN_IF_FAIL (cogl_is_attribute (attribute));
_COGL_RETURN_IF_FAIL (attribute->immutable_ref > 0);
g_return_if_fail (cogl_is_attribute (attribute));
g_return_if_fail (attribute->immutable_ref > 0);
attribute->immutable_ref--;
_cogl_buffer_immutable_unref (buffer);

View File

@@ -361,7 +361,7 @@ _cogl_bitmap_needs_short_temp_buffer (CoglPixelFormat format)
gboolean
_cogl_bitmap_convert_into_bitmap (CoglBitmap *src_bmp,
CoglBitmap *dst_bmp,
CoglError **error)
GError **error)
{
uint8_t *src_data;
uint8_t *dst_data;
@@ -384,8 +384,8 @@ _cogl_bitmap_convert_into_bitmap (CoglBitmap *src_bmp,
width = cogl_bitmap_get_width (src_bmp);
height = cogl_bitmap_get_height (src_bmp);
_COGL_RETURN_VAL_IF_FAIL (width == cogl_bitmap_get_width (dst_bmp), FALSE);
_COGL_RETURN_VAL_IF_FAIL (height == cogl_bitmap_get_height (dst_bmp), FALSE);
g_return_val_if_fail (width == cogl_bitmap_get_width (dst_bmp), FALSE);
g_return_val_if_fail (height == cogl_bitmap_get_height (dst_bmp), FALSE);
need_premult
= ((src_format & COGL_PREMULT_BIT) != (dst_format & COGL_PREMULT_BIT) &&
@@ -488,7 +488,7 @@ _cogl_bitmap_convert_into_bitmap (CoglBitmap *src_bmp,
CoglBitmap *
_cogl_bitmap_convert (CoglBitmap *src_bmp,
CoglPixelFormat dst_format,
CoglError **error)
GError **error)
{
CoglBitmap *dst_bmp;
int width, height;
@@ -547,13 +547,13 @@ CoglBitmap *
_cogl_bitmap_convert_for_upload (CoglBitmap *src_bmp,
CoglPixelFormat internal_format,
gboolean can_convert_in_place,
CoglError **error)
GError **error)
{
CoglContext *ctx = _cogl_bitmap_get_context (src_bmp);
CoglPixelFormat src_format = cogl_bitmap_get_format (src_bmp);
CoglBitmap *dst_bmp;
_COGL_RETURN_VAL_IF_FAIL (internal_format != COGL_PIXEL_FORMAT_ANY, NULL);
g_return_val_if_fail (internal_format != COGL_PIXEL_FORMAT_ANY, NULL);
/* OpenGL supports specifying a different format for the internal
format when uploading texture data. We should use this to convert
@@ -616,7 +616,7 @@ _cogl_bitmap_convert_for_upload (CoglBitmap *src_bmp,
gboolean
_cogl_bitmap_unpremult (CoglBitmap *bmp,
CoglError **error)
GError **error)
{
uint8_t *p, *data;
uint16_t *tmp_row;
@@ -684,7 +684,7 @@ _cogl_bitmap_unpremult (CoglBitmap *bmp,
gboolean
_cogl_bitmap_premult (CoglBitmap *bmp,
CoglError **error)
GError **error)
{
uint8_t *p, *data;
uint16_t *tmp_row;

View File

@@ -34,7 +34,6 @@
#include "cogl-bitmap-private.h"
#include "cogl-context-private.h"
#include "cogl-private.h"
#include "cogl-error-private.h"
#include <string.h>
@@ -45,7 +44,7 @@ _cogl_bitmap_get_size_from_file (const char *filename,
int *width,
int *height)
{
_COGL_RETURN_VAL_IF_FAIL (filename != NULL, FALSE);
g_return_val_if_fail (filename != NULL, FALSE);
if (gdk_pixbuf_get_file_info (filename, width, height) != NULL)
return TRUE;
@@ -56,7 +55,7 @@ _cogl_bitmap_get_size_from_file (const char *filename,
CoglBitmap *
_cogl_bitmap_from_file (CoglContext *ctx,
const char *filename,
CoglError **error)
GError **error)
{
static CoglUserDataKey pixbuf_key;
GdkPixbuf *pixbuf;
@@ -75,7 +74,7 @@ _cogl_bitmap_from_file (CoglContext *ctx,
pixbuf = gdk_pixbuf_new_from_file (filename, &glib_error);
if (pixbuf == NULL)
{
_cogl_propagate_gerror (error, glib_error);
g_propagate_error (error, glib_error);
return FALSE;
}

View File

@@ -70,7 +70,7 @@ struct _CoglBitmap
* @width: width of the bitmap in pixels
* @height: height of the bitmap in pixels
* @format: the format of the pixels the array will store
* @error: A #CoglError for catching exceptional errors or %NULL
* @error: A #GError for catching exceptional errors or %NULL
*
* This is equivalent to cogl_bitmap_new_with_size() except that it
* allocated the buffer using g_malloc() instead of creating a
@@ -87,7 +87,7 @@ _cogl_bitmap_new_with_malloc_buffer (CoglContext *context,
unsigned int width,
unsigned int height,
CoglPixelFormat format,
CoglError **error);
GError **error);
/* The idea of this function is that it will create a bitmap that
shares the actual data with another bitmap. This is needed for the
@@ -103,53 +103,53 @@ _cogl_bitmap_new_shared (CoglBitmap *shared_bmp,
CoglBitmap *
_cogl_bitmap_convert (CoglBitmap *bmp,
CoglPixelFormat dst_format,
CoglError **error);
CoglPixelFormat dst_format,
GError **error);
CoglBitmap *
_cogl_bitmap_convert_for_upload (CoglBitmap *src_bmp,
CoglPixelFormat internal_format,
gboolean can_convert_in_place,
CoglError **error);
GError **error);
gboolean
_cogl_bitmap_convert_into_bitmap (CoglBitmap *src_bmp,
CoglBitmap *dst_bmp,
CoglError **error);
GError **error);
CoglBitmap *
_cogl_bitmap_from_file (CoglContext *ctx,
const char *filename,
CoglError **error);
GError **error);
gboolean
_cogl_bitmap_unpremult (CoglBitmap *dst_bmp,
CoglError **error);
GError **error);
gboolean
_cogl_bitmap_premult (CoglBitmap *dst_bmp,
CoglError **error);
GError **error);
gboolean
_cogl_bitmap_convert_premult_status (CoglBitmap *bmp,
CoglPixelFormat dst_format,
CoglError **error);
GError **error);
gboolean
_cogl_bitmap_copy_subregion (CoglBitmap *src,
CoglBitmap *dst,
int src_x,
int src_y,
int dst_x,
int dst_y,
int width,
int height,
CoglError **error);
CoglBitmap *dst,
int src_x,
int src_y,
int dst_x,
int dst_y,
int width,
int height,
GError **error);
/* Creates a deep copy of the source bitmap */
CoglBitmap *
_cogl_bitmap_copy (CoglBitmap *src_bmp,
CoglError **error);
GError **error);
gboolean
_cogl_bitmap_get_size_from_file (const char *filename,
@@ -172,7 +172,7 @@ uint8_t *
_cogl_bitmap_map (CoglBitmap *bitmap,
CoglBufferAccess access,
CoglBufferMapHint hints,
CoglError **error);
GError **error);
void
_cogl_bitmap_unmap (CoglBitmap *bitmap);
@@ -190,7 +190,7 @@ uint8_t *
_cogl_bitmap_gl_bind (CoglBitmap *bitmap,
CoglBufferAccess access,
CoglBufferMapHint hints,
CoglError **error);
GError **error);
void
_cogl_bitmap_gl_unbind (CoglBitmap *bitmap);

View File

@@ -37,7 +37,6 @@
#include "cogl-buffer-private.h"
#include "cogl-pixel-buffer.h"
#include "cogl-context-private.h"
#include "cogl-error-private.h"
#include "cogl-gtype-private.h"
#include "driver/gl/cogl-buffer-gl-private.h"
@@ -66,7 +65,7 @@ _cogl_bitmap_free (CoglBitmap *bmp)
gboolean
_cogl_bitmap_convert_premult_status (CoglBitmap *bmp,
CoglPixelFormat dst_format,
CoglError **error)
GError **error)
{
/* Do we need to unpremultiply? */
if ((bmp->format & COGL_PREMULT_BIT) > 0 &&
@@ -86,7 +85,7 @@ _cogl_bitmap_convert_premult_status (CoglBitmap *bmp,
CoglBitmap *
_cogl_bitmap_copy (CoglBitmap *src_bmp,
CoglError **error)
GError **error)
{
CoglBitmap *dst_bmp;
CoglPixelFormat src_format = cogl_bitmap_get_format (src_bmp);
@@ -124,7 +123,7 @@ _cogl_bitmap_copy_subregion (CoglBitmap *src,
int dst_y,
int width,
int height,
CoglError **error)
GError **error)
{
uint8_t *srcdata;
uint8_t *dstdata;
@@ -133,9 +132,9 @@ _cogl_bitmap_copy_subregion (CoglBitmap *src,
gboolean succeeded = FALSE;
/* Intended only for fast copies when format is equal! */
_COGL_RETURN_VAL_IF_FAIL ((src->format & ~COGL_PREMULT_BIT) ==
(dst->format & ~COGL_PREMULT_BIT),
FALSE);
g_return_val_if_fail ((src->format & ~COGL_PREMULT_BIT) ==
(dst->format & ~COGL_PREMULT_BIT),
FALSE);
bpp = _cogl_pixel_format_get_bytes_per_pixel (src->format);
@@ -209,7 +208,7 @@ _cogl_bitmap_new_with_malloc_buffer (CoglContext *context,
unsigned int width,
unsigned int height,
CoglPixelFormat format,
CoglError **error)
GError **error)
{
static CoglUserDataKey bitmap_free_key;
int bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
@@ -219,10 +218,9 @@ _cogl_bitmap_new_with_malloc_buffer (CoglContext *context,
if (!data)
{
_cogl_set_error (error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_NO_MEMORY,
"Failed to allocate memory for bitmap");
g_set_error_literal (error, COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_NO_MEMORY,
"Failed to allocate memory for bitmap");
return NULL;
}
@@ -261,12 +259,12 @@ _cogl_bitmap_new_shared (CoglBitmap *shared_bmp,
CoglBitmap *
cogl_bitmap_new_from_file (const char *filename,
CoglError **error)
GError **error)
{
_COGL_GET_CONTEXT (ctx, NULL);
_COGL_RETURN_VAL_IF_FAIL (filename != NULL, NULL);
_COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, NULL);
g_return_val_if_fail (filename != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
return _cogl_bitmap_from_file (ctx, filename, error);
}
@@ -281,7 +279,7 @@ cogl_bitmap_new_from_buffer (CoglBuffer *buffer,
{
CoglBitmap *bmp;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), NULL);
g_return_val_if_fail (cogl_is_buffer (buffer), NULL);
bmp = cogl_bitmap_new_for_data (buffer->context,
width, height,
@@ -306,7 +304,7 @@ cogl_bitmap_new_with_size (CoglContext *context,
unsigned int rowstride;
/* creating a buffer to store "any" format does not make sense */
_COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL);
g_return_val_if_fail (format != COGL_PIXEL_FORMAT_ANY, NULL);
/* for now we fallback to cogl_pixel_buffer_new, later, we could ask
* libdrm a tiled buffer for instance */
@@ -317,7 +315,7 @@ cogl_bitmap_new_with_size (CoglContext *context,
height * rowstride,
NULL); /* data */
_COGL_RETURN_VAL_IF_FAIL (pixel_buffer != NULL, NULL);
g_return_val_if_fail (pixel_buffer != NULL, NULL);
bitmap = cogl_bitmap_new_from_buffer (COGL_BUFFER (pixel_buffer),
format,
@@ -380,7 +378,7 @@ uint8_t *
_cogl_bitmap_map (CoglBitmap *bitmap,
CoglBufferAccess access,
CoglBufferMapHint hints,
CoglError **error)
GError **error)
{
/* Divert to another bitmap if this data is shared */
if (bitmap->shared_bmp)
@@ -437,10 +435,10 @@ uint8_t *
_cogl_bitmap_gl_bind (CoglBitmap *bitmap,
CoglBufferAccess access,
CoglBufferMapHint hints,
CoglError **error)
GError **error)
{
uint8_t *ptr;
CoglError *internal_error = NULL;
GError *internal_error = NULL;
g_return_val_if_fail (access & (COGL_BUFFER_ACCESS_READ |
COGL_BUFFER_ACCESS_WRITE),
@@ -450,7 +448,7 @@ _cogl_bitmap_gl_bind (CoglBitmap *bitmap,
if (bitmap->shared_bmp)
return _cogl_bitmap_gl_bind (bitmap->shared_bmp, access, hints, error);
_COGL_RETURN_VAL_IF_FAIL (!bitmap->bound, NULL);
g_return_val_if_fail (!bitmap->bound, NULL);
/* If the bitmap wasn't created from a buffer then the
implementation of bind is the same as map */
@@ -482,7 +480,7 @@ _cogl_bitmap_gl_bind (CoglBitmap *bitmap,
* if an exception was thrown */
if (internal_error)
{
_cogl_propagate_error (error, internal_error);
g_propagate_error (error, internal_error);
return NULL;
}

View File

@@ -70,7 +70,7 @@ GType cogl_bitmap_get_gtype (void);
/**
* cogl_bitmap_new_from_file:
* @filename: the file to load.
* @error: a #CoglError or %NULL.
* @error: a #GError or %NULL.
*
* Loads an image file from disk. This function can be safely called from
* within a thread.
@@ -82,7 +82,7 @@ GType cogl_bitmap_get_gtype (void);
*/
CoglBitmap *
cogl_bitmap_new_from_file (const char *filename,
CoglError **error);
GError **error);
/**
* cogl_bitmap_new_from_buffer: (skip)
@@ -269,7 +269,7 @@ cogl_is_bitmap (void *object);
/**
* COGL_BITMAP_ERROR:
*
* #CoglError domain for bitmap errors.
* #GError domain for bitmap errors.
*
* Since: 1.4
*/

View File

@@ -41,7 +41,6 @@
#include "cogl-context-private.h"
#include "cogl-debug.h"
#include "cogl-blend-string.h"
#include "cogl-error-private.h"
typedef enum _ParserState
{
@@ -166,7 +165,7 @@ _cogl_blend_string_split_rgba_statement (CoglBlendStringStatement *statement,
static gboolean
validate_tex_combine_statements (CoglBlendStringStatement *statements,
int n_statements,
CoglError **error)
GError **error)
{
int i, j;
const char *error_string;
@@ -195,11 +194,8 @@ validate_tex_combine_statements (CoglBlendStringStatement *statements,
return TRUE;
error:
_cogl_set_error (error,
COGL_BLEND_STRING_ERROR,
detail,
"Invalid texture combine string: %s",
error_string);
g_set_error (error, COGL_BLEND_STRING_ERROR, detail,
"Invalid texture combine string: %s", error_string);
if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS))
{
@@ -212,7 +208,7 @@ error:
static gboolean
validate_blend_statements (CoglBlendStringStatement *statements,
int n_statements,
CoglError **error)
GError **error)
{
int i, j;
const char *error_string;
@@ -265,11 +261,8 @@ validate_blend_statements (CoglBlendStringStatement *statements,
return TRUE;
error:
_cogl_set_error (error,
COGL_BLEND_STRING_ERROR,
detail,
"Invalid blend string: %s",
error_string);
g_set_error (error, COGL_BLEND_STRING_ERROR, detail,
"Invalid blend string: %s", error_string);
return FALSE;
}
@@ -277,7 +270,7 @@ static gboolean
validate_statements_for_context (CoglBlendStringStatement *statements,
int n_statements,
CoglBlendStringContext context,
CoglError **error)
GError **error)
{
const char *error_string;
@@ -303,13 +296,12 @@ validate_statements_for_context (CoglBlendStringStatement *statements,
return validate_tex_combine_statements (statements, n_statements, error);
error:
_cogl_set_error (error,
COGL_BLEND_STRING_ERROR,
COGL_BLEND_STRING_ERROR_INVALID_ERROR,
"Invalid %s string: %s",
context == COGL_BLEND_STRING_CONTEXT_BLENDING ?
"blend" : "texture combine",
error_string);
g_set_error (error, COGL_BLEND_STRING_ERROR,
COGL_BLEND_STRING_ERROR_INVALID_ERROR,
"Invalid %s string: %s",
context == COGL_BLEND_STRING_CONTEXT_BLENDING ?
"blend" : "texture combine",
error_string);
if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS))
{
@@ -464,7 +456,7 @@ parse_argument (const char *string, /* original user string */
int current_arg,
CoglBlendStringArgument *arg, /* OUT */
CoglBlendStringContext context,
CoglError **error)
GError **error)
{
const char *p = *ret_p;
const char *mark = NULL;
@@ -733,13 +725,13 @@ parse_argument (const char *string, /* original user string */
error:
{
int offset = p - string;
_cogl_set_error (error,
COGL_BLEND_STRING_ERROR,
COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR,
"Syntax error for argument %d at offset %d: %s",
current_arg,
offset,
error_string);
g_set_error (error,
COGL_BLEND_STRING_ERROR,
COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR,
"Syntax error for argument %d at offset %d: %s",
current_arg,
offset,
error_string);
if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS))
{
@@ -754,7 +746,7 @@ int
_cogl_blend_string_compile (const char *string,
CoglBlendStringContext context,
CoglBlendStringStatement *statements,
CoglError **error)
GError **error)
{
const char *p = string;
const char *mark = NULL;
@@ -914,12 +906,12 @@ finished:
error:
{
int offset = p - string;
_cogl_set_error (error,
COGL_BLEND_STRING_ERROR,
COGL_BLEND_STRING_ERROR_PARSE_ERROR,
"Syntax error at offset %d: %s",
offset,
error_string);
g_set_error (error,
COGL_BLEND_STRING_ERROR,
COGL_BLEND_STRING_ERROR_PARSE_ERROR,
"Syntax error at offset %d: %s",
offset,
error_string);
if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS))
{
@@ -971,7 +963,7 @@ _cogl_blend_string_test (void)
};
int i;
CoglError *error = NULL;
GError *error = NULL;
for (i = 0; strings[i].string; i++)
{
CoglBlendStringStatement statements[2];
@@ -984,7 +976,7 @@ _cogl_blend_string_test (void)
g_print ("Failed to parse string:\n%s\n%s\n",
strings[i].string,
error->message);
cogl_error_free (error);
g_error_free (error);
error = NULL;
continue;
}

View File

@@ -133,7 +133,7 @@ gboolean
_cogl_blend_string_compile (const char *string,
CoglBlendStringContext context,
CoglBlendStringStatement *statements,
CoglError **error);
GError **error);
void
_cogl_blend_string_split_rgba_statement (CoglBlendStringStatement *statement,

View File

@@ -52,7 +52,7 @@ _cogl_blit_texture_render_begin (CoglBlitData *data)
CoglFramebuffer *fb;
CoglPipeline *pipeline;
unsigned int dst_width, dst_height;
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
offscreen = _cogl_offscreen_new_with_texture_full
(data->dst_tex, COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, 0 /* level */);
@@ -60,7 +60,7 @@ _cogl_blit_texture_render_begin (CoglBlitData *data)
fb = COGL_FRAMEBUFFER (offscreen);
if (!cogl_framebuffer_allocate (fb, &ignore_error))
{
cogl_error_free (ignore_error);
g_error_free (ignore_error);
cogl_object_unref (fb);
return FALSE;
}
@@ -150,7 +150,7 @@ _cogl_blit_framebuffer_begin (CoglBlitData *data)
CoglContext *ctx = data->src_tex->context;
CoglOffscreen *dst_offscreen = NULL, *src_offscreen = NULL;
CoglFramebuffer *dst_fb, *src_fb;
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
/* We can only blit between FBOs if both textures are the same
format and the blit framebuffer extension is supported */
@@ -165,7 +165,7 @@ _cogl_blit_framebuffer_begin (CoglBlitData *data)
dst_fb = COGL_FRAMEBUFFER (dst_offscreen);
if (!cogl_framebuffer_allocate (dst_fb, &ignore_error))
{
cogl_error_free (ignore_error);
g_error_free (ignore_error);
goto error;
}
@@ -177,7 +177,7 @@ _cogl_blit_framebuffer_begin (CoglBlitData *data)
src_fb = COGL_FRAMEBUFFER (src_offscreen);
if (!cogl_framebuffer_allocate (src_fb, &ignore_error))
{
cogl_error_free (ignore_error);
g_error_free (ignore_error);
goto error;
}
@@ -224,7 +224,7 @@ _cogl_blit_copy_tex_sub_image_begin (CoglBlitData *data)
{
CoglOffscreen *offscreen;
CoglFramebuffer *fb;
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
/* This will only work if the target texture is a CoglTexture2D */
if (!cogl_is_texture_2d (data->dst_tex))
@@ -236,7 +236,7 @@ _cogl_blit_copy_tex_sub_image_begin (CoglBlitData *data)
fb = COGL_FRAMEBUFFER (offscreen);
if (!cogl_framebuffer_allocate (fb, &ignore_error))
{
cogl_error_free (ignore_error);
g_error_free (ignore_error);
cogl_object_unref (fb);
return FALSE;
}
@@ -292,7 +292,7 @@ _cogl_blit_get_tex_data_blit (CoglBlitData *data,
int width,
int height)
{
CoglError *ignore = NULL;
GError *ignore = NULL;
int rowstride = data->src_width * data->bpp;
int offset = rowstride * src_y + src_x * data->bpp;
@@ -409,7 +409,7 @@ _cogl_blit_begin (CoglBlitData *data,
_cogl_blit_modes[i].name);
/* The last blit mode can't fail so this should never happen */
_COGL_RETURN_IF_FAIL (i < G_N_ELEMENTS (_cogl_blit_modes));
g_return_if_fail (i < G_N_ELEMENTS (_cogl_blit_modes));
}
data->blit_mode = _cogl_blit_default_mode;

View File

@@ -53,7 +53,7 @@ struct _CoglBufferVtable
size_t size,
CoglBufferAccess access,
CoglBufferMapHint hints,
CoglError **error);
GError **error);
void (* unmap) (CoglBuffer *buffer);
@@ -61,7 +61,7 @@ struct _CoglBufferVtable
unsigned int offset,
const void *data,
unsigned int size,
CoglError **error);
GError **error);
};
typedef enum _CoglBufferFlags
@@ -153,13 +153,13 @@ _cogl_buffer_set_data (CoglBuffer *buffer,
size_t offset,
const void *data,
size_t size,
CoglError **error);
GError **error);
void *
_cogl_buffer_map (CoglBuffer *buffer,
CoglBufferAccess access,
CoglBufferMapHint hints,
CoglError **error);
GError **error);
/* This is a wrapper around cogl_buffer_map_range for internal use
when we want to map the buffer for write only to replace the entire

View File

@@ -88,7 +88,7 @@ malloc_map_range (CoglBuffer *buffer,
size_t size,
CoglBufferAccess access,
CoglBufferMapHint hints,
CoglError **error)
GError **error)
{
buffer->flags |= COGL_BUFFER_FLAG_MAPPED;
return buffer->data + offset;
@@ -105,7 +105,7 @@ malloc_set_data (CoglBuffer *buffer,
unsigned int offset,
const void *data,
unsigned int size,
CoglError **error)
GError **error)
{
memcpy (buffer->data + offset, data, size);
return TRUE;
@@ -167,8 +167,8 @@ _cogl_buffer_initialize (CoglBuffer *buffer,
void
_cogl_buffer_fini (CoglBuffer *buffer)
{
_COGL_RETURN_IF_FAIL (!(buffer->flags & COGL_BUFFER_FLAG_MAPPED));
_COGL_RETURN_IF_FAIL (buffer->immutable_ref == 0);
g_return_if_fail (!(buffer->flags & COGL_BUFFER_FLAG_MAPPED));
g_return_if_fail (buffer->immutable_ref == 0);
if (buffer->flags & COGL_BUFFER_FLAG_BUFFER_OBJECT)
buffer->context->driver_vtable->buffer_destroy (buffer);
@@ -223,9 +223,9 @@ void *
_cogl_buffer_map (CoglBuffer *buffer,
CoglBufferAccess access,
CoglBufferMapHint hints,
CoglError **error)
GError **error)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), NULL);
g_return_val_if_fail (cogl_is_buffer (buffer), NULL);
return cogl_buffer_map_range (buffer, 0, buffer->size, access, hints, error);
}
@@ -235,12 +235,11 @@ cogl_buffer_map (CoglBuffer *buffer,
CoglBufferAccess access,
CoglBufferMapHint hints)
{
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
void *ptr =
cogl_buffer_map_range (buffer, 0, buffer->size, access, hints,
&ignore_error);
if (!ptr)
cogl_error_free (ignore_error);
g_clear_error (&ignore_error);
return ptr;
}
@@ -250,10 +249,10 @@ cogl_buffer_map_range (CoglBuffer *buffer,
size_t size,
CoglBufferAccess access,
CoglBufferMapHint hints,
CoglError **error)
GError **error)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), NULL);
_COGL_RETURN_VAL_IF_FAIL (!(buffer->flags & COGL_BUFFER_FLAG_MAPPED), NULL);
g_return_val_if_fail (cogl_is_buffer (buffer), NULL);
g_return_val_if_fail (!(buffer->flags & COGL_BUFFER_FLAG_MAPPED), NULL);
if (G_UNLIKELY (buffer->immutable_ref))
warn_about_midscene_changes ();
@@ -293,9 +292,9 @@ _cogl_buffer_map_range_for_fill_or_fallback (CoglBuffer *buffer,
{
CoglContext *ctx = buffer->context;
void *ret;
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
_COGL_RETURN_VAL_IF_FAIL (!ctx->buffer_map_fallback_in_use, NULL);
g_return_val_if_fail (!ctx->buffer_map_fallback_in_use, NULL);
ctx->buffer_map_fallback_in_use = TRUE;
@@ -309,7 +308,7 @@ _cogl_buffer_map_range_for_fill_or_fallback (CoglBuffer *buffer,
if (ret)
return ret;
cogl_error_free (ignore_error);
g_error_free (ignore_error);
/* If the map fails then we'll use a temporary buffer to fill
the data and then upload it using cogl_buffer_set_data when
@@ -328,7 +327,7 @@ _cogl_buffer_unmap_for_fill_or_fallback (CoglBuffer *buffer)
{
CoglContext *ctx = buffer->context;
_COGL_RETURN_IF_FAIL (ctx->buffer_map_fallback_in_use);
g_return_if_fail (ctx->buffer_map_fallback_in_use);
ctx->buffer_map_fallback_in_use = FALSE;
@@ -364,10 +363,10 @@ _cogl_buffer_set_data (CoglBuffer *buffer,
size_t offset,
const void *data,
size_t size,
CoglError **error)
GError **error)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), FALSE);
_COGL_RETURN_VAL_IF_FAIL ((offset + size) <= buffer->size, FALSE);
g_return_val_if_fail (cogl_is_buffer (buffer), FALSE);
g_return_val_if_fail ((offset + size) <= buffer->size, FALSE);
if (G_UNLIKELY (buffer->immutable_ref))
warn_about_midscene_changes ();
@@ -381,18 +380,17 @@ cogl_buffer_set_data (CoglBuffer *buffer,
const void *data,
size_t size)
{
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
gboolean status =
_cogl_buffer_set_data (buffer, offset, data, size, &ignore_error);
if (!status)
cogl_error_free (ignore_error);
g_clear_error (&ignore_error);
return status;
}
CoglBuffer *
_cogl_buffer_immutable_ref (CoglBuffer *buffer)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), NULL);
g_return_val_if_fail (cogl_is_buffer (buffer), NULL);
buffer->immutable_ref++;
return buffer;
@@ -401,8 +399,8 @@ _cogl_buffer_immutable_ref (CoglBuffer *buffer)
void
_cogl_buffer_immutable_unref (CoglBuffer *buffer)
{
_COGL_RETURN_IF_FAIL (cogl_is_buffer (buffer));
_COGL_RETURN_IF_FAIL (buffer->immutable_ref > 0);
g_return_if_fail (cogl_is_buffer (buffer));
g_return_if_fail (buffer->immutable_ref > 0);
buffer->immutable_ref--;
}

View File

@@ -40,7 +40,6 @@
#define __COGL_BUFFER_H__
#include <cogl/cogl-types.h>
#include <cogl/cogl-error.h>
G_BEGIN_DECLS
@@ -258,7 +257,7 @@ cogl_buffer_map (CoglBuffer *buffer,
* @access: how the mapped buffer will be used by the application
* @hints: A mask of #CoglBufferMapHint<!-- -->s that tell Cogl how
* the data will be modified once mapped.
* @error: A #CoglError for catching exceptional errors
* @error: A #GError for catching exceptional errors
*
* Maps a sub-region of the buffer into the application's address space
* for direct access.
@@ -288,7 +287,7 @@ cogl_buffer_map_range (CoglBuffer *buffer,
size_t size,
CoglBufferAccess access,
CoglBufferMapHint hints,
CoglError **error);
GError **error);
/**
* cogl_buffer_unmap:

View File

@@ -350,7 +350,7 @@ _cogl_clip_stack_pop (CoglClipStack *stack)
{
CoglClipStack *new_top;
_COGL_RETURN_VAL_IF_FAIL (stack != NULL, NULL);
g_return_val_if_fail (stack != NULL, NULL);
/* To pop we are moving the top of the stack to the old top's parent
node. The stack always needs to have a reference to the top entry

View File

@@ -68,7 +68,7 @@ cogl_color_init_from_4ub (CoglColor *color,
uint8_t blue,
uint8_t alpha)
{
_COGL_RETURN_IF_FAIL (color != NULL);
g_return_if_fail (color != NULL);
color->red = red;
color->green = green;
@@ -94,7 +94,7 @@ cogl_color_init_from_4f (CoglColor *color,
float blue,
float alpha)
{
_COGL_RETURN_IF_FAIL (color != NULL);
g_return_if_fail (color != NULL);
color->red = (red * 255);
color->green = (green * 255);
@@ -117,7 +117,7 @@ void
cogl_color_init_from_4fv (CoglColor *color,
const float *color_array)
{
_COGL_RETURN_IF_FAIL (color != NULL);
g_return_if_fail (color != NULL);
color->red = (color_array[0] * 255);
color->green = (color_array[1] * 255);
@@ -305,8 +305,8 @@ cogl_color_equal (const void *v1, const void *v2)
{
const uint32_t *c1 = v1, *c2 = v2;
_COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE);
_COGL_RETURN_VAL_IF_FAIL (v2 != NULL, FALSE);
g_return_val_if_fail (v1 != NULL, FALSE);
g_return_val_if_fail (v2 != NULL, FALSE);
/* XXX: We don't compare the padding */
return *c1 == *c2 ? TRUE : FALSE;

View File

@@ -363,7 +363,7 @@ _cogl_context_get_winsys (CoglContext *context);
* return FALSE and set @error */
gboolean
_cogl_context_update_features (CoglContext *context,
CoglError **error);
GError **error);
/* Obtains the context and returns retval if NULL */
#define _COGL_GET_CONTEXT(ctxvar, retval) \

View File

@@ -47,7 +47,6 @@
#include "cogl1-context.h"
#include "cogl-gpu-info-private.h"
#include "cogl-config-private.h"
#include "cogl-error-private.h"
#include "cogl-gtype-private.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
#include "driver/gl/cogl-util-gl-private.h"
@@ -123,7 +122,7 @@ _cogl_context_get_winsys (CoglContext *context)
*/
CoglContext *
cogl_context_new (CoglDisplay *display,
CoglError **error)
GError **error)
{
CoglContext *context;
uint8_t white_pixel[] = { 0xff, 0xff, 0xff, 0xff };
@@ -528,7 +527,7 @@ _cogl_context_free (CoglContext *context)
CoglContext *
_cogl_context_get_default (void)
{
CoglError *error = NULL;
GError *error = NULL;
/* Create if doesn't exist yet */
if (_cogl_context == NULL)
{
@@ -537,7 +536,7 @@ _cogl_context_get_default (void)
{
g_warning ("Failed to create default context: %s",
error->message);
cogl_error_free (error);
g_error_free (error);
}
}
@@ -558,7 +557,7 @@ cogl_context_get_renderer (CoglContext *context)
gboolean
_cogl_context_update_features (CoglContext *context,
CoglError **error)
GError **error)
{
return context->driver_vtable->update_features (context, error);
}

View File

@@ -104,7 +104,7 @@ GType cogl_context_get_gtype (void);
/**
* cogl_context_new: (constructor)
* @display: (allow-none): A #CoglDisplay pointer
* @error: A CoglError return location.
* @error: A GError return location.
*
* Creates a new #CoglContext which acts as an application sandbox
* for any state objects that are allocated.
@@ -115,7 +115,7 @@ GType cogl_context_get_gtype (void);
*/
CoglContext *
cogl_context_new (CoglDisplay *display,
CoglError **error);
GError **error);
/**
* cogl_context_get_display:

View File

@@ -46,3 +46,4 @@
#mesondefine COGL_HAS_X11_SUPPORT
#mesondefine COGL_HAS_XLIB
#mesondefine COGL_HAS_XLIB_SUPPORT
#mesondefine COGL_HAS_LIBDRM

View File

@@ -52,14 +52,14 @@ void
cogl_depth_state_set_test_enabled (CoglDepthState *state,
gboolean enabled)
{
_COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC);
g_return_if_fail (state->magic == COGL_DEPTH_STATE_MAGIC);
state->test_enabled = enabled;
}
gboolean
cogl_depth_state_get_test_enabled (CoglDepthState *state)
{
_COGL_RETURN_VAL_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE);
g_return_val_if_fail (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE);
return state->test_enabled;
}
@@ -67,14 +67,14 @@ void
cogl_depth_state_set_write_enabled (CoglDepthState *state,
gboolean enabled)
{
_COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC);
g_return_if_fail (state->magic == COGL_DEPTH_STATE_MAGIC);
state->write_enabled = enabled;
}
gboolean
cogl_depth_state_get_write_enabled (CoglDepthState *state)
{
_COGL_RETURN_VAL_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE);
g_return_val_if_fail (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE);
return state->write_enabled;
}
@@ -82,14 +82,14 @@ void
cogl_depth_state_set_test_function (CoglDepthState *state,
CoglDepthTestFunction function)
{
_COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC);
g_return_if_fail (state->magic == COGL_DEPTH_STATE_MAGIC);
state->test_function = function;
}
CoglDepthTestFunction
cogl_depth_state_get_test_function (CoglDepthState *state)
{
_COGL_RETURN_VAL_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE);
g_return_val_if_fail (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE);
return state->test_function;
}
@@ -98,7 +98,7 @@ cogl_depth_state_set_range (CoglDepthState *state,
float near,
float far)
{
_COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC);
g_return_if_fail (state->magic == COGL_DEPTH_STATE_MAGIC);
state->range_near = near;
state->range_far = far;
}
@@ -108,7 +108,7 @@ cogl_depth_state_get_range (CoglDepthState *state,
float *near_out,
float *far_out)
{
_COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC);
g_return_if_fail (state->magic == COGL_DEPTH_STATE_MAGIC);
*near_out = state->range_near;
*far_out = state->range_far;
}

View File

@@ -87,7 +87,7 @@ cogl_display_new (CoglRenderer *renderer,
CoglOnscreenTemplate *onscreen_template)
{
CoglDisplay *display = g_slice_new0 (CoglDisplay);
CoglError *error = NULL;
GError *error = NULL;
_cogl_init ();
@@ -119,7 +119,7 @@ void
cogl_display_set_onscreen_template (CoglDisplay *display,
CoglOnscreenTemplate *onscreen_template)
{
_COGL_RETURN_IF_FAIL (display->setup == FALSE);
g_return_if_fail (display->setup == FALSE);
if (onscreen_template)
cogl_object_ref (onscreen_template);
@@ -137,7 +137,7 @@ cogl_display_set_onscreen_template (CoglDisplay *display,
gboolean
cogl_display_setup (CoglDisplay *display,
CoglError **error)
GError **error)
{
const CoglWinsysVtable *winsys;
@@ -158,7 +158,7 @@ void
cogl_wayland_display_set_compositor_display (CoglDisplay *display,
struct wl_display *wayland_display)
{
_COGL_RETURN_IF_FAIL (display->setup == FALSE);
g_return_if_fail (display->setup == FALSE);
display->wayland_compositor_display = wayland_display;
}

View File

@@ -158,7 +158,7 @@ cogl_display_set_onscreen_template (CoglDisplay *display,
/**
* cogl_display_setup:
* @display: a #CoglDisplay
* @error: return location for a #CoglError
* @error: return location for a #GError
*
* Explicitly sets up the given @display object. Use of this api is
* optional since Cogl will internally setup the display if not done
@@ -188,7 +188,7 @@ cogl_display_set_onscreen_template (CoglDisplay *display,
*/
gboolean
cogl_display_setup (CoglDisplay *display,
CoglError **error);
GError **error);
/**
* cogl_is_display:

View File

@@ -58,11 +58,11 @@ struct _CoglDriverVtable
gboolean
(* update_features) (CoglContext *context,
CoglError **error);
GError **error);
gboolean
(* offscreen_allocate) (CoglOffscreen *offscreen,
CoglError **error);
GError **error);
void
(* offscreen_free) (CoglOffscreen *offscreen);
@@ -118,7 +118,7 @@ struct _CoglDriverVtable
int y,
CoglReadPixelsFlags source,
CoglBitmap *bitmap,
CoglError **error);
GError **error);
/* Destroys any driver specific resources associated with the given
* 2D texture. */
@@ -146,7 +146,7 @@ struct _CoglDriverVtable
* to the configured size and format of the texture */
gboolean
(* texture_2d_allocate) (CoglTexture *tex,
CoglError **error);
GError **error);
/* Initialize the specified region of storage of the given texture
* with the contents of the specified framebuffer region
@@ -190,7 +190,7 @@ struct _CoglDriverVtable
int dst_x,
int dst_y,
int level,
CoglError **error);
GError **error);
gboolean
(* texture_2d_is_get_data_supported) (CoglTexture2D *tex_2d);
@@ -239,7 +239,7 @@ struct _CoglDriverVtable
size_t size,
CoglBufferAccess access,
CoglBufferMapHint hints,
CoglError **error);
GError **error);
/* Unmaps a buffer */
void
@@ -252,7 +252,7 @@ struct _CoglDriverVtable
unsigned int offset,
const void *data,
unsigned int size,
CoglError **error);
GError **error);
};
#define COGL_DRIVER_ERROR (_cogl_driver_error_quark ())

View File

@@ -1,57 +0,0 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2012 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __COGL_ERROR_PRIVATE_H__
#define __COGL_ERROR_PRIVATE_H__
#include "cogl-error.h"
void
_cogl_set_error (CoglError **error,
uint32_t domain,
int code,
const char *format,
...) G_GNUC_PRINTF (4, 5);
void
_cogl_set_error_literal (CoglError **error,
uint32_t domain,
int code,
const char *message);
void
_cogl_propagate_error (CoglError **dest,
CoglError *src);
void
_cogl_propagate_gerror (CoglError **dest,
GError *src);
#define _cogl_clear_error(X) g_clear_error ((GError **)X)
#endif /* __COGL_ERROR_PRIVATE_H__ */

View File

@@ -1,126 +0,0 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2011 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
*/
#include "cogl-config.h"
#include "cogl-types.h"
#include "cogl-util.h"
#include "cogl-error-private.h"
#include <glib.h>
void
cogl_error_free (CoglError *error)
{
g_error_free ((GError *)error);
}
CoglError *
cogl_error_copy (CoglError *error)
{
return (CoglError *)g_error_copy ((GError *)error);
}
gboolean
cogl_error_matches (CoglError *error,
uint32_t domain,
int code)
{
return g_error_matches ((GError *)error, domain, code);
}
#define ERROR_OVERWRITTEN_WARNING \
"CoglError set over the top of a previous CoglError or " \
"uninitialized memory.\nThis indicates a bug in someone's " \
"code. You must ensure an error is NULL before it's set.\n" \
"The overwriting error message was: %s"
void
_cogl_set_error (CoglError **error,
uint32_t domain,
int code,
const char *format,
...)
{
GError *new;
va_list args;
va_start (args, format);
if (error == NULL)
{
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
va_end (args);
return;
}
new = g_error_new_valist (domain, code, format, args);
va_end (args);
if (*error == NULL)
*error = (CoglError *)new;
else
g_warning (ERROR_OVERWRITTEN_WARNING, new->message);
}
void
_cogl_set_error_literal (CoglError **error,
uint32_t domain,
int code,
const char *message)
{
_cogl_set_error (error, domain, code, "%s", message);
}
void
_cogl_propagate_error (CoglError **dest,
CoglError *src)
{
_COGL_RETURN_IF_FAIL (src != NULL);
if (dest == NULL)
{
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, "%s", src->message);
cogl_error_free (src);
}
else if (*dest)
g_warning (ERROR_OVERWRITTEN_WARNING, src->message);
else
*dest = src;
}
void
_cogl_propagate_gerror (CoglError **dest,
GError *src)
{
_cogl_propagate_error (dest, (CoglError *) src);
}

View File

@@ -1,169 +0,0 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2012 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION)
#error "Only <cogl/cogl.h> can be included directly."
#endif
#ifndef __COGL_ERROR_H__
#define __COGL_ERROR_H__
#include "cogl-types.h"
G_BEGIN_DECLS
/**
* SECTION:cogl-error
* @short_description: A way for Cogl to throw exceptions
*
* As a general rule Cogl shields non-recoverable errors from
* developers, such as most heap allocation failures (unless for
* exceptionally large resources which we might reasonably expect to
* fail) and this reduces the burden on developers.
*
* There are some Cogl apis though that can fail for exceptional
* reasons that can also potentially be recovered from at runtime
* and for these apis we use a standard convention for reporting
* runtime recoverable errors.
*
* As an example if we look at the cogl_context_new() api which
* takes an error argument:
* |[
* CoglContext *
* cogl_context_new (CoglDisplay *display, CoglError **error);
* ]|
*
* A caller interested in catching any runtime error when creating a
* new #CoglContext would pass the address of a #CoglError pointer
* that has first been initialized to %NULL as follows:
*
* |[
* CoglError *error = NULL;
* CoglContext *context;
*
* context = cogl_context_new (NULL, &error);
* ]|
*
* The return status should usually be enough to determine if there
* was an error set (in this example we can check if context == %NULL)
* but if it's not possible to tell from the function's return status
* you can instead look directly at the error pointer which you
* initialized to %NULL. In this example we now check the error,
* report any error to the user, free the error and then simply
* abort without attempting to recover.
*
* |[
* if (context == NULL)
* {
* fprintf (stderr, "Failed to create a Cogl context: %s\n",
* error->message);
* cogl_error_free (error);
* abort ();
* }
* ]|
*
* All Cogl APIs that accept an error argument can also be passed a
* %NULL pointer. In this case if an exceptional error condition is hit
* then Cogl will simply log the error message and abort the
* application. This can be compared to language execeptions where the
* developer has not attempted to catch the exception. This means the
* above example is essentially redundant because it's what Cogl would
* have done automatically and so, similarly, if your application has
* no way to recover from a particular error you might just as well
* pass a %NULL #CoglError pointer to save a bit of typing.
*
* <note>If you are used to using the GLib API you will probably
* recognize that #CoglError is just like a #GError. In fact if Cogl
* has been built with --enable-glib then it is safe to cast a
* #CoglError to a #GError.</note>
*
* <note>An important detail to be aware of if you are used to using
* GLib's GError API is that Cogl deviates from the GLib GError
* conventions in one noteable way which is that a %NULL error pointer
* does not mean you want to ignore the details of an error, it means
* you are not trying to catch any exceptional errors the function might
* throw which will result in the program aborting with a log message
* if an error is thrown.</note>
*/
#define CoglError GError
/**
* cogl_error_free:
* @error: A #CoglError thrown by the Cogl api
*
* Frees a #CoglError and associated resources.
*/
void
cogl_error_free (CoglError *error);
/**
* cogl_error_copy:
* @error: A #CoglError thrown by the Cogl api
*
* Makes a copy of @error which can later be freed using
* cogl_error_free().
*
* Return value: A newly allocated #CoglError initialized to match the
* contents of @error.
*/
CoglError *
cogl_error_copy (CoglError *error);
/**
* cogl_error_matches:
* @error: A #CoglError thrown by the Cogl api or %NULL
* @domain: The error domain
* @code: The error code
*
* Returns %TRUE if error matches @domain and @code, %FALSE otherwise.
* In particular, when error is %NULL, FALSE will be returned.
*
* Return value: whether the @error corresponds to the given @domain
* and @code.
*/
gboolean
cogl_error_matches (CoglError *error,
uint32_t domain,
int code);
/**
* COGL_GLIB_ERROR:
* @COGL_ERROR: A #CoglError thrown by the Cogl api or %NULL
*
* Simply casts a #CoglError to a #CoglError
*
* If Cogl is built with GLib support then it can safely be assumed
* that a CoglError is a GError and can be used directly with the
* GError api.
*/
#define COGL_GLIB_ERROR(COGL_ERROR) ((CoglError *)COGL_ERROR)
G_END_DECLS
#endif /* __COGL_ERROR_H__ */

View File

@@ -164,8 +164,8 @@ cogl_euler_equal (const void *v1, const void *v2)
const CoglEuler *a = v1;
const CoglEuler *b = v2;
_COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE);
_COGL_RETURN_VAL_IF_FAIL (v2 != NULL, FALSE);
g_return_val_if_fail (v1 != NULL, FALSE);
g_return_val_if_fail (v2 != NULL, FALSE);
if (v1 == v2)
return TRUE;

View File

@@ -497,7 +497,7 @@ _cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
int y,
CoglReadPixelsFlags source,
CoglBitmap *bitmap,
CoglError **error);
GError **error);
/*
* _cogl_framebuffer_get_stencil_bits:

View File

@@ -50,7 +50,6 @@
#include "cogl1-context.h"
#include "cogl-private.h"
#include "cogl-primitives-private.h"
#include "cogl-error-private.h"
#include "cogl-gtype-private.h"
#include "driver/gl/cogl-texture-gl-private.h"
#include "winsys/cogl-winsys-private.h"
@@ -445,11 +444,11 @@ ensure_size_initialized (CoglFramebuffer *framebuffer)
{
/* Currently we assume the size is always initialized for
* onscreen framebuffers. */
_COGL_RETURN_IF_FAIL (cogl_is_offscreen (framebuffer));
g_return_if_fail (cogl_is_offscreen (framebuffer));
/* We also assume the size would have been initialized if the
* framebuffer were allocated. */
_COGL_RETURN_IF_FAIL (!framebuffer->allocated);
g_return_if_fail (!framebuffer->allocated);
cogl_framebuffer_allocate (framebuffer, NULL);
}
@@ -493,7 +492,7 @@ cogl_framebuffer_set_viewport (CoglFramebuffer *framebuffer,
{
CoglContext *context = framebuffer->context;
_COGL_RETURN_IF_FAIL (width > 0 && height > 0);
g_return_if_fail (width > 0 && height > 0);
if (framebuffer->viewport_x == x &&
framebuffer->viewport_y == y &&
@@ -618,7 +617,7 @@ _cogl_offscreen_new_with_texture_full (CoglTexture *texture,
CoglFramebuffer *fb;
CoglOffscreen *ret;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_texture (texture), NULL);
g_return_val_if_fail (cogl_is_texture (texture), NULL);
offscreen = g_new0 (CoglOffscreen, 1);
offscreen->texture = cogl_object_ref (texture);
@@ -650,12 +649,12 @@ CoglOffscreen *
cogl_offscreen_new_to_texture (CoglTexture *texture)
{
CoglOffscreen *ret = _cogl_offscreen_new_with_texture_full (texture, 0, 0);
CoglError *error = NULL;
GError *error = NULL;
if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (ret), &error))
{
cogl_object_unref (ret);
cogl_error_free (error);
g_error_free (error);
ret = NULL;
}
@@ -696,7 +695,7 @@ _cogl_offscreen_free (CoglOffscreen *offscreen)
gboolean
cogl_framebuffer_allocate (CoglFramebuffer *framebuffer,
CoglError **error)
GError **error)
{
CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer);
@@ -709,10 +708,10 @@ cogl_framebuffer_allocate (CoglFramebuffer *framebuffer,
{
if (framebuffer->config.depth_texture_enabled)
{
_cogl_set_error (error, COGL_FRAMEBUFFER_ERROR,
COGL_FRAMEBUFFER_ERROR_ALLOCATE,
"Can't allocate onscreen framebuffer with a "
"texture based depth buffer");
g_set_error_literal (error, COGL_FRAMEBUFFER_ERROR,
COGL_FRAMEBUFFER_ERROR_ALLOCATE,
"Can't allocate onscreen framebuffer with a "
"texture based depth buffer");
return FALSE;
}
@@ -732,9 +731,9 @@ cogl_framebuffer_allocate (CoglFramebuffer *framebuffer,
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN))
{
_cogl_set_error (error, COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_UNSUPPORTED,
"Offscreen framebuffers not supported by system");
g_set_error_literal (error, COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_UNSUPPORTED,
"Offscreen framebuffers not supported by system");
return FALSE;
}
@@ -745,10 +744,9 @@ cogl_framebuffer_allocate (CoglFramebuffer *framebuffer,
* determine whether a texture needs slicing... */
if (cogl_texture_is_sliced (offscreen->texture))
{
_cogl_set_error (error, COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_UNSUPPORTED,
"Can't create offscreen framebuffer from "
"sliced texture");
g_set_error (error, COGL_SYSTEM_ERROR, COGL_SYSTEM_ERROR_UNSUPPORTED,
"Can't create offscreen framebuffer from "
"sliced texture");
return FALSE;
}
@@ -1069,7 +1067,7 @@ void
cogl_framebuffer_set_depth_texture_enabled (CoglFramebuffer *framebuffer,
gboolean enabled)
{
_COGL_RETURN_IF_FAIL (!framebuffer->allocated);
g_return_if_fail (!framebuffer->allocated);
framebuffer->config.depth_texture_enabled = enabled;
}
@@ -1087,7 +1085,7 @@ cogl_framebuffer_get_depth_texture (CoglFramebuffer *framebuffer)
if (!cogl_framebuffer_allocate (framebuffer, NULL))
return NULL;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_offscreen (framebuffer), NULL);
g_return_val_if_fail (cogl_is_offscreen (framebuffer), NULL);
return COGL_OFFSCREEN(framebuffer)->depth_texture;
}
@@ -1104,7 +1102,7 @@ void
cogl_framebuffer_set_samples_per_pixel (CoglFramebuffer *framebuffer,
int samples_per_pixel)
{
_COGL_RETURN_IF_FAIL (!framebuffer->allocated);
g_return_if_fail (!framebuffer->allocated);
framebuffer->config.samples_per_pixel = samples_per_pixel;
}
@@ -1158,7 +1156,7 @@ cogl_framebuffer_resolve_samples_region (CoglFramebuffer *framebuffer,
CoglContext *
cogl_framebuffer_get_context (CoglFramebuffer *framebuffer)
{
_COGL_RETURN_VAL_IF_FAIL (framebuffer != NULL, NULL);
g_return_val_if_fail (framebuffer != NULL, NULL);
return framebuffer->context;
}
@@ -1212,7 +1210,7 @@ _cogl_framebuffer_try_fast_read_pixel (CoglFramebuffer *framebuffer,
y < framebuffer->clear_clip_y1)
{
uint8_t *pixel;
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
/* we currently only care about cases where the premultiplied or
* unpremultipled colors are equivalent... */
@@ -1225,7 +1223,7 @@ _cogl_framebuffer_try_fast_read_pixel (CoglFramebuffer *framebuffer,
&ignore_error);
if (pixel == NULL)
{
cogl_error_free (ignore_error);
g_error_free (ignore_error);
return FALSE;
}
@@ -1248,14 +1246,14 @@ _cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
int y,
CoglReadPixelsFlags source,
CoglBitmap *bitmap,
CoglError **error)
GError **error)
{
CoglContext *ctx;
int width;
int height;
_COGL_RETURN_VAL_IF_FAIL (source & COGL_READ_PIXELS_COLOR_BUFFER, FALSE);
_COGL_RETURN_VAL_IF_FAIL (cogl_is_framebuffer (framebuffer), FALSE);
g_return_val_if_fail (source & COGL_READ_PIXELS_COLOR_BUFFER, FALSE);
g_return_val_if_fail (cogl_is_framebuffer (framebuffer), FALSE);
if (!cogl_framebuffer_allocate (framebuffer, error))
return FALSE;
@@ -1299,13 +1297,12 @@ cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
CoglReadPixelsFlags source,
CoglBitmap *bitmap)
{
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
gboolean status =
_cogl_framebuffer_read_pixels_into_bitmap (framebuffer,
x, y, source, bitmap,
&ignore_error);
if (!status)
cogl_error_free (ignore_error);
g_clear_error (&ignore_error);
return status;
}
@@ -1355,16 +1352,16 @@ _cogl_blit_framebuffer (CoglFramebuffer *src,
{
CoglContext *ctx = src->context;
_COGL_RETURN_IF_FAIL (_cogl_has_private_feature
(ctx, COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT));
g_return_if_fail (_cogl_has_private_feature
(ctx, COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT));
/* We can only support blitting between offscreen buffers because
otherwise we would need to mirror the image and GLES2.0 doesn't
support this */
_COGL_RETURN_IF_FAIL (cogl_is_offscreen (src));
_COGL_RETURN_IF_FAIL (cogl_is_offscreen (dest));
g_return_if_fail (cogl_is_offscreen (src));
g_return_if_fail (cogl_is_offscreen (dest));
/* The buffers must be the same format */
_COGL_RETURN_IF_FAIL (src->internal_format == dest->internal_format);
g_return_if_fail (src->internal_format == dest->internal_format);
/* Make sure the current framebuffers are bound. We explicitly avoid
flushing the clip state so we can bind our own empty state */
@@ -1399,7 +1396,7 @@ cogl_framebuffer_discard_buffers (CoglFramebuffer *framebuffer,
{
CoglContext *ctx = framebuffer->context;
_COGL_RETURN_IF_FAIL (buffers & COGL_BUFFER_BIT_COLOR);
g_return_if_fail (buffers & COGL_BUFFER_BIT_COLOR);
ctx->driver_vtable->framebuffer_discard_buffers (framebuffer, buffers);
}

View File

@@ -106,7 +106,7 @@ GType cogl_framebuffer_get_gtype (void);
/**
* cogl_framebuffer_allocate:
* @framebuffer: A #CoglFramebuffer
* @error: A pointer to a #CoglError for returning exceptions.
* @error: A pointer to a #GError for returning exceptions.
*
* Explicitly allocates a configured #CoglFramebuffer allowing developers to
* check and handle any errors that might arise from an unsupported
@@ -125,7 +125,7 @@ GType cogl_framebuffer_get_gtype (void);
*/
gboolean
cogl_framebuffer_allocate (CoglFramebuffer *framebuffer,
CoglError **error);
GError **error);
/**
* cogl_framebuffer_get_width:

View File

@@ -48,7 +48,6 @@
#include "cogl-swap-chain-private.h"
#include "cogl-texture-2d-gl.h"
#include "cogl-texture-2d-private.h"
#include "cogl-error-private.h"
#include "cogl-gtype-private.h"
#include "driver/gl/cogl-framebuffer-gl-private.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
@@ -159,10 +158,10 @@ replace_token (char *string,
/* NOTE: this assumes token and replacement are the same length */
while ((token_pos = _cogl_util_memmem (last_pos,
end - last_pos,
token,
token_length)))
while ((token_pos = memmem (last_pos,
end - last_pos,
token,
token_length)))
{
/* Make sure this isn't in the middle of some longer token */
if ((token_pos <= string ||
@@ -908,10 +907,10 @@ gl_get_shader_source_wrapper (GLuint shader,
/* Strip out the wrapper snippet we added when the source was
* specified */
wrapper_start = _cogl_util_memmem (source,
copy_length,
wrapper_marker,
sizeof (wrapper_marker) - 1);
wrapper_start = memmem (source,
copy_length,
wrapper_marker,
sizeof (wrapper_marker) - 1);
if (wrapper_start)
{
length = wrapper_start - source;
@@ -1566,16 +1565,16 @@ free_texture_object_data (CoglGLES2TextureObjectData *data)
}
CoglGLES2Context *
cogl_gles2_context_new (CoglContext *ctx, CoglError **error)
cogl_gles2_context_new (CoglContext *ctx, GError **error)
{
CoglGLES2Context *gles2_ctx;
const CoglWinsysVtable *winsys;
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_GLES2_CONTEXT))
{
_cogl_set_error (error, COGL_GLES2_CONTEXT_ERROR,
COGL_GLES2_CONTEXT_ERROR_UNSUPPORTED,
"Backend doesn't support creating GLES2 contexts");
g_set_error_literal (error, COGL_GLES2_CONTEXT_ERROR,
COGL_GLES2_CONTEXT_ERROR_UNSUPPORTED,
"Backend doesn't support creating GLES2 contexts");
return NULL;
}
@@ -1693,11 +1692,11 @@ cogl_gles2_context_get_vtable (CoglGLES2Context *gles2_ctx)
static CoglGLES2Offscreen *
_cogl_gles2_offscreen_allocate (CoglOffscreen *offscreen,
CoglGLES2Context *gles2_context,
CoglError **error)
GError **error)
{
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (offscreen);
const CoglWinsysVtable *winsys;
CoglError *internal_error = NULL;
GError *internal_error = NULL;
CoglGLES2Offscreen *gles2_offscreen;
int level_width;
int level_height;
@@ -1722,10 +1721,10 @@ _cogl_gles2_offscreen_allocate (CoglOffscreen *offscreen,
{
winsys->restore_context (framebuffer->context);
cogl_error_free (internal_error);
_cogl_set_error (error, COGL_FRAMEBUFFER_ERROR,
COGL_FRAMEBUFFER_ERROR_ALLOCATE,
"Failed to bind gles2 context to create framebuffer");
g_error_free (internal_error);
g_set_error_literal (error, COGL_FRAMEBUFFER_ERROR,
COGL_FRAMEBUFFER_ERROR_ALLOCATE,
"Failed to bind gles2 context to create framebuffer");
return NULL;
}
@@ -1751,9 +1750,9 @@ _cogl_gles2_offscreen_allocate (CoglOffscreen *offscreen,
g_slice_free (CoglGLES2Offscreen, gles2_offscreen);
_cogl_set_error (error, COGL_FRAMEBUFFER_ERROR,
COGL_FRAMEBUFFER_ERROR_ALLOCATE,
"Failed to create an OpenGL framebuffer object");
g_set_error_literal (error, COGL_FRAMEBUFFER_ERROR,
COGL_FRAMEBUFFER_ERROR_ALLOCATE,
"Failed to create an OpenGL framebuffer object");
return NULL;
}
@@ -1781,12 +1780,12 @@ cogl_push_gles2_context (CoglContext *ctx,
CoglGLES2Context *gles2_ctx,
CoglFramebuffer *read_buffer,
CoglFramebuffer *write_buffer,
CoglError **error)
GError **error)
{
const CoglWinsysVtable *winsys = ctx->display->renderer->winsys_vtable;
CoglError *internal_error = NULL;
GError *internal_error = NULL;
_COGL_RETURN_VAL_IF_FAIL (gles2_ctx != NULL, FALSE);
g_return_val_if_fail (gles2_ctx != NULL, FALSE);
/* The read/write buffers are properties of the gles2 context and we
* don't currently track the read/write buffers as part of the stack
@@ -1863,10 +1862,10 @@ cogl_push_gles2_context (CoglContext *ctx,
{
winsys->restore_context (ctx);
cogl_error_free (internal_error);
_cogl_set_error (error, COGL_GLES2_CONTEXT_ERROR,
COGL_GLES2_CONTEXT_ERROR_DRIVER,
"Driver failed to make GLES2 context current");
g_error_free (internal_error);
g_set_error_literal (error, COGL_GLES2_CONTEXT_ERROR,
COGL_GLES2_CONTEXT_ERROR_DRIVER,
"Driver failed to make GLES2 context current");
return FALSE;
}
@@ -1923,7 +1922,7 @@ cogl_pop_gles2_context (CoglContext *ctx)
CoglGLES2Context *gles2_ctx;
const CoglWinsysVtable *winsys = ctx->display->renderer->winsys_vtable;
_COGL_RETURN_IF_FAIL (ctx->gles2_context_stack.length > 0);
g_return_if_fail (ctx->gles2_context_stack.length > 0);
g_queue_pop_tail (&ctx->gles2_context_stack);

View File

@@ -189,7 +189,7 @@ typedef enum /*< prefix=COGL_GLES2_CONTEXT_ERROR >*/
/**
* cogl_gles2_context_new:
* @ctx: A #CoglContext
* @error: A pointer to a #CoglError for returning exceptions
* @error: A pointer to a #GError for returning exceptions
*
* Allocates a new OpenGLES 2.0 context that can be used to render to
* #CoglOffscreen framebuffers (Rendering to #CoglOnscreen
@@ -216,7 +216,7 @@ typedef enum /*< prefix=COGL_GLES2_CONTEXT_ERROR >*/
* Stability: unstable
*/
CoglGLES2Context *
cogl_gles2_context_new (CoglContext *ctx, CoglError **error);
cogl_gles2_context_new (CoglContext *ctx, GError **error);
/**
* cogl_gles2_context_get_vtable:
@@ -248,7 +248,7 @@ cogl_gles2_context_get_vtable (CoglGLES2Context *gles2_ctx);
* @write_buffer: A #CoglFramebuffer to access for drawing operations
* such as glDrawArrays. (must be a #CoglOffscreen
* framebuffer currently)
* @error: A pointer to a #CoglError for returning exceptions
* @error: A pointer to a #GError for returning exceptions
*
* Pushes the given @gles2_ctx onto a stack associated with @ctx so
* that the OpenGLES 2.0 api can be used instead of the Cogl
@@ -272,7 +272,7 @@ cogl_push_gles2_context (CoglContext *ctx,
CoglGLES2Context *gles2_ctx,
CoglFramebuffer *read_buffer,
CoglFramebuffer *write_buffer,
CoglError **error);
GError **error);
/**
* cogl_pop_gles2_context:

View File

@@ -91,7 +91,7 @@ cogl_indices_new (CoglContext *context,
CoglIndexBuffer *index_buffer = cogl_index_buffer_new (context, buffer_bytes);
CoglBuffer *buffer = COGL_BUFFER (index_buffer);
CoglIndices *indices;
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
_cogl_buffer_set_data (buffer,
0,
@@ -100,7 +100,7 @@ cogl_indices_new (CoglContext *context,
&ignore_error);
if (ignore_error)
{
cogl_error_free (ignore_error);
g_error_free (ignore_error);
cogl_object_unref (index_buffer);
return NULL;
}
@@ -120,15 +120,15 @@ cogl_indices_get_buffer (CoglIndices *indices)
CoglIndicesType
cogl_indices_get_type (CoglIndices *indices)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_indices (indices),
COGL_INDICES_TYPE_UNSIGNED_BYTE);
g_return_val_if_fail (cogl_is_indices (indices),
COGL_INDICES_TYPE_UNSIGNED_BYTE);
return indices->type;
}
size_t
cogl_indices_get_offset (CoglIndices *indices)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_indices (indices), 0);
g_return_val_if_fail (cogl_is_indices (indices), 0);
return indices->offset;
}
@@ -149,7 +149,7 @@ void
cogl_indices_set_offset (CoglIndices *indices,
size_t offset)
{
_COGL_RETURN_IF_FAIL (cogl_is_indices (indices));
g_return_if_fail (cogl_is_indices (indices));
if (G_UNLIKELY (indices->immutable_ref))
warn_about_midscene_changes ();
@@ -167,7 +167,7 @@ _cogl_indices_free (CoglIndices *indices)
CoglIndices *
_cogl_indices_immutable_ref (CoglIndices *indices)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_indices (indices), NULL);
g_return_val_if_fail (cogl_is_indices (indices), NULL);
indices->immutable_ref++;
_cogl_buffer_immutable_ref (COGL_BUFFER (indices->buffer));
@@ -177,8 +177,8 @@ _cogl_indices_immutable_ref (CoglIndices *indices)
void
_cogl_indices_immutable_unref (CoglIndices *indices)
{
_COGL_RETURN_IF_FAIL (cogl_is_indices (indices));
_COGL_RETURN_IF_FAIL (indices->immutable_ref > 0);
g_return_if_fail (cogl_is_indices (indices));
g_return_if_fail (indices->immutable_ref > 0);
indices->immutable_ref--;
_cogl_buffer_immutable_unref (COGL_BUFFER (indices->buffer));

View File

@@ -1786,7 +1786,7 @@ _cogl_journal_try_read_pixel (CoglJournal *journal,
float poly[16];
CoglFramebuffer *framebuffer = journal->framebuffer;
uint8_t *pixel;
CoglError *ignore_error;
GError *ignore_error;
entry_to_screen_polygon (framebuffer, entry, vertices, poly);
@@ -1831,7 +1831,7 @@ _cogl_journal_try_read_pixel (CoglJournal *journal,
&ignore_error);
if (pixel == NULL)
{
cogl_error_free (ignore_error);
g_error_free (ignore_error);
return FALSE;
}

View File

@@ -396,10 +396,10 @@ cogl_matrix_stack_pop (CoglMatrixStack *stack)
CoglMatrixEntry *old_top;
CoglMatrixEntry *new_top;
_COGL_RETURN_IF_FAIL (stack != NULL);
g_return_if_fail (stack != NULL);
old_top = stack->last_entry;
_COGL_RETURN_IF_FAIL (old_top != NULL);
g_return_if_fail (old_top != NULL);
/* To pop we are moving the top of the stack to the old top's parent
* node. The stack always needs to have a reference to the top entry

View File

@@ -376,7 +376,7 @@ _cogl_matrix_prefix_print (const char *prefix, const CoglMatrix *matrix)
{
if (!(matrix->flags & MAT_DIRTY_TYPE))
{
_COGL_RETURN_IF_FAIL (matrix->type < COGL_MATRIX_N_TYPES);
g_return_if_fail (matrix->type < COGL_MATRIX_N_TYPES);
g_print ("%sMatrix type: %s, flags: %x\n",
prefix, types[matrix->type], (int)matrix->flags);
}
@@ -1942,8 +1942,8 @@ cogl_matrix_equal (const void *v1, const void *v2)
const CoglMatrix *a = v1;
const CoglMatrix *b = v2;
_COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE);
_COGL_RETURN_VAL_IF_FAIL (v2 != NULL, FALSE);
g_return_val_if_fail (v1 != NULL, FALSE);
g_return_val_if_fail (v2 != NULL, FALSE);
/* We want to avoid having a fuzzy _equal() function (e.g. that uses
* an arbitrary epsilon value) since this function noteably conforms
@@ -2167,7 +2167,7 @@ cogl_matrix_transform_points (const CoglMatrix *matrix,
int n_points)
{
/* The results of transforming always have three components... */
_COGL_RETURN_IF_FAIL (stride_out >= sizeof (Point3f));
g_return_if_fail (stride_out >= sizeof (Point3f));
if (n_components == 2)
_cogl_matrix_transform_points_f2 (matrix,
@@ -2176,7 +2176,7 @@ cogl_matrix_transform_points (const CoglMatrix *matrix,
n_points);
else
{
_COGL_RETURN_IF_FAIL (n_components == 3);
g_return_if_fail (n_components == 3);
_cogl_matrix_transform_points_f3 (matrix,
stride_in, points_in,
@@ -2206,7 +2206,7 @@ cogl_matrix_project_points (const CoglMatrix *matrix,
n_points);
else
{
_COGL_RETURN_IF_FAIL (n_components == 4);
g_return_if_fail (n_components == 4);
_cogl_matrix_project_points_f4 (matrix,
stride_in, points_in,

View File

@@ -36,7 +36,6 @@
#include <cogl/cogl-texture.h>
#include <cogl/cogl-meta-texture.h>
#include <cogl/cogl-error-private.h>
#include <cogl/cogl-frame-info-private.h>
#include <cogl/cogl-renderer-private.h>
#if defined (COGL_HAS_EGL_SUPPORT)

View File

@@ -84,7 +84,7 @@ _cogl_pipeline_node_unparent_real (CoglNode *node)
if (parent == NULL)
return;
_COGL_RETURN_IF_FAIL (!_cogl_list_empty (&parent->children));
g_return_if_fail (!_cogl_list_empty (&parent->children));
_cogl_list_remove (&node->link);

View File

@@ -46,7 +46,7 @@ cogl_object_ref (void *object)
{
CoglObject *obj = object;
_COGL_RETURN_VAL_IF_FAIL (object != NULL, NULL);
g_return_val_if_fail (object != NULL, NULL);
obj->ref_count++;
return object;
@@ -63,8 +63,8 @@ _cogl_object_default_unref (void *object)
{
CoglObject *obj = object;
_COGL_RETURN_IF_FAIL (object != NULL);
_COGL_RETURN_IF_FAIL (obj->ref_count > 0);
g_return_if_fail (object != NULL);
g_return_if_fail (obj->ref_count > 0);
if (--obj->ref_count < 1)
{
@@ -109,7 +109,7 @@ cogl_object_unref (void *obj)
{
void (* unref_func) (void *);
_COGL_RETURN_IF_FAIL (obj != NULL);
g_return_if_fail (obj != NULL);
unref_func = ((CoglObject *) obj)->klass->virt_unref;
unref_func (obj);

View File

@@ -90,7 +90,7 @@ GType cogl_offscreen_get_gtype (void);
* message. If you need to be able to catch such exceptions at runtime
* then you can explicitly allocate your framebuffer when you have
* finished configuring it by calling cogl_framebuffer_allocate() and
* passing in a #CoglError argument to catch any exceptions.
* passing in a #GError argument to catch any exceptions.
*
* Return value: (transfer full): a newly instantiated #CoglOffscreen
* framebuffer.

View File

@@ -165,7 +165,7 @@ _cogl_onscreen_free (CoglOnscreen *onscreen)
framebuffer->context->window_buffer = NULL;
winsys->onscreen_deinit (onscreen);
_COGL_RETURN_IF_FAIL (onscreen->winsys == NULL);
g_return_if_fail (onscreen->winsys == NULL);
/* Chain up to parent */
_cogl_framebuffer_free (framebuffer);
@@ -304,7 +304,7 @@ cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
const CoglWinsysVtable *winsys;
CoglFrameInfo *info;
_COGL_RETURN_IF_FAIL (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN);
g_return_if_fail (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN);
info = _cogl_frame_info_new ();
info->frame_counter = onscreen->frame_counter;
@@ -354,7 +354,7 @@ cogl_onscreen_swap_region (CoglOnscreen *onscreen,
const CoglWinsysVtable *winsys;
CoglFrameInfo *info;
_COGL_RETURN_IF_FAIL (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN);
g_return_if_fail (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN);
info = _cogl_frame_info_new ();
info->frame_counter = onscreen->frame_counter;
@@ -367,7 +367,7 @@ cogl_onscreen_swap_region (CoglOnscreen *onscreen,
/* This should only be called if the winsys advertises
COGL_WINSYS_FEATURE_SWAP_REGION */
_COGL_RETURN_IF_FAIL (winsys->onscreen_swap_region != NULL);
g_return_if_fail (winsys->onscreen_swap_region != NULL);
winsys->onscreen_swap_region (COGL_ONSCREEN (framebuffer),
rectangles,
@@ -402,7 +402,7 @@ cogl_onscreen_get_buffer_age (CoglOnscreen *onscreen)
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
const CoglWinsysVtable *winsys;
_COGL_RETURN_VAL_IF_FAIL (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN, 0);
g_return_val_if_fail (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN, 0);
winsys = _cogl_framebuffer_get_winsys (framebuffer);
@@ -421,7 +421,7 @@ cogl_x11_onscreen_set_foreign_window_xid (CoglOnscreen *onscreen,
{
/* We don't wan't applications to get away with being lazy here and not
* passing an update callback... */
_COGL_RETURN_IF_FAIL (update);
g_return_if_fail (update);
onscreen->foreign_xid = xid;
onscreen->foreign_update_mask_callback = update;
@@ -440,7 +440,7 @@ cogl_x11_onscreen_get_window_xid (CoglOnscreen *onscreen)
const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer);
/* This should only be called for x11 onscreens */
_COGL_RETURN_VAL_IF_FAIL (winsys->onscreen_x11_get_window_xid != NULL, 0);
g_return_val_if_fail (winsys->onscreen_x11_get_window_xid != NULL, 0);
return winsys->onscreen_x11_get_window_xid (onscreen);
}
@@ -480,7 +480,7 @@ void
cogl_onscreen_remove_frame_callback (CoglOnscreen *onscreen,
CoglFrameClosure *closure)
{
_COGL_RETURN_IF_FAIL (closure);
g_return_if_fail (closure);
_cogl_closure_disconnect (closure);
}
@@ -552,7 +552,7 @@ cogl_onscreen_remove_swap_buffers_callback (CoglOnscreen *onscreen,
CoglFrameClosure *closure = g_hash_table_lookup (ctx->swap_callback_closures,
GINT_TO_POINTER (id));
_COGL_RETURN_IF_FAIL (closure);
g_return_if_fail (closure);
cogl_onscreen_remove_frame_callback (onscreen, closure);
}
@@ -692,7 +692,7 @@ void
cogl_onscreen_remove_dirty_callback (CoglOnscreen *onscreen,
CoglOnscreenDirtyClosure *closure)
{
_COGL_RETURN_IF_FAIL (closure);
g_return_if_fail (closure);
_cogl_closure_disconnect (closure);
}

View File

@@ -41,7 +41,6 @@
#include "cogl-snippet-private.h"
#include "cogl-texture-private.h"
#include "cogl-pipeline-layer-state-private.h"
#include "cogl-error-private.h"
#include "string.h"
#if 0
@@ -293,7 +292,7 @@ public_to_internal_wrap_mode (CoglPipelineWrapMode mode)
static CoglPipelineWrapMode
internal_to_public_wrap_mode (CoglSamplerCacheWrapMode internal_mode)
{
_COGL_RETURN_VAL_IF_FAIL (internal_mode !=
g_return_val_if_fail (internal_mode !=
COGL_SAMPLER_CACHE_WRAP_MODE_CLAMP_TO_BORDER,
COGL_PIPELINE_WRAP_MODE_AUTOMATIC);
return (CoglPipelineWrapMode)internal_mode;
@@ -313,7 +312,7 @@ cogl_pipeline_set_layer_wrap_mode_s (CoglPipeline *pipeline,
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
/* Note: this will ensure that the layer exists, creating one if it
* doesn't already.
@@ -355,7 +354,7 @@ cogl_pipeline_set_layer_wrap_mode_t (CoglPipeline *pipeline,
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
/* Note: this will ensure that the layer exists, creating one if it
* doesn't already.
@@ -409,7 +408,7 @@ cogl_pipeline_set_layer_wrap_mode_p (CoglPipeline *pipeline,
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
/* Note: this will ensure that the layer exists, creating one if it
* doesn't already.
@@ -451,7 +450,7 @@ cogl_pipeline_set_layer_wrap_mode (CoglPipeline *pipeline,
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
/* Note: this will ensure that the layer exists, creating one if it
* doesn't already.
@@ -487,7 +486,7 @@ _cogl_pipeline_layer_get_wrap_mode_s (CoglPipelineLayer *layer)
CoglPipelineLayer *authority;
const CoglSamplerCacheEntry *sampler_state;
_COGL_RETURN_VAL_IF_FAIL (_cogl_is_pipeline_layer (layer), FALSE);
g_return_val_if_fail (_cogl_is_pipeline_layer (layer), FALSE);
/* Now find the ancestor of the layer that is the authority for the
* state we want to change */
@@ -502,7 +501,7 @@ cogl_pipeline_get_layer_wrap_mode_s (CoglPipeline *pipeline, int layer_index)
{
CoglPipelineLayer *layer;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
/* Note: this will ensure that the layer exists, creating one if it
* doesn't already.
@@ -524,7 +523,7 @@ _cogl_pipeline_layer_get_wrap_mode_t (CoglPipelineLayer *layer)
CoglPipelineLayer *authority;
const CoglSamplerCacheEntry *sampler_state;
_COGL_RETURN_VAL_IF_FAIL (_cogl_is_pipeline_layer (layer), FALSE);
g_return_val_if_fail (_cogl_is_pipeline_layer (layer), FALSE);
/* Now find the ancestor of the layer that is the authority for the
* state we want to change */
@@ -539,7 +538,7 @@ cogl_pipeline_get_layer_wrap_mode_t (CoglPipeline *pipeline, int layer_index)
{
CoglPipelineLayer *layer;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
/* Note: this will ensure that the layer exists, creating one if it
* doesn't already.
@@ -570,7 +569,7 @@ cogl_pipeline_get_layer_wrap_mode_p (CoglPipeline *pipeline, int layer_index)
{
CoglPipelineLayer *layer;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
/* Note: this will ensure that the layer exists, creating one if it
* doesn't already.
@@ -602,7 +601,7 @@ gboolean
cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline,
int layer_index,
gboolean enable,
CoglError **error)
GError **error)
{
CoglPipelineLayerState change =
COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS;
@@ -612,7 +611,7 @@ cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline,
_COGL_GET_CONTEXT (ctx, FALSE);
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
/* Don't allow point sprite coordinates to be enabled if the driver
doesn't support it */
@@ -620,11 +619,11 @@ cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline,
{
if (error)
{
_cogl_set_error (error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_UNSUPPORTED,
"Point sprite texture coordinates are enabled for "
"a layer but the GL driver does not support it.");
g_set_error_literal (error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_UNSUPPORTED,
"Point sprite texture coordinates are enabled for "
"a layer but the GL driver does not support it.");
}
else
{
@@ -706,7 +705,7 @@ cogl_pipeline_get_layer_point_sprite_coords_enabled (CoglPipeline *pipeline,
CoglPipelineLayer *layer;
CoglPipelineLayer *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
/* Note: this will ensure that the layer exists, creating one if it
* doesn't already.
@@ -799,9 +798,9 @@ cogl_pipeline_add_layer_snippet (CoglPipeline *pipeline,
int layer_index,
CoglSnippet *snippet)
{
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
_COGL_RETURN_IF_FAIL (cogl_is_snippet (snippet));
_COGL_RETURN_IF_FAIL (snippet->hook >= COGL_SNIPPET_FIRST_LAYER_HOOK);
g_return_if_fail (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_snippet (snippet));
g_return_if_fail (snippet->hook >= COGL_SNIPPET_FIRST_LAYER_HOOK);
if (snippet->hook < COGL_SNIPPET_FIRST_LAYER_FRAGMENT_HOOK)
_cogl_pipeline_layer_add_vertex_snippet (pipeline,
@@ -1029,7 +1028,7 @@ gboolean
cogl_pipeline_set_layer_combine (CoglPipeline *pipeline,
int layer_index,
const char *combine_description,
CoglError **error)
GError **error)
{
CoglPipelineLayerState state = COGL_PIPELINE_LAYER_STATE_COMBINE;
CoglPipelineLayer *authority;
@@ -1040,7 +1039,7 @@ cogl_pipeline_set_layer_combine (CoglPipeline *pipeline,
CoglBlendStringStatement *a;
int count;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
/* Note: this will ensure that the layer exists, creating one if it
* doesn't already.
@@ -1140,7 +1139,7 @@ cogl_pipeline_set_layer_combine_constant (CoglPipeline *pipeline,
CoglPipelineLayer *new;
float color_as_floats[4];
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
/* Note: this will ensure that the layer exists, creating one if it
* doesn't already.
@@ -1223,7 +1222,7 @@ _cogl_pipeline_get_layer_combine_constant (CoglPipeline *pipeline,
CoglPipelineLayer *layer;
CoglPipelineLayer *authority;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
/* Note: this will ensure that the layer exists, creating one if it
* doesn't already.
@@ -1250,7 +1249,7 @@ _cogl_pipeline_get_layer_matrix (CoglPipeline *pipeline, int layer_index)
CoglPipelineLayer *layer;
CoglPipelineLayer *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), NULL);
g_return_val_if_fail (cogl_is_pipeline (pipeline), NULL);
layer = _cogl_pipeline_get_layer (pipeline, layer_index);
@@ -1268,7 +1267,7 @@ cogl_pipeline_set_layer_matrix (CoglPipeline *pipeline,
CoglPipelineLayer *authority;
CoglPipelineLayer *new;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
/* Note: this will ensure that the layer exists, creating one if it
* doesn't already.
@@ -1330,7 +1329,7 @@ cogl_pipeline_set_layer_matrix (CoglPipeline *pipeline,
CoglTexture *
_cogl_pipeline_layer_get_texture (CoglPipelineLayer *layer)
{
_COGL_RETURN_VAL_IF_FAIL (_cogl_is_pipeline_layer (layer), NULL);
g_return_val_if_fail (_cogl_is_pipeline_layer (layer), NULL);
return _cogl_pipeline_layer_get_texture_real (layer);
}
@@ -1374,7 +1373,7 @@ _cogl_pipeline_get_layer_filters (CoglPipeline *pipeline,
CoglPipelineLayer *layer;
CoglPipelineLayer *authority;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
layer = _cogl_pipeline_get_layer (pipeline, layer_index);
@@ -1415,7 +1414,7 @@ _cogl_pipeline_layer_get_min_filter (CoglPipelineLayer *layer)
{
CoglPipelineLayer *authority;
_COGL_RETURN_VAL_IF_FAIL (_cogl_is_pipeline_layer (layer), 0);
g_return_val_if_fail (_cogl_is_pipeline_layer (layer), 0);
authority =
_cogl_pipeline_layer_get_authority (layer,
@@ -1429,7 +1428,7 @@ _cogl_pipeline_layer_get_mag_filter (CoglPipelineLayer *layer)
{
CoglPipelineLayer *authority;
_COGL_RETURN_VAL_IF_FAIL (_cogl_is_pipeline_layer (layer), 0);
g_return_val_if_fail (_cogl_is_pipeline_layer (layer), 0);
authority =
_cogl_pipeline_layer_get_authority (layer,
@@ -1451,10 +1450,10 @@ cogl_pipeline_set_layer_filters (CoglPipeline *pipeline,
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
_COGL_RETURN_IF_FAIL (mag_filter == COGL_PIPELINE_FILTER_NEAREST ||
mag_filter == COGL_PIPELINE_FILTER_LINEAR);
g_return_if_fail (mag_filter == COGL_PIPELINE_FILTER_NEAREST ||
mag_filter == COGL_PIPELINE_FILTER_LINEAR);
/* Note: this will ensure that the layer exists, creating one if it
* doesn't already.

View File

@@ -209,7 +209,7 @@ cogl_pipeline_remove_layer (CoglPipeline *pipeline,
* @layer_index: Specifies the layer you want define a combine function for
* @blend_string: A <link linkend="cogl-Blend-Strings">Cogl blend string</link>
* describing the desired texture combine function.
* @error: A #CoglError that may report parse errors or lack of GPU/driver
* @error: A #GError that may report parse errors or lack of GPU/driver
* support. May be %NULL, in which case a warning will be printed out if an
* error is encountered.
*
@@ -301,7 +301,7 @@ gboolean
cogl_pipeline_set_layer_combine (CoglPipeline *pipeline,
int layer_index,
const char *blend_string,
CoglError **error);
GError **error);
/**
* cogl_pipeline_set_layer_combine_constant:
@@ -423,7 +423,7 @@ cogl_pipeline_get_layer_mag_filter (CoglPipeline *pipeline,
* @pipeline: A #CoglPipeline object
* @layer_index: the layer number to change.
* @enable: whether to enable point sprite coord generation.
* @error: A return location for a CoglError, or NULL to ignore errors.
* @error: A return location for a #GError, or NULL to ignore errors.
*
* When rendering points, if @enable is %TRUE then the texture
* coordinates for this layer will be replaced with coordinates that
@@ -444,7 +444,7 @@ gboolean
cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline,
int layer_index,
gboolean enable,
CoglError **error);
GError **error);
/**
* cogl_pipeline_get_layer_point_sprite_coords_enabled:

View File

@@ -173,7 +173,7 @@ _cogl_pipeline_layer_copy_differences (CoglPipelineLayer *dest,
while (differences)
{
int index = _cogl_util_ffs (differences) - 1;
int index = ffs (differences) - 1;
differences &= ~(1 << index);
@@ -351,7 +351,7 @@ _cogl_pipeline_layer_pre_change_notify (CoglPipeline *required_owner,
goto init_layer_state;
/* We only allow a NULL required_owner for new layers */
_COGL_RETURN_VAL_IF_FAIL (required_owner != NULL, layer);
g_return_val_if_fail (required_owner != NULL, layer);
/* Chain up:
* A modification of a layer is indirectly also a modification of

View File

@@ -40,7 +40,6 @@
#include "cogl-depth-state-private.h"
#include "cogl-pipeline-state-private.h"
#include "cogl-snippet-private.h"
#include "cogl-error-private.h"
#include <test-fixtures/test-unit.h>
@@ -55,7 +54,7 @@ _cogl_pipeline_get_user_program (CoglPipeline *pipeline)
{
CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), NULL);
g_return_val_if_fail (cogl_is_pipeline (pipeline), NULL);
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_USER_SHADER);
@@ -375,7 +374,7 @@ cogl_pipeline_get_color (CoglPipeline *pipeline,
{
CoglPipeline *authority;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_COLOR);
@@ -401,7 +400,7 @@ cogl_pipeline_set_color (CoglPipeline *pipeline,
CoglPipelineState state = COGL_PIPELINE_STATE_COLOR;
CoglPipeline *authority;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state);
@@ -452,7 +451,7 @@ _cogl_pipeline_get_blend_enabled (CoglPipeline *pipeline)
{
CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_BLEND_ENABLE);
@@ -473,9 +472,9 @@ _cogl_pipeline_set_blend_enabled (CoglPipeline *pipeline,
CoglPipelineState state = COGL_PIPELINE_STATE_BLEND_ENABLE;
CoglPipeline *authority;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
_COGL_RETURN_IF_FAIL (enable > 1 &&
"don't pass TRUE or FALSE to _set_blend_enabled!");
g_return_if_fail (cogl_is_pipeline (pipeline));
g_return_if_fail (enable > 1 &&
"don't pass TRUE or FALSE to _set_blend_enabled!");
authority = _cogl_pipeline_get_authority (pipeline, state);
@@ -503,7 +502,7 @@ cogl_pipeline_get_ambient (CoglPipeline *pipeline,
{
CoglPipeline *authority;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING);
@@ -520,7 +519,7 @@ cogl_pipeline_set_ambient (CoglPipeline *pipeline,
CoglPipeline *authority;
CoglPipelineLightingState *lighting_state;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state);
@@ -553,7 +552,7 @@ cogl_pipeline_get_diffuse (CoglPipeline *pipeline,
{
CoglPipeline *authority;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING);
@@ -570,7 +569,7 @@ cogl_pipeline_set_diffuse (CoglPipeline *pipeline,
CoglPipeline *authority;
CoglPipelineLightingState *lighting_state;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state);
@@ -612,7 +611,7 @@ cogl_pipeline_get_specular (CoglPipeline *pipeline,
{
CoglPipeline *authority;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING);
@@ -628,7 +627,7 @@ cogl_pipeline_set_specular (CoglPipeline *pipeline, const CoglColor *specular)
CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING;
CoglPipelineLightingState *lighting_state;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state);
@@ -660,7 +659,7 @@ cogl_pipeline_get_shininess (CoglPipeline *pipeline)
{
CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0);
g_return_val_if_fail (cogl_is_pipeline (pipeline), 0);
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING);
@@ -676,7 +675,7 @@ cogl_pipeline_set_shininess (CoglPipeline *pipeline,
CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING;
CoglPipelineLightingState *lighting_state;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
if (shininess < 0.0)
{
@@ -712,7 +711,7 @@ cogl_pipeline_get_emission (CoglPipeline *pipeline,
{
CoglPipeline *authority;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING);
@@ -728,7 +727,7 @@ cogl_pipeline_set_emission (CoglPipeline *pipeline, const CoglColor *emission)
CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING;
CoglPipelineLightingState *lighting_state;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state);
@@ -763,7 +762,7 @@ _cogl_pipeline_set_alpha_test_function (CoglPipeline *pipeline,
CoglPipeline *authority;
CoglPipelineAlphaFuncState *alpha_state;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state);
@@ -793,7 +792,7 @@ _cogl_pipeline_set_alpha_test_function_reference (CoglPipeline *pipeline,
CoglPipeline *authority;
CoglPipelineAlphaFuncState *alpha_state;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state);
@@ -830,7 +829,7 @@ cogl_pipeline_get_alpha_test_function (CoglPipeline *pipeline)
{
CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0);
g_return_val_if_fail (cogl_is_pipeline (pipeline), 0);
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_ALPHA_FUNC);
@@ -843,7 +842,7 @@ cogl_pipeline_get_alpha_test_reference (CoglPipeline *pipeline)
{
CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0.0f);
g_return_val_if_fail (cogl_is_pipeline (pipeline), 0.0f);
authority =
_cogl_pipeline_get_authority (pipeline,
@@ -946,7 +945,7 @@ setup_blend_state (CoglBlendStringStatement *statement,
gboolean
cogl_pipeline_set_blend (CoglPipeline *pipeline,
const char *blend_description,
CoglError **error)
GError **error)
{
CoglPipelineState state = COGL_PIPELINE_STATE_BLEND;
CoglPipeline *authority;
@@ -958,7 +957,7 @@ cogl_pipeline_set_blend (CoglPipeline *pipeline,
_COGL_GET_CONTEXT (ctx, FALSE);
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
count =
_cogl_blend_string_compile (blend_description,
@@ -1031,7 +1030,7 @@ cogl_pipeline_set_blend_constant (CoglPipeline *pipeline,
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_BLEND_CONSTANT))
return;
@@ -1071,7 +1070,7 @@ cogl_pipeline_get_user_program (CoglPipeline *pipeline)
{
CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), COGL_INVALID_HANDLE);
g_return_val_if_fail (cogl_is_pipeline (pipeline), COGL_INVALID_HANDLE);
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_USER_SHADER);
@@ -1092,7 +1091,7 @@ cogl_pipeline_set_user_program (CoglPipeline *pipeline,
CoglPipelineState state = COGL_PIPELINE_STATE_USER_SHADER;
CoglPipeline *authority;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state);
@@ -1144,7 +1143,7 @@ cogl_pipeline_set_user_program (CoglPipeline *pipeline,
gboolean
cogl_pipeline_set_depth_state (CoglPipeline *pipeline,
const CoglDepthState *depth_state,
CoglError **error)
GError **error)
{
CoglPipelineState state = COGL_PIPELINE_STATE_DEPTH;
CoglPipeline *authority;
@@ -1152,8 +1151,8 @@ cogl_pipeline_set_depth_state (CoglPipeline *pipeline,
_COGL_GET_CONTEXT (ctx, FALSE);
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
_COGL_RETURN_VAL_IF_FAIL (depth_state->magic == COGL_DEPTH_STATE_MAGIC, FALSE);
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
g_return_val_if_fail (depth_state->magic == COGL_DEPTH_STATE_MAGIC, FALSE);
authority = _cogl_pipeline_get_authority (pipeline, state);
@@ -1186,7 +1185,7 @@ cogl_pipeline_get_depth_state (CoglPipeline *pipeline,
{
CoglPipeline *authority;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_DEPTH);
@@ -1201,7 +1200,7 @@ _cogl_pipeline_set_fog_state (CoglPipeline *pipeline,
CoglPipeline *authority;
CoglPipelineFogState *current_fog_state;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state);
@@ -1236,7 +1235,7 @@ cogl_pipeline_set_cull_face_mode (CoglPipeline *pipeline,
CoglPipeline *authority;
CoglPipelineCullFaceState *cull_face_state;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state);
@@ -1266,7 +1265,7 @@ cogl_pipeline_set_front_face_winding (CoglPipeline *pipeline,
CoglPipeline *authority;
CoglPipelineCullFaceState *cull_face_state;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state);
@@ -1294,8 +1293,8 @@ cogl_pipeline_get_cull_face_mode (CoglPipeline *pipeline)
CoglPipelineState state = COGL_PIPELINE_STATE_CULL_FACE;
CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline),
COGL_PIPELINE_CULL_FACE_MODE_NONE);
g_return_val_if_fail (cogl_is_pipeline (pipeline),
COGL_PIPELINE_CULL_FACE_MODE_NONE);
authority = _cogl_pipeline_get_authority (pipeline, state);
@@ -1308,8 +1307,8 @@ cogl_pipeline_get_front_face_winding (CoglPipeline *pipeline)
CoglPipelineState state = COGL_PIPELINE_STATE_CULL_FACE;
CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline),
COGL_PIPELINE_CULL_FACE_MODE_NONE);
g_return_val_if_fail (cogl_is_pipeline (pipeline),
COGL_PIPELINE_CULL_FACE_MODE_NONE);
authority = _cogl_pipeline_get_authority (pipeline, state);
@@ -1321,7 +1320,7 @@ cogl_pipeline_get_point_size (CoglPipeline *pipeline)
{
CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_POINT_SIZE);
@@ -1336,7 +1335,7 @@ _cogl_pipeline_set_non_zero_point_size (CoglPipeline *pipeline,
CoglPipelineState state = COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE;
CoglPipeline *authority;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state);
@@ -1360,7 +1359,7 @@ cogl_pipeline_set_point_size (CoglPipeline *pipeline,
CoglPipelineState state = COGL_PIPELINE_STATE_POINT_SIZE;
CoglPipeline *authority;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state);
@@ -1389,13 +1388,13 @@ cogl_pipeline_set_point_size (CoglPipeline *pipeline,
gboolean
cogl_pipeline_set_per_vertex_point_size (CoglPipeline *pipeline,
gboolean enable,
CoglError **error)
GError **error)
{
CoglPipelineState state = COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE;
CoglPipeline *authority;
_COGL_GET_CONTEXT (ctx, FALSE);
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
authority = _cogl_pipeline_get_authority (pipeline, state);
@@ -1406,10 +1405,10 @@ cogl_pipeline_set_per_vertex_point_size (CoglPipeline *pipeline,
if (enable && !cogl_has_feature (ctx, COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE))
{
_cogl_set_error (error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_UNSUPPORTED,
"Per-vertex point size is not supported");
g_set_error_literal (error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_UNSUPPORTED,
"Per-vertex point size is not supported");
return FALSE;
}
@@ -1434,7 +1433,7 @@ cogl_pipeline_get_per_vertex_point_size (CoglPipeline *pipeline)
{
CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
authority =
_cogl_pipeline_get_authority (pipeline,

View File

@@ -390,7 +390,7 @@ cogl_pipeline_get_alpha_test_reference (CoglPipeline *pipeline);
* @pipeline: A #CoglPipeline object
* @blend_string: A <link linkend="cogl-Blend-Strings">Cogl blend string</link>
* describing the desired blend function.
* @error: return location for a #CoglError that may report lack of driver
* @error: return location for a #GError that may report lack of driver
* support if you give separate blend string statements for the alpha
* channel and RGB channels since some drivers, or backends such as
* GLES 1.1, don't support this feature. May be %NULL, in which case a
@@ -470,7 +470,7 @@ cogl_pipeline_get_alpha_test_reference (CoglPipeline *pipeline);
gboolean
cogl_pipeline_set_blend (CoglPipeline *pipeline,
const char *blend_string,
CoglError **error);
GError **error);
/**
* cogl_pipeline_set_blend_constant:
@@ -531,7 +531,7 @@ cogl_pipeline_get_point_size (CoglPipeline *pipeline);
* cogl_pipeline_set_per_vertex_point_size:
* @pipeline: a #CoglPipeline pointer
* @enable: whether to enable per-vertex point size
* @error: a location to store a #CoglError if the change failed
* @error: a location to store a #GError if the change failed
*
* Sets whether to use a per-vertex point size or to use the value set
* by cogl_pipeline_set_point_size(). If per-vertex point size is
@@ -547,7 +547,7 @@ cogl_pipeline_get_point_size (CoglPipeline *pipeline);
* Note that enabling this will only work if the
* %COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE feature is available. If
* this is not available then the function will return %FALSE and set
* a #CoglError.
* a #GError.
*
* Since: 2.0
* Stability: Unstable
@@ -556,7 +556,7 @@ cogl_pipeline_get_point_size (CoglPipeline *pipeline);
gboolean
cogl_pipeline_set_per_vertex_point_size (CoglPipeline *pipeline,
gboolean enable,
CoglError **error);
GError **error);
/**
* cogl_pipeline_get_per_vertex_point_size:
@@ -637,7 +637,7 @@ cogl_pipeline_set_user_program (CoglPipeline *pipeline,
* cogl_pipeline_set_depth_state: (skip)
* @pipeline: A #CoglPipeline object
* @state: A #CoglDepthState struct
* @error: A #CoglError to report failures to setup the given @state.
* @error: A #GError to report failures to setup the given @state.
*
* This commits all the depth state configured in @state struct to the
* given @pipeline. The configuration values are copied into the
@@ -656,7 +656,7 @@ cogl_pipeline_set_user_program (CoglPipeline *pipeline,
gboolean
cogl_pipeline_set_depth_state (CoglPipeline *pipeline,
const CoglDepthState *state,
CoglError **error);
GError **error);
/**
* cogl_pipeline_get_depth_state: (skip)

View File

@@ -276,7 +276,7 @@ _cogl_pipeline_promote_weak_ancestors (CoglPipeline *strong)
{
CoglNode *n;
_COGL_RETURN_IF_FAIL (!strong->is_weak);
g_return_if_fail (!strong->is_weak);
/* If the parent of strong is weak, then we want to promote it by
taking a reference on strong's grandparent. We don't need to take
@@ -298,7 +298,7 @@ _cogl_pipeline_revert_weak_ancestors (CoglPipeline *strong)
{
CoglNode *n;
_COGL_RETURN_IF_FAIL (!strong->is_weak);
g_return_if_fail (!strong->is_weak);
/* This reverts the effect of calling
_cogl_pipeline_promote_weak_ancestors */
@@ -474,7 +474,7 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
gboolean
_cogl_pipeline_get_real_blend_enabled (CoglPipeline *pipeline)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
return pipeline->real_blend_enable;
}
@@ -579,7 +579,7 @@ _cogl_pipeline_foreach_layer_internal (CoglPipeline *pipeline,
for (i = 0, cont = TRUE; i < n_layers && cont == TRUE; i++)
{
_COGL_RETURN_IF_FAIL (authority->layers_cache_dirty == FALSE);
g_return_if_fail (authority->layers_cache_dirty == FALSE);
cont = callback (authority->layers_cache[i], user_data);
}
}
@@ -1077,7 +1077,7 @@ _cogl_pipeline_init_multi_property_sparse_state (CoglPipeline *pipeline,
{
CoglPipeline *authority;
_COGL_RETURN_IF_FAIL (change & COGL_PIPELINE_STATE_ALL_SPARSE);
g_return_if_fail (change & COGL_PIPELINE_STATE_ALL_SPARSE);
if (!(change & COGL_PIPELINE_STATE_MULTI_PROPERTY))
return;
@@ -1420,7 +1420,7 @@ _cogl_pipeline_add_layer_difference (CoglPipeline *pipeline,
CoglPipelineLayer *layer,
gboolean inc_n_layers)
{
_COGL_RETURN_IF_FAIL (layer->owner == NULL);
g_return_if_fail (layer->owner == NULL);
layer->owner = pipeline;
cogl_object_ref (layer);
@@ -1816,7 +1816,7 @@ _cogl_pipeline_prune_empty_layer_difference (CoglPipeline *layers_authority,
CoglPipelineLayerInfo layer_info;
CoglPipeline *old_layers_authority;
_COGL_RETURN_IF_FAIL (link != NULL);
g_return_if_fail (link != NULL);
/* If the layer's parent doesn't have an owner then we can simply
* take ownership ourselves and drop our reference on the empty
@@ -2401,7 +2401,7 @@ _cogl_pipeline_get_fog_enabled (CoglPipeline *pipeline)
{
CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_FOG);
@@ -2411,7 +2411,7 @@ _cogl_pipeline_get_fog_enabled (CoglPipeline *pipeline)
unsigned long
_cogl_pipeline_get_age (CoglPipeline *pipeline)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0);
g_return_val_if_fail (cogl_is_pipeline (pipeline), 0);
return pipeline->age;
}
@@ -2423,7 +2423,7 @@ cogl_pipeline_remove_layer (CoglPipeline *pipeline, int layer_index)
CoglPipelineLayerInfo layer_info;
int i;
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LAYERS);
@@ -2486,7 +2486,7 @@ prepend_layer_to_list_cb (CoglPipelineLayer *layer,
const GList *
_cogl_pipeline_get_layers (CoglPipeline *pipeline)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), NULL);
g_return_val_if_fail (cogl_is_pipeline (pipeline), NULL);
if (!pipeline->deprecated_get_layers_list_dirty)
g_list_free (pipeline->deprecated_get_layers_list);
@@ -2509,7 +2509,7 @@ cogl_pipeline_get_n_layers (CoglPipeline *pipeline)
{
CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0);
g_return_val_if_fail (cogl_is_pipeline (pipeline), 0);
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LAYERS);

View File

@@ -77,7 +77,7 @@ static CoglPixelBuffer *
_cogl_pixel_buffer_new (CoglContext *context,
size_t size,
const void *data,
CoglError **error)
GError **error)
{
CoglPixelBuffer *pixel_buffer = g_slice_new0 (CoglPixelBuffer);
CoglBuffer *buffer = COGL_BUFFER (pixel_buffer);
@@ -113,11 +113,11 @@ cogl_pixel_buffer_new (CoglContext *context,
size_t size,
const void *data)
{
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
CoglPixelBuffer *buffer =
_cogl_pixel_buffer_new (context, size, data, &ignore_error);
if (!buffer)
cogl_error_free (ignore_error);
g_clear_error (&ignore_error);
return buffer;
}

View File

@@ -29,6 +29,7 @@
*/
#include "cogl-config.h"
#include "cogl-defines.h"
#include <string.h>
#include <math.h>
@@ -308,3 +309,66 @@ cogl_pixel_format_to_string (CoglPixelFormat format)
g_assert_not_reached ();
}
#ifdef COGL_HAS_LIBDRM
typedef struct _PixelFormatMap {
uint32_t drm_format;
CoglPixelFormat cogl_format;
CoglTextureComponents cogl_components;
} PixelFormatMap;
static const PixelFormatMap pixel_format_map[] = {
/* DRM formats are defined as little-endian, not machine endian. */
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
{ DRM_FORMAT_RGB565, COGL_PIXEL_FORMAT_RGB_565, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_ABGR8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_XBGR8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_ARGB8888, COGL_PIXEL_FORMAT_BGRA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_XRGB8888, COGL_PIXEL_FORMAT_BGRA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_BGRA8888, COGL_PIXEL_FORMAT_ARGB_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_BGRX8888, COGL_PIXEL_FORMAT_ARGB_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_RGBA8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_RGBX8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
#elif G_BYTE_ORDER == G_BIG_ENDIAN
/* DRM_FORMAT_RGB565 cannot be expressed. */
{ DRM_FORMAT_ABGR8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_XBGR8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_ARGB8888, COGL_PIXEL_FORMAT_ARGB_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_XRGB8888, COGL_PIXEL_FORMAT_ARGB_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_BGRA8888, COGL_PIXEL_FORMAT_BGRA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_BGRX8888, COGL_PIXEL_FORMAT_BGRA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_RGBA8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_RGBX8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
#else
#error "unexpected G_BYTE_ORDER"
#endif
};
gboolean
cogl_pixel_format_from_drm_format (uint32_t drm_format,
CoglPixelFormat *out_format,
CoglTextureComponents *out_components)
{
const size_t n = G_N_ELEMENTS (pixel_format_map);
size_t i;
for (i = 0; i < n; i++)
{
if (pixel_format_map[i].drm_format == drm_format)
break;
}
if (i == n)
return FALSE;
if (out_format)
*out_format = pixel_format_map[i].cogl_format;
if (out_components)
*out_components = pixel_format_map[i].cogl_components;
return TRUE;
}
#endif

View File

@@ -38,7 +38,12 @@
#include <stdint.h>
#include <stddef.h>
#ifdef COGL_HAS_LIBDRM
#include <drm_fourcc.h>
#endif
#include <cogl/cogl-defines.h>
#include <cogl/cogl-texture-components.h>
#include <glib.h>
#include <glib-object.h>
@@ -58,6 +63,9 @@ G_BEGIN_DECLS
*
* Other examples of factors that can influence the layout in memory are the
* system's endianness.
*
* This file also contains methods to map Linux DRM 4CC codes to
* CoglPixelFormats.
*/
#define COGL_A_BIT (1 << 4)
@@ -295,6 +303,34 @@ _cogl_pixel_format_is_endian_dependant (CoglPixelFormat format);
const char *
cogl_pixel_format_to_string (CoglPixelFormat format);
#ifdef COGL_HAS_LIBDRM
/* added in libdrm 2.4.95 */
#ifndef DRM_FORMAT_INVALID
#define DRM_FORMAT_INVALID 0
#endif
/**
* cogl_pixel_format_from_drm_format:
* @drm_format: The DRM 4CC code (as specified in drm_fourcc.h)
* @out_format: (out) (optional): The corresponding #CoglPixelFormat (if successful)
* @out_components: (out) (optional): The corresponding #CoglTextureComponents,
* if sucessful.
*
* Does an internal lookup to find a #CoglPixelFormat that matches the given
* DRM 4CC code. If no such format could be found, this function will return
* %FALSE and the output parameters will stay untouched.
*
* Returns: %TRUE if a #CoglPixelFormat corresponding to the 4CC code exists,
* %FALSE otherwise.
*/
gboolean
cogl_pixel_format_from_drm_format (uint32_t drm_format,
CoglPixelFormat *out_format,
CoglTextureComponents *out_components);
#endif /* COGL_HAS_LIBDRM */
G_END_DECLS
#endif /* __COGL_PIXEL_FORMAT_H__ */

View File

@@ -53,10 +53,10 @@ cogl_poll_renderer_get_info (CoglRenderer *renderer,
{
GList *l, *next;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), 0);
_COGL_RETURN_VAL_IF_FAIL (poll_fds != NULL, 0);
_COGL_RETURN_VAL_IF_FAIL (n_poll_fds != NULL, 0);
_COGL_RETURN_VAL_IF_FAIL (timeout != NULL, 0);
g_return_val_if_fail (cogl_is_renderer (renderer), 0);
g_return_val_if_fail (poll_fds != NULL, 0);
g_return_val_if_fail (n_poll_fds != NULL, 0);
g_return_val_if_fail (timeout != NULL, 0);
*timeout = -1;
@@ -95,7 +95,7 @@ cogl_poll_renderer_dispatch (CoglRenderer *renderer,
{
GList *l, *next;
_COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer));
g_return_if_fail (cogl_is_renderer (renderer));
_cogl_closure_list_invoke_no_args (&renderer->idle_closures);

View File

@@ -48,7 +48,7 @@ cogl_primitive_texture_set_auto_mipmap (CoglPrimitiveTexture *primitive_texture,
{
CoglTexture *texture;
_COGL_RETURN_IF_FAIL (cogl_is_primitive_texture (primitive_texture));
g_return_if_fail (cogl_is_primitive_texture (primitive_texture));
texture = COGL_TEXTURE (primitive_texture);

View File

@@ -74,7 +74,7 @@ cogl_primitive_new_with_attributes (CoglVerticesMode mode,
CoglAttribute *attribute = attributes[i];
cogl_object_ref (attribute);
_COGL_RETURN_VAL_IF_FAIL (cogl_is_attribute (attribute), NULL);
g_return_val_if_fail (cogl_is_attribute (attribute), NULL);
primitive->attributes[i] = attribute;
}
@@ -414,7 +414,7 @@ cogl_primitive_set_attributes (CoglPrimitive *primitive,
{
int i;
_COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive));
g_return_if_fail (cogl_is_primitive (primitive));
if (G_UNLIKELY (primitive->immutable_ref))
{
@@ -427,7 +427,7 @@ cogl_primitive_set_attributes (CoglPrimitive *primitive,
* attribute thats actually in the new list too. */
for (i = 0; i < n_attributes; i++)
{
_COGL_RETURN_IF_FAIL (cogl_is_attribute (attributes[i]));
g_return_if_fail (cogl_is_attribute (attributes[i]));
cogl_object_ref (attributes[i]);
}
@@ -463,7 +463,7 @@ cogl_primitive_set_attributes (CoglPrimitive *primitive,
int
cogl_primitive_get_first_vertex (CoglPrimitive *primitive)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_primitive (primitive), 0);
g_return_val_if_fail (cogl_is_primitive (primitive), 0);
return primitive->first_vertex;
}
@@ -472,7 +472,7 @@ void
cogl_primitive_set_first_vertex (CoglPrimitive *primitive,
int first_vertex)
{
_COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive));
g_return_if_fail (cogl_is_primitive (primitive));
if (G_UNLIKELY (primitive->immutable_ref))
{
@@ -486,7 +486,7 @@ cogl_primitive_set_first_vertex (CoglPrimitive *primitive,
int
cogl_primitive_get_n_vertices (CoglPrimitive *primitive)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_primitive (primitive), 0);
g_return_val_if_fail (cogl_is_primitive (primitive), 0);
return primitive->n_vertices;
}
@@ -495,7 +495,7 @@ void
cogl_primitive_set_n_vertices (CoglPrimitive *primitive,
int n_vertices)
{
_COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive));
g_return_if_fail (cogl_is_primitive (primitive));
primitive->n_vertices = n_vertices;
}
@@ -503,7 +503,7 @@ cogl_primitive_set_n_vertices (CoglPrimitive *primitive,
CoglVerticesMode
cogl_primitive_get_mode (CoglPrimitive *primitive)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_primitive (primitive), 0);
g_return_val_if_fail (cogl_is_primitive (primitive), 0);
return primitive->mode;
}
@@ -512,7 +512,7 @@ void
cogl_primitive_set_mode (CoglPrimitive *primitive,
CoglVerticesMode mode)
{
_COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive));
g_return_if_fail (cogl_is_primitive (primitive));
if (G_UNLIKELY (primitive->immutable_ref))
{
@@ -528,7 +528,7 @@ cogl_primitive_set_indices (CoglPrimitive *primitive,
CoglIndices *indices,
int n_indices)
{
_COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive));
g_return_if_fail (cogl_is_primitive (primitive));
if (G_UNLIKELY (primitive->immutable_ref))
{
@@ -571,7 +571,7 @@ _cogl_primitive_immutable_ref (CoglPrimitive *primitive)
{
int i;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_primitive (primitive), NULL);
g_return_val_if_fail (cogl_is_primitive (primitive), NULL);
primitive->immutable_ref++;
@@ -586,8 +586,8 @@ _cogl_primitive_immutable_unref (CoglPrimitive *primitive)
{
int i;
_COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive));
_COGL_RETURN_IF_FAIL (primitive->immutable_ref > 0);
g_return_if_fail (cogl_is_primitive (primitive));
g_return_if_fail (primitive->immutable_ref > 0);
primitive->immutable_ref--;

View File

@@ -330,8 +330,8 @@ cogl_quaternion_equal (const void *v1, const void *v2)
const CoglQuaternion *a = v1;
const CoglQuaternion *b = v2;
_COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE);
_COGL_RETURN_VAL_IF_FAIL (v2 != NULL, FALSE);
g_return_val_if_fail (v1 != NULL, FALSE);
g_return_val_if_fail (v2 != NULL, FALSE);
if (v1 == v2)
return TRUE;
@@ -447,7 +447,7 @@ cogl_quaternion_multiply (CoglQuaternion *result,
float y = a->y;
float z = a->z;
_COGL_RETURN_IF_FAIL (b != result);
g_return_if_fail (b != result);
result->w = w * b->w - x * b->x - y * b->y - z * b->z;
@@ -504,7 +504,7 @@ cogl_quaternion_slerp (CoglQuaternion *result,
float fa;
float fb;
_COGL_RETURN_IF_FAIL (t >=0 && t <= 1.0f);
g_return_if_fail (t >=0 && t <= 1.0f);
if (t == 0)
{
@@ -591,7 +591,7 @@ cogl_quaternion_nlerp (CoglQuaternion *result,
float fa;
float fb;
_COGL_RETURN_IF_FAIL (t >=0 && t <= 1.0f);
g_return_if_fail (t >=0 && t <= 1.0f);
if (t == 0)
{

View File

@@ -360,7 +360,7 @@ _cogl_rectangle_map_add (CoglRectangleMap *map,
/* Zero-sized rectangles break the algorithm for removing rectangles
so we'll disallow them */
_COGL_RETURN_VAL_IF_FAIL (width > 0 && height > 0, FALSE);
g_return_val_if_fail (width > 0 && height > 0, FALSE);
/* Start with the root node */
g_array_set_size (stack, 0);

View File

@@ -44,7 +44,6 @@
#include "cogl-renderer-private.h"
#include "cogl-display-private.h"
#include "cogl-config-private.h"
#include "cogl-error-private.h"
#include "cogl-gtype-private.h"
#include "driver/gl/cogl-util-gl-private.h"
@@ -228,10 +227,10 @@ void
cogl_xlib_renderer_set_foreign_display (CoglRenderer *renderer,
Display *xdisplay)
{
_COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer));
g_return_if_fail (cogl_is_renderer (renderer));
/* NB: Renderers are considered immutable once connected */
_COGL_RETURN_IF_FAIL (!renderer->connected);
g_return_if_fail (!renderer->connected);
renderer->foreign_xdpy = xdisplay;
@@ -243,7 +242,7 @@ cogl_xlib_renderer_set_foreign_display (CoglRenderer *renderer,
Display *
cogl_xlib_renderer_get_foreign_display (CoglRenderer *renderer)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), NULL);
g_return_val_if_fail (cogl_is_renderer (renderer), NULL);
return renderer->foreign_xdpy;
}
@@ -252,9 +251,9 @@ void
cogl_xlib_renderer_set_event_retrieval_enabled (CoglRenderer *renderer,
gboolean enable)
{
_COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer));
g_return_if_fail (cogl_is_renderer (renderer));
/* NB: Renderers are considered immutable once connected */
_COGL_RETURN_IF_FAIL (!renderer->connected);
g_return_if_fail (!renderer->connected);
renderer->xlib_enable_event_retrieval = enable;
}
@@ -263,8 +262,8 @@ void
cogl_xlib_renderer_request_reset_on_video_memory_purge (CoglRenderer *renderer,
gboolean enable)
{
_COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer));
_COGL_RETURN_IF_FAIL (!renderer->connected);
g_return_if_fail (cogl_is_renderer (renderer));
g_return_if_fail (!renderer->connected);
renderer->xlib_want_reset_on_video_memory_purge = enable;
}
@@ -273,9 +272,9 @@ void
cogl_xlib_renderer_set_threaded_swap_wait_enabled (CoglRenderer *renderer,
gboolean enable)
{
_COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer));
g_return_if_fail (cogl_is_renderer (renderer));
/* NB: Renderers are considered immutable once connected */
_COGL_RETURN_IF_FAIL (!renderer->connected);
g_return_if_fail (!renderer->connected);
renderer->xlib_enable_threaded_swap_wait = enable;
}
@@ -284,7 +283,7 @@ cogl_xlib_renderer_set_threaded_swap_wait_enabled (CoglRenderer *renderer,
gboolean
cogl_renderer_check_onscreen_template (CoglRenderer *renderer,
CoglOnscreenTemplate *onscreen_template,
CoglError **error)
GError **error)
{
CoglDisplay *display;
@@ -432,7 +431,7 @@ satisfy_constraints (CoglDriverDescription *description,
static gboolean
_cogl_renderer_choose_driver (CoglRenderer *renderer,
CoglError **error)
GError **error)
{
const char *driver_name = g_getenv ("COGL_DRIVER");
CoglDriver driver_override = COGL_DRIVER_ANY;
@@ -457,11 +456,10 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer,
if (driver_override != COGL_DRIVER_ANY &&
renderer->driver_override != driver_override)
{
_cogl_set_error (error,
COGL_RENDERER_ERROR,
COGL_RENDERER_ERROR_BAD_CONSTRAINT,
"Application driver selection conflicts with driver "
"specified in configuration");
g_set_error (error, COGL_RENDERER_ERROR,
COGL_RENDERER_ERROR_BAD_CONSTRAINT,
"Application driver selection conflicts with driver "
"specified in configuration");
return FALSE;
}
@@ -487,11 +485,10 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer,
if (invalid_override)
{
_cogl_set_error (error,
COGL_RENDERER_ERROR,
COGL_RENDERER_ERROR_BAD_CONSTRAINT,
"Driver \"%s\" is not available",
invalid_override);
g_set_error (error, COGL_RENDERER_ERROR,
COGL_RENDERER_ERROR_BAD_CONSTRAINT,
"Driver \"%s\" is not available",
invalid_override);
return FALSE;
}
@@ -504,10 +501,9 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer,
if (!state.driver_description)
{
_cogl_set_error (error,
COGL_RENDERER_ERROR,
COGL_RENDERER_ERROR_BAD_CONSTRAINT,
"No suitable driver found");
g_set_error (error, COGL_RENDERER_ERROR,
COGL_RENDERER_ERROR_BAD_CONSTRAINT,
"No suitable driver found");
return FALSE;
}
@@ -530,7 +526,7 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer,
if (renderer->libgl_module == NULL)
{
_cogl_set_error (error, COGL_DRIVER_ERROR,
g_set_error (error, COGL_DRIVER_ERROR,
COGL_DRIVER_ERROR_FAILED_TO_LOAD_LIBRARY,
"Failed to dynamically open the GL library \"%s\"",
libgl_name);
@@ -554,10 +550,10 @@ cogl_renderer_set_custom_winsys (CoglRenderer *renderer,
static gboolean
connect_custom_winsys (CoglRenderer *renderer,
CoglError **error)
GError **error)
{
const CoglWinsysVtable *winsys;
CoglError *tmp_error = NULL;
GError *tmp_error = NULL;
GString *error_message;
winsys = renderer->custom_winsys_vtable_getter (renderer);
@@ -568,7 +564,7 @@ connect_custom_winsys (CoglRenderer *renderer,
{
g_string_append_c (error_message, '\n');
g_string_append (error_message, tmp_error->message);
cogl_error_free (tmp_error);
g_error_free (tmp_error);
}
else
{
@@ -578,16 +574,14 @@ connect_custom_winsys (CoglRenderer *renderer,
}
renderer->winsys_vtable = NULL;
_cogl_set_error (error, COGL_WINSYS_ERROR,
COGL_WINSYS_ERROR_INIT,
"Failed to connected to any renderer: %s",
error_message->str);
g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_INIT,
"Failed to connected to any renderer: %s", error_message->str);
g_string_free (error_message, TRUE);
return FALSE;
}
gboolean
cogl_renderer_connect (CoglRenderer *renderer, CoglError **error)
cogl_renderer_connect (CoglRenderer *renderer, GError **error)
{
int i;
GString *error_message;
@@ -609,7 +603,7 @@ cogl_renderer_connect (CoglRenderer *renderer, CoglError **error)
for (i = 0; i < G_N_ELEMENTS (_cogl_winsys_vtable_getters); i++)
{
const CoglWinsysVtable *winsys = _cogl_winsys_vtable_getters[i]();
CoglError *tmp_error = NULL;
GError *tmp_error = NULL;
GList *l;
gboolean skip_due_to_constraints = FALSE;
@@ -652,7 +646,7 @@ cogl_renderer_connect (CoglRenderer *renderer, CoglError **error)
{
g_string_append_c (error_message, '\n');
g_string_append (error_message, tmp_error->message);
cogl_error_free (tmp_error);
g_error_free (tmp_error);
}
else
{
@@ -666,15 +660,14 @@ cogl_renderer_connect (CoglRenderer *renderer, CoglError **error)
{
if (constraints_failed)
{
_cogl_set_error (error, COGL_RENDERER_ERROR,
g_set_error (error, COGL_RENDERER_ERROR,
COGL_RENDERER_ERROR_BAD_CONSTRAINT,
"Failed to connected to any renderer due to constraints");
return FALSE;
}
renderer->winsys_vtable = NULL;
_cogl_set_error (error, COGL_WINSYS_ERROR,
COGL_WINSYS_ERROR_INIT,
g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_INIT,
"Failed to connected to any renderer: %s",
error_message->str);
g_string_free (error_message, TRUE);
@@ -751,7 +744,7 @@ void
cogl_renderer_set_winsys_id (CoglRenderer *renderer,
CoglWinsysID winsys_id)
{
_COGL_RETURN_IF_FAIL (!renderer->connected);
g_return_if_fail (!renderer->connected);
renderer->winsys_id_override = winsys_id;
}
@@ -759,7 +752,7 @@ cogl_renderer_set_winsys_id (CoglRenderer *renderer,
CoglWinsysID
cogl_renderer_get_winsys_id (CoglRenderer *renderer)
{
_COGL_RETURN_VAL_IF_FAIL (renderer->connected, 0);
g_return_val_if_fail (renderer->connected, 0);
return renderer->winsys_vtable->id;
}
@@ -810,14 +803,14 @@ void
cogl_renderer_set_driver (CoglRenderer *renderer,
CoglDriver driver)
{
_COGL_RETURN_IF_FAIL (!renderer->connected);
g_return_if_fail (!renderer->connected);
renderer->driver_override = driver;
}
CoglDriver
cogl_renderer_get_driver (CoglRenderer *renderer)
{
_COGL_RETURN_VAL_IF_FAIL (renderer->connected, 0);
g_return_val_if_fail (renderer->connected, 0);
return renderer->driver;
}
@@ -829,8 +822,8 @@ cogl_renderer_foreach_output (CoglRenderer *renderer,
{
GList *l;
_COGL_RETURN_IF_FAIL (renderer->connected);
_COGL_RETURN_IF_FAIL (callback != NULL);
g_return_if_fail (renderer->connected);
g_return_if_fail (callback != NULL);
for (l = renderer->outputs; l; l = l->next)
callback (l->data, user_data);

View File

@@ -35,7 +35,6 @@
#include <cogl/cogl-types.h>
#include <cogl/cogl-onscreen-template.h>
#include <cogl/cogl-error.h>
#include <cogl/cogl-output.h>
#include <glib-object.h>
@@ -221,7 +220,7 @@ cogl_renderer_get_n_fragment_texture_units (CoglRenderer *renderer);
* cogl_renderer_check_onscreen_template: (skip)
* @renderer: A #CoglRenderer
* @onscreen_template: A #CoglOnscreenTemplate
* @error: A pointer to a #CoglError for reporting exceptions
* @error: A pointer to a #GError for reporting exceptions
*
* Tests if a given @onscreen_template can be supported with the given
* @renderer.
@@ -234,14 +233,14 @@ cogl_renderer_get_n_fragment_texture_units (CoglRenderer *renderer);
gboolean
cogl_renderer_check_onscreen_template (CoglRenderer *renderer,
CoglOnscreenTemplate *onscreen_template,
CoglError **error);
GError **error);
/* Final connection API */
/**
* cogl_renderer_connect:
* @renderer: An unconnected #CoglRenderer
* @error: a pointer to a #CoglError for reporting exceptions
* @error: a pointer to a #GError for reporting exceptions
*
* Connects the configured @renderer. Renderer connection isn't a
* very active process, it basically just means validating that
@@ -254,7 +253,7 @@ cogl_renderer_check_onscreen_template (CoglRenderer *renderer,
* Stability: unstable
*/
gboolean
cogl_renderer_connect (CoglRenderer *renderer, CoglError **error);
cogl_renderer_connect (CoglRenderer *renderer, GError **error);
/**
* CoglRendererConstraint:

View File

@@ -64,7 +64,7 @@ cogl_snippet_new (CoglSnippetHook hook,
CoglSnippetHook
cogl_snippet_get_hook (CoglSnippet *snippet)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_snippet (snippet), 0);
g_return_val_if_fail (cogl_is_snippet (snippet), 0);
return snippet->hook;
}
@@ -88,7 +88,7 @@ void
cogl_snippet_set_declarations (CoglSnippet *snippet,
const char *declarations)
{
_COGL_RETURN_IF_FAIL (cogl_is_snippet (snippet));
g_return_if_fail (cogl_is_snippet (snippet));
if (!_cogl_snippet_modify (snippet))
return;
@@ -100,7 +100,7 @@ cogl_snippet_set_declarations (CoglSnippet *snippet,
const char *
cogl_snippet_get_declarations (CoglSnippet *snippet)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_snippet (snippet), NULL);
g_return_val_if_fail (cogl_is_snippet (snippet), NULL);
return snippet->declarations;
}
@@ -109,7 +109,7 @@ void
cogl_snippet_set_pre (CoglSnippet *snippet,
const char *pre)
{
_COGL_RETURN_IF_FAIL (cogl_is_snippet (snippet));
g_return_if_fail (cogl_is_snippet (snippet));
if (!_cogl_snippet_modify (snippet))
return;
@@ -121,7 +121,7 @@ cogl_snippet_set_pre (CoglSnippet *snippet,
const char *
cogl_snippet_get_pre (CoglSnippet *snippet)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_snippet (snippet), NULL);
g_return_val_if_fail (cogl_is_snippet (snippet), NULL);
return snippet->pre;
}
@@ -130,7 +130,7 @@ void
cogl_snippet_set_replace (CoglSnippet *snippet,
const char *replace)
{
_COGL_RETURN_IF_FAIL (cogl_is_snippet (snippet));
g_return_if_fail (cogl_is_snippet (snippet));
if (!_cogl_snippet_modify (snippet))
return;
@@ -142,7 +142,7 @@ cogl_snippet_set_replace (CoglSnippet *snippet,
const char *
cogl_snippet_get_replace (CoglSnippet *snippet)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_snippet (snippet), NULL);
g_return_val_if_fail (cogl_is_snippet (snippet), NULL);
return snippet->replace;
}
@@ -151,7 +151,7 @@ void
cogl_snippet_set_post (CoglSnippet *snippet,
const char *post)
{
_COGL_RETURN_IF_FAIL (cogl_is_snippet (snippet));
g_return_if_fail (cogl_is_snippet (snippet));
if (!_cogl_snippet_modify (snippet))
return;
@@ -163,7 +163,7 @@ cogl_snippet_set_post (CoglSnippet *snippet,
const char *
cogl_snippet_get_post (CoglSnippet *snippet)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_snippet (snippet), NULL);
g_return_val_if_fail (cogl_is_snippet (snippet), NULL);
return snippet->post;
}

View File

@@ -79,8 +79,8 @@ _cogl_span_iter_begin (CoglSpanIter *iter,
{
/* XXX: If CLAMP_TO_EDGE needs to be emulated then it needs to be
* done at a higher level than here... */
_COGL_RETURN_IF_FAIL (wrap_mode == COGL_PIPELINE_WRAP_MODE_REPEAT ||
wrap_mode == COGL_PIPELINE_WRAP_MODE_MIRRORED_REPEAT);
g_return_if_fail (wrap_mode == COGL_PIPELINE_WRAP_MODE_REPEAT ||
wrap_mode == COGL_PIPELINE_WRAP_MODE_MIRRORED_REPEAT);
iter->span = NULL;

View File

@@ -195,10 +195,10 @@ cogl_sub_texture_new (CoglContext *ctx,
next_height = cogl_texture_get_height (next_texture);
/* The region must specify a non-zero subset of the full texture */
_COGL_RETURN_VAL_IF_FAIL (sub_x >= 0 && sub_y >= 0, NULL);
_COGL_RETURN_VAL_IF_FAIL (sub_width > 0 && sub_height > 0, NULL);
_COGL_RETURN_VAL_IF_FAIL (sub_x + sub_width <= next_width, NULL);
_COGL_RETURN_VAL_IF_FAIL (sub_y + sub_height <= next_height, NULL);
g_return_val_if_fail (sub_x >= 0 && sub_y >= 0, NULL);
g_return_val_if_fail (sub_width > 0 && sub_height > 0, NULL);
g_return_val_if_fail (sub_x + sub_width <= next_width, NULL);
g_return_val_if_fail (sub_y + sub_height <= next_height, NULL);
sub_tex = g_new (CoglSubTexture, 1);
@@ -233,7 +233,7 @@ cogl_sub_texture_new (CoglContext *ctx,
static gboolean
_cogl_sub_texture_allocate (CoglTexture *tex,
CoglError **error)
GError **error)
{
CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex);
gboolean status = cogl_texture_allocate (sub_tex->full_texture, error);
@@ -364,7 +364,7 @@ _cogl_sub_texture_set_region (CoglTexture *tex,
int dst_height,
int level,
CoglBitmap *bmp,
CoglError **error)
GError **error)
{
CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex);
@@ -373,12 +373,12 @@ _cogl_sub_texture_set_region (CoglTexture *tex,
int full_width = cogl_texture_get_width (sub_tex->full_texture);
int full_height = cogl_texture_get_width (sub_tex->full_texture);
_COGL_RETURN_VAL_IF_FAIL (sub_tex->sub_x == 0 &&
cogl_texture_get_width (tex) == full_width,
FALSE);
_COGL_RETURN_VAL_IF_FAIL (sub_tex->sub_y == 0 &&
cogl_texture_get_height (tex) == full_height,
FALSE);
g_return_val_if_fail (sub_tex->sub_x == 0 &&
cogl_texture_get_width (tex) == full_width,
FALSE);
g_return_val_if_fail (sub_tex->sub_y == 0 &&
cogl_texture_get_height (tex) == full_height,
FALSE);
}
return _cogl_texture_set_region_from_bitmap (sub_tex->full_texture,

View File

@@ -50,7 +50,6 @@
#include "cogl-spans.h"
#include "cogl-journal-private.h"
#include "cogl-primitive-texture.h"
#include "cogl-error-private.h"
#include "cogl-gtype-private.h"
#include "driver/gl/cogl-texture-gl-private.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
@@ -191,7 +190,7 @@ _cogl_texture_2d_sliced_set_waste (CoglTexture2DSliced *tex_2ds,
int src_y,
int dst_x,
int dst_y,
CoglError **error)
GError **error)
{
gboolean need_x, need_y;
CoglContext *ctx = COGL_TEXTURE (tex_2ds)->context;
@@ -342,7 +341,7 @@ _cogl_texture_2d_sliced_set_waste (CoglTexture2DSliced *tex_2ds,
static gboolean
_cogl_texture_2d_sliced_upload_bitmap (CoglTexture2DSliced *tex_2ds,
CoglBitmap *bmp,
CoglError **error)
GError **error)
{
CoglSpan *x_span;
CoglSpan *y_span;
@@ -438,7 +437,7 @@ _cogl_texture_2d_sliced_upload_subregion (CoglTexture2DSliced *tex_2ds,
int width,
int height,
CoglBitmap *source_bmp,
CoglError **error)
GError **error)
{
CoglTexture *tex = COGL_TEXTURE (tex_2ds);
CoglSpan *x_span;
@@ -631,7 +630,7 @@ setup_spans (CoglContext *ctx,
int height,
int max_waste,
CoglPixelFormat internal_format,
CoglError **error)
GError **error)
{
int max_width;
int max_height;
@@ -656,13 +655,11 @@ setup_spans (CoglContext *ctx,
max_height,
internal_format))
{
_cogl_set_error (error,
COGL_TEXTURE_ERROR,
COGL_TEXTURE_ERROR_SIZE,
"Sliced texture size of %d x %d not possible "
"with max waste set to -1",
width,
height);
g_set_error (error, COGL_TEXTURE_ERROR, COGL_TEXTURE_ERROR_SIZE,
"Sliced texture size of %d x %d not possible "
"with max waste set to -1",
width,
height);
return FALSE;
}
@@ -706,10 +703,8 @@ setup_spans (CoglContext *ctx,
{
/* Maybe it would be ok to just g_warn_if_reached() for this
* codepath */
_cogl_set_error (error,
COGL_TEXTURE_ERROR,
COGL_TEXTURE_ERROR_SIZE,
"No suitable slice geometry found");
g_set_error (error, COGL_TEXTURE_ERROR, COGL_TEXTURE_ERROR_SIZE,
"No suitable slice geometry found");
free_spans (tex_2ds);
return FALSE;
}
@@ -772,7 +767,7 @@ allocate_slices (CoglTexture2DSliced *tex_2ds,
int height,
int max_waste,
CoglPixelFormat internal_format,
CoglError **error)
GError **error)
{
CoglTexture *tex = COGL_TEXTURE (tex_2ds);
CoglContext *ctx = tex->context;
@@ -891,7 +886,7 @@ _cogl_texture_2d_sliced_new_from_bitmap (CoglBitmap *bmp,
{
CoglTextureLoader *loader;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), NULL);
g_return_val_if_fail (cogl_is_bitmap (bmp), NULL);
loader = _cogl_texture_create_loader ();
loader->src_type = COGL_TEXTURE_SOURCE_TYPE_BITMAP;
@@ -932,16 +927,16 @@ _cogl_texture_2d_sliced_new_from_foreign (CoglContext *ctx,
*/
/* This should only be called when the texture target is 2D. */
_COGL_RETURN_VAL_IF_FAIL (gl_target == GL_TEXTURE_2D, NULL);
g_return_val_if_fail (gl_target == GL_TEXTURE_2D, NULL);
/* Assert it is a valid GL texture object */
_COGL_RETURN_VAL_IF_FAIL (ctx->glIsTexture (gl_handle), FALSE);
g_return_val_if_fail (ctx->glIsTexture (gl_handle), FALSE);
/* Validate width and height */
_COGL_RETURN_VAL_IF_FAIL (width > 0 && height > 0, NULL);
g_return_val_if_fail (width > 0 && height > 0, NULL);
/* Validate pot waste */
_COGL_RETURN_VAL_IF_FAIL (x_pot_waste >= 0 && x_pot_waste < width &&
g_return_val_if_fail (x_pot_waste >= 0 && x_pot_waste < width &&
y_pot_waste >= 0 && y_pot_waste < height,
NULL);
@@ -967,13 +962,13 @@ cogl_texture_2d_sliced_new_from_data (CoglContext *ctx,
CoglPixelFormat format,
int rowstride,
const uint8_t *data,
CoglError **error)
GError **error)
{
CoglBitmap *bmp;
CoglTexture2DSliced *tex_2ds;
_COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL);
_COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL);
g_return_val_if_fail (format != COGL_PIXEL_FORMAT_ANY, NULL);
g_return_val_if_fail (data != NULL, NULL);
/* Rowstride from width if not given */
if (rowstride == 0)
@@ -1004,12 +999,12 @@ CoglTexture2DSliced *
cogl_texture_2d_sliced_new_from_file (CoglContext *ctx,
const char *filename,
int max_waste,
CoglError **error)
GError **error)
{
CoglBitmap *bmp;
CoglTexture2DSliced *tex_2ds = NULL;
_COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
bmp = _cogl_bitmap_from_file (ctx, filename, error);
if (bmp == NULL)
@@ -1027,7 +1022,7 @@ cogl_texture_2d_sliced_new_from_file (CoglContext *ctx,
static gboolean
allocate_with_size (CoglTexture2DSliced *tex_2ds,
CoglTextureLoader *loader,
CoglError **error)
GError **error)
{
CoglTexture *tex = COGL_TEXTURE (tex_2ds);
CoglPixelFormat internal_format =
@@ -1053,7 +1048,7 @@ allocate_with_size (CoglTexture2DSliced *tex_2ds,
static gboolean
allocate_from_bitmap (CoglTexture2DSliced *tex_2ds,
CoglTextureLoader *loader,
CoglError **error)
GError **error)
{
CoglTexture *tex = COGL_TEXTURE (tex_2ds);
CoglBitmap *bmp = loader->src.bitmap.bitmap;
@@ -1063,7 +1058,7 @@ allocate_from_bitmap (CoglTexture2DSliced *tex_2ds,
CoglPixelFormat internal_format;
CoglBitmap *upload_bmp;
_COGL_RETURN_VAL_IF_FAIL (tex_2ds->slice_textures == NULL, FALSE);
g_return_val_if_fail (tex_2ds->slice_textures == NULL, FALSE);
internal_format =
_cogl_texture_determine_internal_format (tex,
@@ -1106,7 +1101,7 @@ allocate_from_bitmap (CoglTexture2DSliced *tex_2ds,
static gboolean
allocate_from_gl_foreign (CoglTexture2DSliced *tex_2ds,
CoglTextureLoader *loader,
CoglError **error)
GError **error)
{
CoglTexture *tex = COGL_TEXTURE (tex_2ds);
CoglContext *ctx = tex->context;
@@ -1170,12 +1165,12 @@ allocate_from_gl_foreign (CoglTexture2DSliced *tex_2ds,
static gboolean
_cogl_texture_2d_sliced_allocate (CoglTexture *tex,
CoglError **error)
GError **error)
{
CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex);
CoglTextureLoader *loader = tex->loader;
_COGL_RETURN_VAL_IF_FAIL (loader, FALSE);
g_return_val_if_fail (loader, FALSE);
switch (loader->src_type)
{
@@ -1337,7 +1332,7 @@ _cogl_texture_2d_sliced_gl_flush_legacy_texobj_filters (CoglTexture *tex,
CoglTexture2D *slice_tex;
int i;
_COGL_RETURN_IF_FAIL (tex_2ds->slice_textures != NULL);
g_return_if_fail (tex_2ds->slice_textures != NULL);
/* Apply new filters to every slice. The slice texture itself should
cache the value and avoid resubmitting the same filter value to
@@ -1357,7 +1352,7 @@ _cogl_texture_2d_sliced_pre_paint (CoglTexture *tex,
CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex);
int i;
_COGL_RETURN_IF_FAIL (tex_2ds->slice_textures != NULL);
g_return_if_fail (tex_2ds->slice_textures != NULL);
/* Pass the pre-paint on to every slice */
for (i = 0; i < tex_2ds->slice_textures->len; i++)
@@ -1374,7 +1369,7 @@ _cogl_texture_2d_sliced_ensure_non_quad_rendering (CoglTexture *tex)
CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex);
int i;
_COGL_RETURN_IF_FAIL (tex_2ds->slice_textures != NULL);
g_return_if_fail (tex_2ds->slice_textures != NULL);
/* Pass the call on to every slice */
for (i = 0; i < tex_2ds->slice_textures->len; i++)
@@ -1395,7 +1390,7 @@ _cogl_texture_2d_sliced_set_region (CoglTexture *tex,
int dst_height,
int level,
CoglBitmap *bmp,
CoglError **error)
GError **error)
{
CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex);
CoglBitmap *upload_bmp;

View File

@@ -132,7 +132,7 @@ cogl_texture_2d_sliced_new_with_size (CoglContext *ctx,
* are allowed along the right and bottom textures before
* they must be sliced to reduce the amount of waste. A
* negative can be passed to disable slicing.
* @error: A #CoglError to catch exceptional errors or %NULL
* @error: A #GError to catch exceptional errors or %NULL
*
* Creates a #CoglTexture2DSliced from an image file.
*
@@ -170,7 +170,7 @@ CoglTexture2DSliced *
cogl_texture_2d_sliced_new_from_file (CoglContext *ctx,
const char *filename,
int max_waste,
CoglError **error);
GError **error);
/**
* cogl_texture_2d_sliced_new_from_data: (skip)
@@ -186,7 +186,7 @@ cogl_texture_2d_sliced_new_from_file (CoglContext *ctx,
* row in @data. A value of 0 will make Cogl automatically
* calculate @rowstride from @width and @format.
* @data: pointer the memory region where the source buffer resides
* @error: A #CoglError to catch exceptional errors or %NULL
* @error: A #GError to catch exceptional errors or %NULL
*
* Creates a new #CoglTexture2DSliced texture based on data residing
* in memory.
@@ -235,7 +235,7 @@ cogl_texture_2d_sliced_new_from_data (CoglContext *ctx,
CoglPixelFormat format,
int rowstride,
const uint8_t *data,
CoglError **error);
GError **error);
/**
* cogl_texture_2d_sliced_new_from_bitmap:

View File

@@ -42,7 +42,6 @@
#include "cogl-object-private.h"
#include "cogl-journal-private.h"
#include "cogl-framebuffer-private.h"
#include "cogl-error-private.h"
#include "cogl-gtype-private.h"
#include "driver/gl/cogl-texture-2d-gl-private.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
@@ -135,7 +134,7 @@ cogl_texture_2d_new_with_size (CoglContext *ctx,
static gboolean
_cogl_texture_2d_allocate (CoglTexture *tex,
CoglError **error)
GError **error)
{
CoglContext *ctx = tex->context;
@@ -148,7 +147,7 @@ _cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
{
CoglTextureLoader *loader;
_COGL_RETURN_VAL_IF_FAIL (bmp != NULL, NULL);
g_return_val_if_fail (bmp != NULL, NULL);
loader = _cogl_texture_create_loader ();
loader->src_type = COGL_TEXTURE_SOURCE_TYPE_BITMAP;
@@ -172,12 +171,12 @@ cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp)
CoglTexture2D *
cogl_texture_2d_new_from_file (CoglContext *ctx,
const char *filename,
CoglError **error)
GError **error)
{
CoglBitmap *bmp;
CoglTexture2D *tex_2d = NULL;
_COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
bmp = _cogl_bitmap_from_file (ctx, filename, error);
if (bmp == NULL)
@@ -198,13 +197,13 @@ cogl_texture_2d_new_from_data (CoglContext *ctx,
CoglPixelFormat format,
int rowstride,
const uint8_t *data,
CoglError **error)
GError **error)
{
CoglBitmap *bmp;
CoglTexture2D *tex_2d;
_COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL);
_COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL);
g_return_val_if_fail (format != COGL_PIXEL_FORMAT_ANY, NULL);
g_return_val_if_fail (data != NULL, NULL);
/* Rowstride from width if not given */
if (rowstride == 0)
@@ -241,19 +240,19 @@ cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
int height,
CoglPixelFormat format,
EGLImageKHR image,
CoglError **error)
GError **error)
{
CoglTextureLoader *loader;
CoglTexture2D *tex;
_COGL_RETURN_VAL_IF_FAIL (_cogl_context_get_winsys (ctx)->constraints &
COGL_RENDERER_CONSTRAINT_USES_EGL,
NULL);
g_return_val_if_fail (_cogl_context_get_winsys (ctx)->constraints &
COGL_RENDERER_CONSTRAINT_USES_EGL,
NULL);
_COGL_RETURN_VAL_IF_FAIL (_cogl_has_private_feature
(ctx,
COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE),
NULL);
g_return_val_if_fail (_cogl_has_private_feature
(ctx,
COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE),
NULL);
loader = _cogl_texture_create_loader ();
loader->src_type = COGL_TEXTURE_SOURCE_TYPE_EGL_IMAGE;
@@ -421,7 +420,7 @@ _cogl_texture_2d_set_region (CoglTexture *tex,
int height,
int level,
CoglBitmap *bmp,
CoglError **error)
GError **error)
{
CoglContext *ctx = tex->context;
CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex);

View File

@@ -113,7 +113,7 @@ cogl_texture_2d_new_with_size (CoglContext *ctx,
* cogl_texture_2d_new_from_file: (skip)
* @ctx: A #CoglContext
* @filename: the file to load
* @error: A #CoglError to catch exceptional errors or %NULL
* @error: A #GError to catch exceptional errors or %NULL
*
* Creates a low-level #CoglTexture2D texture from an image file.
*
@@ -136,7 +136,7 @@ cogl_texture_2d_new_with_size (CoglContext *ctx,
CoglTexture2D *
cogl_texture_2d_new_from_file (CoglContext *ctx,
const char *filename,
CoglError **error);
GError **error);
/**
* cogl_texture_2d_new_from_data: (skip)
@@ -148,7 +148,7 @@ cogl_texture_2d_new_from_file (CoglContext *ctx,
* scanlines in @data. A value of 0 will make Cogl automatically
* calculate @rowstride from @width and @format.
* @data: pointer the memory region where the source buffer resides
* @error: A #CoglError for exceptions
* @error: A #GError for exceptions
*
* Creates a low-level #CoglTexture2D texture based on data residing
* in memory.
@@ -178,7 +178,7 @@ cogl_texture_2d_new_from_data (CoglContext *ctx,
CoglPixelFormat format,
int rowstride,
const uint8_t *data,
CoglError **error);
GError **error);
/**
* cogl_texture_2d_new_from_bitmap:
@@ -219,7 +219,7 @@ cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
int height,
CoglPixelFormat format,
EGLImageKHR image,
CoglError **error);
GError **error);
typedef gboolean (*CoglTexture2DEGLImageExternalAlloc) (CoglTexture2D *tex_2d,
gpointer user_data,
@@ -235,7 +235,7 @@ cogl_texture_2d_new_from_egl_image_external (CoglContext *ctx,
CoglTexture2DEGLImageExternalAlloc alloc,
gpointer user_data,
GDestroyNotify destroy,
CoglError **error);
GError **error);
void
cogl_texture_2d_egl_image_external_bind (CoglTexture2D *tex_2d);

View File

@@ -0,0 +1,80 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2007,2008,2009,2010 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.
*
*
*/
#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION)
#error "Only <cogl/cogl.h> can be included directly."
#endif
#ifndef __COGL_TEXTURE_COMPONENTS_H__
#define __COGL_TEXTURE_COMPONENTS_H__
#include <cogl/cogl-types.h>
#include <cogl/cogl-macros.h>
#include <cogl/cogl-defines.h>
#include <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION:cogl-texture-components
* @short_description: Functions for creating and manipulating textures
*
* CoglTextureComponents can be used to specify what components of a
* #CoglTexture can be used for sampling later. This affects how data is
* uploaded to the GPU.
*/
/**
* CoglTextureComponents:
* @COGL_TEXTURE_COMPONENTS_A: Only the alpha component
* @COGL_TEXTURE_COMPONENTS_RG: Red and green components. Note that
* this can only be used if the %COGL_FEATURE_ID_TEXTURE_RG feature
* is advertised.
* @COGL_TEXTURE_COMPONENTS_RGB: Red, green and blue components
* @COGL_TEXTURE_COMPONENTS_RGBA: Red, green, blue and alpha components
* @COGL_TEXTURE_COMPONENTS_DEPTH: Only a depth component
*
* See cogl_texture_set_components().
*
* Since: 1.18
*/
typedef enum _CoglTextureComponents
{
COGL_TEXTURE_COMPONENTS_A = 1,
COGL_TEXTURE_COMPONENTS_RG,
COGL_TEXTURE_COMPONENTS_RGB,
COGL_TEXTURE_COMPONENTS_RGBA,
COGL_TEXTURE_COMPONENTS_DEPTH
} CoglTextureComponents;
G_END_DECLS
#endif /* __COGL_TEXTURE_COMPONENTS_H__ */

View File

@@ -84,7 +84,7 @@ struct _CoglTextureDriver
CoglBitmap *source_bmp,
GLuint source_gl_format,
GLuint source_gl_type,
CoglError **error);
GError **error);
/*
* Replaces the contents of the GL texture with the entire bitmap. On
@@ -101,7 +101,7 @@ struct _CoglTextureDriver
GLint internal_gl_format,
GLuint source_gl_format,
GLuint source_gl_type,
CoglError **error);
GError **error);
/*
* This sets up the glPixelStore state for an download to a destination with

View File

@@ -75,7 +75,7 @@ struct _CoglTextureVtable
gboolean is_primitive;
gboolean (* allocate) (CoglTexture *tex,
CoglError **error);
GError **error);
/* This should update the specified sub region of the texture with a
sub region of the given bitmap. The bitmap is not converted
@@ -91,7 +91,7 @@ struct _CoglTextureVtable
int dst_height,
int level,
CoglBitmap *bitmap,
CoglError **error);
GError **error);
gboolean (* is_get_data_supported) (CoglTexture *texture);
@@ -362,7 +362,7 @@ _cogl_texture_set_region (CoglTexture *texture,
int dst_x,
int dst_y,
int level,
CoglError **error);
GError **error);
gboolean
_cogl_texture_set_region_from_bitmap (CoglTexture *texture,
@@ -374,7 +374,7 @@ _cogl_texture_set_region_from_bitmap (CoglTexture *texture,
int dst_x,
int dst_y,
int level,
CoglError **error);
GError **error);
gboolean
_cogl_texture_needs_premult_conversion (CoglPixelFormat src_format,

View File

@@ -58,7 +58,6 @@
#include "cogl1-context.h"
#include "cogl-sub-texture.h"
#include "cogl-primitive-texture.h"
#include "cogl-error-private.h"
#include "cogl-gtype-private.h"
#include <string.h>
@@ -363,14 +362,12 @@ _cogl_texture_set_region_from_bitmap (CoglTexture *texture,
int dst_x,
int dst_y,
int level,
CoglError **error)
GError **error)
{
_COGL_RETURN_VAL_IF_FAIL ((cogl_bitmap_get_width (bmp) - src_x)
>= width, FALSE);
_COGL_RETURN_VAL_IF_FAIL ((cogl_bitmap_get_height (bmp) - src_y)
>= height, FALSE);
_COGL_RETURN_VAL_IF_FAIL (width > 0, FALSE);
_COGL_RETURN_VAL_IF_FAIL (height > 0, FALSE);
g_return_val_if_fail (cogl_bitmap_get_width (bmp) - src_x >= width, FALSE);
g_return_val_if_fail (cogl_bitmap_get_height (bmp) - src_y >= height, FALSE);
g_return_val_if_fail (width > 0, FALSE);
g_return_val_if_fail (height > 0, FALSE);
/* Assert that the storage for this texture has been allocated */
if (!cogl_texture_allocate (texture, error))
@@ -402,7 +399,7 @@ cogl_texture_set_region_from_bitmap (CoglTexture *texture,
unsigned int dst_height,
CoglBitmap *bitmap)
{
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
gboolean status =
_cogl_texture_set_region_from_bitmap (texture,
src_x, src_y,
@@ -412,8 +409,7 @@ cogl_texture_set_region_from_bitmap (CoglTexture *texture,
0, /* level */
&ignore_error);
if (!status)
cogl_error_free (ignore_error);
g_clear_error (&ignore_error);
return status;
}
@@ -427,13 +423,13 @@ _cogl_texture_set_region (CoglTexture *texture,
int dst_x,
int dst_y,
int level,
CoglError **error)
GError **error)
{
CoglContext *ctx = texture->context;
CoglBitmap *source_bmp;
gboolean ret;
_COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, FALSE);
g_return_val_if_fail (format != COGL_PIXEL_FORMAT_ANY, FALSE);
/* Rowstride from width if none specified */
if (rowstride == 0)
@@ -473,7 +469,7 @@ cogl_texture_set_region (CoglTexture *texture,
unsigned int rowstride,
const uint8_t *data)
{
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
const uint8_t *first_pixel;
int bytes_per_pixel = _cogl_pixel_format_get_bytes_per_pixel (format);
gboolean status;
@@ -494,8 +490,7 @@ cogl_texture_set_region (CoglTexture *texture,
dst_y,
0,
&ignore_error);
if (!status)
cogl_error_free (ignore_error);
g_clear_error (&ignore_error);
return status;
}
@@ -505,7 +500,7 @@ cogl_texture_set_data (CoglTexture *texture,
int rowstride,
const uint8_t *data,
int level,
CoglError **error)
GError **error)
{
int level_width;
int level_height;
@@ -543,7 +538,7 @@ get_texture_bits_via_offscreen (CoglTexture *meta_texture,
CoglFramebuffer *framebuffer;
CoglBitmap *bitmap;
gboolean ret;
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
CoglPixelFormat real_format;
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN))
@@ -557,7 +552,7 @@ get_texture_bits_via_offscreen (CoglTexture *meta_texture,
framebuffer = COGL_FRAMEBUFFER (offscreen);
if (!cogl_framebuffer_allocate (framebuffer, &ignore_error))
{
cogl_error_free (ignore_error);
g_error_free (ignore_error);
return FALSE;
}
@@ -586,8 +581,7 @@ get_texture_bits_via_offscreen (CoglTexture *meta_texture,
bitmap,
&ignore_error);
if (!ret)
cogl_error_free (ignore_error);
g_clear_error (&ignore_error);
cogl_object_unref (bitmap);
@@ -652,7 +646,7 @@ typedef struct
CoglBitmap *target_bmp;
uint8_t *target_bits;
gboolean success;
CoglError *error;
GError *error;
} CoglTextureGetData;
static void
@@ -740,7 +734,7 @@ cogl_texture_get_data (CoglTexture *texture,
int tex_width;
int tex_height;
CoglPixelFormat texture_format;
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
CoglTextureGetData tg_data;
@@ -820,7 +814,7 @@ cogl_texture_get_data (CoglTexture *texture,
&ignore_error);
if (!target_bmp)
{
cogl_error_free (ignore_error);
g_error_free (ignore_error);
return 0;
}
}
@@ -857,7 +851,7 @@ cogl_texture_get_data (CoglTexture *texture,
}
else
{
cogl_error_free (ignore_error);
g_error_free (ignore_error);
tg_data.success = FALSE;
}
@@ -875,7 +869,7 @@ cogl_texture_get_data (CoglTexture *texture,
{
CoglBitmap *new_bmp;
gboolean result;
CoglError *error = NULL;
GError *error = NULL;
/* Convert to requested format directly into the user's buffer */
new_bmp = cogl_bitmap_new_for_data (ctx,
@@ -887,7 +881,7 @@ cogl_texture_get_data (CoglTexture *texture,
if (!result)
{
cogl_error_free (error);
g_error_free (error);
/* Return failure after cleaning up */
byte_size = 0;
}
@@ -1077,18 +1071,18 @@ _cogl_texture_set_allocated (CoglTexture *texture,
gboolean
cogl_texture_allocate (CoglTexture *texture,
CoglError **error)
GError **error)
{
if (texture->allocated)
return TRUE;
if (texture->components == COGL_TEXTURE_COMPONENTS_RG &&
!cogl_has_feature (texture->context, COGL_FEATURE_ID_TEXTURE_RG))
_cogl_set_error (error,
COGL_TEXTURE_ERROR,
COGL_TEXTURE_ERROR_FORMAT,
"A red-green texture was requested but the driver "
"does not support them");
g_set_error (error,
COGL_TEXTURE_ERROR,
COGL_TEXTURE_ERROR_FORMAT,
"A red-green texture was requested but the driver "
"does not support them");
texture->allocated = texture->vtable->allocate (texture, error);
@@ -1192,7 +1186,7 @@ void
cogl_texture_set_components (CoglTexture *texture,
CoglTextureComponents components)
{
_COGL_RETURN_IF_FAIL (!texture->allocated);
g_return_if_fail (!texture->allocated);
if (texture->components == components)
return;
@@ -1210,7 +1204,7 @@ void
cogl_texture_set_premultiplied (CoglTexture *texture,
gboolean premultiplied)
{
_COGL_RETURN_IF_FAIL (!texture->allocated);
g_return_if_fail (!texture->allocated);
premultiplied = !!premultiplied;

View File

@@ -81,7 +81,7 @@ GType cogl_texture_get_gtype (void);
/**
* COGL_TEXTURE_ERROR:
*
* #CoglError domain for texture errors.
* #GError domain for texture errors.
*
* Since: 1.8
* Stability: Unstable
@@ -122,29 +122,6 @@ uint32_t cogl_texture_error_quark (void);
gboolean
cogl_is_texture (void *object);
/**
* CoglTextureComponents:
* @COGL_TEXTURE_COMPONENTS_A: Only the alpha component
* @COGL_TEXTURE_COMPONENTS_RG: Red and green components. Note that
* this can only be used if the %COGL_FEATURE_ID_TEXTURE_RG feature
* is advertised.
* @COGL_TEXTURE_COMPONENTS_RGB: Red, green and blue components
* @COGL_TEXTURE_COMPONENTS_RGBA: Red, green, blue and alpha components
* @COGL_TEXTURE_COMPONENTS_DEPTH: Only a depth component
*
* See cogl_texture_set_components().
*
* Since: 1.18
*/
typedef enum _CoglTextureComponents
{
COGL_TEXTURE_COMPONENTS_A = 1,
COGL_TEXTURE_COMPONENTS_RG,
COGL_TEXTURE_COMPONENTS_RGB,
COGL_TEXTURE_COMPONENTS_RGBA,
COGL_TEXTURE_COMPONENTS_DEPTH
} CoglTextureComponents;
/**
* cogl_texture_set_components:
* @texture: a #CoglTexture pointer.
@@ -387,7 +364,7 @@ cogl_texture_set_region (CoglTexture *texture,
* @data: the source data, pointing to the first top-left pixel to set
* @level: The mipmap level to update (Normally 0 for the largest,
* base texture)
* @error: A #CoglError to return exceptional errors
* @error: A #GError to return exceptional errors
*
* Sets all the pixels for a given mipmap @level by copying the pixel
* data pointed to by the @data argument into the given @texture.
@@ -436,7 +413,7 @@ cogl_texture_set_data (CoglTexture *texture,
int rowstride,
const uint8_t *data,
int level,
CoglError **error);
GError **error);
/**
* cogl_texture_set_region_from_bitmap:
@@ -476,7 +453,7 @@ cogl_texture_set_region_from_bitmap (CoglTexture *texture,
/**
* cogl_texture_allocate:
* @texture: A #CoglTexture
* @error: A #CoglError to return exceptional errors or %NULL
* @error: A #GError to return exceptional errors or %NULL
*
* Explicitly allocates the storage for the given @texture which
* allows you to be sure that there is enough memory for the
@@ -493,7 +470,7 @@ cogl_texture_set_region_from_bitmap (CoglTexture *texture,
*/
gboolean
cogl_texture_allocate (CoglTexture *texture,
CoglError **error);
GError **error);
/**
* cogl_texture_is_get_data_supported: (skip)

View File

@@ -323,7 +323,7 @@ typedef enum
/**
* COGL_BLEND_STRING_ERROR:
*
* #CoglError domain for blend string parser errors
* #GError domain for blend string parser errors
*
* Since: 1.0
*/

View File

@@ -114,7 +114,6 @@ unsigned int
_cogl_util_one_at_a_time_mix (unsigned int hash);
#define _cogl_util_ffs ffs
#define _cogl_util_ffsl __builtin_ffsl
static inline unsigned int
@@ -125,9 +124,6 @@ _cogl_util_fls (unsigned int n)
#define _cogl_util_popcountl __builtin_popcountl
#define _COGL_RETURN_IF_FAIL(EXPR) g_return_if_fail(EXPR)
#define _COGL_RETURN_VAL_IF_FAIL(EXPR, VAL) g_return_val_if_fail(EXPR, VAL)
/* Match a CoglPixelFormat according to channel masks, color depth,
* bits per pixel and byte order. These information are provided by
* the Visual and XImage structures.
@@ -142,14 +138,6 @@ _cogl_util_pixel_format_from_masks (unsigned long r_mask,
int depth, int bpp,
int byte_order);
/* Since we can't rely on _Static_assert always being available for
* all compilers we have limited static assert that can be used in
* C code but not in headers.
*/
#define _COGL_TYPEDEF_ASSERT(EXPRESSION) \
typedef struct { char Compile_Time_Assertion[(EXPRESSION) ? 1 : -1]; } \
G_PASTE (_GStaticAssert_, __LINE__)
/* _COGL_STATIC_ASSERT:
* @expression: An expression to assert evaluates to true at compile
* time.
@@ -163,8 +151,6 @@ _cogl_util_pixel_format_from_masks (unsigned long r_mask,
#define _COGL_STATIC_ASSERT(EXPRESSION, MESSAGE) \
_Static_assert (EXPRESSION, MESSAGE);
#define _cogl_util_memmem memmem
static inline void
_cogl_util_scissor_intersect (int rect_x0,
int rect_y0,

View File

@@ -63,8 +63,8 @@ cogl_vector3_equal (const void *v1, const void *v2)
float *vector0 = (float *)v1;
float *vector1 = (float *)v2;
_COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE);
_COGL_RETURN_VAL_IF_FAIL (v2 != NULL, FALSE);
g_return_val_if_fail (v1 != NULL, FALSE);
g_return_val_if_fail (v2 != NULL, FALSE);
/* There's no point picking an arbitrary epsilon that's appropriate
* for comparing the components so we just use == that will at least
@@ -80,8 +80,8 @@ cogl_vector3_equal_with_epsilon (const float *vector0,
const float *vector1,
float epsilon)
{
_COGL_RETURN_VAL_IF_FAIL (vector0 != NULL, FALSE);
_COGL_RETURN_VAL_IF_FAIL (vector1 != NULL, FALSE);
g_return_val_if_fail (vector0 != NULL, FALSE);
g_return_val_if_fail (vector1 != NULL, FALSE);
if (fabsf (vector0[X] - vector1[X]) < epsilon &&
fabsf (vector0[Y] - vector1[Y]) < epsilon &&
@@ -233,8 +233,8 @@ cogl_vector4_init_from_vector4 (float *vector, float *src)
gboolean
cogl_vector4_equal (const void *v0, const void *v1)
{
_COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE);
_COGL_RETURN_VAL_IF_FAIL (v2 != NULL, FALSE);
g_return_val_if_fail (v1 != NULL, FALSE);
g_return_val_if_fail (v2 != NULL, FALSE);
return memcmp (v1, v2, sizeof (float) * 4) == 0 ? TRUE : FALSE;
}

View File

@@ -55,7 +55,7 @@ typedef struct _CoglXlibRenderer
} CoglXlibRenderer;
gboolean
_cogl_xlib_renderer_connect (CoglRenderer *renderer, CoglError **error);
_cogl_xlib_renderer_connect (CoglRenderer *renderer, GError **error);
void
_cogl_xlib_renderer_disconnect (CoglRenderer *renderer);

View File

@@ -39,7 +39,6 @@
#include "cogl-renderer-private.h"
#include "cogl-xlib-renderer-private.h"
#include "cogl-x11-renderer-private.h"
#include "cogl-error-private.h"
#include "cogl-poll-private.h"
#include "winsys/cogl-winsys-private.h"
@@ -162,7 +161,7 @@ _cogl_xlib_renderer_untrap_errors (CoglRenderer *renderer,
}
static Display *
assert_xlib_display (CoglRenderer *renderer, CoglError **error)
assert_xlib_display (CoglRenderer *renderer, GError **error)
{
Display *xdpy = cogl_xlib_renderer_get_foreign_display (renderer);
CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (renderer);
@@ -177,7 +176,7 @@ assert_xlib_display (CoglRenderer *renderer, CoglError **error)
xdpy = XOpenDisplay (_cogl_x11_display_name);
if (xdpy == NULL)
{
_cogl_set_error (error,
g_set_error (error,
COGL_RENDERER_ERROR,
COGL_RENDERER_ERROR_XLIB_DISPLAY_OPEN,
"Failed to open X Display %s", _cogl_x11_display_name);
@@ -489,7 +488,7 @@ dispatch_xlib_events (void *user_data, int revents)
}
gboolean
_cogl_xlib_renderer_connect (CoglRenderer *renderer, CoglError **error)
_cogl_xlib_renderer_connect (CoglRenderer *renderer, GError **error)
{
CoglXlibRenderer *xlib_renderer =
_cogl_xlib_renderer_get_data (renderer);
@@ -566,7 +565,7 @@ cogl_xlib_renderer_get_display (CoglRenderer *renderer)
{
CoglXlibRenderer *xlib_renderer;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), NULL);
g_return_val_if_fail (cogl_is_renderer (renderer), NULL);
xlib_renderer = _cogl_xlib_renderer_get_data (renderer);
@@ -655,7 +654,7 @@ cogl_xlib_renderer_get_visual_info (CoglRenderer *renderer)
{
CoglXlibRenderer *xlib_renderer;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), NULL);
g_return_val_if_fail (cogl_is_renderer (renderer), NULL);
xlib_renderer = _cogl_xlib_renderer_get_data (renderer);

View File

@@ -556,7 +556,7 @@ cogl_push_source (void *material_or_pipeline)
{
CoglPipeline *pipeline = COGL_PIPELINE (material_or_pipeline);
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
_cogl_push_source (pipeline, TRUE);
}
@@ -571,7 +571,7 @@ _cogl_push_source (CoglPipeline *pipeline, gboolean enable_legacy)
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (cogl_is_pipeline (pipeline));
if (ctx->source_stack)
{
@@ -596,7 +596,7 @@ cogl_pop_source (void)
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
_COGL_RETURN_IF_FAIL (ctx->source_stack);
g_return_if_fail (ctx->source_stack);
top = ctx->source_stack->data;
top->push_count--;
@@ -617,7 +617,7 @@ cogl_get_source (void)
_COGL_GET_CONTEXT (ctx, NULL);
_COGL_RETURN_VAL_IF_FAIL (ctx->source_stack, NULL);
g_return_val_if_fail (ctx->source_stack, NULL);
top = ctx->source_stack->data;
return top->pipeline;
@@ -630,7 +630,7 @@ _cogl_get_enable_legacy_state (void)
_COGL_GET_CONTEXT (ctx, FALSE);
_COGL_RETURN_VAL_IF_FAIL (ctx->source_stack, FALSE);
g_return_val_if_fail (ctx->source_stack, FALSE);
top = ctx->source_stack->data;
return top->enable_legacy;
@@ -644,8 +644,8 @@ cogl_set_source (void *material_or_pipeline)
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
_COGL_RETURN_IF_FAIL (ctx->source_stack);
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)
@@ -672,7 +672,7 @@ cogl_set_source_texture (CoglTexture *texture)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
_COGL_RETURN_IF_FAIL (texture != NULL);
g_return_if_fail (texture != NULL);
cogl_pipeline_set_layer_texture (ctx->texture_pipeline, 0, texture);
cogl_set_source (ctx->texture_pipeline);

View File

@@ -55,8 +55,6 @@
#include <cogl/cogl-defines.h>
#include <cogl/cogl-macros.h>
#include <cogl/cogl-error.h>
#include <cogl/cogl-object.h>
#include <cogl/cogl1-context.h>
#include <cogl/cogl-bitmap.h>

View File

@@ -200,10 +200,6 @@ cogl_double_to_fixed
cogl_end_gl
cogl_error_copy
cogl_error_free
cogl_error_matches
cogl_euler_copy
cogl_euler_equal
cogl_euler_free

View File

@@ -47,7 +47,6 @@
#include "cogl-object.h"
#include "cogl-bitmap-private.h"
#include "cogl-atlas-texture-private.h"
#include "cogl-error-private.h"
#include "cogl-sub-texture.h"
#include "cogl-texture-2d-gl.h"
@@ -58,7 +57,7 @@ _cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
CoglTextureFlags flags,
CoglPixelFormat internal_format,
gboolean can_convert_in_place,
CoglError **error);
GError **error);
static void
set_auto_mipmap_cb (CoglTexture *sub_texture,
@@ -77,7 +76,7 @@ cogl_texture_new_with_size (unsigned int width,
CoglPixelFormat internal_format)
{
CoglTexture *tex;
CoglError *skip_error = NULL;
GError *skip_error = NULL;
_COGL_GET_CONTEXT (ctx, NULL);
@@ -88,7 +87,7 @@ cogl_texture_new_with_size (unsigned int width,
if (!cogl_texture_allocate (tex, &skip_error))
{
cogl_error_free (skip_error);
g_error_free (skip_error);
skip_error = NULL;
cogl_object_unref (tex);
tex = NULL;
@@ -111,7 +110,7 @@ cogl_texture_new_with_size (unsigned int width,
* semantics and return NULL if allocation fails... */
if (!cogl_texture_allocate (tex, &skip_error))
{
cogl_error_free (skip_error);
g_error_free (skip_error);
cogl_object_unref (tex);
return NULL;
}
@@ -139,13 +138,13 @@ _cogl_texture_new_from_data (CoglContext *ctx,
CoglPixelFormat internal_format,
int rowstride,
const uint8_t *data,
CoglError **error)
GError **error)
{
CoglBitmap *bmp;
CoglTexture *tex;
_COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL);
_COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL);
g_return_val_if_fail (format != COGL_PIXEL_FORMAT_ANY, NULL);
g_return_val_if_fail (data != NULL, NULL);
/* Rowstride from width if not given */
if (rowstride == 0)
@@ -178,7 +177,7 @@ cogl_texture_new_from_data (int width,
int rowstride,
const uint8_t *data)
{
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
CoglTexture *tex;
_COGL_GET_CONTEXT (ctx, NULL);
@@ -191,7 +190,7 @@ cogl_texture_new_from_data (int width,
data,
&ignore_error);
if (!tex)
cogl_error_free (ignore_error);
g_error_free (ignore_error);
return tex;
}
@@ -200,10 +199,10 @@ _cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
CoglTextureFlags flags,
CoglPixelFormat internal_format,
gboolean can_convert_in_place,
CoglError **error)
GError **error)
{
CoglTexture *tex;
CoglError *internal_error = NULL;
GError *internal_error = NULL;
if (!flags &&
!COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_ATLAS))
@@ -219,7 +218,7 @@ _cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
if (cogl_texture_allocate (COGL_TEXTURE (atlas_tex), &internal_error))
return COGL_TEXTURE (atlas_tex);
cogl_error_free (internal_error);
g_error_free (internal_error);
internal_error = NULL;
cogl_object_unref (atlas_tex);
}
@@ -232,7 +231,7 @@ _cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
if (!cogl_texture_allocate (tex, &internal_error))
{
cogl_error_free (internal_error);
g_error_free (internal_error);
internal_error = NULL;
cogl_object_unref (tex);
tex = NULL;
@@ -274,7 +273,7 @@ cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
CoglTextureFlags flags,
CoglPixelFormat internal_format)
{
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
CoglTexture *tex =
_cogl_texture_new_from_bitmap (bitmap,
flags,
@@ -282,7 +281,7 @@ cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
FALSE, /* can't convert in-place */
&ignore_error);
if (!tex)
cogl_error_free (ignore_error);
g_error_free (ignore_error);
return tex;
}
@@ -290,14 +289,14 @@ CoglTexture *
cogl_texture_new_from_file (const char *filename,
CoglTextureFlags flags,
CoglPixelFormat internal_format,
CoglError **error)
GError **error)
{
CoglBitmap *bmp;
CoglTexture *texture = NULL;
_COGL_GET_CONTEXT (ctx, NULL);
_COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
bmp = cogl_bitmap_new_from_file (filename, error);
if (bmp == NULL)

View File

@@ -70,7 +70,7 @@ cogl_texture_new_with_size (unsigned int width,
* have non-premultiplied source data and are going to adjust the blend
* mode (see cogl_material_set_blend()) or use the data for something
* other than straight blending.
* @error: return location for a #CoglError or %NULL
* @error: return location for a #GError or %NULL
*
* Creates a #CoglTexture from an image file.
*
@@ -86,7 +86,7 @@ CoglTexture *
cogl_texture_new_from_file (const char *filename,
CoglTextureFlags flags,
CoglPixelFormat internal_format,
CoglError **error);
GError **error);
/**
* cogl_texture_new_from_data:

View File

@@ -102,10 +102,10 @@ cogl_clutter_winsys_xlib_get_visual_info (void)
_COGL_GET_CONTEXT (ctx, NULL);
_COGL_RETURN_VAL_IF_FAIL (ctx->display != NULL, NULL);
g_return_val_if_fail (ctx->display != NULL, NULL);
renderer = cogl_display_get_renderer (ctx->display);
_COGL_RETURN_VAL_IF_FAIL (renderer != NULL, NULL);
g_return_val_if_fail (renderer != NULL, NULL);
return cogl_xlib_renderer_get_visual_info (renderer);
}

View File

@@ -114,8 +114,8 @@ _cogl_set_framebuffers_real (CoglFramebuffer *draw_buffer,
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
_COGL_RETURN_IF_FAIL (ctx != NULL);
_COGL_RETURN_IF_FAIL (draw_buffer && read_buffer ?
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;
@@ -146,8 +146,8 @@ _cogl_set_framebuffers (CoglFramebuffer *draw_buffer,
CoglFramebuffer *current_draw_buffer;
CoglFramebuffer *current_read_buffer;
_COGL_RETURN_IF_FAIL (cogl_is_framebuffer (draw_buffer));
_COGL_RETURN_IF_FAIL (cogl_is_framebuffer (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 ();
@@ -213,14 +213,14 @@ _cogl_push_framebuffers (CoglFramebuffer *draw_buffer,
CoglContext *ctx;
CoglFramebuffer *old_draw_buffer, *old_read_buffer;
_COGL_RETURN_IF_FAIL (cogl_is_framebuffer (draw_buffer));
_COGL_RETURN_IF_FAIL (cogl_is_framebuffer (read_buffer));
g_return_if_fail (cogl_is_framebuffer (draw_buffer));
g_return_if_fail (cogl_is_framebuffer (read_buffer));
ctx = draw_buffer->context;
_COGL_RETURN_IF_FAIL (ctx != NULL);
_COGL_RETURN_IF_FAIL (draw_buffer->context == read_buffer->context);
g_return_if_fail (ctx != NULL);
g_return_if_fail (draw_buffer->context == read_buffer->context);
_COGL_RETURN_IF_FAIL (ctx->framebuffer_stack != NULL);
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 */

View File

@@ -200,7 +200,7 @@ cogl_material_set_alpha_test_function (CoglMaterial *material,
gboolean
cogl_material_set_blend (CoglMaterial *material,
const char *blend_string,
CoglError **error)
GError **error)
{
return cogl_pipeline_set_blend (COGL_PIPELINE (material),
blend_string,
@@ -260,7 +260,7 @@ gboolean
cogl_material_set_layer_combine (CoglMaterial *material,
int layer_index,
const char *blend_string,
CoglError **error)
GError **error)
{
return cogl_pipeline_set_layer_combine (COGL_PIPELINE (material),
layer_index,
@@ -339,7 +339,7 @@ gboolean
cogl_material_set_layer_point_sprite_coords_enabled (CoglMaterial *material,
int layer_index,
gboolean enable,
CoglError **error)
GError **error)
{
CoglPipeline *pipeline = COGL_PIPELINE (material);
return cogl_pipeline_set_layer_point_sprite_coords_enabled (pipeline,
@@ -447,7 +447,7 @@ cogl_material_foreach_layer (CoglMaterial *material,
gboolean
cogl_material_set_depth_state (CoglMaterial *material,
const CoglDepthState *state,
CoglError **error)
GError **error)
{
return cogl_pipeline_set_depth_state (COGL_PIPELINE (material),
state, error);

View File

@@ -38,7 +38,6 @@
#include <cogl/cogl-types.h>
#include <cogl/cogl-matrix.h>
#include <cogl/cogl-depth-state.h>
#include <cogl/cogl-error.h>
#include <cogl/cogl-macros.h>
#include <cogl/cogl-object.h>
@@ -560,7 +559,7 @@ cogl_material_set_alpha_test_function (CoglMaterial *material,
* @material: A #CoglMaterial object
* @blend_string: A <link linkend="cogl-Blend-Strings">Cogl blend string</link>
* describing the desired blend function.
* @error: return location for a #CoglError that may report lack of driver
* @error: return location for a #GError that may report lack of driver
* support if you give separate blend string statements for the alpha
* channel and RGB channels since some drivers, or backends such as
* GLES 1.1, don't support this feature. May be %NULL, in which case a
@@ -644,7 +643,7 @@ COGL_DEPRECATED_FOR (cogl_pipeline_set_blend)
gboolean
cogl_material_set_blend (CoglMaterial *material,
const char *blend_string,
CoglError **error);
GError **error);
/**
* cogl_material_set_blend_constant:
@@ -810,7 +809,7 @@ cogl_material_remove_layer (CoglMaterial *material,
* @layer_index: Specifies the layer you want define a combine function for
* @blend_string: A <link linkend="cogl-Blend-Strings">Cogl blend string</link>
* describing the desired texture combine function.
* @error: A #CoglError that may report parse errors or lack of GPU/driver
* @error: A #GError that may report parse errors or lack of GPU/driver
* support. May be %NULL, in which case a warning will be printed out if an
* error is encountered.
*
@@ -902,7 +901,7 @@ gboolean
cogl_material_set_layer_combine (CoglMaterial *material,
int layer_index,
const char *blend_string,
CoglError **error);
GError **error);
/**
* cogl_material_set_layer_combine_constant:
@@ -1083,7 +1082,7 @@ cogl_material_set_layer_filters (CoglMaterial *material,
* @material: a #CoglHandle to a material.
* @layer_index: the layer number to change.
* @enable: whether to enable point sprite coord generation.
* @error: A return location for a CoglError, or NULL to ignore errors.
* @error: A return location for a GError, or NULL to ignore errors.
*
* When rendering points, if @enable is %TRUE then the texture
* coordinates for this layer will be replaced with coordinates that
@@ -1106,7 +1105,7 @@ gboolean
cogl_material_set_layer_point_sprite_coords_enabled (CoglMaterial *material,
int layer_index,
gboolean enable,
CoglError **error);
GError **error);
/**
* cogl_material_get_layer_point_sprite_coords_enabled:
@@ -1310,7 +1309,7 @@ cogl_material_layer_get_wrap_mode_p (CoglMaterialLayer *layer);
* cogl_material_set_depth_state: (skip)
* @material: A #CoglMaterial object
* @state: A #CoglDepthState struct
* @error: A #CoglError to report failures to setup the given @state.
* @error: A #GError to report failures to setup the given @state.
*
* This commits all the depth state configured in @state struct to the
* given @material. The configuration values are copied into the
@@ -1331,7 +1330,7 @@ COGL_DEPRECATED_FOR (cogl_pipeline_set_depth_state)
gboolean
cogl_material_set_depth_state (CoglMaterial *material,
const CoglDepthState *state,
CoglError **error);
GError **error);
/**
* cogl_material_get_depth_state: (skip)

View File

@@ -108,7 +108,7 @@ cogl_program_attach_shader (CoglHandle program_handle,
shader = shader_handle;
if (shader->language == COGL_SHADER_LANGUAGE_GLSL)
_COGL_RETURN_IF_FAIL (_cogl_program_get_language (program) ==
g_return_if_fail (_cogl_program_get_language (program) ==
COGL_SHADER_LANGUAGE_GLSL);
program->attached_shaders
@@ -131,7 +131,7 @@ cogl_program_use (CoglHandle handle)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
_COGL_RETURN_IF_FAIL (handle == COGL_INVALID_HANDLE ||
g_return_if_fail (handle == COGL_INVALID_HANDLE ||
cogl_is_program (handle));
if (ctx->current_program == 0 && handle != 0)
@@ -193,10 +193,10 @@ cogl_program_modify_uniform (CoglProgram *program,
{
CoglProgramUniform *uniform;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_program (program), NULL);
_COGL_RETURN_VAL_IF_FAIL (uniform_no >= 0 &&
uniform_no < program->custom_uniforms->len,
NULL);
g_return_val_if_fail (cogl_is_program (program), NULL);
g_return_val_if_fail (uniform_no >= 0 &&
uniform_no < program->custom_uniforms->len,
NULL);
uniform = &g_array_index (program->custom_uniforms,
CoglProgramUniform, uniform_no);

View File

@@ -1171,7 +1171,7 @@ update_primitive_attributes (CoglVertexBuffer *buffer)
;
}
_COGL_RETURN_IF_FAIL (n_attributes > 0);
g_return_if_fail (n_attributes > 0);
attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes);

View File

@@ -37,7 +37,6 @@
#include <string.h>
#include "cogl-private.h"
#include "cogl-error-private.h"
#include "cogl-context-private.h"
#include "cogl-attribute.h"
#include "cogl-attribute-private.h"
@@ -60,9 +59,9 @@ toggle_builtin_attribute_enabled_cb (int bit_num, void *user_data)
ForeachChangedBitState *state = user_data;
CoglContext *context = state->context;
_COGL_RETURN_VAL_IF_FAIL (_cogl_has_private_feature
(context, COGL_PRIVATE_FEATURE_GL_FIXED),
FALSE);
g_return_val_if_fail (_cogl_has_private_feature
(context, COGL_PRIVATE_FEATURE_GL_FIXED),
FALSE);
#ifdef HAVE_COGL_GL
{
@@ -99,9 +98,9 @@ toggle_texcood_attribute_enabled_cb (int bit_num, void *user_data)
ForeachChangedBitState *state = user_data;
CoglContext *context = state->context;
_COGL_RETURN_VAL_IF_FAIL (_cogl_has_private_feature
(context, COGL_PRIVATE_FEATURE_GL_FIXED),
FALSE);
g_return_val_if_fail (_cogl_has_private_feature
(context, COGL_PRIVATE_FEATURE_GL_FIXED),
FALSE);
#ifdef HAVE_COGL_GL
{

View File

@@ -51,7 +51,7 @@ _cogl_buffer_gl_map_range (CoglBuffer *buffer,
size_t size,
CoglBufferAccess access,
CoglBufferMapHint hints,
CoglError **error);
GError **error);
void
_cogl_buffer_gl_unmap (CoglBuffer *buffer);
@@ -61,12 +61,12 @@ _cogl_buffer_gl_set_data (CoglBuffer *buffer,
unsigned int offset,
const void *data,
unsigned int size,
CoglError **error);
GError **error);
void *
_cogl_buffer_gl_bind (CoglBuffer *buffer,
CoglBufferBindTarget target,
CoglError **error);
GError **error);
void
_cogl_buffer_gl_unbind (CoglBuffer *buffer);

View File

@@ -36,7 +36,6 @@
#include "cogl-context-private.h"
#include "driver/gl/cogl-buffer-gl-private.h"
#include "cogl-error-private.h"
#include "driver/gl/cogl-util-gl-private.h"
/*
@@ -135,7 +134,7 @@ convert_bind_target_to_gl_target (CoglBufferBindTarget target)
static gboolean
recreate_store (CoglBuffer *buffer,
CoglError **error)
GError **error)
{
CoglContext *ctx = buffer->context;
GLenum gl_target;
@@ -178,14 +177,14 @@ _cogl_buffer_bind_no_create (CoglBuffer *buffer,
{
CoglContext *ctx = buffer->context;
_COGL_RETURN_VAL_IF_FAIL (buffer != NULL, NULL);
g_return_val_if_fail (buffer != NULL, NULL);
/* Don't allow binding the buffer to multiple targets at the same time */
_COGL_RETURN_VAL_IF_FAIL (ctx->current_buffer[buffer->last_target] != buffer,
NULL);
g_return_val_if_fail (ctx->current_buffer[buffer->last_target] != buffer,
NULL);
/* Don't allow nesting binds to the same target */
_COGL_RETURN_VAL_IF_FAIL (ctx->current_buffer[target] == NULL, NULL);
g_return_val_if_fail (ctx->current_buffer[target] == NULL, NULL);
buffer->last_target = target;
ctx->current_buffer[target] = buffer;
@@ -206,7 +205,7 @@ _cogl_buffer_gl_map_range (CoglBuffer *buffer,
size_t size,
CoglBufferAccess access,
CoglBufferMapHint hints,
CoglError **error)
GError **error)
{
uint8_t *data;
CoglBufferBindTarget target;
@@ -218,10 +217,10 @@ _cogl_buffer_gl_map_range (CoglBuffer *buffer,
((access & COGL_BUFFER_ACCESS_WRITE) &&
!cogl_has_feature (ctx, COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE)))
{
_cogl_set_error (error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_UNSUPPORTED,
"Tried to map a buffer with unsupported access mode");
g_set_error_literal (error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_UNSUPPORTED,
"Tried to map a buffer with unsupported access mode");
return NULL;
}
@@ -290,7 +289,7 @@ _cogl_buffer_gl_map_range (CoglBuffer *buffer,
return NULL;
}
_COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL);
g_return_val_if_fail (data != NULL, NULL);
}
else
{
@@ -319,7 +318,7 @@ _cogl_buffer_gl_map_range (CoglBuffer *buffer,
return NULL;
}
_COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL);
g_return_val_if_fail (data != NULL, NULL);
data += offset;
}
@@ -351,13 +350,13 @@ _cogl_buffer_gl_set_data (CoglBuffer *buffer,
unsigned int offset,
const void *data,
unsigned int size,
CoglError **error)
GError **error)
{
CoglBufferBindTarget target;
GLenum gl_target;
CoglContext *ctx = buffer->context;
gboolean status = TRUE;
CoglError *internal_error = NULL;
GError *internal_error = NULL;
target = buffer->last_target;
@@ -369,7 +368,7 @@ _cogl_buffer_gl_set_data (CoglBuffer *buffer,
*/
if (internal_error)
{
_cogl_propagate_error (error, internal_error);
g_propagate_error (error, internal_error);
return FALSE;
}
@@ -391,7 +390,7 @@ _cogl_buffer_gl_set_data (CoglBuffer *buffer,
void *
_cogl_buffer_gl_bind (CoglBuffer *buffer,
CoglBufferBindTarget target,
CoglError **error)
GError **error)
{
void *ret;
@@ -418,10 +417,10 @@ _cogl_buffer_gl_unbind (CoglBuffer *buffer)
{
CoglContext *ctx = buffer->context;
_COGL_RETURN_IF_FAIL (buffer != NULL);
g_return_if_fail (buffer != NULL);
/* the unbind should pair up with a previous bind */
_COGL_RETURN_IF_FAIL (ctx->current_buffer[buffer->last_target] == buffer);
g_return_if_fail (ctx->current_buffer[buffer->last_target] == buffer);
if (buffer->flags & COGL_BUFFER_FLAG_BUFFER_OBJECT)
{

View File

@@ -36,7 +36,7 @@
gboolean
_cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
CoglError **error);
GError **error);
void
_cogl_offscreen_gl_free (CoglOffscreen *offscreen);
@@ -95,7 +95,7 @@ _cogl_framebuffer_gl_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
int y,
CoglReadPixelsFlags source,
CoglBitmap *bitmap,
CoglError **error);
GError **error);
#endif /* __COGL_FRAMEBUFFER_GL_PRIVATE_H__ */

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