Compare commits
204 Commits
wip/nielsd
...
wip/carlos
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d7f799bfaf | ||
![]() |
09bab98b1e | ||
![]() |
aee8bfce3f | ||
![]() |
92868182c9 | ||
![]() |
08a3cbfc6c | ||
![]() |
59fb26cb00 | ||
![]() |
87c734cef9 | ||
![]() |
c755fb6995 | ||
![]() |
e9cc220c8e | ||
![]() |
92f210039e | ||
![]() |
aef393efd0 | ||
![]() |
6836317e41 | ||
![]() |
61e51cdef6 | ||
![]() |
7868ab761f | ||
![]() |
e6c8939c30 | ||
![]() |
ac5d9ec558 | ||
![]() |
9c8ff5dbe8 | ||
![]() |
7738316dff | ||
![]() |
1c3d8defb5 | ||
![]() |
b2ae03c428 | ||
![]() |
456698c814 | ||
![]() |
9189b7b512 | ||
![]() |
4259cfd4c6 | ||
![]() |
4fdefb5b2e | ||
![]() |
5ca0ef078d | ||
![]() |
a5265365dd | ||
![]() |
62f576e15b | ||
![]() |
73bc3c4426 | ||
![]() |
57772e5850 | ||
![]() |
7c8baf8ed9 | ||
![]() |
0e3c062406 | ||
![]() |
4bc7425332 | ||
![]() |
a2a8f0cdaa | ||
![]() |
faa7b2d4e5 | ||
![]() |
a95644dbdc | ||
![]() |
720f363241 | ||
![]() |
3794df608c | ||
![]() |
2c893beff1 | ||
![]() |
a3c425ad89 | ||
![]() |
1d144486d1 | ||
![]() |
9cd3b07472 | ||
![]() |
6061abbf90 | ||
![]() |
55c084e6e1 | ||
![]() |
45289b3d65 | ||
![]() |
6df34eb4b7 | ||
![]() |
3e68c9e8fa | ||
![]() |
fc0ce11fcd | ||
![]() |
c08a24bb40 | ||
![]() |
78560b8426 | ||
![]() |
0eab73dc2e | ||
![]() |
dd8c8e82f2 | ||
![]() |
62f4e0501f | ||
![]() |
6d8293a422 | ||
![]() |
b80250e483 | ||
![]() |
bd0f1bd338 | ||
![]() |
2439255f32 | ||
![]() |
c327b2df95 | ||
![]() |
9aee47daa9 | ||
![]() |
ecf7e53206 | ||
![]() |
8038eaa99f | ||
![]() |
9bcb50fa09 | ||
![]() |
c17af6c794 | ||
![]() |
4a184d74d5 | ||
![]() |
1f133b3ed2 | ||
![]() |
84616bef27 | ||
![]() |
040de396b2 | ||
![]() |
5a4bc15d0b | ||
![]() |
01e20a6ba9 | ||
![]() |
b0b1ff36ae | ||
![]() |
5ed9abd51a | ||
![]() |
65c5260312 | ||
![]() |
7d9674149f | ||
![]() |
25376b3b3c | ||
![]() |
b86a67c80a | ||
![]() |
7419ab7de5 | ||
![]() |
6b853ffdbd | ||
![]() |
ad220fc025 | ||
![]() |
5bd85ef7e5 | ||
![]() |
73f83f1ab6 | ||
![]() |
5cb6286436 | ||
![]() |
1c25b75571 | ||
![]() |
f2f4af0d50 | ||
![]() |
a8f8bc563e | ||
![]() |
46248748a9 | ||
![]() |
da7372a2fa | ||
![]() |
de97b54595 | ||
![]() |
d7d97f2477 | ||
![]() |
7776941b89 | ||
![]() |
4061c8384b | ||
![]() |
b850f5a732 | ||
![]() |
7645c51c54 | ||
![]() |
f1837b785b | ||
![]() |
22978b9d07 | ||
![]() |
1206879a20 | ||
![]() |
dc5925b7d1 | ||
![]() |
b138006bb7 | ||
![]() |
bca08c2c4e | ||
![]() |
6541d49fe7 | ||
![]() |
c3c6668343 | ||
![]() |
70de90ebce | ||
![]() |
0756fd4636 | ||
![]() |
8c339dac3e | ||
![]() |
06a7c22bcd | ||
![]() |
ca88826ce9 | ||
![]() |
7229a07b6c | ||
![]() |
85f4772a4f | ||
![]() |
f2fb3945d1 | ||
![]() |
d7d75dd8e7 | ||
![]() |
54fe0d311d | ||
![]() |
fefac75e96 | ||
![]() |
5e46940332 | ||
![]() |
1767672375 | ||
![]() |
6fc4cd3c0c | ||
![]() |
feb9d129db | ||
![]() |
2b519cba36 | ||
![]() |
832fc798d5 | ||
![]() |
bd0743a421 | ||
![]() |
20731887f2 | ||
![]() |
980d9b1042 | ||
![]() |
bd7704f9e1 | ||
![]() |
68f18f1fe9 | ||
![]() |
c655166398 | ||
![]() |
e14613e74e | ||
![]() |
f71151a5dd | ||
![]() |
6022b23923 | ||
![]() |
d08763c18c | ||
![]() |
fcb408ad5d | ||
![]() |
51f9e04ef1 | ||
![]() |
2fc7760cee | ||
![]() |
f2d2d473b7 | ||
![]() |
e1f839f48f | ||
![]() |
eccc791f3b | ||
![]() |
6055f04814 | ||
![]() |
0185909ee3 | ||
![]() |
c35e56196a | ||
![]() |
181c7cab32 | ||
![]() |
740a62044e | ||
![]() |
0bf0366933 | ||
![]() |
70bacb9402 | ||
![]() |
57dfe4696d | ||
![]() |
22a91f23ad | ||
![]() |
6aa1026600 | ||
![]() |
75dff3e7c9 | ||
![]() |
bea7600471 | ||
![]() |
8932388dda | ||
![]() |
2238c9f180 | ||
![]() |
ca21ca6745 | ||
![]() |
2bbd2e5563 | ||
![]() |
691d58e69b | ||
![]() |
d84c7269b2 | ||
![]() |
aba689312f | ||
![]() |
f2d9a11013 | ||
![]() |
596376c408 | ||
![]() |
1f62a8dbd9 | ||
![]() |
f59d62bc8f | ||
![]() |
5d5d296551 | ||
![]() |
065bf752f4 | ||
![]() |
4d3e804391 | ||
![]() |
15a2ccd21b | ||
![]() |
fef5753a19 | ||
![]() |
f3fd7cf92b | ||
![]() |
5c500ad402 | ||
![]() |
e7fd068a78 | ||
![]() |
171e5fc3c2 | ||
![]() |
7b7d881386 | ||
![]() |
44905d96da | ||
![]() |
73e8127d5d | ||
![]() |
11e2005563 | ||
![]() |
02fc0b4533 | ||
![]() |
36155f72d0 | ||
![]() |
c63d0173b5 | ||
![]() |
7fcdd60ac5 | ||
![]() |
a8984a81c2 | ||
![]() |
769a02b630 | ||
![]() |
576330edce | ||
![]() |
a2a114e79c | ||
![]() |
79e22853ea | ||
![]() |
be72b22964 | ||
![]() |
2464f00902 | ||
![]() |
9b5d9f3cb3 | ||
![]() |
088117a619 | ||
![]() |
4a19628829 | ||
![]() |
0cd54c5735 | ||
![]() |
cc2c670a5e | ||
![]() |
769a01f4e9 | ||
![]() |
9c1afbbb67 | ||
![]() |
376725e30e | ||
![]() |
b836e661cf | ||
![]() |
446e82e86d | ||
![]() |
f2020913fd | ||
![]() |
d9fb11b043 | ||
![]() |
56ddaaa380 | ||
![]() |
1efb32d300 | ||
![]() |
6dba56223a | ||
![]() |
2ff6beea35 | ||
![]() |
689c7f4107 | ||
![]() |
59bf1f4838 | ||
![]() |
db0f85ba5d | ||
![]() |
425611eadf | ||
![]() |
9213574870 | ||
![]() |
3073acc3b0 | ||
![]() |
a61d525111 | ||
![]() |
4064d9a7a7 | ||
![]() |
8a06cfdd81 |
@@ -28,6 +28,20 @@ build-mutter:
|
||||
- merge_requests
|
||||
- /^.*$/
|
||||
|
||||
build-without-native-backend:
|
||||
stage: build
|
||||
script:
|
||||
- meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false --werror --prefix /usr
|
||||
- ninja -C build
|
||||
- ninja -C build install
|
||||
artifacts:
|
||||
expire_in: 1 day
|
||||
paths:
|
||||
- build
|
||||
only:
|
||||
- merge_requests
|
||||
- /^.*$/
|
||||
|
||||
test-mutter:
|
||||
stage: test
|
||||
dependencies:
|
||||
|
@@ -1,21 +1,31 @@
|
||||
# Rebuild and push with
|
||||
#
|
||||
# cd .gitlab-ci/
|
||||
# docker build -t registry.gitlab.gnome.org/gnome/mutter/master:v2 .
|
||||
# docker push registry.gitlab.gnome.org/gnome/mutter/master:v2
|
||||
#
|
||||
|
||||
FROM fedora:30
|
||||
|
||||
RUN dnf -y update && dnf -y upgrade && \
|
||||
dnf install -y 'dnf-command(builddep)' && \
|
||||
dnf install -y 'dnf-command(copr)' && \
|
||||
dnf copr enable -y fmuellner/gnome-shell-ci && \
|
||||
dnf copr enable -y jadahl/mutter-ci && \
|
||||
dnf copr enable -y hergertme/sysprof-3 && \
|
||||
|
||||
dnf builddep -y mutter && \
|
||||
|
||||
# Until Fedora catches up with meson build-deps
|
||||
dnf install -y meson xorg-x11-server-Xorg gnome-settings-daemon-devel egl-wayland-devel xorg-x11-server-Xwayland && \
|
||||
|
||||
# Until Fedora catches up with mesa bug fixes
|
||||
dnf upgrade -y mesa-dri-drivers mesa-libEGL && \
|
||||
|
||||
# For running unit tests
|
||||
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 '*/xvfb-run' gdm-lib accountsservice-libs && \
|
||||
|
||||
# Unpackaged versions
|
||||
dnf install -y https://copr-be.cloud.fedoraproject.org/results/jadahl/mutter-ci/fedora-29-x86_64/00834984-gsettings-desktop-schemas/gsettings-desktop-schemas-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm https://copr-be.cloud.fedoraproject.org/results/jadahl/mutter-ci/fedora-29-x86_64/00834984-gsettings-desktop-schemas/gsettings-desktop-schemas-devel-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm && \
|
||||
dnf install -y https://copr-be.cloud.fedoraproject.org/results/hergertme/sysprof-3/fedora-30-x86_64/00917385-sysprof/libsysprof-ui-3.33.2-1.fc30.x86_64.rpm https://copr-be.cloud.fedoraproject.org/results/hergertme/sysprof-3/fedora-30-x86_64/00917385-sysprof/sysprof-cli-3.33.2-1.fc30.x86_64.rpm https://copr-be.cloud.fedoraproject.org/results/hergertme/sysprof-3/fedora-30-x86_64/00917385-sysprof/sysprof-3.33.2-1.fc30.x86_64.rpm https://copr-be.cloud.fedoraproject.org/results/hergertme/sysprof-3/fedora-30-x86_64/00917385-sysprof/sysprof-devel-3.33.2-1.fc30.x86_64.rpm && \
|
||||
dnf install -y sysprof-devel && \
|
||||
|
||||
dnf install -y intltool redhat-rpm-config make && \
|
||||
|
||||
|
66
NEWS
66
NEWS
@@ -1,3 +1,69 @@
|
||||
3.33.4
|
||||
======
|
||||
* Discard page flip retries on hotplug [Jonas; !630]
|
||||
* Add xdg-output v2 support [Olivier; #645]
|
||||
* Restore DRM format fallbacks [Jonas; !662]
|
||||
* Don't emit ::size-changed when only position changed [Daniel; !568]
|
||||
* Expose workspace layout properties [Florian; !618]
|
||||
* Don't use grab modifiers when shortcuts are inhibited [Olivier; #642]
|
||||
* Fix stuttering due to unchanged power save mode notifications [Georges; !674]
|
||||
* Add API to reorder workspaces [Adam; !670]
|
||||
* Make picking a new focus window more reliable [Marco; !669]
|
||||
* Defer actor allocation till shown [Carlos; !677]
|
||||
* Try to use primary GPU for copy instead of glReadPixels [Pekka; !615]
|
||||
* Unset pointer focus when the cursor is hidden [Jonas D.; !448]
|
||||
* Fix modifier-drag on wayland subsurfaces [Robert; !604]
|
||||
* Fix background corruption on Nvidia after resuming from suspend [Daniel; !600]
|
||||
* Only grab the locate-pointer key when necessary [Olivier; !685, #647]
|
||||
* Misc. bug fixes and cleanups [Florian, Jonas, Daniel, Robert, Olivier,
|
||||
Georges, Marco, Carlos, Emmanuele; !648, !650, !647, !656, !658, !637,
|
||||
!663, !660, !659, !665, !666, !668, !667, #667, !676, !678, #672, !680,
|
||||
!683, !688, !689, !687]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl, Emmanuele Bassi, Adam Bieńkowski, Piotr Drąg, Jonas Dreßler,
|
||||
Olivier Fourdan, Carlos Garnacho, Robert Mader, Florian Müllner,
|
||||
Georges Basile Stavracas Neto, Pekka Paalanen, Marco Trevisan (Treviño),
|
||||
Daniel van Vugt
|
||||
|
||||
Translators:
|
||||
Fabio Tomat [fur], Kukuh Syafaat [id]
|
||||
|
||||
3.33.3
|
||||
======
|
||||
* Prepare for running Xwayland on demand [Carlos; !420]
|
||||
* Fix text selection color rendering [Florian; #494]
|
||||
* Fix black shadows when using fractional scaling [Robert; #609]
|
||||
* Honor startup sequence workspace on wayland [Carlos; gnome-shell#674]
|
||||
* Only emit 'grab-op-end` signal after dropping grabs [Marco; !596]
|
||||
* Add a Sysprof-based profiler [Jonas, Georges; !197, !603]
|
||||
* Relax "xwayland-allow-grabs" setting [Olivier; #597]
|
||||
* Implement locate-pointer accessibility feature [Olivier; !453]
|
||||
* Implement mouse accessibility [Olivier; !512]
|
||||
* Consolidate frame throttling [Daniel, Georges; !363]
|
||||
* Fix setting blank cursor under wayland [Jonas; #630]
|
||||
* Pixel-align OpenGL cursors [Jonas; !610]
|
||||
* Handle returning from fullscreen/maximization better [Jonas; !621]
|
||||
* Improve screencast support on multi-monitor systems [Georges; !623]
|
||||
* Fix running X11 applications with sudo under wayland [Hans; #643]
|
||||
* Implement toggle-keys notification [Olivier; #637]
|
||||
* Add initial KMS transactional support [Jonas; !525]
|
||||
* Improve finding new focus window when the old one is closed [Marco; #308]
|
||||
* Misc. bug fixes and cleanups [Jonas, Carlos, Marco, Florian, Pekka, Robert,
|
||||
Douglas, Georges, Daniel, Emil, Niels, Hans, Olivier, Ting-Wei, Corentin;
|
||||
!591, #398, !592, !581, !597, !598, !593, !497, #591, !545, gtk#1675, !601,
|
||||
#568, !564, !605, !609, !115, !214, !611, !617, !616, !619, !624, !622, !627,
|
||||
!628, !629, !632, !633, !631, !636, !639, !638, !634, !640, !529, !644, !590]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl, Piotr Drąg, Olivier Fourdan, Carlos Garnacho, Hans de Goede,
|
||||
Niels De Graef, Ting-Wei Lan, Robert Mader, Florian Müllner,
|
||||
Georges Basile Stavracas Neto, Corentin Noël, Pekka Paalanen, Douglas R. Reno,
|
||||
Marco Trevisan (Treviño), Emil Velikov, Daniel van Vugt
|
||||
|
||||
Translators:
|
||||
Balázs Úr [hu], Daniel Mustieles [es], Nathan Follens [nl], Goran Vidović [hr]
|
||||
|
||||
3.33.2
|
||||
======
|
||||
* Fix rendering lag on Xorg [Daniel; !520, !281]
|
||||
|
@@ -10107,6 +10107,9 @@ clutter_actor_allocate (ClutterActor *self,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!clutter_actor_is_visible (self))
|
||||
return;
|
||||
|
||||
priv = self->priv;
|
||||
|
||||
old_allocation = priv->allocation;
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -252,6 +252,13 @@ clutter_clone_allocate (ClutterActor *self,
|
||||
if (priv->clone_source == NULL)
|
||||
return;
|
||||
|
||||
/* ClutterActor delays allocating until the actor is shown; however
|
||||
* we cannot paint it correctly in that case, so force an allocation.
|
||||
*/
|
||||
if (clutter_actor_get_parent (priv->clone_source) != NULL &&
|
||||
!clutter_actor_has_allocation (priv->clone_source))
|
||||
clutter_actor_allocate_preferred_size (priv->clone_source, flags);
|
||||
|
||||
#if 0
|
||||
/* XXX - this is wrong: ClutterClone cannot clone unparented
|
||||
* actors, as it will break all invariants
|
||||
|
@@ -17,7 +17,6 @@
|
||||
#include "deprecated/clutter-container.h"
|
||||
#include "deprecated/clutter-group.h"
|
||||
#include "deprecated/clutter-keysyms.h"
|
||||
#include "deprecated/clutter-main.h"
|
||||
#include "deprecated/clutter-rectangle.h"
|
||||
#include "deprecated/clutter-stage-manager.h"
|
||||
#include "deprecated/clutter-stage.h"
|
||||
|
@@ -13,7 +13,7 @@ G_BEGIN_DECLS
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
/* enumerations from "@filename@" */
|
||||
/* enumerations from "@basename@" */
|
||||
/*** END file-production ***/
|
||||
|
||||
/*** BEGIN value-header ***/
|
||||
|
@@ -277,24 +277,6 @@ typedef enum
|
||||
CLUTTER_ANIMATION_LAST
|
||||
} ClutterAnimationMode;
|
||||
|
||||
/**
|
||||
* ClutterFontFlags:
|
||||
* @CLUTTER_FONT_MIPMAPPING: Set to use mipmaps for the glyph cache textures.
|
||||
* @CLUTTER_FONT_HINTING: Set to enable hinting on the glyphs.
|
||||
*
|
||||
* Runtime flags to change the font quality. To be used with
|
||||
* clutter_set_font_flags().
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.22: Use #cairo_font_options_t instead
|
||||
*/
|
||||
typedef enum /*< prefix=CLUTTER_FONT >*/
|
||||
{
|
||||
CLUTTER_FONT_MIPMAPPING = (1 << 0),
|
||||
CLUTTER_FONT_HINTING = (1 << 1)
|
||||
} ClutterFontFlags;
|
||||
|
||||
/**
|
||||
* ClutterTextDirection:
|
||||
* @CLUTTER_TEXT_DIRECTION_DEFAULT: Use the default setting, as returned
|
||||
@@ -974,8 +956,6 @@ typedef enum /*< prefix=CLUTTER_SCROLL >*/
|
||||
|
||||
/**
|
||||
* ClutterStageState:
|
||||
* @CLUTTER_STAGE_STATE_FULLSCREEN: Fullscreen mask
|
||||
* @CLUTTER_STAGE_STATE_OFFSCREEN: Offscreen mask (deprecated)
|
||||
* @CLUTTER_STAGE_STATE_ACTIVATED: Activated mask
|
||||
*
|
||||
* Stage state masks, used by the #ClutterEvent of type %CLUTTER_STAGE_STATE.
|
||||
@@ -984,8 +964,6 @@ typedef enum /*< prefix=CLUTTER_SCROLL >*/
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
CLUTTER_STAGE_STATE_FULLSCREEN = (1 << 1),
|
||||
CLUTTER_STAGE_STATE_OFFSCREEN = (1 << 2),
|
||||
CLUTTER_STAGE_STATE_ACTIVATED = (1 << 3)
|
||||
} ClutterStageState;
|
||||
|
||||
@@ -995,7 +973,6 @@ typedef enum
|
||||
* @CLUTTER_FEATURE_TEXTURE_YUV: Set if YUV based textures supported.
|
||||
* @CLUTTER_FEATURE_TEXTURE_READ_PIXELS: Set if texture pixels can be read.
|
||||
* @CLUTTER_FEATURE_STAGE_STATIC: Set if stage size if fixed (i.e framebuffer)
|
||||
* @CLUTTER_FEATURE_STAGE_USER_RESIZE: Set if stage is able to be user resized.
|
||||
* @CLUTTER_FEATURE_STAGE_CURSOR: Set if stage has a graphical cursor.
|
||||
* @CLUTTER_FEATURE_SHADERS_GLSL: Set if the backend supports GLSL shaders.
|
||||
* @CLUTTER_FEATURE_OFFSCREEN: Set if the backend supports offscreen rendering.
|
||||
@@ -1013,7 +990,6 @@ typedef enum
|
||||
CLUTTER_FEATURE_TEXTURE_YUV = (1 << 4),
|
||||
CLUTTER_FEATURE_TEXTURE_READ_PIXELS = (1 << 5),
|
||||
CLUTTER_FEATURE_STAGE_STATIC = (1 << 6),
|
||||
CLUTTER_FEATURE_STAGE_USER_RESIZE = (1 << 7),
|
||||
CLUTTER_FEATURE_STAGE_CURSOR = (1 << 8),
|
||||
CLUTTER_FEATURE_SHADERS_GLSL = (1 << 9),
|
||||
CLUTTER_FEATURE_OFFSCREEN = (1 << 10),
|
||||
|
@@ -85,8 +85,6 @@ G_LOCK_DEFINE_STATIC (ClutterCntx);
|
||||
|
||||
/* main lock and locking/unlocking functions */
|
||||
static GMutex clutter_threads_mutex;
|
||||
static GCallback clutter_threads_lock = NULL;
|
||||
static GCallback clutter_threads_unlock = NULL;
|
||||
|
||||
/* command line options */
|
||||
static gboolean clutter_is_initialized = FALSE;
|
||||
@@ -146,38 +144,10 @@ static const GDebugKey clutter_paint_debug_keys[] = {
|
||||
{ "damage-region", CLUTTER_DEBUG_PAINT_DAMAGE_REGION },
|
||||
};
|
||||
|
||||
static void
|
||||
clutter_threads_impl_lock (void)
|
||||
{
|
||||
g_mutex_lock (&clutter_threads_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_threads_impl_unlock (void)
|
||||
{
|
||||
/* we need to trylock here, in case the lock hasn't been acquired; on
|
||||
* various systems trying to release a mutex that hasn't been acquired
|
||||
* will cause a run-time error. trylock() will either fail, in which
|
||||
* case we can release the lock we own; or it will succeeds, in which
|
||||
* case we need to release the lock we just acquired. so we ignore the
|
||||
* returned value.
|
||||
*
|
||||
* see: https://bugs.gnome.org/679439
|
||||
*/
|
||||
g_mutex_trylock (&clutter_threads_mutex);
|
||||
g_mutex_unlock (&clutter_threads_mutex);
|
||||
}
|
||||
|
||||
static inline void
|
||||
clutter_threads_init_default (void)
|
||||
{
|
||||
g_mutex_init (&clutter_threads_mutex);
|
||||
|
||||
if (clutter_threads_lock == NULL)
|
||||
clutter_threads_lock = clutter_threads_impl_lock;
|
||||
|
||||
if (clutter_threads_unlock == NULL)
|
||||
clutter_threads_unlock = clutter_threads_impl_unlock;
|
||||
}
|
||||
|
||||
#define ENVIRONMENT_GROUP "Environment"
|
||||
@@ -383,28 +353,6 @@ clutter_config_read (void)
|
||||
g_free (config_path);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_get_show_fps:
|
||||
*
|
||||
* Returns whether Clutter should print out the frames per second on the
|
||||
* console. You can enable this setting either using the
|
||||
* <literal>CLUTTER_SHOW_FPS</literal> environment variable or passing
|
||||
* the <literal>--clutter-show-fps</literal> command line argument. *
|
||||
*
|
||||
* Return value: %TRUE if Clutter should show the FPS.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.10: This function does not do anything. Use the environment
|
||||
* variable or the configuration file to determine whether Clutter should
|
||||
* print out the FPS counter on the console.
|
||||
*/
|
||||
gboolean
|
||||
clutter_get_show_fps (void)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_context_get_show_fps (void)
|
||||
{
|
||||
@@ -453,86 +401,6 @@ clutter_disable_accessibility (void)
|
||||
clutter_enable_accessibility = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_redraw:
|
||||
*
|
||||
* Forces a redraw of the entire stage. Applications should never use this
|
||||
* function, but queue a redraw using clutter_actor_queue_redraw().
|
||||
*
|
||||
* This function should only be used by libraries integrating Clutter from
|
||||
* within another toolkit.
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_stage_ensure_redraw() instead.
|
||||
*/
|
||||
void
|
||||
clutter_redraw (ClutterStage *stage)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
||||
|
||||
clutter_stage_ensure_redraw (stage);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_set_motion_events_enabled:
|
||||
* @enable: %TRUE to enable per-actor motion events
|
||||
*
|
||||
* Sets whether per-actor motion events should be enabled or not on
|
||||
* all #ClutterStage<!-- -->s managed by Clutter.
|
||||
*
|
||||
* If @enable is %FALSE the following events will not work:
|
||||
*
|
||||
* - ClutterActor::motion-event, except on the #ClutterStage
|
||||
* - ClutterActor::enter-event
|
||||
* - ClutterActor::leave-event
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.8: Use clutter_stage_set_motion_events_enabled() instead.
|
||||
*/
|
||||
void
|
||||
clutter_set_motion_events_enabled (gboolean enable)
|
||||
{
|
||||
ClutterStageManager *stage_manager;
|
||||
ClutterMainContext *context;
|
||||
const GSList *l;
|
||||
|
||||
enable = !!enable;
|
||||
|
||||
context = _clutter_context_get_default ();
|
||||
if (context->motion_events_per_actor == enable)
|
||||
return;
|
||||
|
||||
/* store the flag for later query and for newly created stages */
|
||||
context->motion_events_per_actor = enable;
|
||||
|
||||
/* propagate the change to all stages */
|
||||
stage_manager = clutter_stage_manager_get_default ();
|
||||
|
||||
for (l = clutter_stage_manager_peek_stages (stage_manager);
|
||||
l != NULL;
|
||||
l = l->next)
|
||||
{
|
||||
clutter_stage_set_motion_events_enabled (l->data, enable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_get_motion_events_enabled:
|
||||
*
|
||||
* Gets whether the per-actor motion events are enabled.
|
||||
*
|
||||
* Return value: %TRUE if the motion events are enabled
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.8: Use clutter_stage_get_motion_events_enabled() instead.
|
||||
*/
|
||||
gboolean
|
||||
clutter_get_motion_events_enabled (void)
|
||||
{
|
||||
return _clutter_context_get_motion_events_enabled ();
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_id_to_color (guint id_,
|
||||
ClutterColor *col)
|
||||
@@ -784,69 +652,6 @@ clutter_main (void)
|
||||
clutter_main_loop_level--;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_threads_init:
|
||||
*
|
||||
* Initialises the Clutter threading mechanism, so that Clutter API can be
|
||||
* called by multiple threads, using clutter_threads_enter() and
|
||||
* clutter_threads_leave() to mark the critical sections.
|
||||
*
|
||||
* You must call g_thread_init() before this function.
|
||||
*
|
||||
* This function must be called before clutter_init().
|
||||
*
|
||||
* It is safe to call this function multiple times.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.10: This function does not do anything. Threading support
|
||||
* is initialized when Clutter is initialized.
|
||||
*/
|
||||
void
|
||||
clutter_threads_init (void)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_threads_set_lock_functions: (skip)
|
||||
* @enter_fn: function called when aquiring the Clutter main lock
|
||||
* @leave_fn: function called when releasing the Clutter main lock
|
||||
*
|
||||
* Allows the application to replace the standard method that
|
||||
* Clutter uses to protect its data structures. Normally, Clutter
|
||||
* creates a single #GMutex that is locked by clutter_threads_enter(),
|
||||
* and released by clutter_threads_leave(); using this function an
|
||||
* application provides, instead, a function @enter_fn that is
|
||||
* called by clutter_threads_enter() and a function @leave_fn that is
|
||||
* called by clutter_threads_leave().
|
||||
*
|
||||
* The functions must provide at least same locking functionality
|
||||
* as the default implementation, but can also do extra application
|
||||
* specific processing.
|
||||
*
|
||||
* As an example, consider an application that has its own recursive
|
||||
* lock that when held, holds the Clutter lock as well. When Clutter
|
||||
* unlocks the Clutter lock when entering a recursive main loop, the
|
||||
* application must temporarily release its lock as well.
|
||||
*
|
||||
* Most threaded Clutter apps won't need to use this method.
|
||||
*
|
||||
* This method must be called before clutter_init(), and cannot
|
||||
* be called multiple times.
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
void
|
||||
clutter_threads_set_lock_functions (GCallback enter_fn,
|
||||
GCallback leave_fn)
|
||||
{
|
||||
g_return_if_fail (clutter_threads_lock == NULL &&
|
||||
clutter_threads_unlock == NULL);
|
||||
|
||||
clutter_threads_lock = enter_fn;
|
||||
clutter_threads_unlock = leave_fn;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_threads_dispatch (gpointer data)
|
||||
{
|
||||
@@ -903,17 +708,11 @@ _clutter_threads_dispatch_free (gpointer data)
|
||||
* SafeClosure *closure = data;
|
||||
* gboolean res = FALSE;
|
||||
*
|
||||
* // mark the critical section //
|
||||
*
|
||||
* clutter_threads_enter();
|
||||
*
|
||||
* // the callback does not need to acquire the Clutter
|
||||
* / lock itself, as it is held by the this proxy handler
|
||||
* //
|
||||
* res = closure->callback (closure->data);
|
||||
*
|
||||
* clutter_threads_leave();
|
||||
*
|
||||
* return res;
|
||||
* }
|
||||
* static gulong
|
||||
@@ -1093,69 +892,23 @@ clutter_threads_add_timeout (guint interval,
|
||||
void
|
||||
_clutter_threads_acquire_lock (void)
|
||||
{
|
||||
if (clutter_threads_lock != NULL)
|
||||
(* clutter_threads_lock) ();
|
||||
g_mutex_lock (&clutter_threads_mutex);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_threads_release_lock (void)
|
||||
{
|
||||
if (clutter_threads_unlock != NULL)
|
||||
(* clutter_threads_unlock) ();
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_threads_enter:
|
||||
*
|
||||
* Locks the Clutter thread lock.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.12: This function should not be used by application
|
||||
* code; marking critical sections is not portable on various
|
||||
* platforms. Instead of acquiring the Clutter lock, schedule UI
|
||||
* updates from the main loop using clutter_threads_add_idle() or
|
||||
* clutter_threads_add_timeout().
|
||||
*/
|
||||
void
|
||||
clutter_threads_enter (void)
|
||||
{
|
||||
_clutter_threads_acquire_lock ();
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_threads_leave:
|
||||
*
|
||||
* Unlocks the Clutter thread lock.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.12: This function should not be used by application
|
||||
* code; marking critical sections is not portable on various
|
||||
* platforms. Instead of acquiring the Clutter lock, schedule UI
|
||||
* updates from the main loop using clutter_threads_add_idle() or
|
||||
* clutter_threads_add_timeout().
|
||||
*/
|
||||
void
|
||||
clutter_threads_leave (void)
|
||||
{
|
||||
_clutter_threads_release_lock ();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* clutter_get_debug_enabled:
|
||||
*
|
||||
* Check if Clutter has debugging enabled.
|
||||
*
|
||||
* Return value: %FALSE
|
||||
*
|
||||
* Deprecated: 1.10: This function does not do anything.
|
||||
*/
|
||||
gboolean
|
||||
clutter_get_debug_enabled (void)
|
||||
{
|
||||
return FALSE;
|
||||
/* we need to trylock here, in case the lock hasn't been acquired; on
|
||||
* various systems trying to release a mutex that hasn't been acquired
|
||||
* will cause a run-time error. trylock() will either fail, in which
|
||||
* case we can release the lock we own; or it will succeeds, in which
|
||||
* case we need to release the lock we just acquired. so we ignore the
|
||||
* returned value.
|
||||
*
|
||||
* see: https://bugs.gnome.org/679439
|
||||
*/
|
||||
g_mutex_trylock (&clutter_threads_mutex);
|
||||
g_mutex_unlock (&clutter_threads_mutex);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1205,7 +958,6 @@ clutter_context_get_default_unlocked (void)
|
||||
ctx->settings = clutter_settings_get_default ();
|
||||
_clutter_settings_set_backend (ctx->settings, ctx->backend);
|
||||
|
||||
ctx->motion_events_per_actor = TRUE;
|
||||
ctx->last_repaint_id = 1;
|
||||
}
|
||||
|
||||
@@ -1226,36 +978,6 @@ _clutter_context_get_default (void)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_get_timestamp:
|
||||
*
|
||||
* Returns the approximate number of microseconds passed since Clutter was
|
||||
* intialised.
|
||||
*
|
||||
* This function shdould not be used by application code.
|
||||
*
|
||||
* The output of this function depends on whether Clutter was configured to
|
||||
* enable its debugging code paths, so it's less useful than intended.
|
||||
*
|
||||
* Since Clutter 1.10, this function is an alias to g_get_monotonic_time()
|
||||
* if Clutter was configured to enable the debugging code paths.
|
||||
*
|
||||
* Return value: Number of microseconds since clutter_init() was called, or
|
||||
* zero if Clutter was not configured with debugging code paths.
|
||||
*
|
||||
* Deprecated: 1.10: Use #GTimer or g_get_monotonic_time() for a proper
|
||||
* timing source
|
||||
*/
|
||||
gulong
|
||||
clutter_get_timestamp (void)
|
||||
{
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
return (gulong) g_get_monotonic_time ();
|
||||
#else
|
||||
return 0L;
|
||||
#endif
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_arg_direction_cb (const char *key,
|
||||
const char *value,
|
||||
@@ -2552,7 +2274,7 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
break;
|
||||
|
||||
case CLUTTER_STAGE_STATE:
|
||||
/* fullscreen / focus - forward to stage */
|
||||
/* focus - forward to stage */
|
||||
event->any.source = stage;
|
||||
if (!_clutter_event_process_filters (event))
|
||||
clutter_stage_event (CLUTTER_STAGE (stage), event);
|
||||
@@ -2658,24 +2380,6 @@ clutter_get_default_frame_rate (void)
|
||||
return context->frame_rate;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_set_default_frame_rate:
|
||||
* @frames_per_sec: the new default frame rate
|
||||
*
|
||||
* Sets the default frame rate. This frame rate will be used to limit
|
||||
* the number of frames drawn if Clutter is not able to synchronize
|
||||
* with the vertical refresh rate of the display. When synchronization
|
||||
* is possible, this value is ignored.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.10: This function does not do anything any more.
|
||||
*/
|
||||
void
|
||||
clutter_set_default_frame_rate (guint frames_per_sec)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
on_grab_actor_destroy (ClutterActor *actor,
|
||||
ClutterInputDevice *device)
|
||||
@@ -2890,57 +2594,6 @@ clutter_input_device_get_grabbed_actor (ClutterInputDevice *device)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_grab_pointer_for_device:
|
||||
* @actor: a #ClutterActor
|
||||
* @id_: a device id, or -1
|
||||
*
|
||||
* Grabs all the pointer events coming from the device @id for @actor.
|
||||
*
|
||||
* If @id is -1 then this function is equivalent to clutter_grab_pointer().
|
||||
*
|
||||
* Since: 0.8
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_input_device_grab() instead.
|
||||
*/
|
||||
void
|
||||
clutter_grab_pointer_for_device (ClutterActor *actor,
|
||||
gint id_)
|
||||
{
|
||||
ClutterDeviceManager *manager;
|
||||
ClutterInputDevice *dev;
|
||||
|
||||
g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
/* essentially a global grab */
|
||||
if (id_ == -1)
|
||||
{
|
||||
if (actor == NULL)
|
||||
clutter_ungrab_pointer ();
|
||||
else
|
||||
clutter_grab_pointer (actor);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
manager = clutter_device_manager_get_default ();
|
||||
if (manager == NULL)
|
||||
return;
|
||||
|
||||
dev = clutter_device_manager_get_device (manager, id_);
|
||||
if (dev == NULL)
|
||||
return;
|
||||
|
||||
if (dev->device_type != CLUTTER_POINTER_DEVICE)
|
||||
return;
|
||||
|
||||
if (actor == NULL)
|
||||
clutter_input_device_ungrab (dev);
|
||||
else
|
||||
clutter_input_device_grab (dev, actor);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* clutter_ungrab_pointer:
|
||||
*
|
||||
@@ -2954,32 +2607,6 @@ clutter_ungrab_pointer (void)
|
||||
clutter_grab_pointer (NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_ungrab_pointer_for_device:
|
||||
* @id_: a device id
|
||||
*
|
||||
* Removes an existing grab of the pointer events for device @id_.
|
||||
*
|
||||
* Since: 0.8
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_input_device_ungrab() instead.
|
||||
*/
|
||||
void
|
||||
clutter_ungrab_pointer_for_device (gint id_)
|
||||
{
|
||||
ClutterDeviceManager *manager;
|
||||
ClutterInputDevice *device;
|
||||
|
||||
manager = clutter_device_manager_get_default ();
|
||||
if (manager == NULL)
|
||||
return;
|
||||
|
||||
device = clutter_device_manager_get_device (manager, id_);
|
||||
if (device != NULL)
|
||||
clutter_input_device_ungrab (device);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* clutter_get_pointer_grab:
|
||||
*
|
||||
@@ -3079,170 +2706,6 @@ clutter_get_keyboard_grab (void)
|
||||
return context->keyboard_grab_actor;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_clear_glyph_cache:
|
||||
*
|
||||
* Clears the internal cache of glyphs used by the Pango
|
||||
* renderer. This will free up some memory and GL texture
|
||||
* resources. The cache will be automatically refilled as more text is
|
||||
* drawn.
|
||||
*
|
||||
* Since: 0.8
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_get_font_map() and
|
||||
* cogl_pango_font_map_clear_glyph_cache() instead.
|
||||
*/
|
||||
void
|
||||
clutter_clear_glyph_cache (void)
|
||||
{
|
||||
CoglPangoFontMap *font_map;
|
||||
|
||||
font_map = clutter_context_get_pango_fontmap ();
|
||||
cogl_pango_font_map_clear_glyph_cache (font_map);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_set_font_flags:
|
||||
* @flags: The new flags
|
||||
*
|
||||
* Sets the font quality options for subsequent text rendering
|
||||
* operations.
|
||||
*
|
||||
* Using mipmapped textures will improve the quality for scaled down
|
||||
* text but will use more texture memory.
|
||||
*
|
||||
* Enabling hinting improves text quality for static text but may
|
||||
* introduce some artifacts if the text is animated.
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_backend_set_font_options() and the
|
||||
* #cairo_font_option_t API.
|
||||
*/
|
||||
void
|
||||
clutter_set_font_flags (ClutterFontFlags flags)
|
||||
{
|
||||
CoglPangoFontMap *font_map;
|
||||
ClutterFontFlags old_flags, changed_flags;
|
||||
const cairo_font_options_t *font_options;
|
||||
cairo_font_options_t *new_font_options;
|
||||
cairo_hint_style_t hint_style;
|
||||
gboolean use_mipmapping;
|
||||
ClutterBackend *backend;
|
||||
|
||||
backend = clutter_get_default_backend ();
|
||||
font_map = clutter_context_get_pango_fontmap ();
|
||||
font_options = clutter_backend_get_font_options (backend);
|
||||
old_flags = 0;
|
||||
|
||||
if (cogl_pango_font_map_get_use_mipmapping (font_map))
|
||||
old_flags |= CLUTTER_FONT_MIPMAPPING;
|
||||
|
||||
hint_style = cairo_font_options_get_hint_style (font_options);
|
||||
if (hint_style != CAIRO_HINT_STYLE_DEFAULT &&
|
||||
hint_style != CAIRO_HINT_STYLE_NONE)
|
||||
old_flags |= CLUTTER_FONT_HINTING;
|
||||
|
||||
if (old_flags == flags)
|
||||
return;
|
||||
|
||||
new_font_options = cairo_font_options_copy (font_options);
|
||||
|
||||
/* Only set the font options that have actually changed so we don't
|
||||
override a detailed setting from the backend */
|
||||
changed_flags = old_flags ^ flags;
|
||||
|
||||
if ((changed_flags & CLUTTER_FONT_MIPMAPPING))
|
||||
{
|
||||
use_mipmapping = (changed_flags & CLUTTER_FONT_MIPMAPPING) != 0;
|
||||
|
||||
cogl_pango_font_map_set_use_mipmapping (font_map, use_mipmapping);
|
||||
}
|
||||
|
||||
if ((changed_flags & CLUTTER_FONT_HINTING))
|
||||
{
|
||||
hint_style = (flags & CLUTTER_FONT_HINTING)
|
||||
? CAIRO_HINT_STYLE_FULL
|
||||
: CAIRO_HINT_STYLE_NONE;
|
||||
|
||||
cairo_font_options_set_hint_style (new_font_options, hint_style);
|
||||
}
|
||||
|
||||
clutter_backend_set_font_options (backend, new_font_options);
|
||||
|
||||
cairo_font_options_destroy (new_font_options);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_get_font_flags:
|
||||
*
|
||||
* Gets the current font flags for rendering text. See
|
||||
* clutter_set_font_flags().
|
||||
*
|
||||
* Return value: The font flags
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_backend_get_font_options() and the
|
||||
* #cairo_font_options_t API.
|
||||
*/
|
||||
ClutterFontFlags
|
||||
clutter_get_font_flags (void)
|
||||
{
|
||||
CoglPangoFontMap *font_map = NULL;
|
||||
const cairo_font_options_t *font_options;
|
||||
ClutterFontFlags flags = 0;
|
||||
cairo_hint_style_t hint_style;
|
||||
|
||||
font_map = clutter_context_get_pango_fontmap ();
|
||||
if (cogl_pango_font_map_get_use_mipmapping (font_map))
|
||||
flags |= CLUTTER_FONT_MIPMAPPING;
|
||||
|
||||
font_options =
|
||||
clutter_backend_get_font_options (clutter_get_default_backend ());
|
||||
|
||||
hint_style = cairo_font_options_get_hint_style (font_options);
|
||||
if (hint_style != CAIRO_HINT_STYLE_DEFAULT &&
|
||||
hint_style != CAIRO_HINT_STYLE_NONE)
|
||||
flags |= CLUTTER_FONT_HINTING;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_get_input_device_for_id:
|
||||
* @id_: the unique id for a device
|
||||
*
|
||||
* Retrieves the #ClutterInputDevice from its @id_. This is a convenience
|
||||
* wrapper for clutter_device_manager_get_device() and it is functionally
|
||||
* equivalent to:
|
||||
*
|
||||
* |[
|
||||
* ClutterDeviceManager *manager;
|
||||
* ClutterInputDevice *device;
|
||||
*
|
||||
* manager = clutter_device_manager_get_default ();
|
||||
* device = clutter_device_manager_get_device (manager, id);
|
||||
* ]|
|
||||
*
|
||||
* Return value: (transfer none): a #ClutterInputDevice, or %NULL
|
||||
*
|
||||
* Since: 0.8
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_device_manager_get_device() instead.
|
||||
*/
|
||||
ClutterInputDevice *
|
||||
clutter_get_input_device_for_id (gint id_)
|
||||
{
|
||||
ClutterDeviceManager *manager;
|
||||
|
||||
manager = clutter_device_manager_get_default ();
|
||||
if (manager == NULL)
|
||||
return NULL;
|
||||
|
||||
return clutter_device_manager_get_device (manager, id_);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_get_font_map:
|
||||
*
|
||||
@@ -3577,43 +3040,6 @@ _clutter_context_get_pick_mode (void)
|
||||
return context->pick_mode;
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_context_push_shader_stack (ClutterActor *actor)
|
||||
{
|
||||
ClutterMainContext *context = _clutter_context_get_default ();
|
||||
|
||||
context->shaders = g_slist_prepend (context->shaders, actor);
|
||||
}
|
||||
|
||||
ClutterActor *
|
||||
_clutter_context_peek_shader_stack (void)
|
||||
{
|
||||
ClutterMainContext *context = _clutter_context_get_default ();
|
||||
|
||||
if (context->shaders != NULL)
|
||||
return context->shaders->data;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ClutterActor *
|
||||
_clutter_context_pop_shader_stack (ClutterActor *actor)
|
||||
{
|
||||
ClutterMainContext *context = _clutter_context_get_default ();
|
||||
|
||||
context->shaders = g_slist_remove (context->shaders, actor);
|
||||
|
||||
return _clutter_context_peek_shader_stack ();
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_context_get_motion_events_enabled (void)
|
||||
{
|
||||
ClutterMainContext *context = _clutter_context_get_default ();
|
||||
|
||||
return context->motion_events_per_actor;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_check_windowing_backend:
|
||||
* @backend_type: the name of the backend to check
|
||||
|
@@ -117,9 +117,6 @@ void clutter_disable_accessibility (void);
|
||||
|
||||
/* Threading functions */
|
||||
CLUTTER_EXPORT
|
||||
void clutter_threads_set_lock_functions (GCallback enter_fn,
|
||||
GCallback leave_fn);
|
||||
CLUTTER_EXPORT
|
||||
guint clutter_threads_add_idle (GSourceFunc func,
|
||||
gpointer data);
|
||||
CLUTTER_EXPORT
|
||||
|
@@ -43,11 +43,6 @@ void clutter_stage_capture_into (ClutterStage *stage,
|
||||
cairo_rectangle_int_t *rect,
|
||||
uint8_t *data);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterStageView * clutter_stage_get_view_at (ClutterStage *stage,
|
||||
float x,
|
||||
float y);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_freeze_updates (ClutterStage *stage);
|
||||
|
||||
|
@@ -146,9 +146,6 @@ struct _ClutterMainContext
|
||||
ClutterActor *pointer_grab_actor;
|
||||
ClutterActor *keyboard_grab_actor;
|
||||
|
||||
/* stack of actors with shaders during paint */
|
||||
GSList *shaders;
|
||||
|
||||
/* fb bit masks for col<->id mapping in picking */
|
||||
gint fb_r_mask;
|
||||
gint fb_g_mask;
|
||||
@@ -173,7 +170,6 @@ struct _ClutterMainContext
|
||||
|
||||
/* boolean flags */
|
||||
guint is_initialized : 1;
|
||||
guint motion_events_per_actor : 1;
|
||||
guint defer_display_setup : 1;
|
||||
guint options_parsed : 1;
|
||||
guint show_fps : 1;
|
||||
@@ -198,10 +194,6 @@ void _clutter_context_lock (void);
|
||||
void _clutter_context_unlock (void);
|
||||
gboolean _clutter_context_is_initialized (void);
|
||||
ClutterPickMode _clutter_context_get_pick_mode (void);
|
||||
void _clutter_context_push_shader_stack (ClutterActor *actor);
|
||||
ClutterActor * _clutter_context_pop_shader_stack (ClutterActor *actor);
|
||||
ClutterActor * _clutter_context_peek_shader_stack (void);
|
||||
gboolean _clutter_context_get_motion_events_enabled (void);
|
||||
gboolean _clutter_context_get_show_fps (void);
|
||||
|
||||
gboolean _clutter_feature_init (GError **error);
|
||||
|
@@ -1636,14 +1636,17 @@ clutter_script_translate_parameters (ClutterScript *script,
|
||||
GObject *object,
|
||||
const gchar *name,
|
||||
GList *properties,
|
||||
GArray **params)
|
||||
GPtrArray **param_names,
|
||||
GArray **param_values)
|
||||
{
|
||||
ClutterScriptable *scriptable = NULL;
|
||||
ClutterScriptableIface *iface = NULL;
|
||||
GList *l, *unparsed;
|
||||
gboolean parse_custom = FALSE;
|
||||
|
||||
*params = g_array_new (FALSE, FALSE, sizeof (GParameter));
|
||||
*param_names = g_ptr_array_new_with_free_func (g_free);
|
||||
*param_values = g_array_new (FALSE, FALSE, sizeof (GValue));
|
||||
g_array_set_clear_func (*param_values, (GDestroyNotify) g_value_unset);
|
||||
|
||||
if (CLUTTER_IS_SCRIPTABLE (object))
|
||||
{
|
||||
@@ -1659,7 +1662,7 @@ clutter_script_translate_parameters (ClutterScript *script,
|
||||
for (l = properties; l != NULL; l = l->next)
|
||||
{
|
||||
PropertyInfo *pinfo = l->data;
|
||||
GParameter param = { NULL };
|
||||
GValue value = G_VALUE_INIT;
|
||||
gboolean res = FALSE;
|
||||
|
||||
if (pinfo->is_child || pinfo->is_layout)
|
||||
@@ -1676,12 +1679,12 @@ clutter_script_translate_parameters (ClutterScript *script,
|
||||
pinfo->name);
|
||||
|
||||
if (parse_custom)
|
||||
res = iface->parse_custom_node (scriptable, script, ¶m.value,
|
||||
res = iface->parse_custom_node (scriptable, script, &value,
|
||||
pinfo->name,
|
||||
pinfo->node);
|
||||
|
||||
if (!res)
|
||||
res = _clutter_script_parse_node (script, ¶m.value,
|
||||
res = _clutter_script_parse_node (script, &value,
|
||||
pinfo->name,
|
||||
pinfo->node,
|
||||
pinfo->pspec);
|
||||
@@ -1693,9 +1696,8 @@ clutter_script_translate_parameters (ClutterScript *script,
|
||||
continue;
|
||||
}
|
||||
|
||||
param.name = g_strdup (pinfo->name);
|
||||
|
||||
g_array_append_val (*params, param);
|
||||
g_ptr_array_add (*param_names, g_strdup (pinfo->name));
|
||||
g_array_append_val (*param_values, value);
|
||||
|
||||
property_info_free (pinfo);
|
||||
}
|
||||
@@ -1710,7 +1712,8 @@ clutter_script_construct_parameters (ClutterScript *script,
|
||||
GType gtype,
|
||||
const gchar *name,
|
||||
GList *properties,
|
||||
GArray **construct_params)
|
||||
GPtrArray **construct_param_names,
|
||||
GArray **construct_param_values)
|
||||
{
|
||||
GObjectClass *klass;
|
||||
GList *l, *unparsed;
|
||||
@@ -1718,14 +1721,17 @@ clutter_script_construct_parameters (ClutterScript *script,
|
||||
klass = g_type_class_ref (gtype);
|
||||
g_assert (klass != NULL);
|
||||
|
||||
*construct_params = g_array_new (FALSE, FALSE, sizeof (GParameter));
|
||||
*construct_param_names = g_ptr_array_new_with_free_func (g_free);
|
||||
*construct_param_values = g_array_new (FALSE, FALSE, sizeof (GValue));
|
||||
g_array_set_clear_func (*construct_param_values,
|
||||
(GDestroyNotify) g_value_unset);
|
||||
|
||||
unparsed = NULL;
|
||||
|
||||
for (l = properties; l != NULL; l = l->next)
|
||||
{
|
||||
PropertyInfo *pinfo = l->data;
|
||||
GParameter param = { NULL };
|
||||
GValue value = G_VALUE_INIT;
|
||||
GParamSpec *pspec = NULL;
|
||||
|
||||
/* we allow custom property names for classes, so if we
|
||||
@@ -1749,9 +1755,7 @@ clutter_script_construct_parameters (ClutterScript *script,
|
||||
continue;
|
||||
}
|
||||
|
||||
param.name = g_strdup (pinfo->name);
|
||||
|
||||
if (!_clutter_script_parse_node (script, ¶m.value,
|
||||
if (!_clutter_script_parse_node (script, &value,
|
||||
pinfo->name,
|
||||
pinfo->node,
|
||||
pinfo->pspec))
|
||||
@@ -1760,7 +1764,8 @@ clutter_script_construct_parameters (ClutterScript *script,
|
||||
continue;
|
||||
}
|
||||
|
||||
g_array_append_val (*construct_params, param);
|
||||
g_ptr_array_add (*construct_param_names, g_strdup (pinfo->name));
|
||||
g_array_append_val (*construct_param_values, value);
|
||||
|
||||
property_info_free (pinfo);
|
||||
}
|
||||
@@ -2087,7 +2092,8 @@ _clutter_script_apply_properties (ClutterScript *script,
|
||||
gboolean set_custom_property = FALSE;
|
||||
GObject *object = oinfo->object;
|
||||
GList *properties;
|
||||
GArray *params;
|
||||
g_autoptr (GPtrArray) param_names = NULL;
|
||||
g_autoptr (GArray) param_values = NULL;
|
||||
guint i;
|
||||
|
||||
if (!oinfo->has_unresolved)
|
||||
@@ -2111,34 +2117,31 @@ _clutter_script_apply_properties (ClutterScript *script,
|
||||
object,
|
||||
oinfo->id,
|
||||
properties,
|
||||
¶ms);
|
||||
¶m_names,
|
||||
¶m_values);
|
||||
|
||||
/* consume all the properties we could translate in this pass */
|
||||
for (i = 0; i < params->len; i++)
|
||||
for (i = 0; i < param_names->len; i++)
|
||||
{
|
||||
GParameter *param = &g_array_index (params, GParameter, i);
|
||||
char *name = g_ptr_array_index (param_names, i);
|
||||
GValue *value = &g_array_index (param_values, GValue, i);
|
||||
|
||||
CLUTTER_NOTE (SCRIPT,
|
||||
"Setting %s property '%s' (type:%s) to object '%s' (id:%s)",
|
||||
set_custom_property ? "custom" : "regular",
|
||||
param->name,
|
||||
g_type_name (G_VALUE_TYPE (¶m->value)),
|
||||
name,
|
||||
g_type_name (G_VALUE_TYPE (value)),
|
||||
g_type_name (oinfo->gtype),
|
||||
oinfo->id);
|
||||
|
||||
if (set_custom_property)
|
||||
iface->set_custom_property (scriptable, script,
|
||||
param->name,
|
||||
¶m->value);
|
||||
name,
|
||||
value);
|
||||
else
|
||||
g_object_set_property (object, param->name, ¶m->value);
|
||||
|
||||
g_free ((gchar *) param->name);
|
||||
g_value_unset (¶m->value);
|
||||
g_object_set_property (object, name, value);
|
||||
}
|
||||
|
||||
g_array_free (params, TRUE);
|
||||
|
||||
_clutter_script_check_unresolved (script, oinfo);
|
||||
}
|
||||
|
||||
@@ -2146,8 +2149,8 @@ void
|
||||
_clutter_script_construct_object (ClutterScript *script,
|
||||
ObjectInfo *oinfo)
|
||||
{
|
||||
GArray *params = NULL;
|
||||
guint i;
|
||||
g_autoptr (GPtrArray) param_names = NULL;
|
||||
g_autoptr (GArray) param_values = NULL;
|
||||
|
||||
/* we have completely updated the object */
|
||||
if (oinfo->object != NULL)
|
||||
@@ -2190,25 +2193,14 @@ _clutter_script_construct_object (ClutterScript *script,
|
||||
oinfo->gtype,
|
||||
oinfo->id,
|
||||
properties,
|
||||
¶ms);
|
||||
¶m_names,
|
||||
¶m_values);
|
||||
|
||||
default_stage = clutter_stage_manager_get_default_stage (manager);
|
||||
oinfo->object = G_OBJECT (default_stage);
|
||||
|
||||
for (i = 0; i < params->len; i++)
|
||||
{
|
||||
GParameter *param = &g_array_index (params, GParameter, i);
|
||||
|
||||
g_free ((gchar *) param->name);
|
||||
g_value_unset (¶m->value);
|
||||
}
|
||||
|
||||
g_array_free (params, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_autoptr (GPtrArray) param_names = NULL;
|
||||
GArray *param_values;
|
||||
GList *properties = oinfo->properties;
|
||||
|
||||
/* every other object: first, we get the construction parameters */
|
||||
@@ -2217,22 +2209,11 @@ _clutter_script_construct_object (ClutterScript *script,
|
||||
oinfo->gtype,
|
||||
oinfo->id,
|
||||
properties,
|
||||
¶ms);
|
||||
|
||||
/* Convert GParameter → (GStrv, GValue[]) */
|
||||
param_names = g_ptr_array_sized_new (params->len);
|
||||
param_values = g_array_sized_new (TRUE, FALSE, sizeof (GValue), params->len);
|
||||
for (i = 0; i < params->len; i++)
|
||||
{
|
||||
GParameter *param = &g_array_index (params, GParameter, i);
|
||||
|
||||
g_ptr_array_add (param_names, (gchar *) param->name);
|
||||
g_array_append_val (param_values, param->value);
|
||||
}
|
||||
g_ptr_array_add (param_names, NULL);
|
||||
¶m_names,
|
||||
¶m_values);
|
||||
|
||||
oinfo->object = g_object_new_with_properties (oinfo->gtype,
|
||||
params->len,
|
||||
param_names->len,
|
||||
(const gchar **) param_names->pdata,
|
||||
(const GValue *) param_values->data);
|
||||
|
||||
@@ -2241,17 +2222,6 @@ _clutter_script_construct_object (ClutterScript *script,
|
||||
* else too or only by this ClutterScript object.
|
||||
*/
|
||||
g_object_ref_sink (oinfo->object);
|
||||
|
||||
for (i = 0; i < params->len; i++)
|
||||
{
|
||||
GParameter *param = &g_array_index (params, GParameter, i);
|
||||
|
||||
g_free ((gchar *) param->name);
|
||||
g_value_unset (¶m->value);
|
||||
}
|
||||
|
||||
g_array_free (param_values, FALSE);
|
||||
g_array_free (params, TRUE);
|
||||
}
|
||||
|
||||
g_assert (oinfo->object != NULL);
|
||||
|
@@ -263,8 +263,6 @@ enum
|
||||
|
||||
static GParamSpec *obj_props[PROP_LAST];
|
||||
|
||||
#define CLUTTER_SCRIPT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_SCRIPT, ClutterScriptPrivate))
|
||||
|
||||
struct _ClutterScriptPrivate
|
||||
{
|
||||
GHashTable *objects;
|
||||
@@ -377,7 +375,7 @@ object_info_free (gpointer data)
|
||||
static void
|
||||
clutter_script_finalize (GObject *gobject)
|
||||
{
|
||||
ClutterScriptPrivate *priv = CLUTTER_SCRIPT_GET_PRIVATE (gobject);
|
||||
ClutterScriptPrivate *priv = CLUTTER_SCRIPT (gobject)->priv;
|
||||
|
||||
g_object_unref (priv->parser);
|
||||
g_hash_table_destroy (priv->objects);
|
||||
|
@@ -40,6 +40,7 @@ void _clutter_stage_paint_view (ClutterStage
|
||||
ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip);
|
||||
|
||||
void _clutter_stage_emit_after_paint (ClutterStage *stage);
|
||||
void _clutter_stage_set_window (ClutterStage *stage,
|
||||
ClutterStageWindow *stage_window);
|
||||
ClutterStageWindow *_clutter_stage_get_window (ClutterStage *stage);
|
||||
@@ -117,7 +118,6 @@ void _clutter_stage_remove_touch_drag_actor (ClutterStage *st
|
||||
|
||||
ClutterStageState _clutter_stage_get_state (ClutterStage *stage);
|
||||
gboolean _clutter_stage_is_activated (ClutterStage *stage);
|
||||
gboolean _clutter_stage_is_fullscreen (ClutterStage *stage);
|
||||
gboolean _clutter_stage_update_state (ClutterStage *stage,
|
||||
ClutterStageState unset_state,
|
||||
ClutterStageState set_state);
|
||||
|
37
clutter/clutter/clutter-stage-view-private.h
Normal file
37
clutter/clutter/clutter-stage-view-private.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_STAGE_VIEW_PRIVATE_H__
|
||||
#define __CLUTTER_STAGE_VIEW_PRIVATE_H__
|
||||
|
||||
#include "clutter/clutter-stage-view.h"
|
||||
|
||||
void clutter_stage_view_blit_offscreen (ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip);
|
||||
|
||||
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
|
||||
|
||||
void clutter_stage_view_set_dirty_viewport (ClutterStageView *view,
|
||||
gboolean dirty);
|
||||
|
||||
gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view);
|
||||
|
||||
void clutter_stage_view_set_dirty_projection (ClutterStageView *view,
|
||||
gboolean dirty);
|
||||
|
||||
|
||||
#endif /* __CLUTTER_STAGE_VIEW_PRIVATE_H__ */
|
@@ -18,6 +18,7 @@
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter/clutter-stage-view.h"
|
||||
#include "clutter/clutter-stage-view-private.h"
|
||||
|
||||
#include <cairo-gobject.h>
|
||||
#include <math.h>
|
||||
@@ -61,6 +62,14 @@ clutter_stage_view_get_layout (ClutterStageView *view,
|
||||
*rect = priv->layout;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_view_get_framebuffer:
|
||||
* @view: a #ClutterStageView
|
||||
*
|
||||
* Retrieves the framebuffer of @view to draw to.
|
||||
*
|
||||
* Returns: (transfer none): a #CoglFramebuffer
|
||||
*/
|
||||
CoglFramebuffer *
|
||||
clutter_stage_view_get_framebuffer (ClutterStageView *view)
|
||||
{
|
||||
@@ -73,6 +82,14 @@ clutter_stage_view_get_framebuffer (ClutterStageView *view)
|
||||
return priv->framebuffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_view_get_onscreen:
|
||||
* @view: a #ClutterStageView
|
||||
*
|
||||
* Retrieves the onscreen framebuffer of @view if available.
|
||||
*
|
||||
* Returns: (transfer none): a #CoglFramebuffer
|
||||
*/
|
||||
CoglFramebuffer *
|
||||
clutter_stage_view_get_onscreen (ClutterStageView *view)
|
||||
{
|
||||
|
@@ -18,6 +18,10 @@
|
||||
#ifndef __CLUTTER_STAGE_VIEW_H__
|
||||
#define __CLUTTER_STAGE_VIEW_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <cairo.h>
|
||||
#include <glib-object.h>
|
||||
#include <cogl/cogl.h>
|
||||
@@ -57,22 +61,9 @@ void clutter_stage_view_transform_to_onscreen (ClutterStageView *vie
|
||||
gfloat *x,
|
||||
gfloat *y);
|
||||
|
||||
void clutter_stage_view_blit_offscreen (ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
float clutter_stage_view_get_scale (ClutterStageView *view);
|
||||
|
||||
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
|
||||
|
||||
void clutter_stage_view_set_dirty_viewport (ClutterStageView *view,
|
||||
gboolean dirty);
|
||||
|
||||
gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view);
|
||||
|
||||
void clutter_stage_view_set_dirty_projection (ClutterStageView *view,
|
||||
gboolean dirty);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_view_get_offscreen_transformation_matrix (ClutterStageView *view,
|
||||
CoglMatrix *matrix);
|
||||
|
@@ -62,16 +62,6 @@ _clutter_stage_window_set_title (ClutterStageWindow *window,
|
||||
iface->set_title (window, title);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_stage_window_set_fullscreen (ClutterStageWindow *window,
|
||||
gboolean is_fullscreen)
|
||||
{
|
||||
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
|
||||
if (iface->set_fullscreen)
|
||||
iface->set_fullscreen (window, is_fullscreen);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_stage_window_set_cursor_visible (ClutterStageWindow *window,
|
||||
gboolean is_visible)
|
||||
@@ -82,14 +72,6 @@ _clutter_stage_window_set_cursor_visible (ClutterStageWindow *window,
|
||||
iface->set_cursor_visible (window, is_visible);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_stage_window_set_user_resizable (ClutterStageWindow *window,
|
||||
gboolean is_resizable)
|
||||
{
|
||||
CLUTTER_STAGE_WINDOW_GET_IFACE (window)->set_user_resizable (window,
|
||||
is_resizable);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_stage_window_realize (ClutterStageWindow *window)
|
||||
{
|
||||
|
@@ -30,12 +30,8 @@ struct _ClutterStageWindowInterface
|
||||
|
||||
void (* set_title) (ClutterStageWindow *stage_window,
|
||||
const gchar *title);
|
||||
void (* set_fullscreen) (ClutterStageWindow *stage_window,
|
||||
gboolean is_fullscreen);
|
||||
void (* set_cursor_visible) (ClutterStageWindow *stage_window,
|
||||
gboolean cursor_visible);
|
||||
void (* set_user_resizable) (ClutterStageWindow *stage_window,
|
||||
gboolean is_resizable);
|
||||
|
||||
gboolean (* realize) (ClutterStageWindow *stage_window);
|
||||
void (* unrealize) (ClutterStageWindow *stage_window);
|
||||
@@ -83,12 +79,8 @@ ClutterActor * _clutter_stage_window_get_wrapper (ClutterStageWindow *
|
||||
|
||||
void _clutter_stage_window_set_title (ClutterStageWindow *window,
|
||||
const gchar *title);
|
||||
void _clutter_stage_window_set_fullscreen (ClutterStageWindow *window,
|
||||
gboolean is_fullscreen);
|
||||
void _clutter_stage_window_set_cursor_visible (ClutterStageWindow *window,
|
||||
gboolean is_visible);
|
||||
void _clutter_stage_window_set_user_resizable (ClutterStageWindow *window,
|
||||
gboolean is_resizable);
|
||||
|
||||
gboolean _clutter_stage_window_realize (ClutterStageWindow *window);
|
||||
void _clutter_stage_window_unrealize (ClutterStageWindow *window);
|
||||
|
@@ -72,6 +72,7 @@
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-stage-manager-private.h"
|
||||
#include "clutter-stage-private.h"
|
||||
#include "clutter-stage-view-private.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
#include "cogl/cogl.h"
|
||||
@@ -148,13 +149,13 @@ struct _ClutterStagePrivate
|
||||
gpointer paint_data;
|
||||
GDestroyNotify paint_notify;
|
||||
|
||||
cairo_rectangle_int_t view_clip;
|
||||
|
||||
int update_freeze_count;
|
||||
|
||||
guint relayout_pending : 1;
|
||||
guint redraw_pending : 1;
|
||||
guint is_fullscreen : 1;
|
||||
guint is_cursor_visible : 1;
|
||||
guint is_user_resizable : 1;
|
||||
guint use_fog : 1;
|
||||
guint throttle_motion_events : 1;
|
||||
guint use_alpha : 1;
|
||||
@@ -170,12 +171,9 @@ enum
|
||||
PROP_0,
|
||||
|
||||
PROP_COLOR,
|
||||
PROP_FULLSCREEN_SET,
|
||||
PROP_OFFSCREEN,
|
||||
PROP_CURSOR_VISIBLE,
|
||||
PROP_PERSPECTIVE,
|
||||
PROP_TITLE,
|
||||
PROP_USER_RESIZABLE,
|
||||
PROP_USE_FOG,
|
||||
PROP_FOG,
|
||||
PROP_USE_ALPHA,
|
||||
@@ -186,12 +184,11 @@ enum
|
||||
|
||||
enum
|
||||
{
|
||||
FULLSCREEN,
|
||||
UNFULLSCREEN,
|
||||
ACTIVATE,
|
||||
DEACTIVATE,
|
||||
DELETE_EVENT,
|
||||
AFTER_PAINT,
|
||||
PAINT_VIEW,
|
||||
PRESENTED,
|
||||
|
||||
LAST_SIGNAL
|
||||
@@ -404,40 +401,37 @@ clutter_stage_allocate (ClutterActor *self,
|
||||
flags | CLUTTER_DELEGATE_LAYOUT);
|
||||
|
||||
/* Ensure the window is sized correctly */
|
||||
if (!priv->is_fullscreen)
|
||||
if (priv->min_size_changed)
|
||||
{
|
||||
if (priv->min_size_changed)
|
||||
{
|
||||
gfloat min_width, min_height;
|
||||
gboolean min_width_set, min_height_set;
|
||||
gfloat min_width, min_height;
|
||||
gboolean min_width_set, min_height_set;
|
||||
|
||||
g_object_get (G_OBJECT (self),
|
||||
"min-width", &min_width,
|
||||
"min-width-set", &min_width_set,
|
||||
"min-height", &min_height,
|
||||
"min-height-set", &min_height_set,
|
||||
NULL);
|
||||
g_object_get (G_OBJECT (self),
|
||||
"min-width", &min_width,
|
||||
"min-width-set", &min_width_set,
|
||||
"min-height", &min_height,
|
||||
"min-height-set", &min_height_set,
|
||||
NULL);
|
||||
|
||||
if (!min_width_set)
|
||||
min_width = 1;
|
||||
if (!min_height_set)
|
||||
min_height = 1;
|
||||
if (!min_width_set)
|
||||
min_width = 1;
|
||||
if (!min_height_set)
|
||||
min_height = 1;
|
||||
|
||||
if (width < min_width)
|
||||
width = min_width;
|
||||
if (height < min_height)
|
||||
height = min_height;
|
||||
if (width < min_width)
|
||||
width = min_width;
|
||||
if (height < min_height)
|
||||
height = min_height;
|
||||
|
||||
priv->min_size_changed = FALSE;
|
||||
}
|
||||
priv->min_size_changed = FALSE;
|
||||
}
|
||||
|
||||
if (window_size.width != CLUTTER_NEARBYINT (width) ||
|
||||
window_size.height != CLUTTER_NEARBYINT (height))
|
||||
{
|
||||
_clutter_stage_window_resize (priv->impl,
|
||||
CLUTTER_NEARBYINT (width),
|
||||
CLUTTER_NEARBYINT (height));
|
||||
}
|
||||
if (window_size.width != CLUTTER_NEARBYINT (width) ||
|
||||
window_size.height != CLUTTER_NEARBYINT (height))
|
||||
{
|
||||
_clutter_stage_window_resize (priv->impl,
|
||||
CLUTTER_NEARBYINT (width),
|
||||
CLUTTER_NEARBYINT (height));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -691,7 +685,20 @@ _clutter_stage_paint_view (ClutterStage *stage,
|
||||
|
||||
COGL_TRACE_BEGIN_SCOPED (ClutterStagePaintView, "Paint (view)");
|
||||
|
||||
clutter_stage_do_paint_view (stage, view, clip);
|
||||
priv->view_clip = *clip;
|
||||
|
||||
if (g_signal_has_handler_pending (stage, stage_signals[PAINT_VIEW],
|
||||
0, TRUE))
|
||||
g_signal_emit (stage, stage_signals[PAINT_VIEW], 0, view);
|
||||
else
|
||||
CLUTTER_STAGE_GET_CLASS (stage)->paint_view (stage, view);
|
||||
|
||||
priv->view_clip = (cairo_rectangle_int_t) { 0 };
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_stage_emit_after_paint (ClutterStage *stage)
|
||||
{
|
||||
g_signal_emit (stage, stage_signals[AFTER_PAINT], 0);
|
||||
}
|
||||
|
||||
@@ -847,40 +854,6 @@ clutter_stage_real_deactivate (ClutterStage *stage)
|
||||
clutter_stage_emit_key_focus_event (stage, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_real_fullscreen (ClutterStage *stage)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
cairo_rectangle_int_t geom;
|
||||
ClutterActorBox box;
|
||||
|
||||
/* we need to force an allocation here because the size
|
||||
* of the stage might have been changed by the backend
|
||||
*
|
||||
* this is a really bad solution to the issues caused by
|
||||
* the fact that fullscreening the stage on the X11 backends
|
||||
* is really an asynchronous operation
|
||||
*/
|
||||
_clutter_stage_window_get_geometry (priv->impl, &geom);
|
||||
|
||||
box.x1 = 0;
|
||||
box.y1 = 0;
|
||||
box.x2 = geom.width;
|
||||
box.y2 = geom.height;
|
||||
|
||||
/* we need to blow the caching on the Stage size, given that
|
||||
* we're about to force an allocation, because if anything
|
||||
* ends up querying the size of the stage during the allocate()
|
||||
* call, like constraints or signal handlers, we'll get into an
|
||||
* inconsistent state: the stage will report the old cached size,
|
||||
* but the allocation will be updated anyway.
|
||||
*/
|
||||
clutter_actor_set_size (CLUTTER_ACTOR (stage), -1.0, -1.0);
|
||||
clutter_actor_allocate (CLUTTER_ACTOR (stage),
|
||||
&box,
|
||||
CLUTTER_ALLOCATION_NONE);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_stage_queue_event (ClutterStage *stage,
|
||||
ClutterEvent *event,
|
||||
@@ -1718,11 +1691,6 @@ clutter_stage_set_property (GObject *object,
|
||||
clutter_value_get_color (value));
|
||||
break;
|
||||
|
||||
case PROP_OFFSCREEN:
|
||||
if (g_value_get_boolean (value))
|
||||
g_warning ("Offscreen stages are currently not supported\n");
|
||||
break;
|
||||
|
||||
case PROP_CURSOR_VISIBLE:
|
||||
if (g_value_get_boolean (value))
|
||||
clutter_stage_show_cursor (stage);
|
||||
@@ -1738,10 +1706,6 @@ clutter_stage_set_property (GObject *object,
|
||||
clutter_stage_set_title (stage, g_value_get_string (value));
|
||||
break;
|
||||
|
||||
case PROP_USER_RESIZABLE:
|
||||
clutter_stage_set_user_resizable (stage, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case PROP_USE_FOG:
|
||||
clutter_stage_set_use_fog (stage, g_value_get_boolean (value));
|
||||
break;
|
||||
@@ -1792,14 +1756,6 @@ clutter_stage_get_property (GObject *gobject,
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_OFFSCREEN:
|
||||
g_value_set_boolean (value, FALSE);
|
||||
break;
|
||||
|
||||
case PROP_FULLSCREEN_SET:
|
||||
g_value_set_boolean (value, priv->is_fullscreen);
|
||||
break;
|
||||
|
||||
case PROP_CURSOR_VISIBLE:
|
||||
g_value_set_boolean (value, priv->is_cursor_visible);
|
||||
break;
|
||||
@@ -1812,10 +1768,6 @@ clutter_stage_get_property (GObject *gobject,
|
||||
g_value_set_string (value, priv->title);
|
||||
break;
|
||||
|
||||
case PROP_USER_RESIZABLE:
|
||||
g_value_set_boolean (value, priv->is_user_resizable);
|
||||
break;
|
||||
|
||||
case PROP_USE_FOG:
|
||||
g_value_set_boolean (value, priv->use_fog);
|
||||
break;
|
||||
@@ -1910,6 +1862,16 @@ clutter_stage_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (clutter_stage_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_real_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
const cairo_rectangle_int_t *clip = &priv->view_clip;
|
||||
|
||||
clutter_stage_do_paint_view (stage, view, clip);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_class_init (ClutterStageClass *klass)
|
||||
{
|
||||
@@ -1939,42 +1901,8 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
actor_class->queue_redraw = clutter_stage_real_queue_redraw;
|
||||
actor_class->apply_transform = clutter_stage_real_apply_transform;
|
||||
|
||||
/**
|
||||
* ClutterStage:fullscreen:
|
||||
*
|
||||
* Whether the stage should be fullscreen or not.
|
||||
*
|
||||
* This property is set by calling clutter_stage_set_fullscreen()
|
||||
* but since the actual implementation is delegated to the backend
|
||||
* you should connect to the notify::fullscreen-set signal in order
|
||||
* to get notification if the fullscreen state has been successfully
|
||||
* achieved.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
pspec = g_param_spec_boolean ("fullscreen-set",
|
||||
P_("Fullscreen Set"),
|
||||
P_("Whether the main stage is fullscreen"),
|
||||
FALSE,
|
||||
CLUTTER_PARAM_READABLE);
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_FULLSCREEN_SET,
|
||||
pspec);
|
||||
/**
|
||||
* ClutterStage:offscreen:
|
||||
*
|
||||
* Whether the stage should be rendered in an offscreen buffer.
|
||||
*
|
||||
* Deprecated: 1.10: This property does not do anything.
|
||||
*/
|
||||
pspec = g_param_spec_boolean ("offscreen",
|
||||
P_("Offscreen"),
|
||||
P_("Whether the main stage should be rendered offscreen"),
|
||||
FALSE,
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_DEPRECATED);
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_OFFSCREEN,
|
||||
pspec);
|
||||
klass->paint_view = clutter_stage_real_paint_view;
|
||||
|
||||
/**
|
||||
* ClutterStage:cursor-visible:
|
||||
*
|
||||
@@ -1988,21 +1916,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_CURSOR_VISIBLE,
|
||||
pspec);
|
||||
/**
|
||||
* ClutterStage:user-resizable:
|
||||
*
|
||||
* Whether the stage is resizable via user interaction.
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
pspec = g_param_spec_boolean ("user-resizable",
|
||||
P_("User Resizable"),
|
||||
P_("Whether the stage is able to be resized via user interaction"),
|
||||
FALSE,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_USER_RESIZABLE,
|
||||
pspec);
|
||||
/**
|
||||
* ClutterStage:color:
|
||||
*
|
||||
@@ -2150,39 +2063,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class, PROP_ACCEPT_FOCUS, pspec);
|
||||
|
||||
/**
|
||||
* ClutterStage::fullscreen:
|
||||
* @stage: the stage which was fullscreened
|
||||
*
|
||||
* The ::fullscreen signal is emitted when the stage is made fullscreen.
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
stage_signals[FULLSCREEN] =
|
||||
g_signal_new (I_("fullscreen"),
|
||||
G_TYPE_FROM_CLASS (gobject_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (ClutterStageClass, fullscreen),
|
||||
NULL, NULL,
|
||||
_clutter_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
/**
|
||||
* ClutterStage::unfullscreen:
|
||||
* @stage: the stage which has left a fullscreen state.
|
||||
*
|
||||
* The ::unfullscreen signal is emitted when the stage leaves a fullscreen
|
||||
* state.
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
stage_signals[UNFULLSCREEN] =
|
||||
g_signal_new (I_("unfullscreen"),
|
||||
G_TYPE_FROM_CLASS (gobject_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ClutterStageClass, unfullscreen),
|
||||
NULL, NULL,
|
||||
_clutter_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
/**
|
||||
* ClutterStage::activate:
|
||||
* @stage: the stage which was activated
|
||||
@@ -2266,6 +2146,28 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* ClutterStage::paint-view:
|
||||
* @stage: the stage that received the event
|
||||
* @view: a #ClutterStageView
|
||||
*
|
||||
* The ::paint-view signal is emitted before a #ClutterStageView is being
|
||||
* painted.
|
||||
*
|
||||
* The view is painted in the default handler. Hence, if you want to perform
|
||||
* some action after the view is painted, like reading the contents of the
|
||||
* framebuffer, use g_signal_connect_after() or pass %G_CONNECT_AFTER.
|
||||
*/
|
||||
stage_signals[PAINT_VIEW] =
|
||||
g_signal_new (I_("paint-view"),
|
||||
G_TYPE_FROM_CLASS (gobject_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ClutterStageClass, paint_view),
|
||||
NULL, NULL,
|
||||
_clutter_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_STAGE_VIEW);
|
||||
|
||||
/**
|
||||
* ClutterStage::presented: (skip)
|
||||
* @stage: the stage that received the event
|
||||
@@ -2283,7 +2185,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_INT, G_TYPE_POINTER);
|
||||
|
||||
klass->fullscreen = clutter_stage_real_fullscreen;
|
||||
klass->activate = clutter_stage_real_activate;
|
||||
klass->deactivate = clutter_stage_real_deactivate;
|
||||
klass->delete_event = clutter_stage_real_delete_event;
|
||||
@@ -2334,21 +2235,12 @@ clutter_stage_init (ClutterStage *self)
|
||||
|
||||
priv->event_queue = g_queue_new ();
|
||||
|
||||
priv->is_fullscreen = FALSE;
|
||||
priv->is_user_resizable = FALSE;
|
||||
priv->is_cursor_visible = TRUE;
|
||||
priv->use_fog = FALSE;
|
||||
priv->throttle_motion_events = TRUE;
|
||||
priv->min_size_changed = FALSE;
|
||||
priv->sync_delay = -1;
|
||||
|
||||
/* XXX - we need to keep the invariant that calling
|
||||
* clutter_set_motion_event_enabled() before the stage creation
|
||||
* will cause motion event delivery to be disabled on any newly
|
||||
* created stage. this can go away when we break API and remove
|
||||
* deprecated functions.
|
||||
*/
|
||||
priv->motion_events_enabled = _clutter_context_get_motion_events_enabled ();
|
||||
priv->motion_events_enabled = TRUE;
|
||||
|
||||
clutter_actor_set_background_color (CLUTTER_ACTOR (self),
|
||||
&default_stage_color);
|
||||
@@ -2731,136 +2623,6 @@ _clutter_stage_get_viewport (ClutterStage *stage,
|
||||
*height = priv->viewport[3];
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_set_fullscreen:
|
||||
* @stage: a #ClutterStage
|
||||
* @fullscreen: %TRUE to to set the stage fullscreen
|
||||
*
|
||||
* Asks to place the stage window in the fullscreen or unfullscreen
|
||||
* states.
|
||||
*
|
||||
( Note that you shouldn't assume the window is definitely full screen
|
||||
* afterward, because other entities (e.g. the user or window manager)
|
||||
* could unfullscreen it again, and not all window managers honor
|
||||
* requests to fullscreen windows.
|
||||
*
|
||||
* If you want to receive notification of the fullscreen state you
|
||||
* should either use the #ClutterStage::fullscreen and
|
||||
* #ClutterStage::unfullscreen signals, or use the notify signal
|
||||
* for the #ClutterStage:fullscreen-set property
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
clutter_stage_set_fullscreen (ClutterStage *stage,
|
||||
gboolean fullscreen)
|
||||
{
|
||||
ClutterStagePrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
||||
|
||||
priv = stage->priv;
|
||||
|
||||
if (priv->is_fullscreen != fullscreen)
|
||||
{
|
||||
ClutterStageWindow *impl = CLUTTER_STAGE_WINDOW (priv->impl);
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (impl);
|
||||
|
||||
/* Only set if backend implements.
|
||||
*
|
||||
* Also see clutter_stage_event() for setting priv->is_fullscreen
|
||||
* on state change event.
|
||||
*/
|
||||
if (iface->set_fullscreen)
|
||||
iface->set_fullscreen (impl, fullscreen);
|
||||
}
|
||||
|
||||
/* If the backend did fullscreen the stage window then we need to resize
|
||||
* the stage and update its viewport so we queue a relayout. Note: if the
|
||||
* fullscreen request is handled asynchronously we can't rely on this
|
||||
* queue_relayout to update the viewport, but for example the X backend
|
||||
* will recieve a ConfigureNotify after a successful resize which is how
|
||||
* we ensure the viewport is updated on X.
|
||||
*/
|
||||
clutter_actor_queue_relayout (CLUTTER_ACTOR (stage));
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_get_fullscreen:
|
||||
* @stage: a #ClutterStage
|
||||
*
|
||||
* Retrieves whether the stage is full screen or not
|
||||
*
|
||||
* Return value: %TRUE if the stage is full screen
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
gboolean
|
||||
clutter_stage_get_fullscreen (ClutterStage *stage)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
|
||||
|
||||
return stage->priv->is_fullscreen;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_set_user_resizable:
|
||||
* @stage: a #ClutterStage
|
||||
* @resizable: whether the stage should be user resizable.
|
||||
*
|
||||
* Sets if the stage is resizable by user interaction (e.g. via
|
||||
* window manager controls)
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
void
|
||||
clutter_stage_set_user_resizable (ClutterStage *stage,
|
||||
gboolean resizable)
|
||||
{
|
||||
ClutterStagePrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
||||
|
||||
priv = stage->priv;
|
||||
|
||||
if (clutter_feature_available (CLUTTER_FEATURE_STAGE_USER_RESIZE)
|
||||
&& priv->is_user_resizable != resizable)
|
||||
{
|
||||
ClutterStageWindow *impl = CLUTTER_STAGE_WINDOW (priv->impl);
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (impl);
|
||||
if (iface->set_user_resizable)
|
||||
{
|
||||
priv->is_user_resizable = resizable;
|
||||
|
||||
iface->set_user_resizable (impl, resizable);
|
||||
|
||||
g_object_notify (G_OBJECT (stage), "user-resizable");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_get_user_resizable:
|
||||
* @stage: a #ClutterStage
|
||||
*
|
||||
* Retrieves the value set with clutter_stage_set_user_resizable().
|
||||
*
|
||||
* Return value: %TRUE if the stage is resizable by the user.
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
gboolean
|
||||
clutter_stage_get_user_resizable (ClutterStage *stage)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
|
||||
|
||||
return stage->priv->is_user_resizable;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_show_cursor:
|
||||
* @stage: a #ClutterStage
|
||||
@@ -3072,13 +2834,9 @@ gboolean
|
||||
clutter_stage_event (ClutterStage *stage,
|
||||
ClutterEvent *event)
|
||||
{
|
||||
ClutterStagePrivate *priv;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
priv = stage->priv;
|
||||
|
||||
if (event->type == CLUTTER_DELETE)
|
||||
{
|
||||
gboolean retval = FALSE;
|
||||
@@ -3098,24 +2856,6 @@ clutter_stage_event (ClutterStage *stage,
|
||||
if (clutter_actor_event (CLUTTER_ACTOR (stage), event, FALSE))
|
||||
return TRUE;
|
||||
|
||||
if (event->stage_state.changed_mask & CLUTTER_STAGE_STATE_FULLSCREEN)
|
||||
{
|
||||
if (event->stage_state.new_state & CLUTTER_STAGE_STATE_FULLSCREEN)
|
||||
{
|
||||
priv->is_fullscreen = TRUE;
|
||||
g_signal_emit (stage, stage_signals[FULLSCREEN], 0);
|
||||
|
||||
g_object_notify (G_OBJECT (stage), "fullscreen-set");
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->is_fullscreen = FALSE;
|
||||
g_signal_emit (stage, stage_signals[UNFULLSCREEN], 0);
|
||||
|
||||
g_object_notify (G_OBJECT (stage), "fullscreen-set");
|
||||
}
|
||||
}
|
||||
|
||||
if (event->stage_state.changed_mask & CLUTTER_STAGE_STATE_ACTIVATED)
|
||||
{
|
||||
if (event->stage_state.new_state & CLUTTER_STAGE_STATE_ACTIVATED)
|
||||
@@ -3970,8 +3710,6 @@ clutter_stage_get_use_alpha (ClutterStage *stage)
|
||||
* If the current size of @stage is smaller than the minimum size, the
|
||||
* @stage will be resized to the new @width and @height
|
||||
*
|
||||
* This function has no effect if @stage is fullscreen
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
void
|
||||
@@ -4658,20 +4396,6 @@ _clutter_stage_is_activated (ClutterStage *stage)
|
||||
return (stage->priv->current_state & CLUTTER_STAGE_STATE_ACTIVATED) != 0;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* _clutter_stage_is_fullscreen:
|
||||
* @stage: a #ClutterStage
|
||||
*
|
||||
* Checks whether the @stage state includes %CLUTTER_STAGE_STATE_FULLSCREEN.
|
||||
*
|
||||
* Return value: %TRUE if the @stage is fullscreen
|
||||
*/
|
||||
gboolean
|
||||
_clutter_stage_is_fullscreen (ClutterStage *stage)
|
||||
{
|
||||
return (stage->priv->current_state & CLUTTER_STAGE_STATE_FULLSCREEN) != 0;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* _clutter_stage_update_state:
|
||||
* @stage: a #ClutterStage
|
||||
|
@@ -30,6 +30,7 @@
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
#include <clutter/clutter-group.h>
|
||||
#include <clutter/clutter-stage-view.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -61,8 +62,6 @@ struct _ClutterStage
|
||||
};
|
||||
/**
|
||||
* ClutterStageClass:
|
||||
* @fullscreen: handler for the #ClutterStage::fullscreen signal
|
||||
* @unfullscreen: handler for the #ClutterStage::unfullscreen signal
|
||||
* @activate: handler for the #ClutterStage::activate signal
|
||||
* @deactivate: handler for the #ClutterStage::deactivate signal
|
||||
* @delete_event: handler for the #ClutterStage::delete-event signal
|
||||
@@ -79,17 +78,18 @@ struct _ClutterStageClass
|
||||
|
||||
/*< public >*/
|
||||
/* signals */
|
||||
void (* fullscreen) (ClutterStage *stage);
|
||||
void (* unfullscreen) (ClutterStage *stage);
|
||||
void (* activate) (ClutterStage *stage);
|
||||
void (* deactivate) (ClutterStage *stage);
|
||||
|
||||
gboolean (* delete_event) (ClutterStage *stage,
|
||||
ClutterEvent *event);
|
||||
|
||||
void (* paint_view) (ClutterStage *stage,
|
||||
ClutterStageView *view);
|
||||
|
||||
/*< private >*/
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[31];
|
||||
gpointer _padding_dummy[30];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -168,11 +168,6 @@ CLUTTER_EXPORT
|
||||
void clutter_stage_get_perspective (ClutterStage *stage,
|
||||
ClutterPerspective *perspective);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_set_fullscreen (ClutterStage *stage,
|
||||
gboolean fullscreen);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_stage_get_fullscreen (ClutterStage *stage);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_show_cursor (ClutterStage *stage);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_hide_cursor (ClutterStage *stage);
|
||||
@@ -181,11 +176,6 @@ void clutter_stage_set_title (ClutterStage
|
||||
const gchar *title);
|
||||
CLUTTER_EXPORT
|
||||
const gchar * clutter_stage_get_title (ClutterStage *stage);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_set_user_resizable (ClutterStage *stage,
|
||||
gboolean resizable);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_stage_get_user_resizable (ClutterStage *stage);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_set_minimum_size (ClutterStage *stage,
|
||||
@@ -274,6 +264,10 @@ gboolean clutter_stage_capture (ClutterStage *stage,
|
||||
cairo_rectangle_int_t *rect,
|
||||
ClutterCapture **captures,
|
||||
int *n_captures);
|
||||
CLUTTER_EXPORT
|
||||
ClutterStageView * clutter_stage_get_view_at (ClutterStage *stage,
|
||||
float x,
|
||||
float y);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -171,7 +171,7 @@ clutter_text_buffer_normal_insert_text (ClutterTextBuffer *buffer,
|
||||
|
||||
/* Actual text insertion */
|
||||
at = g_utf8_offset_to_pointer (pv->normal_text, position) - pv->normal_text;
|
||||
g_memmove (pv->normal_text + at + n_bytes, pv->normal_text + at, pv->normal_text_bytes - at);
|
||||
memmove (pv->normal_text + at + n_bytes, pv->normal_text + at, pv->normal_text_bytes - at);
|
||||
memcpy (pv->normal_text + at, chars, n_bytes);
|
||||
|
||||
/* Book keeping */
|
||||
@@ -201,7 +201,7 @@ clutter_text_buffer_normal_delete_text (ClutterTextBuffer *buffer,
|
||||
start = g_utf8_offset_to_pointer (pv->normal_text, position) - pv->normal_text;
|
||||
end = g_utf8_offset_to_pointer (pv->normal_text, position + n_chars) - pv->normal_text;
|
||||
|
||||
g_memmove (pv->normal_text + start, pv->normal_text + end, pv->normal_text_bytes + 1 - end);
|
||||
memmove (pv->normal_text + start, pv->normal_text + end, pv->normal_text_bytes + 1 - end);
|
||||
pv->normal_text_chars -= n_chars;
|
||||
pv->normal_text_bytes -= (end - start);
|
||||
|
||||
|
@@ -101,6 +101,7 @@
|
||||
#include "clutter-snap-constraint.h"
|
||||
#include "clutter-stage.h"
|
||||
#include "clutter-stage-manager.h"
|
||||
#include "clutter-stage-view.h"
|
||||
#include "clutter-tap-action.h"
|
||||
#include "clutter-test-utils.h"
|
||||
#include "clutter-texture.h"
|
||||
|
@@ -45,6 +45,7 @@
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-stage-private.h"
|
||||
#include "clutter-stage-view-private.h"
|
||||
|
||||
#include "cogl/cogl-trace.h"
|
||||
|
||||
@@ -982,6 +983,8 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
|
||||
clutter_stage_cogl_redraw_view (stage_window, view) || swap_event;
|
||||
}
|
||||
|
||||
_clutter_stage_emit_after_paint (stage_cogl->wrapper);
|
||||
|
||||
_clutter_stage_window_finish_frame (stage_window);
|
||||
|
||||
if (swap_event)
|
||||
|
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2011 Intel Corp
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_MAIN_DEPRECATED_H__
|
||||
#define __CLUTTER_MAIN_DEPRECATED_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
#include <clutter/clutter-input-device.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_threads_init (void);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_threads_enter (void);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_threads_leave (void);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_stage_set_motion_events_enabled)
|
||||
void clutter_set_motion_events_enabled (gboolean enable);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_stage_get_motion_events_enabled)
|
||||
gboolean clutter_get_motion_events_enabled (void);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_stage_ensure_redraw)
|
||||
void clutter_redraw (ClutterStage *stage);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(cogl_pango_font_map_clear_glyph_cache)
|
||||
void clutter_clear_glyph_cache (void);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_backend_set_font_options)
|
||||
void clutter_set_font_flags (ClutterFontFlags flags);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_backend_get_font_options)
|
||||
ClutterFontFlags clutter_get_font_flags (void);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_device_manager_get_device)
|
||||
ClutterInputDevice * clutter_get_input_device_for_id (gint id_);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_input_device_grab)
|
||||
void clutter_grab_pointer_for_device (ClutterActor *actor,
|
||||
gint id_);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_input_device_ungrab)
|
||||
void clutter_ungrab_pointer_for_device (gint id_);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_set_default_frame_rate (guint frames_per_sec);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
gulong clutter_get_timestamp (void);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_get_debug_enabled (void);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_get_show_fps (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_MAIN_DEPRECATED_H__ */
|
@@ -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)
|
||||
{
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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 */
|
||||
|
@@ -75,6 +75,7 @@ clutter_headers = [
|
||||
'clutter-snap-constraint.h',
|
||||
'clutter-stage.h',
|
||||
'clutter-stage-manager.h',
|
||||
'clutter-stage-view.h',
|
||||
'clutter-tap-action.h',
|
||||
'clutter-test-utils.h',
|
||||
'clutter-texture.h',
|
||||
@@ -164,6 +165,7 @@ clutter_sources = [
|
||||
'clutter-snap-constraint.c',
|
||||
'clutter-stage.c',
|
||||
'clutter-stage-manager.c',
|
||||
'clutter-stage-view.c',
|
||||
'clutter-stage-window.c',
|
||||
'clutter-tap-action.c',
|
||||
'clutter-test-utils.c',
|
||||
@@ -207,7 +209,7 @@ clutter_private_headers = [
|
||||
'clutter-settings-private.h',
|
||||
'clutter-stage-manager-private.h',
|
||||
'clutter-stage-private.h',
|
||||
'clutter-stage-view.h',
|
||||
'clutter-stage-view-private.h',
|
||||
'clutter-stage-window.h',
|
||||
]
|
||||
|
||||
@@ -215,7 +217,6 @@ clutter_nonintrospected_sources = [
|
||||
'clutter-easing.c',
|
||||
'clutter-event-translator.c',
|
||||
'clutter-id-pool.c',
|
||||
'clutter-stage-view.c',
|
||||
]
|
||||
|
||||
clutter_deprecated_headers = [
|
||||
@@ -233,7 +234,6 @@ clutter_deprecated_headers = [
|
||||
'deprecated/clutter-container.h',
|
||||
'deprecated/clutter-group.h',
|
||||
'deprecated/clutter-keysyms.h',
|
||||
'deprecated/clutter-main.h',
|
||||
'deprecated/clutter-rectangle.h',
|
||||
'deprecated/clutter-stage-manager.h',
|
||||
'deprecated/clutter-stage.h',
|
||||
@@ -343,14 +343,8 @@ if have_native_backend
|
||||
endif
|
||||
|
||||
if have_wayland
|
||||
clutter_wayland_nonintrospected_sources = [
|
||||
'wayland/clutter-wayland-surface.c',
|
||||
]
|
||||
clutter_backend_nonintrospected_sources += clutter_wayland_nonintrospected_sources
|
||||
|
||||
clutter_wayland_private_headers = [
|
||||
'wayland/clutter-wayland-compositor.h',
|
||||
'wayland/clutter-wayland-surface.h',
|
||||
]
|
||||
clutter_backend_private_headers += clutter_wayland_private_headers
|
||||
endif
|
||||
|
@@ -1,654 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2011 Intel Corporation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors:
|
||||
* Robert Bragg <robert@linux.intel.com>
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:clutter-wayland-surface
|
||||
* @Title: ClutterWaylandSurface
|
||||
* @short_description: An actor which displays the content of a client surface
|
||||
*
|
||||
* #ClutterWaylandSurface is an actor for displaying the contents of a client
|
||||
* surface. It is intended to support developers implementing Clutter based
|
||||
* wayland compositors.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#define CLUTTER_ENABLE_EXPERIMENTAL_API
|
||||
|
||||
#include "clutter-wayland-surface.h"
|
||||
|
||||
#include "clutter-actor-private.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-paint-volume-private.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-backend.h"
|
||||
|
||||
#include <cogl/cogl.h>
|
||||
#include <cogl/cogl-wayland-server.h>
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_SURFACE = 1,
|
||||
PROP_SURFACE_WIDTH,
|
||||
PROP_SURFACE_HEIGHT,
|
||||
PROP_COGL_TEXTURE,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
static GParamSpec *obj_props[PROP_LAST];
|
||||
|
||||
enum
|
||||
{
|
||||
QUEUE_DAMAGE_REDRAW,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0, };
|
||||
|
||||
struct _ClutterWaylandSurfacePrivate
|
||||
{
|
||||
struct wl_surface *surface;
|
||||
CoglTexture2D *buffer;
|
||||
int width, height;
|
||||
CoglPipeline *pipeline;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterWaylandSurface,
|
||||
clutter_wayland_surface,
|
||||
CLUTTER_TYPE_ACTOR)
|
||||
|
||||
static gboolean
|
||||
clutter_wayland_surface_get_paint_volume (ClutterActor *self,
|
||||
ClutterPaintVolume *volume)
|
||||
{
|
||||
return clutter_paint_volume_set_from_allocation (volume, self);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_wayland_surface_queue_damage_redraw (ClutterWaylandSurface *texture,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
ClutterWaylandSurfacePrivate *priv = texture->priv;
|
||||
ClutterActor *self = CLUTTER_ACTOR (texture);
|
||||
ClutterActorBox allocation;
|
||||
float scale_x;
|
||||
float scale_y;
|
||||
cairo_rectangle_int_t clip;
|
||||
|
||||
/* NB: clutter_actor_queue_redraw_with_clip expects a box in the actor's
|
||||
* coordinate space so we need to convert from surface coordinates to
|
||||
* actor coordinates...
|
||||
*/
|
||||
|
||||
/* Calling clutter_actor_get_allocation_box() is enormously expensive
|
||||
* if the actor has an out-of-date allocation, since it triggers
|
||||
* a full redraw. clutter_actor_queue_redraw_with_clip() would redraw
|
||||
* the whole stage anyways in that case, so just go ahead and do
|
||||
* it here.
|
||||
*/
|
||||
if (!clutter_actor_has_allocation (self))
|
||||
{
|
||||
clutter_actor_queue_redraw (self);
|
||||
return;
|
||||
}
|
||||
|
||||
if (priv->width == 0 || priv->height == 0)
|
||||
return;
|
||||
|
||||
clutter_actor_get_allocation_box (self, &allocation);
|
||||
|
||||
scale_x = (allocation.x2 - allocation.x1) / priv->width;
|
||||
scale_y = (allocation.y2 - allocation.y1) / priv->height;
|
||||
|
||||
clip.x = x * scale_x;
|
||||
clip.y = y * scale_y;
|
||||
clip.width = width * scale_x;
|
||||
clip.height = height * scale_y;
|
||||
clutter_actor_queue_redraw_with_clip (self, &clip);
|
||||
}
|
||||
|
||||
static void
|
||||
free_pipeline (ClutterWaylandSurface *self)
|
||||
{
|
||||
ClutterWaylandSurfacePrivate *priv = self->priv;
|
||||
|
||||
if (priv->pipeline)
|
||||
{
|
||||
cogl_object_unref (priv->pipeline);
|
||||
priv->pipeline = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
opacity_change_cb (ClutterWaylandSurface *self)
|
||||
{
|
||||
free_pipeline (self);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_wayland_surface_init (ClutterWaylandSurface *self)
|
||||
{
|
||||
ClutterWaylandSurfacePrivate *priv;
|
||||
|
||||
priv = clutter_wayland_surface_get_instance_private (self);
|
||||
priv->surface = NULL;
|
||||
priv->width = 0;
|
||||
priv->height = 0;
|
||||
|
||||
self->priv = priv;
|
||||
|
||||
g_signal_connect (self, "notify::opacity", G_CALLBACK (opacity_change_cb), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
free_surface_buffers (ClutterWaylandSurface *self)
|
||||
{
|
||||
ClutterWaylandSurfacePrivate *priv = self->priv;
|
||||
|
||||
if (priv->buffer)
|
||||
{
|
||||
cogl_object_unref (priv->buffer);
|
||||
priv->buffer = NULL;
|
||||
free_pipeline (self);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_wayland_surface_dispose (GObject *object)
|
||||
{
|
||||
ClutterWaylandSurface *self = CLUTTER_WAYLAND_SURFACE (object);
|
||||
ClutterWaylandSurfacePrivate *priv = self->priv;
|
||||
|
||||
free_pipeline (self);
|
||||
free_surface_buffers (self);
|
||||
priv->surface = NULL;
|
||||
|
||||
G_OBJECT_CLASS (clutter_wayland_surface_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
set_size (ClutterWaylandSurface *self,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
ClutterWaylandSurfacePrivate *priv = self->priv;
|
||||
|
||||
if (priv->width != width)
|
||||
{
|
||||
priv->width = width;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SURFACE_WIDTH]);
|
||||
}
|
||||
if (priv->height != height)
|
||||
{
|
||||
priv->height = height;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SURFACE_HEIGHT]);
|
||||
}
|
||||
|
||||
clutter_actor_set_size (CLUTTER_ACTOR (self), priv->width, priv->height);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_wayland_surface_get_surface:
|
||||
* @self: a #ClutterWaylandSurface
|
||||
*
|
||||
* Retrieves a point to the Wayland surface used by the actor.
|
||||
*
|
||||
* Return value: (transfer none): a wl_surface pointer, or %NULL
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
struct wl_surface *
|
||||
clutter_wayland_surface_get_surface (ClutterWaylandSurface *self)
|
||||
{
|
||||
ClutterWaylandSurfacePrivate *priv = self->priv;
|
||||
return priv->surface;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_wayland_surface_set_surface:
|
||||
* @self: a #ClutterWaylandSurface
|
||||
* @surface: a Wayland wl_surface pointer
|
||||
*
|
||||
* Sets the Wayland surface to be used by the actor.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
void
|
||||
clutter_wayland_surface_set_surface (ClutterWaylandSurface *self,
|
||||
struct wl_surface *surface)
|
||||
{
|
||||
ClutterWaylandSurfacePrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_WAYLAND_IS_SURFACE (self));
|
||||
|
||||
priv = self->priv;
|
||||
|
||||
if (priv->surface == surface)
|
||||
return;
|
||||
|
||||
if (priv->surface)
|
||||
{
|
||||
free_pipeline (self);
|
||||
free_surface_buffers (self);
|
||||
g_signal_emit (self, signals[QUEUE_DAMAGE_REDRAW],
|
||||
0,
|
||||
0, 0, priv->width, priv->height);
|
||||
}
|
||||
|
||||
priv->surface = surface;
|
||||
|
||||
/* XXX: should we freeze/thaw notifications? */
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SURFACE]);
|
||||
|
||||
/* We have to wait until the next attach event to find out the surface
|
||||
* geometry... */
|
||||
set_size (self, 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_wayland_surface_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterWaylandSurface *self = CLUTTER_WAYLAND_SURFACE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_SURFACE:
|
||||
clutter_wayland_surface_set_surface (self, g_value_get_pointer (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_wayland_surface_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterWaylandSurface *self = CLUTTER_WAYLAND_SURFACE (object);
|
||||
ClutterWaylandSurfacePrivate *priv = self->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_SURFACE:
|
||||
g_value_set_pointer (value, priv->surface);
|
||||
break;
|
||||
case PROP_SURFACE_WIDTH:
|
||||
g_value_set_uint (value, priv->width);
|
||||
break;
|
||||
case PROP_SURFACE_HEIGHT:
|
||||
g_value_set_uint (value, priv->height);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_wayland_surface_paint (ClutterActor *self)
|
||||
{
|
||||
ClutterWaylandSurfacePrivate *priv;
|
||||
CoglFramebuffer *framebuffer;
|
||||
ClutterActorBox box;
|
||||
|
||||
g_return_if_fail (CLUTTER_WAYLAND_IS_SURFACE (self));
|
||||
|
||||
priv = CLUTTER_WAYLAND_SURFACE (self)->priv;
|
||||
framebuffer = cogl_get_draw_framebuffer ();
|
||||
|
||||
if (G_UNLIKELY (priv->pipeline == NULL))
|
||||
{
|
||||
CoglContext *ctx =
|
||||
clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||
guint8 paint_opacity = clutter_actor_get_paint_opacity (self);
|
||||
|
||||
priv->pipeline = cogl_pipeline_new (ctx);
|
||||
cogl_pipeline_set_color4ub (priv->pipeline,
|
||||
paint_opacity,
|
||||
paint_opacity,
|
||||
paint_opacity,
|
||||
paint_opacity);
|
||||
cogl_pipeline_set_layer_texture (priv->pipeline, 0,
|
||||
COGL_TEXTURE (priv->buffer));
|
||||
}
|
||||
|
||||
clutter_actor_get_allocation_box (self, &box);
|
||||
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||
priv->pipeline,
|
||||
0, 0,
|
||||
box.x2 - box.x1, box.y2 - box.y1);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_wayland_surface_get_preferred_width (ClutterActor *self,
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *natural_width_p)
|
||||
{
|
||||
ClutterWaylandSurfacePrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_WAYLAND_IS_SURFACE (self));
|
||||
|
||||
priv = CLUTTER_WAYLAND_SURFACE (self)->priv;
|
||||
|
||||
if (min_width_p)
|
||||
*min_width_p = 0;
|
||||
|
||||
if (natural_width_p)
|
||||
*natural_width_p = priv->width;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_wayland_surface_get_preferred_height (ClutterActor *self,
|
||||
gfloat for_width,
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_height_p)
|
||||
{
|
||||
ClutterWaylandSurfacePrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_WAYLAND_IS_SURFACE (self));
|
||||
|
||||
priv = CLUTTER_WAYLAND_SURFACE (self)->priv;
|
||||
|
||||
if (min_height_p)
|
||||
*min_height_p = 0;
|
||||
|
||||
if (natural_height_p)
|
||||
*natural_height_p = priv->height;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_wayland_surface_has_overlaps (ClutterActor *self)
|
||||
{
|
||||
/* Rectangles never need an offscreen redirect because there are
|
||||
never any overlapping primitives */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_wayland_surface_class_init (ClutterWaylandSurfaceClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
||||
GParamSpec *pspec;
|
||||
|
||||
actor_class->get_paint_volume = clutter_wayland_surface_get_paint_volume;
|
||||
actor_class->paint = clutter_wayland_surface_paint;
|
||||
actor_class->get_preferred_width =
|
||||
clutter_wayland_surface_get_preferred_width;
|
||||
actor_class->get_preferred_height =
|
||||
clutter_wayland_surface_get_preferred_height;
|
||||
actor_class->has_overlaps = clutter_wayland_surface_has_overlaps;
|
||||
|
||||
object_class->dispose = clutter_wayland_surface_dispose;
|
||||
object_class->set_property = clutter_wayland_surface_set_property;
|
||||
object_class->get_property = clutter_wayland_surface_get_property;
|
||||
|
||||
pspec = g_param_spec_pointer ("surface",
|
||||
P_("Surface"),
|
||||
P_("The underlying wayland surface"),
|
||||
CLUTTER_PARAM_READWRITE|
|
||||
G_PARAM_CONSTRUCT_ONLY);
|
||||
obj_props[PROP_SURFACE] = pspec;
|
||||
g_object_class_install_property (object_class, PROP_SURFACE, pspec);
|
||||
|
||||
pspec = g_param_spec_uint ("surface-width",
|
||||
P_("Surface width"),
|
||||
P_("The width of the underlying wayland surface"),
|
||||
0, G_MAXUINT,
|
||||
0,
|
||||
G_PARAM_READABLE);
|
||||
obj_props[PROP_SURFACE_WIDTH] = pspec;
|
||||
g_object_class_install_property (object_class, PROP_SURFACE_WIDTH, pspec);
|
||||
|
||||
pspec = g_param_spec_uint ("surface-height",
|
||||
P_("Surface height"),
|
||||
P_("The height of the underlying wayland surface"),
|
||||
0, G_MAXUINT,
|
||||
0,
|
||||
G_PARAM_READABLE);
|
||||
obj_props[PROP_SURFACE_HEIGHT] = pspec;
|
||||
g_object_class_install_property (object_class, PROP_SURFACE_HEIGHT, pspec);
|
||||
|
||||
pspec = g_param_spec_boxed ("cogl-texture",
|
||||
P_("Cogl Texture"),
|
||||
P_("The underlying Cogl texture handle used to draw this actor"),
|
||||
COGL_TYPE_HANDLE,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
obj_props[PROP_COGL_TEXTURE] = pspec;
|
||||
g_object_class_install_property (object_class, PROP_COGL_TEXTURE, pspec);
|
||||
|
||||
/**
|
||||
* ClutterWaylandSurface::queue-damage-redraw:
|
||||
* @texture: the object which received the signal
|
||||
* @x: The top left x position of the damage region
|
||||
* @y: The top left y position of the damage region
|
||||
* @width: The width of the damage region
|
||||
* @height: The height of the damage region
|
||||
*
|
||||
* ::queue-damage-redraw is emitted to notify that some sub-region
|
||||
* of the texture has been changed. This usually means a redraw
|
||||
* needs to be queued for the actor.
|
||||
*
|
||||
* The default handler will queue a clipped redraw in response to
|
||||
* the damage, using the assumption that the pixmap is being painted
|
||||
* to a rectangle covering the transformed allocation of the actor.
|
||||
* If you sub-class and change the paint method so this isn't true
|
||||
* then you must also provide your own damage signal handler to
|
||||
* queue a redraw that blocks this default behaviour.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
signals[QUEUE_DAMAGE_REDRAW] =
|
||||
g_signal_new (g_intern_static_string ("queue-damage-redraw"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (ClutterWaylandSurfaceClass, queue_damage_redraw),
|
||||
NULL, NULL,
|
||||
_clutter_marshal_VOID__INT_INT_INT_INT,
|
||||
G_TYPE_NONE, 4,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT);
|
||||
klass->queue_damage_redraw = clutter_wayland_surface_queue_damage_redraw;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_wayland_surface_new:
|
||||
* @surface: the Wayland surface this actor should represent
|
||||
*
|
||||
* Creates a new #ClutterWaylandSurface for @surface
|
||||
*
|
||||
* Return value: A new #ClutterWaylandSurface representing @surface
|
||||
*
|
||||
* Since: 1.8
|
||||
* Stability: unstable
|
||||
*/
|
||||
ClutterActor *
|
||||
clutter_wayland_surface_new (struct wl_surface *surface)
|
||||
{
|
||||
ClutterActor *actor;
|
||||
|
||||
actor = g_object_new (CLUTTER_WAYLAND_TYPE_SURFACE,
|
||||
"surface", surface,
|
||||
NULL);
|
||||
|
||||
return actor;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_wayland_surface_attach_buffer:
|
||||
* @self: A #ClutterWaylandSurface actor
|
||||
* @buffer: A compositor side resource representing a wl_buffer
|
||||
* @error: A #GError
|
||||
*
|
||||
* This associates a client's buffer with the #ClutterWaylandSurface
|
||||
* actor @self. This will automatically result in @self being re-drawn
|
||||
* with the new buffer contents.
|
||||
*
|
||||
* Since: 1.8
|
||||
* Stability: unstable
|
||||
*/
|
||||
gboolean
|
||||
clutter_wayland_surface_attach_buffer (ClutterWaylandSurface *self,
|
||||
struct wl_resource *buffer,
|
||||
GError **error)
|
||||
{
|
||||
ClutterWaylandSurfacePrivate *priv;
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
CoglContext *context = clutter_backend_get_cogl_context (backend);
|
||||
|
||||
g_return_val_if_fail (CLUTTER_WAYLAND_IS_SURFACE (self), TRUE);
|
||||
|
||||
priv = self->priv;
|
||||
|
||||
free_surface_buffers (self);
|
||||
|
||||
priv->buffer =
|
||||
cogl_wayland_texture_2d_new_from_buffer (context, buffer, error);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_COGL_TEXTURE]);
|
||||
|
||||
/* NB: We don't queue a redraw of the actor here because we don't
|
||||
* know how much of the buffer has changed with respect to the
|
||||
* previous buffer. We only ever queue a redraw in response to
|
||||
* surface damage. */
|
||||
|
||||
if (!priv->buffer)
|
||||
return FALSE;
|
||||
|
||||
set_size (self,
|
||||
cogl_texture_get_width (COGL_TEXTURE (priv->buffer)),
|
||||
cogl_texture_get_height (COGL_TEXTURE (priv->buffer)));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_wayland_surface_damage_buffer:
|
||||
* @self: A #ClutterWaylandSurface actor
|
||||
* @buffer: A wayland resource for a buffer
|
||||
* @x: The x coordinate of the damaged rectangle
|
||||
* @y: The y coordinate of the damaged rectangle
|
||||
* @width: The width of the damaged rectangle
|
||||
* @height: The height of the damaged rectangle
|
||||
*
|
||||
* This marks a region of the given @buffer has having been changed by
|
||||
* the client. This will automatically result in the corresponding damaged
|
||||
* region of the actor @self being redrawn.
|
||||
*
|
||||
* If multiple regions are changed then this should be called multiple
|
||||
* times with different damage rectangles.
|
||||
*
|
||||
* Since: 1.8
|
||||
* Stability: unstable
|
||||
*/
|
||||
void
|
||||
clutter_wayland_surface_damage_buffer (ClutterWaylandSurface *self,
|
||||
struct wl_resource *buffer,
|
||||
gint32 x,
|
||||
gint32 y,
|
||||
gint32 width,
|
||||
gint32 height)
|
||||
{
|
||||
ClutterWaylandSurfacePrivate *priv;
|
||||
struct wl_shm_buffer *shm_buffer;
|
||||
|
||||
g_return_if_fail (CLUTTER_WAYLAND_IS_SURFACE (self));
|
||||
|
||||
priv = self->priv;
|
||||
|
||||
shm_buffer = wl_shm_buffer_get (buffer);
|
||||
|
||||
if (priv->buffer && shm_buffer)
|
||||
{
|
||||
CoglPixelFormat format;
|
||||
|
||||
switch (wl_shm_buffer_get_format (shm_buffer))
|
||||
{
|
||||
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
||||
case WL_SHM_FORMAT_ARGB8888:
|
||||
format = COGL_PIXEL_FORMAT_ARGB_8888_PRE;
|
||||
break;
|
||||
case WL_SHM_FORMAT_XRGB8888:
|
||||
format = COGL_PIXEL_FORMAT_ARGB_8888;
|
||||
break;
|
||||
#elif G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
case WL_SHM_FORMAT_ARGB8888:
|
||||
format = COGL_PIXEL_FORMAT_BGRA_8888_PRE;
|
||||
break;
|
||||
case WL_SHM_FORMAT_XRGB8888:
|
||||
format = COGL_PIXEL_FORMAT_BGRA_8888;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
g_warn_if_reached ();
|
||||
format = COGL_PIXEL_FORMAT_ARGB_8888;
|
||||
}
|
||||
|
||||
cogl_texture_set_region (COGL_TEXTURE (priv->buffer),
|
||||
x, y,
|
||||
x, y,
|
||||
width, height,
|
||||
width, height,
|
||||
format,
|
||||
wl_shm_buffer_get_stride (shm_buffer),
|
||||
wl_shm_buffer_get_data (shm_buffer));
|
||||
}
|
||||
|
||||
g_signal_emit (self, signals[QUEUE_DAMAGE_REDRAW],
|
||||
0,
|
||||
x, y, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_wayland_surface_get_cogl_texture:
|
||||
* @self: a #ClutterWaylandSurface
|
||||
*
|
||||
* Retrieves the Cogl texture with the contents of the Wayland surface.
|
||||
*
|
||||
* Return value: (transfer none): a Cogl texture, or %NULL
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
CoglTexture *
|
||||
clutter_wayland_surface_get_cogl_texture (ClutterWaylandSurface *self)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_WAYLAND_IS_SURFACE (self), NULL);
|
||||
|
||||
return COGL_TEXTURE (self->priv->buffer);
|
||||
}
|
@@ -1,117 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2011 Intel Corporation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors:
|
||||
* Robert Bragg <robert@linux.intel.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_WAYLAND_SURFACE_H__
|
||||
#define __CLUTTER_WAYLAND_SURFACE_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include <wayland-server.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_WAYLAND_TYPE_SURFACE (clutter_wayland_surface_get_type ())
|
||||
#define CLUTTER_WAYLAND_SURFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_WAYLAND_TYPE_SURFACE, ClutterWaylandSurface))
|
||||
#define CLUTTER_WAYLAND_SURFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_WAYLAND_TYPE_SURFACE, ClutterWaylandSurfaceClass))
|
||||
#define CLUTTER_WAYLAND_IS_SURFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_WAYLAND_TYPE_SURFACE))
|
||||
#define CLUTTER_WAYLAND_IS_SURFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_WAYLAND_TYPE_SURFACE))
|
||||
#define CLUTTER_WAYLAND_SURFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_WAYLAND_TYPE_SURFACE, ClutterWaylandSurfaceClass))
|
||||
|
||||
typedef struct _ClutterWaylandSurface ClutterWaylandSurface;
|
||||
typedef struct _ClutterWaylandSurfaceClass ClutterWaylandSurfaceClass;
|
||||
typedef struct _ClutterWaylandSurfacePrivate ClutterWaylandSurfacePrivate;
|
||||
|
||||
/**
|
||||
* ClutterWaylandSurface:
|
||||
*
|
||||
* The #ClutterWaylandSurface structure contains only private data
|
||||
*
|
||||
* Since: 1.10
|
||||
* Stability: unstable
|
||||
*/
|
||||
struct _ClutterWaylandSurface
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterActor parent;
|
||||
|
||||
ClutterWaylandSurfacePrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterWaylandSurfaceClass:
|
||||
* @queue_damage_redraw: class handler of the #ClutterWaylandSurface::queue-damage-redraw signal
|
||||
*
|
||||
* The #ClutterWaylandSurfaceClass structure contains only private data
|
||||
*
|
||||
* Since: 1.10
|
||||
* Stability: unstable
|
||||
*/
|
||||
struct _ClutterWaylandSurfaceClass
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterActorClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
void (*queue_damage_redraw) (ClutterWaylandSurface *texture,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
/*< private >*/
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[8];
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_wayland_surface_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterActor *clutter_wayland_surface_new (struct wl_surface *surface);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_wayland_surface_set_surface (ClutterWaylandSurface *self,
|
||||
struct wl_surface *surface);
|
||||
CLUTTER_EXPORT
|
||||
struct wl_surface *clutter_wayland_surface_get_surface (ClutterWaylandSurface *self);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_wayland_surface_attach_buffer (ClutterWaylandSurface *self,
|
||||
struct wl_resource *buffer,
|
||||
GError **error);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_wayland_surface_damage_buffer (ClutterWaylandSurface *self,
|
||||
struct wl_resource *buffer,
|
||||
gint32 x,
|
||||
gint32 y,
|
||||
gint32 width,
|
||||
gint32 height);
|
||||
CLUTTER_EXPORT
|
||||
CoglTexture *clutter_wayland_surface_get_cogl_texture (ClutterWaylandSurface *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
@@ -89,7 +89,6 @@ static const gchar *atom_names[] = {
|
||||
"_NET_WM_PID",
|
||||
"_NET_WM_PING",
|
||||
"_NET_WM_STATE",
|
||||
"_NET_WM_STATE_FULLSCREEN",
|
||||
"_NET_WM_USER_TIME",
|
||||
"WM_PROTOCOLS",
|
||||
"WM_DELETE_WINDOW",
|
||||
@@ -441,14 +440,13 @@ clutter_backend_x11_post_parse (ClutterBackend *backend,
|
||||
backend_x11->atom_NET_WM_PID = atoms[0];
|
||||
backend_x11->atom_NET_WM_PING = atoms[1];
|
||||
backend_x11->atom_NET_WM_STATE = atoms[2];
|
||||
backend_x11->atom_NET_WM_STATE_FULLSCREEN = atoms[3];
|
||||
backend_x11->atom_NET_WM_USER_TIME = atoms[4];
|
||||
backend_x11->atom_WM_PROTOCOLS = atoms[5];
|
||||
backend_x11->atom_WM_DELETE_WINDOW = atoms[6];
|
||||
backend_x11->atom_XEMBED = atoms[7];
|
||||
backend_x11->atom_XEMBED_INFO = atoms[8];
|
||||
backend_x11->atom_NET_WM_NAME = atoms[9];
|
||||
backend_x11->atom_UTF8_STRING = atoms[10];
|
||||
backend_x11->atom_NET_WM_USER_TIME = atoms[3];
|
||||
backend_x11->atom_WM_PROTOCOLS = atoms[4];
|
||||
backend_x11->atom_WM_DELETE_WINDOW = atoms[5];
|
||||
backend_x11->atom_XEMBED = atoms[6];
|
||||
backend_x11->atom_XEMBED_INFO = atoms[7];
|
||||
backend_x11->atom_NET_WM_NAME = atoms[8];
|
||||
backend_x11->atom_UTF8_STRING = atoms[9];
|
||||
|
||||
g_free (clutter_display_name);
|
||||
|
||||
@@ -563,8 +561,7 @@ clutter_backend_x11_dispose (GObject *gobject)
|
||||
static ClutterFeatureFlags
|
||||
clutter_backend_x11_get_features (ClutterBackend *backend)
|
||||
{
|
||||
ClutterFeatureFlags flags = CLUTTER_FEATURE_STAGE_USER_RESIZE
|
||||
| CLUTTER_FEATURE_STAGE_CURSOR;
|
||||
ClutterFeatureFlags flags = CLUTTER_FEATURE_STAGE_CURSOR;
|
||||
|
||||
flags |= CLUTTER_BACKEND_CLASS (clutter_backend_x11_parent_class)->get_features (backend);
|
||||
|
||||
|
@@ -89,7 +89,6 @@ struct _ClutterBackendX11
|
||||
Atom atom_NET_WM_PID;
|
||||
Atom atom_NET_WM_PING;
|
||||
Atom atom_NET_WM_STATE;
|
||||
Atom atom_NET_WM_STATE_FULLSCREEN;
|
||||
Atom atom_NET_WM_USER_TIME;
|
||||
Atom atom_WM_PROTOCOLS;
|
||||
Atom atom_WM_DELETE_WINDOW;
|
||||
|
@@ -87,60 +87,6 @@ G_DEFINE_TYPE_WITH_CODE (ClutterStageX11,
|
||||
ButtonReleaseMask | \
|
||||
PointerMotionMask
|
||||
|
||||
static void
|
||||
send_wmspec_change_state (ClutterBackendX11 *backend_x11,
|
||||
Window window,
|
||||
Atom state,
|
||||
gboolean add)
|
||||
{
|
||||
XClientMessageEvent xclient;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "%s NET_WM state", add ? "adding" : "removing");
|
||||
|
||||
memset (&xclient, 0, sizeof (xclient));
|
||||
|
||||
xclient.type = ClientMessage;
|
||||
xclient.window = window;
|
||||
xclient.message_type = backend_x11->atom_NET_WM_STATE;
|
||||
xclient.format = 32;
|
||||
|
||||
xclient.data.l[0] = add ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
|
||||
xclient.data.l[1] = state;
|
||||
xclient.data.l[2] = 0;
|
||||
xclient.data.l[3] = 0;
|
||||
xclient.data.l[4] = 0;
|
||||
|
||||
XSendEvent (backend_x11->xdpy,
|
||||
DefaultRootWindow (backend_x11->xdpy),
|
||||
False,
|
||||
SubstructureRedirectMask | SubstructureNotifyMask,
|
||||
(XEvent *)&xclient);
|
||||
}
|
||||
|
||||
static void
|
||||
update_state (ClutterStageX11 *stage_x11,
|
||||
ClutterBackendX11 *backend_x11,
|
||||
Atom *state,
|
||||
gboolean add)
|
||||
{
|
||||
if (add)
|
||||
{
|
||||
/* FIXME: This wont work if we support more states */
|
||||
XChangeProperty (backend_x11->xdpy,
|
||||
stage_x11->xwin,
|
||||
backend_x11->atom_NET_WM_STATE, XA_ATOM, 32,
|
||||
PropModeReplace,
|
||||
(unsigned char *) state, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME: This wont work if we support more states */
|
||||
XDeleteProperty (backend_x11->xdpy,
|
||||
stage_x11->xwin,
|
||||
backend_x11->atom_NET_WM_STATE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11,
|
||||
gint new_width,
|
||||
@@ -153,9 +99,6 @@ clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11,
|
||||
{
|
||||
guint min_width, min_height;
|
||||
XSizeHints *size_hints;
|
||||
gboolean resize;
|
||||
|
||||
resize = clutter_stage_get_user_resizable (stage_cogl->wrapper);
|
||||
|
||||
size_hints = XAllocSizeHints();
|
||||
|
||||
@@ -169,27 +112,11 @@ clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11,
|
||||
if (new_height <= 0)
|
||||
new_height = min_height;
|
||||
|
||||
size_hints->flags = 0;
|
||||
|
||||
/* If we are going fullscreen then we don't want any
|
||||
restrictions on the window size */
|
||||
if (!stage_x11->fullscreening)
|
||||
{
|
||||
if (resize)
|
||||
{
|
||||
size_hints->min_width = min_width;
|
||||
size_hints->min_height = min_height;
|
||||
size_hints->flags = PMinSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_hints->min_width = new_width;
|
||||
size_hints->min_height = new_height;
|
||||
size_hints->max_width = new_width;
|
||||
size_hints->max_height = new_height;
|
||||
size_hints->flags = PMinSize | PMaxSize;
|
||||
}
|
||||
}
|
||||
size_hints->min_width = new_width;
|
||||
size_hints->min_height = new_height;
|
||||
size_hints->max_width = new_width;
|
||||
size_hints->max_height = new_height;
|
||||
size_hints->flags = PMinSize | PMaxSize;
|
||||
|
||||
XSetWMNormalHints (backend_x11->xdpy, stage_x11->xwin, size_hints);
|
||||
|
||||
@@ -216,28 +143,8 @@ clutter_stage_x11_get_geometry (ClutterStageWindow *stage_window,
|
||||
cairo_rectangle_int_t *geometry)
|
||||
{
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||
|
||||
geometry->x = geometry->y = 0;
|
||||
|
||||
/* If we're fullscreen, return the size of the display.
|
||||
*
|
||||
* FIXME - this is utterly broken for anything that is not a single
|
||||
* head set up; the window manager will give us the right size in a
|
||||
* ConfigureNotify, but between the fullscreen signal emission on the
|
||||
* stage and the following frame, the size returned by the stage will
|
||||
* be wrong.
|
||||
*/
|
||||
if (_clutter_stage_is_fullscreen (stage_cogl->wrapper) &&
|
||||
stage_x11->fullscreening)
|
||||
{
|
||||
geometry->width = DisplayWidth (backend_x11->xdpy, backend_x11->xscreen_num);
|
||||
geometry->height = DisplayHeight (backend_x11->xdpy, backend_x11->xscreen_num);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
geometry->width = stage_x11->xwin_width;
|
||||
geometry->height = stage_x11->xwin_height;
|
||||
}
|
||||
@@ -263,10 +170,6 @@ clutter_stage_x11_resize (ClutterStageWindow *stage_window,
|
||||
return;
|
||||
}
|
||||
|
||||
/* If we're going fullscreen, don't mess with the size */
|
||||
if (stage_x11->fullscreening)
|
||||
return;
|
||||
|
||||
if (width == 0 || height == 0)
|
||||
{
|
||||
/* Should not happen, if this turns up we need to debug it and
|
||||
@@ -460,117 +363,6 @@ _clutter_stage_x11_update_foreign_event_mask (CoglOnscreen *onscreen,
|
||||
&attrs);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_x11_set_fullscreen (ClutterStageWindow *stage_window,
|
||||
gboolean is_fullscreen)
|
||||
{
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11);
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (stage_cogl->backend);
|
||||
ClutterStage *stage = stage_cogl->wrapper;
|
||||
gboolean was_fullscreen;
|
||||
|
||||
if (stage == NULL || CLUTTER_ACTOR_IN_DESTRUCTION (stage))
|
||||
return;
|
||||
|
||||
was_fullscreen = _clutter_stage_is_fullscreen (stage);
|
||||
is_fullscreen = !!is_fullscreen;
|
||||
|
||||
if (was_fullscreen == is_fullscreen)
|
||||
return;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "%ssetting fullscreen", is_fullscreen ? "" : "un");
|
||||
|
||||
if (is_fullscreen)
|
||||
{
|
||||
#if 0
|
||||
int width, height;
|
||||
|
||||
/* FIXME: this will do the wrong thing for dual-headed
|
||||
displays. This will return the size of the combined display
|
||||
but Metacity (at least) will fullscreen to only one of the
|
||||
displays. This will cause the actor to report the wrong size
|
||||
until the ConfigureNotify for the correct size is received */
|
||||
width = DisplayWidth (backend_x11->xdpy, backend_x11->xscreen_num);
|
||||
height = DisplayHeight (backend_x11->xdpy, backend_x11->xscreen_num);
|
||||
#endif
|
||||
|
||||
/* Set the fullscreen hint so we can retain the old size of the window. */
|
||||
stage_x11->fullscreening = TRUE;
|
||||
|
||||
if (stage_x11->xwin != None)
|
||||
{
|
||||
/* if the actor is not mapped we resize the stage window to match
|
||||
* the size of the screen; this is useful for e.g. EGLX to avoid
|
||||
* a resize when calling clutter_stage_fullscreen() before showing
|
||||
* the stage
|
||||
*/
|
||||
if (!STAGE_X11_IS_MAPPED (stage_x11))
|
||||
{
|
||||
CLUTTER_NOTE (BACKEND, "Fullscreening unmapped stage");
|
||||
|
||||
update_state (stage_x11, backend_x11,
|
||||
&backend_x11->atom_NET_WM_STATE_FULLSCREEN,
|
||||
TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
CLUTTER_NOTE (BACKEND, "Fullscreening mapped stage");
|
||||
|
||||
/* We need to fix the window size so that it will remove
|
||||
the maximum and minimum window hints. Otherwise
|
||||
metacity will honour the restrictions and not
|
||||
fullscreen correctly. */
|
||||
clutter_stage_x11_fix_window_size (stage_x11, -1, -1);
|
||||
|
||||
send_wmspec_change_state (backend_x11, stage_x11->xwin,
|
||||
backend_x11->atom_NET_WM_STATE_FULLSCREEN,
|
||||
TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
stage_x11->fullscreen_on_realize = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
stage_x11->fullscreening = FALSE;
|
||||
|
||||
if (stage_x11->xwin != None)
|
||||
{
|
||||
if (!STAGE_X11_IS_MAPPED (stage_x11))
|
||||
{
|
||||
CLUTTER_NOTE (BACKEND, "Un-fullscreening unmapped stage");
|
||||
|
||||
update_state (stage_x11, backend_x11,
|
||||
&backend_x11->atom_NET_WM_STATE_FULLSCREEN,
|
||||
FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
CLUTTER_NOTE (BACKEND, "Un-fullscreening mapped stage");
|
||||
|
||||
send_wmspec_change_state (backend_x11,
|
||||
stage_x11->xwin,
|
||||
backend_x11->atom_NET_WM_STATE_FULLSCREEN,
|
||||
FALSE);
|
||||
|
||||
/* Fix the window size to restore the minimum/maximum
|
||||
restriction */
|
||||
clutter_stage_x11_fix_window_size (stage_x11,
|
||||
stage_x11->xwin_width,
|
||||
stage_x11->xwin_height);
|
||||
}
|
||||
}
|
||||
else
|
||||
stage_x11->fullscreen_on_realize = FALSE;
|
||||
}
|
||||
|
||||
/* XXX: Note we rely on the ConfigureNotify mechanism as the common
|
||||
* mechanism to handle notifications of new X window sizes from the
|
||||
* X server so we don't actively change the stage viewport here or
|
||||
* queue a relayout etc. */
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_stage_x11_events_device_changed (ClutterStageX11 *stage_x11,
|
||||
ClutterInputDevice *device,
|
||||
@@ -722,13 +514,6 @@ clutter_stage_x11_realize (ClutterStageWindow *stage_window)
|
||||
stage_x11->xwin_height);
|
||||
clutter_stage_x11_set_wm_protocols (stage_x11);
|
||||
|
||||
if (stage_x11->fullscreen_on_realize)
|
||||
{
|
||||
stage_x11->fullscreen_on_realize = FALSE;
|
||||
|
||||
clutter_stage_x11_set_fullscreen (stage_window, TRUE);
|
||||
}
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Successfully realized stage");
|
||||
|
||||
return TRUE;
|
||||
@@ -755,17 +540,6 @@ clutter_stage_x11_set_title (ClutterStageWindow *stage_window,
|
||||
set_wm_title (stage_x11);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_x11_set_user_resizable (ClutterStageWindow *stage_window,
|
||||
gboolean is_resizable)
|
||||
{
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
||||
|
||||
clutter_stage_x11_fix_window_size (stage_x11,
|
||||
stage_x11->xwin_width,
|
||||
stage_x11->xwin_height);
|
||||
}
|
||||
|
||||
static inline void
|
||||
update_wm_hints (ClutterStageX11 *stage_x11)
|
||||
{
|
||||
@@ -840,11 +614,6 @@ clutter_stage_x11_show (ClutterStageWindow *stage_window,
|
||||
set_stage_x11_state (stage_x11, STAGE_X11_WITHDRAWN, 0);
|
||||
|
||||
update_wm_hints (stage_x11);
|
||||
|
||||
if (stage_x11->fullscreening)
|
||||
clutter_stage_x11_set_fullscreen (stage_window, TRUE);
|
||||
else
|
||||
clutter_stage_x11_set_fullscreen (stage_window, FALSE);
|
||||
}
|
||||
|
||||
g_assert (STAGE_X11_IS_MAPPED (stage_x11));
|
||||
@@ -966,7 +735,6 @@ clutter_stage_x11_init (ClutterStageX11 *stage)
|
||||
stage->wm_state = STAGE_X11_WITHDRAWN;
|
||||
|
||||
stage->is_foreign_xwin = FALSE;
|
||||
stage->fullscreening = FALSE;
|
||||
stage->is_cursor_visible = TRUE;
|
||||
stage->accept_focus = TRUE;
|
||||
|
||||
@@ -979,9 +747,7 @@ clutter_stage_window_iface_init (ClutterStageWindowInterface *iface)
|
||||
clutter_stage_window_parent_iface = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->set_title = clutter_stage_x11_set_title;
|
||||
iface->set_fullscreen = clutter_stage_x11_set_fullscreen;
|
||||
iface->set_cursor_visible = clutter_stage_x11_set_cursor_visible;
|
||||
iface->set_user_resizable = clutter_stage_x11_set_user_resizable;
|
||||
iface->set_accept_focus = clutter_stage_x11_set_accept_focus;
|
||||
iface->show = clutter_stage_x11_show;
|
||||
iface->hide = clutter_stage_x11_hide;
|
||||
@@ -1101,13 +867,8 @@ clutter_stage_x11_translate_event (ClutterEventTranslator *translator,
|
||||
xevent->xconfigure.width,
|
||||
xevent->xconfigure.height);
|
||||
|
||||
/* When fullscreen, we'll keep the xwin_width/height
|
||||
variables to track the old size of the window and we'll
|
||||
assume all ConfigureNotifies constitute a size change */
|
||||
if (_clutter_stage_is_fullscreen (stage))
|
||||
size_changed = TRUE;
|
||||
else if ((stage_x11->xwin_width != xevent->xconfigure.width) ||
|
||||
(stage_x11->xwin_height != xevent->xconfigure.height))
|
||||
if ((stage_x11->xwin_width != xevent->xconfigure.width) ||
|
||||
(stage_x11->xwin_height != xevent->xconfigure.height))
|
||||
{
|
||||
size_changed = TRUE;
|
||||
stage_x11->xwin_width = xevent->xconfigure.width;
|
||||
@@ -1197,57 +958,6 @@ clutter_stage_x11_translate_event (ClutterEventTranslator *translator,
|
||||
}
|
||||
break;
|
||||
|
||||
case PropertyNotify:
|
||||
if (xevent->xproperty.atom == backend_x11->atom_NET_WM_STATE &&
|
||||
xevent->xproperty.window == stage_xwindow &&
|
||||
!stage_x11->is_foreign_xwin)
|
||||
{
|
||||
Atom type;
|
||||
gint format;
|
||||
gulong n_items, bytes_after;
|
||||
guchar *data = NULL;
|
||||
gboolean fullscreen_set = FALSE;
|
||||
|
||||
clutter_x11_trap_x_errors ();
|
||||
XGetWindowProperty (backend_x11->xdpy, stage_xwindow,
|
||||
backend_x11->atom_NET_WM_STATE,
|
||||
0, G_MAXLONG,
|
||||
False, XA_ATOM,
|
||||
&type, &format, &n_items,
|
||||
&bytes_after, &data);
|
||||
clutter_x11_untrap_x_errors ();
|
||||
|
||||
if (type != None && data != NULL)
|
||||
{
|
||||
gboolean is_fullscreen = FALSE;
|
||||
Atom *atoms = (Atom *) data;
|
||||
gulong i;
|
||||
|
||||
for (i = 0; i < n_items; i++)
|
||||
{
|
||||
if (atoms[i] == backend_x11->atom_NET_WM_STATE_FULLSCREEN)
|
||||
fullscreen_set = TRUE;
|
||||
}
|
||||
|
||||
is_fullscreen = _clutter_stage_is_fullscreen (stage_cogl->wrapper);
|
||||
|
||||
if (fullscreen_set != is_fullscreen)
|
||||
{
|
||||
if (fullscreen_set)
|
||||
_clutter_stage_update_state (stage_cogl->wrapper,
|
||||
0,
|
||||
CLUTTER_STAGE_STATE_FULLSCREEN);
|
||||
else
|
||||
_clutter_stage_update_state (stage_cogl->wrapper,
|
||||
CLUTTER_STAGE_STATE_FULLSCREEN,
|
||||
0);
|
||||
}
|
||||
|
||||
XFree (data);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case FocusIn:
|
||||
if (!_clutter_stage_is_activated (stage_cogl->wrapper))
|
||||
{
|
||||
|
@@ -70,11 +70,9 @@ struct _ClutterStageX11
|
||||
ClutterStageX11State wm_state;
|
||||
|
||||
guint is_foreign_xwin : 1;
|
||||
guint fullscreening : 1;
|
||||
guint is_cursor_visible : 1;
|
||||
guint viewport_initialized : 1;
|
||||
guint accept_focus : 1;
|
||||
guint fullscreen_on_realize : 1;
|
||||
};
|
||||
|
||||
struct _ClutterStageX11Class
|
||||
|
@@ -209,14 +209,16 @@ make_actor (GType shader_type)
|
||||
}
|
||||
|
||||
static guint32
|
||||
get_pixel (int x, int y)
|
||||
get_pixel (CoglFramebuffer *fb,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
guint8 data[4];
|
||||
|
||||
cogl_read_pixels (x, y, 1, 1,
|
||||
COGL_READ_PIXELS_COLOR_BUFFER,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||
data);
|
||||
cogl_framebuffer_read_pixels (fb,
|
||||
x, y, 1, 1,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||
data);
|
||||
|
||||
return (((guint32) data[0] << 16) |
|
||||
((guint32) data[1] << 8) |
|
||||
@@ -224,19 +226,21 @@ get_pixel (int x, int y)
|
||||
}
|
||||
|
||||
static void
|
||||
paint_cb (ClutterStage *stage,
|
||||
gpointer data)
|
||||
view_painted_cb (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
gpointer data)
|
||||
{
|
||||
CoglFramebuffer *fb = clutter_stage_view_get_framebuffer (view);
|
||||
gboolean *was_painted = data;
|
||||
|
||||
/* old shader effect */
|
||||
g_assert_cmpint (get_pixel (0, 25), ==, 0xff0000);
|
||||
g_assert_cmpint (get_pixel (fb, 0, 25), ==, 0xff0000);
|
||||
/* new shader effect */
|
||||
g_assert_cmpint (get_pixel (100, 25), ==, 0x00ffff);
|
||||
g_assert_cmpint (get_pixel (fb, 100, 25), ==, 0x00ffff);
|
||||
/* another new shader effect */
|
||||
g_assert_cmpint (get_pixel (200, 25), ==, 0xff00ff);
|
||||
g_assert_cmpint (get_pixel (fb, 200, 25), ==, 0xff00ff);
|
||||
/* new shader effect */
|
||||
g_assert_cmpint (get_pixel (300, 25), ==, 0x00ffff);
|
||||
g_assert_cmpint (get_pixel (fb, 300, 25), ==, 0x00ffff);
|
||||
|
||||
*was_painted = TRUE;
|
||||
}
|
||||
@@ -271,9 +275,9 @@ actor_shader_effect (void)
|
||||
clutter_actor_show (stage);
|
||||
|
||||
was_painted = FALSE;
|
||||
g_signal_connect (stage, "after-paint",
|
||||
G_CALLBACK (paint_cb),
|
||||
&was_painted);
|
||||
g_signal_connect_after (stage, "paint-view",
|
||||
G_CALLBACK (view_painted_cb),
|
||||
&was_painted);
|
||||
|
||||
while (!was_painted)
|
||||
g_main_context_iteration (NULL, FALSE);
|
||||
|
@@ -199,7 +199,6 @@ test_actors_main (int argc, char *argv[])
|
||||
g_signal_connect (oh->stage, "destroy", G_CALLBACK (stop_and_quit), oh);
|
||||
|
||||
clutter_stage_set_title (CLUTTER_STAGE (oh->stage), "Actors");
|
||||
clutter_stage_set_user_resizable (CLUTTER_STAGE (oh->stage), TRUE);
|
||||
|
||||
/* Create a timeline to manage animation */
|
||||
oh->timeline = clutter_timeline_new (6000);
|
||||
|
@@ -181,7 +181,6 @@ test_bind_constraint_main (int argc, char *argv[])
|
||||
stage = clutter_stage_new ();
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Constraints");
|
||||
clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
|
||||
clutter_actor_set_size (stage, 800, 600);
|
||||
|
||||
/* main rectangle */
|
||||
|
@@ -91,7 +91,6 @@ test_cairo_clock_main (int argc, char *argv[])
|
||||
/* create a resizable stage */
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "2D Clock");
|
||||
clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
|
||||
clutter_actor_set_background_color (stage, CLUTTER_COLOR_LightSkyBlue);
|
||||
clutter_actor_set_size (stage, 300, 300);
|
||||
clutter_actor_show (stage);
|
||||
|
@@ -13,7 +13,7 @@ G_BEGIN_DECLS
|
||||
|
||||
#define TEST_COGLBOX(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
|
||||
TEST_TYPE_COGLBOX, TestCoglboxClass))
|
||||
TEST_TYPE_COGLBOX, TestCoglbox))
|
||||
|
||||
#define TEST_COGLBOX_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), \
|
||||
@@ -77,7 +77,7 @@ struct _TestCoglboxPrivate
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (TestCoglbox, test_coglbox, CLUTTER_TYPE_ACTOR);
|
||||
|
||||
#define TEST_COGLBOX_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), TEST_TYPE_COGLBOX, TestCoglboxPrivate))
|
||||
(test_coglbox_get_instance_private (TEST_COGLBOX ((obj))))
|
||||
|
||||
/* Coglbox implementation
|
||||
*--------------------------------------------------*/
|
||||
|
@@ -13,7 +13,7 @@ G_BEGIN_DECLS
|
||||
|
||||
#define TEST_COGLBOX(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
|
||||
TEST_TYPE_COGLBOX, TestCoglboxClass))
|
||||
TEST_TYPE_COGLBOX, TestCoglbox))
|
||||
|
||||
#define TEST_COGLBOX_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), \
|
||||
@@ -76,7 +76,7 @@ struct _TestCoglboxPrivate
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (TestCoglbox, test_coglbox, CLUTTER_TYPE_ACTOR);
|
||||
|
||||
#define TEST_COGLBOX_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), TEST_TYPE_COGLBOX, TestCoglboxPrivate))
|
||||
(test_coglbox_get_instance_private (TEST_COGLBOX ((obj))))
|
||||
|
||||
/* Coglbox implementation
|
||||
*--------------------------------------------------*/
|
||||
|
@@ -13,7 +13,7 @@ G_BEGIN_DECLS
|
||||
|
||||
#define TEST_COGLBOX(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
|
||||
TEST_TYPE_COGLBOX, TestCoglboxClass))
|
||||
TEST_TYPE_COGLBOX, TestCoglbox))
|
||||
|
||||
#define TEST_COGLBOX_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), \
|
||||
@@ -78,7 +78,7 @@ struct _TestCoglboxPrivate
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (TestCoglbox, test_coglbox, CLUTTER_TYPE_ACTOR);
|
||||
|
||||
#define TEST_COGLBOX_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), TEST_TYPE_COGLBOX, TestCoglboxPrivate))
|
||||
((TestCoglboxPrivate *)test_coglbox_get_instance_private (TEST_COGLBOX ((obj))))
|
||||
|
||||
/* Coglbox implementation
|
||||
*--------------------------------------------------*/
|
||||
|
@@ -14,7 +14,7 @@ G_BEGIN_DECLS
|
||||
|
||||
#define TEST_COGLBOX(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
|
||||
TEST_TYPE_COGLBOX, TestCoglboxClass))
|
||||
TEST_TYPE_COGLBOX, TestCoglbox))
|
||||
|
||||
#define TEST_COGLBOX_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), \
|
||||
@@ -77,7 +77,7 @@ struct _TestCoglboxPrivate
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (TestCoglbox, test_coglbox, CLUTTER_TYPE_ACTOR);
|
||||
|
||||
#define TEST_COGLBOX_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), TEST_TYPE_COGLBOX, TestCoglboxPrivate))
|
||||
(test_coglbox_get_instance_private (TEST_COGLBOX ((obj))))
|
||||
|
||||
/* Coglbox implementation
|
||||
*--------------------------------------------------*/
|
||||
|
@@ -181,7 +181,6 @@ test_content_main (int argc, char *argv[])
|
||||
stage = clutter_stage_new ();
|
||||
clutter_actor_set_name (stage, "Stage");
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Content");
|
||||
clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
clutter_actor_show (stage);
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include <clutter/clutter.h>
|
||||
#include <string.h>
|
||||
|
||||
gboolean IsFullScreen = FALSE, IsMotion = TRUE;
|
||||
gboolean IsMotion = TRUE;
|
||||
|
||||
int
|
||||
test_events_main (int argc, char *argv[]);
|
||||
@@ -114,28 +114,6 @@ stage_state_cb (ClutterStage *stage,
|
||||
printf("[stage signal] %s\n", detail);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
blue_button_cb (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
ClutterActor *stage;
|
||||
|
||||
stage = clutter_actor_get_stage (actor);
|
||||
|
||||
if (IsFullScreen)
|
||||
IsFullScreen = FALSE;
|
||||
else
|
||||
IsFullScreen = TRUE;
|
||||
|
||||
clutter_stage_set_fullscreen (CLUTTER_STAGE (stage), IsFullScreen);
|
||||
|
||||
g_print ("*** Fullscreen %s ***\n",
|
||||
IsFullScreen ? "enabled" : "disabled");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
red_button_cb (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
@@ -429,10 +407,6 @@ test_events_main (int argc, char *argv[])
|
||||
clutter_actor_set_name (stage, "Stage");
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
g_signal_connect (stage, "event", G_CALLBACK (input_cb), (char *) "stage");
|
||||
g_signal_connect (stage, "fullscreen",
|
||||
G_CALLBACK (stage_state_cb), (char *) "fullscreen");
|
||||
g_signal_connect (stage, "unfullscreen",
|
||||
G_CALLBACK (stage_state_cb), (char *) "unfullscreen");
|
||||
g_signal_connect (stage, "activate",
|
||||
G_CALLBACK (stage_state_cb), (char *) "activate");
|
||||
g_signal_connect (stage, "deactivate",
|
||||
@@ -468,19 +442,6 @@ test_events_main (int argc, char *argv[])
|
||||
focus_box);
|
||||
g_signal_connect (actor, "captured-event", G_CALLBACK (capture_cb), NULL);
|
||||
|
||||
actor = clutter_rectangle_new_with_color (CLUTTER_COLOR_Blue);
|
||||
clutter_actor_set_name (actor, "Blue Box");
|
||||
clutter_actor_set_size (actor, 100, 100);
|
||||
clutter_actor_set_position (actor, 400, 100);
|
||||
clutter_actor_set_reactive (actor, TRUE);
|
||||
clutter_container_add (CLUTTER_CONTAINER(stage), actor, NULL);
|
||||
g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "blue box");
|
||||
g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb),
|
||||
focus_box);
|
||||
/* Fullscreen */
|
||||
g_signal_connect (actor, "button-press-event",
|
||||
G_CALLBACK (blue_button_cb), NULL);
|
||||
|
||||
/* non reactive */
|
||||
actor = clutter_rectangle_new_with_color (CLUTTER_COLOR_Black);
|
||||
clutter_actor_set_name (actor, "Black Box");
|
||||
|
@@ -218,10 +218,6 @@ test_grab_main (int argc, char *argv[])
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
g_signal_connect (stage, "event",
|
||||
G_CALLBACK (debug_event_cb), (char *) "stage");
|
||||
g_signal_connect (stage, "fullscreen",
|
||||
G_CALLBACK (stage_state_cb), (char *) "fullscreen");
|
||||
g_signal_connect (stage, "unfullscreen",
|
||||
G_CALLBACK (stage_state_cb), (char *) "unfullscreen");
|
||||
g_signal_connect (stage, "activate",
|
||||
G_CALLBACK (stage_state_cb), (char *) "activate");
|
||||
g_signal_connect (stage, "deactivate",
|
||||
|
@@ -189,7 +189,6 @@ test_image_main (int argc, char *argv[])
|
||||
stage = clutter_stage_new ();
|
||||
clutter_actor_set_name (stage, "Stage");
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Content");
|
||||
clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
clutter_actor_show (stage);
|
||||
|
||||
|
@@ -73,7 +73,6 @@ test_rotate_zoom_main (int argc, char *argv[])
|
||||
stage = clutter_stage_new ();
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Rotate and Zoom actions");
|
||||
clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
|
||||
clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
|
||||
clutter_actor_set_reactive (stage, FALSE);
|
||||
clutter_actor_show (stage);
|
||||
|
@@ -8,21 +8,6 @@ test_stage_sizing_main (int argc, char *argv[]);
|
||||
const char *
|
||||
test_stage_sizing_describe (void);
|
||||
|
||||
static gboolean
|
||||
fullscreen_clicked_cb (ClutterStage *stage)
|
||||
{
|
||||
clutter_stage_set_fullscreen (stage, !clutter_stage_get_fullscreen (stage));
|
||||
return CLUTTER_EVENT_STOP;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
resize_clicked_cb (ClutterStage *stage)
|
||||
{
|
||||
clutter_stage_set_user_resizable (stage,
|
||||
!clutter_stage_get_user_resizable (stage));
|
||||
return CLUTTER_EVENT_STOP;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
shrink_clicked_cb (ClutterActor *stage)
|
||||
{
|
||||
@@ -41,22 +26,6 @@ expand_clicked_cb (ClutterActor *stage)
|
||||
return CLUTTER_EVENT_STOP;
|
||||
}
|
||||
|
||||
static void
|
||||
on_fullscreen (ClutterStage *stage)
|
||||
{
|
||||
float width, height;
|
||||
gboolean is_fullscreen;
|
||||
|
||||
is_fullscreen = clutter_stage_get_fullscreen (stage);
|
||||
|
||||
clutter_actor_get_size (CLUTTER_ACTOR (stage), &width, &height);
|
||||
|
||||
g_print ("Stage size [%s]: %d x %d\n",
|
||||
is_fullscreen ? "fullscreen" : "not fullscreen",
|
||||
(int) width,
|
||||
(int) height);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT int
|
||||
test_stage_sizing_main (int argc, char *argv[])
|
||||
{
|
||||
@@ -69,40 +38,12 @@ test_stage_sizing_main (int argc, char *argv[])
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Stage Sizing");
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
g_signal_connect_after (stage, "notify::fullscreen-set", G_CALLBACK (on_fullscreen), NULL);
|
||||
|
||||
box = clutter_actor_new ();
|
||||
clutter_actor_set_layout_manager (box, clutter_box_layout_new ());
|
||||
clutter_actor_add_constraint (box, clutter_align_constraint_new (stage, CLUTTER_ALIGN_BOTH, 0.5));
|
||||
clutter_actor_add_child (stage, box);
|
||||
|
||||
rect = clutter_actor_new ();
|
||||
clutter_actor_set_layout_manager (rect,
|
||||
clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
|
||||
CLUTTER_BIN_ALIGNMENT_CENTER));
|
||||
clutter_actor_set_background_color (rect, CLUTTER_COLOR_LightScarletRed);
|
||||
clutter_actor_set_reactive (rect, TRUE);
|
||||
g_signal_connect_swapped (rect, "button-press-event",
|
||||
G_CALLBACK (fullscreen_clicked_cb),
|
||||
stage);
|
||||
label = clutter_text_new_with_text ("Sans 16", "Toggle fullscreen");
|
||||
clutter_actor_set_margin (label, &margin);
|
||||
clutter_actor_add_child (rect, label);
|
||||
clutter_actor_add_child (box, rect);
|
||||
|
||||
rect = clutter_actor_new ();
|
||||
clutter_actor_set_layout_manager (rect,
|
||||
clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
|
||||
CLUTTER_BIN_ALIGNMENT_CENTER));
|
||||
clutter_actor_set_background_color (rect, CLUTTER_COLOR_Chameleon);
|
||||
clutter_actor_set_reactive (rect, TRUE);
|
||||
g_signal_connect_swapped (rect, "button-press-event",
|
||||
G_CALLBACK (resize_clicked_cb), stage);
|
||||
label = clutter_text_new_with_text ("Sans 16", "Toggle resizable");
|
||||
clutter_actor_set_margin (label, &margin);
|
||||
clutter_actor_add_child (rect, label);
|
||||
clutter_actor_add_child (box, rect);
|
||||
|
||||
rect = clutter_actor_new ();
|
||||
clutter_actor_set_layout_manager (rect,
|
||||
clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
|
||||
|
@@ -28,7 +28,6 @@ test_state_script_main (int argc, char *argv[])
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "State Script");
|
||||
clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
clutter_actor_show (stage);
|
||||
|
||||
|
@@ -179,7 +179,6 @@ test_table_layout_main (int argc, char *argv[])
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Table Layout");
|
||||
clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
|
||||
clutter_actor_set_size (stage, 640, 480);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
|
@@ -146,9 +146,7 @@ test_texture_async_main (int argc, char *argv[])
|
||||
task, path,
|
||||
cleanup_task);
|
||||
|
||||
clutter_threads_enter ();
|
||||
clutter_main ();
|
||||
clutter_threads_leave ();
|
||||
|
||||
g_free (path);
|
||||
|
||||
|
@@ -146,7 +146,6 @@ test_touch_events_main (int argc, char *argv[])
|
||||
stage = clutter_stage_new ();
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Touch events");
|
||||
clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
|
||||
clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
|
||||
clutter_actor_set_reactive (stage, TRUE);
|
||||
clutter_actor_show (stage);
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -39,6 +39,13 @@
|
||||
#define PANGO_ENABLE_BACKEND 1
|
||||
#endif
|
||||
|
||||
#ifndef PANGO_UNKNOWN_GLYPH_WIDTH
|
||||
#define PANGO_UNKNOWN_GLYPH_WIDTH 10
|
||||
#endif
|
||||
#ifndef PANGO_UNKNOWN_GLYPH_HEIGHT
|
||||
#define PANGO_UNKNOWN_GLYPH_HEIGHT 14
|
||||
#endif
|
||||
|
||||
#include <pango/pango-fontmap.h>
|
||||
#include <pango/pangocairo.h>
|
||||
#include <pango/pango-renderer.h>
|
||||
@@ -153,7 +160,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 +584,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 +712,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 +766,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 +810,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 +837,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);
|
||||
|
||||
|
@@ -9,7 +9,7 @@ G_BEGIN_DECLS
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
/* enumerations from "@filename@" */
|
||||
/* enumerations from "@basename@" */
|
||||
/*** END file-production ***/
|
||||
|
||||
/*** BEGIN file-tail ***/
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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)
|
||||
|
@@ -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:
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
*/
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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,
|
||||
|
@@ -4,6 +4,7 @@
|
||||
* A Low Level GPU Graphics and Utilities API
|
||||
*
|
||||
* Copyright (C) 2011 Intel Corporation.
|
||||
* Copyright (C) 2019 DisplayLink (UK) Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
@@ -52,7 +53,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 +61,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,13 +151,14 @@ _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 */
|
||||
if ((_cogl_texture_get_format (data->src_tex) & ~COGL_A_BIT) !=
|
||||
(_cogl_texture_get_format (data->dst_tex) & ~COGL_A_BIT) ||
|
||||
!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT))
|
||||
/* We can only blit between FBOs if both textures have the same
|
||||
premult convention and the blit framebuffer extension is
|
||||
supported. */
|
||||
if ((_cogl_texture_get_format (data->src_tex) & COGL_PREMULT_BIT) !=
|
||||
(_cogl_texture_get_format (data->dst_tex) & COGL_PREMULT_BIT) ||
|
||||
!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER))
|
||||
return FALSE;
|
||||
|
||||
dst_offscreen = _cogl_offscreen_new_with_texture_full
|
||||
@@ -165,7 +167,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 +179,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;
|
||||
}
|
||||
|
||||
@@ -205,11 +207,12 @@ _cogl_blit_framebuffer_blit (CoglBlitData *data,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
_cogl_blit_framebuffer (data->src_fb,
|
||||
data->dest_fb,
|
||||
src_x, src_y,
|
||||
dst_x, dst_y,
|
||||
width, height);
|
||||
cogl_blit_framebuffer (data->src_fb,
|
||||
data->dest_fb,
|
||||
src_x, src_y,
|
||||
dst_x, dst_y,
|
||||
width, height,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -224,7 +227,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 +239,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 +295,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 +412,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;
|
||||
|
@@ -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
|
||||
|
@@ -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--;
|
||||
}
|
||||
|
@@ -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:
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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) \
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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:
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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:
|
||||
|
@@ -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 ())
|
||||
|
@@ -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__ */
|
@@ -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);
|
||||
}
|
@@ -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__ */
|
@@ -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;
|
||||
|
@@ -4,6 +4,7 @@
|
||||
* A Low Level GPU Graphics and Utilities API
|
||||
*
|
||||
* Copyright (C) 2007,2008,2009 Intel Corporation.
|
||||
* Copyright (C) 2019 DisplayLink (UK) Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
@@ -363,63 +364,6 @@ void
|
||||
_cogl_push_framebuffers (CoglFramebuffer *draw_buffer,
|
||||
CoglFramebuffer *read_buffer);
|
||||
|
||||
/*
|
||||
* _cogl_blit_framebuffer:
|
||||
* @src: The source #CoglFramebuffer
|
||||
* @dest: The destination #CoglFramebuffer
|
||||
* @src_x: Source x position
|
||||
* @src_y: Source y position
|
||||
* @dst_x: Destination x position
|
||||
* @dst_y: Destination y position
|
||||
* @width: Width of region to copy
|
||||
* @height: Height of region to copy
|
||||
*
|
||||
* This blits a region of the color buffer of the current draw buffer
|
||||
* to the current read buffer. The draw and read buffers can be set up
|
||||
* using _cogl_push_framebuffers(). This function should only be
|
||||
* called if the COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT feature is
|
||||
* advertised. The two buffers must both be offscreen and have the
|
||||
* same format.
|
||||
*
|
||||
* Note that this function differs a lot from the glBlitFramebuffer
|
||||
* function provided by the GL_EXT_framebuffer_blit extension. Notably
|
||||
* it doesn't support having different sizes for the source and
|
||||
* destination rectangle. This isn't supported by the corresponding
|
||||
* GL_ANGLE_framebuffer_blit extension on GLES2.0 and it doesn't seem
|
||||
* like a particularly useful feature. If the application wanted to
|
||||
* scale the results it may make more sense to draw a primitive
|
||||
* instead.
|
||||
*
|
||||
* We can only really support blitting between two offscreen buffers
|
||||
* for this function on GLES2.0. This is because we effectively render
|
||||
* upside down to offscreen buffers to maintain Cogl's representation
|
||||
* of the texture coordinate system where 0,0 is the top left of the
|
||||
* texture. If we were to blit from an offscreen to an onscreen buffer
|
||||
* then we would need to mirror the blit along the x-axis but the GLES
|
||||
* extension does not support this.
|
||||
*
|
||||
* The GL function is documented to be affected by the scissor. This
|
||||
* function therefore ensure that an empty clip stack is flushed
|
||||
* before performing the blit which means the scissor is effectively
|
||||
* ignored.
|
||||
*
|
||||
* The function also doesn't support specifying the buffers to copy
|
||||
* and instead only the color buffer is copied. When copying the depth
|
||||
* or stencil buffers the extension on GLES2.0 only supports copying
|
||||
* the full buffer which would be awkward to document with this
|
||||
* API. If we wanted to support that feature it may be better to have
|
||||
* a separate function to copy the entire buffer for a given mask.
|
||||
*/
|
||||
void
|
||||
_cogl_blit_framebuffer (CoglFramebuffer *src,
|
||||
CoglFramebuffer *dest,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
void
|
||||
_cogl_framebuffer_push_projection (CoglFramebuffer *framebuffer);
|
||||
|
||||
@@ -497,7 +441,7 @@ _cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
|
||||
int y,
|
||||
CoglReadPixelsFlags source,
|
||||
CoglBitmap *bitmap,
|
||||
CoglError **error);
|
||||
GError **error);
|
||||
|
||||
/*
|
||||
* _cogl_framebuffer_get_stencil_bits:
|
||||
|
@@ -4,6 +4,7 @@
|
||||
* A Low Level GPU Graphics and Utilities API
|
||||
*
|
||||
* Copyright (C) 2007,2008,2009,2012 Intel Corporation.
|
||||
* Copyright (C) 2019 DisplayLink (UK) Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
@@ -50,7 +51,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 +445,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 +493,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 +618,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 +650,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 +696,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 +709,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 +732,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 +745,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 +1068,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 +1086,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 +1103,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 +1157,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 +1211,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 +1224,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 +1247,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 +1298,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;
|
||||
}
|
||||
|
||||
@@ -1343,28 +1341,38 @@ cogl_framebuffer_read_pixels (CoglFramebuffer *framebuffer,
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_blit_framebuffer (CoglFramebuffer *src,
|
||||
CoglFramebuffer *dest,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int width,
|
||||
int height)
|
||||
gboolean
|
||||
cogl_blit_framebuffer (CoglFramebuffer *src,
|
||||
CoglFramebuffer *dest,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int width,
|
||||
int height,
|
||||
GError **error)
|
||||
{
|
||||
CoglContext *ctx = src->context;
|
||||
int src_x1, src_y1, src_x2, src_y2;
|
||||
int dst_x1, dst_y1, dst_x2, dst_y2;
|
||||
|
||||
_COGL_RETURN_IF_FAIL (_cogl_has_private_feature
|
||||
(ctx, COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT));
|
||||
if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER))
|
||||
{
|
||||
g_set_error_literal (error, COGL_SYSTEM_ERROR,
|
||||
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
||||
"Cogl BLIT_FRAMEBUFFER is not supported by the system.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* 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));
|
||||
/* The buffers must be the same format */
|
||||
_COGL_RETURN_IF_FAIL (src->internal_format == dest->internal_format);
|
||||
/* The buffers must use the same premult convention */
|
||||
if ((src->internal_format & COGL_PREMULT_BIT) !=
|
||||
(dest->internal_format & COGL_PREMULT_BIT))
|
||||
{
|
||||
g_set_error_literal (error, COGL_SYSTEM_ERROR,
|
||||
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
||||
"cogl_blit_framebuffer premult mismatch.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Make sure the current framebuffers are bound. We explicitly avoid
|
||||
flushing the clip state so we can bind our own empty state */
|
||||
@@ -1385,12 +1393,45 @@ _cogl_blit_framebuffer (CoglFramebuffer *src,
|
||||
* as changed */
|
||||
ctx->current_draw_buffer_changes |= COGL_FRAMEBUFFER_STATE_CLIP;
|
||||
|
||||
ctx->glBlitFramebuffer (src_x, src_y,
|
||||
src_x + width, src_y + height,
|
||||
dst_x, dst_y,
|
||||
dst_x + width, dst_y + height,
|
||||
/* Offscreens we do the normal way, onscreens need an y-flip. Even if
|
||||
* we consider offscreens to be rendered upside-down, the offscreen
|
||||
* orientation is in this function's API. */
|
||||
if (cogl_is_offscreen (src))
|
||||
{
|
||||
src_x1 = src_x;
|
||||
src_y1 = src_y;
|
||||
src_x2 = src_x + width;
|
||||
src_y2 = src_y + height;
|
||||
}
|
||||
else
|
||||
{
|
||||
src_x1 = src_x;
|
||||
src_y1 = cogl_framebuffer_get_height (src) - src_y;
|
||||
src_x2 = src_x + width;
|
||||
src_y2 = src_y1 - height;
|
||||
}
|
||||
|
||||
if (cogl_is_offscreen (dest))
|
||||
{
|
||||
dst_x1 = dst_x;
|
||||
dst_y1 = dst_y;
|
||||
dst_x2 = dst_x + width;
|
||||
dst_y2 = dst_y + height;
|
||||
}
|
||||
else
|
||||
{
|
||||
dst_x1 = dst_x;
|
||||
dst_y1 = cogl_framebuffer_get_height (dest) - dst_y;
|
||||
dst_x2 = dst_x + width;
|
||||
dst_y2 = dst_y1 - height;
|
||||
}
|
||||
|
||||
ctx->glBlitFramebuffer (src_x1, src_y1, src_x2, src_y2,
|
||||
dst_x1, dst_y1, dst_x2, dst_y2,
|
||||
GL_COLOR_BUFFER_BIT,
|
||||
GL_NEAREST);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1399,7 +1440,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);
|
||||
}
|
||||
|
@@ -3,7 +3,8 @@
|
||||
*
|
||||
* A Low Level GPU Graphics and Utilities API
|
||||
*
|
||||
* Copyright (C) 2011 Intel Corporation.
|
||||
* Copyright (C) 2007,2008,2009,2011 Intel Corporation.
|
||||
* Copyright (C) 2019 DisplayLink (UK) Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
@@ -106,7 +107,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 +126,7 @@ GType cogl_framebuffer_get_gtype (void);
|
||||
*/
|
||||
gboolean
|
||||
cogl_framebuffer_allocate (CoglFramebuffer *framebuffer,
|
||||
CoglError **error);
|
||||
GError **error);
|
||||
|
||||
/**
|
||||
* cogl_framebuffer_get_width:
|
||||
@@ -1797,6 +1798,69 @@ typedef enum /*< prefix=COGL_FRAMEBUFFER_ERROR >*/
|
||||
gboolean
|
||||
cogl_is_framebuffer (void *object);
|
||||
|
||||
/**
|
||||
* cogl_blit_framebuffer:
|
||||
* @src: The source #CoglFramebuffer
|
||||
* @dest: The destination #CoglFramebuffer
|
||||
* @src_x: Source x position
|
||||
* @src_y: Source y position
|
||||
* @dst_x: Destination x position
|
||||
* @dst_y: Destination y position
|
||||
* @width: Width of region to copy
|
||||
* @height: Height of region to copy
|
||||
* @error: optional error object
|
||||
*
|
||||
* @return FALSE for an immediately detected error, TRUE otherwise.
|
||||
*
|
||||
* This blits a region of the color buffer of the source buffer
|
||||
* to the destination buffer. This function should only be
|
||||
* called if the COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER feature is
|
||||
* advertised.
|
||||
*
|
||||
* The source and destination rectangles are defined in offscreen
|
||||
* framebuffer orientation. When copying between an offscreen and
|
||||
* onscreen framebuffers, the image is y-flipped accordingly.
|
||||
*
|
||||
* The two buffers must have the same value types (e.g. floating-point,
|
||||
* unsigned int, signed int, or fixed-point), but color formats do not
|
||||
* need to match. This limitation comes from OpenGL ES 3.0 definition
|
||||
* of glBlitFramebuffer.
|
||||
*
|
||||
* Note that this function differs a lot from the glBlitFramebuffer
|
||||
* function provided by the GL_EXT_framebuffer_blit extension. Notably
|
||||
* it doesn't support having different sizes for the source and
|
||||
* destination rectangle. This doesn't seem
|
||||
* like a particularly useful feature. If the application wanted to
|
||||
* scale the results it may make more sense to draw a primitive
|
||||
* instead.
|
||||
*
|
||||
* The GL function is documented to be affected by the scissor. This
|
||||
* function therefore ensure that an empty clip stack is flushed
|
||||
* before performing the blit which means the scissor is effectively
|
||||
* ignored.
|
||||
*
|
||||
* The function also doesn't support specifying the buffers to copy
|
||||
* and instead only the color buffer is copied. When copying the depth
|
||||
* or stencil buffers the extension on GLES2.0 only supports copying
|
||||
* the full buffer which would be awkward to document with this
|
||||
* API. If we wanted to support that feature it may be better to have
|
||||
* a separate function to copy the entire buffer for a given mask.
|
||||
*
|
||||
* The @c error argument is optional, it can be NULL. If it is not NULL
|
||||
* and this function returns FALSE, an error object with a code from
|
||||
* COGL_SYSTEM_ERROR will be created.
|
||||
*/
|
||||
gboolean
|
||||
cogl_blit_framebuffer (CoglFramebuffer *src,
|
||||
CoglFramebuffer *dest,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int width,
|
||||
int height,
|
||||
GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_FRAMEBUFFER_H */
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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:
|
||||
|
@@ -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));
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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,
|
||||
|
@@ -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)
|
||||
|
@@ -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);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user