Compare commits
116 Commits
wip/carlos
...
benzea/use
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ac8066a743 | ||
![]() |
c4fa30ac7d | ||
![]() |
84ea4ad990 | ||
![]() |
64685f4b20 | ||
![]() |
bf594e9fb6 | ||
![]() |
3958e75ed2 | ||
![]() |
802309caf9 | ||
![]() |
468b09c01e | ||
![]() |
c13ea4f48d | ||
![]() |
1e7285b2bb | ||
![]() |
a8cb84c711 | ||
![]() |
9075a5bf1e | ||
![]() |
bd4ebd23f4 | ||
![]() |
31c7bcac29 | ||
![]() |
d3b1168e26 | ||
![]() |
674f52ba74 | ||
![]() |
498264959a | ||
![]() |
e89cea8e5a | ||
![]() |
e32e20521d | ||
![]() |
9d5092cef5 | ||
![]() |
68d0c11d88 | ||
![]() |
fdf830940b | ||
![]() |
10daade1c0 | ||
![]() |
9a3a6dc212 | ||
![]() |
f9599b64d0 | ||
![]() |
a46fd33460 | ||
![]() |
d5a70c7669 | ||
![]() |
573ba108d9 | ||
![]() |
9325bd9d8e | ||
![]() |
420fb28d3f | ||
![]() |
5613f4f7f4 | ||
![]() |
02db9ee577 | ||
![]() |
4aab814c37 | ||
![]() |
a48206e827 | ||
![]() |
99cc435730 | ||
![]() |
67d9995280 | ||
![]() |
82233cce65 | ||
![]() |
2e97ba316d | ||
![]() |
7186d09085 | ||
![]() |
4fccc903b5 | ||
![]() |
06fa131235 | ||
![]() |
132fbf49d7 | ||
![]() |
d02c124e1d | ||
![]() |
554644f9e0 | ||
![]() |
cc444d4991 | ||
![]() |
4bf5b7d78d | ||
![]() |
cb91f44ba4 | ||
![]() |
f7e256e9a1 | ||
![]() |
bbec8abb68 | ||
![]() |
d60d671fec | ||
![]() |
8dc730e5ca | ||
![]() |
0cf98c5641 | ||
![]() |
4bacb3621b | ||
![]() |
aef865afc4 | ||
![]() |
d70ddc65ea | ||
![]() |
832a522cce | ||
![]() |
79491df2b8 | ||
![]() |
9f50b2cef2 | ||
![]() |
96e1883361 | ||
![]() |
0d1c18a4ce | ||
![]() |
40205d8f1b | ||
![]() |
4ede6ea8c5 | ||
![]() |
77b3c0d670 | ||
![]() |
3819291cb7 | ||
![]() |
30964051fe | ||
![]() |
ae4ae61a5f | ||
![]() |
a91138c8f8 | ||
![]() |
27b6d1892f | ||
![]() |
2a8f0c2801 | ||
![]() |
9e2e44c0c2 | ||
![]() |
5e117b3f5a | ||
![]() |
294b4eda4c | ||
![]() |
7faf9f91db | ||
![]() |
4b5abdc988 | ||
![]() |
629dc4c770 | ||
![]() |
3f65837e0d | ||
![]() |
549f60fe49 | ||
![]() |
26147afb08 | ||
![]() |
fd0ce66ac1 | ||
![]() |
c621d4d571 | ||
![]() |
6f30cf0004 | ||
![]() |
8c7ec44681 | ||
![]() |
8329c6b069 | ||
![]() |
f11170fecb | ||
![]() |
48e6fccc95 | ||
![]() |
61026d181b | ||
![]() |
5145b33e01 | ||
![]() |
8ce3b3d99e | ||
![]() |
e696f639ab | ||
![]() |
9c43b12206 | ||
![]() |
78a7c93802 | ||
![]() |
5c68596744 | ||
![]() |
61b1ead1a2 | ||
![]() |
138907c480 | ||
![]() |
66f02ae93d | ||
![]() |
455535128a | ||
![]() |
53431fce2a | ||
![]() |
339372ac99 | ||
![]() |
cb9d6b79ef | ||
![]() |
e8e5ccf82d | ||
![]() |
3f2a6f58eb | ||
![]() |
98c0fe934b | ||
![]() |
49c8d42317 | ||
![]() |
5c986060f0 | ||
![]() |
404e713227 | ||
![]() |
542bad60ba | ||
![]() |
6f4c7d66a4 | ||
![]() |
c843102eec | ||
![]() |
b753213f9b | ||
![]() |
599d8e3287 | ||
![]() |
1c89fce30e | ||
![]() |
0247d35e5a | ||
![]() |
427670cc63 | ||
![]() |
4af4b79123 | ||
![]() |
5582d7b3be | ||
![]() |
4cccba5cac |
@@ -1,8 +1,8 @@
|
||||
# Rebuild and push with
|
||||
#
|
||||
# cd .gitlab-ci/
|
||||
# docker build --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v3 .
|
||||
# docker push registry.gitlab.gnome.org/gnome/mutter/master:v3
|
||||
# podman build --format docker --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v3 .
|
||||
# podman push registry.gitlab.gnome.org/gnome/mutter/master:v3
|
||||
#
|
||||
|
||||
FROM fedora:31
|
||||
|
65
NEWS
65
NEWS
@@ -1,3 +1,68 @@
|
||||
3.35.3
|
||||
======
|
||||
* backends/native: Correct dy value in pinch gesture event [Yariv; !974]
|
||||
* Upload clipping rectangles in parallel [Daniel; !969]
|
||||
* More cogl API cleanups [Adam; !978, !977, !973]
|
||||
* Fix window recording on HiDPI [Pascal; !976]
|
||||
* Fix top-left pixel being insensitive to clicks [Sebastian; #893]
|
||||
* Misc. bug fixes and cleanups [Daniel, Adam; !979, !980]
|
||||
|
||||
Contributors:
|
||||
Yariv Barkan, Adam Jackson, Sebastian Keller, Pascal Nowack, Daniel van Vugt
|
||||
|
||||
Translators:
|
||||
Fran Dieguez [gl], Dz Chen [zh_CN]
|
||||
|
||||
3.35.2
|
||||
======
|
||||
* Don't emit focus event after destruction [Marco; gnome-shell#1704, !860]
|
||||
* Add a notion of pixel format planes [Niels; !858]
|
||||
* Replace various Cogl/Clutter types with Graphene [Georges; !458]
|
||||
* Improve CoglJournal [Georges, Jasper; !402]
|
||||
* Split pick and paint [Georges; !865]
|
||||
* Remove deprecated/unused cogl/clutter APIs [Adam; !866, !878, !879, !880,
|
||||
!885, !900, !902, !904, !896, !913, !922, !883, !903, !921, !933, !819]
|
||||
* Fix hang when opening not-responding dialog on Xorg [Carlos; !876]
|
||||
* Allow changing Clutter debug flags at runtime [Georges; !862]
|
||||
* Fix frozen grabs on Xorg after weeks of inactivity [Jonas; !886]
|
||||
* Fix triggering popups from stylus devices o wayland [Carlos; #886]
|
||||
* Fix fallback to GLES2 [Adam; #635]
|
||||
* Fix buffer age checks on multiple monitors [Carlos; !906]
|
||||
* Adjust to Sysprof API change [Christian; !908]
|
||||
* Improve support for (X11) fullscreen games under wayland [Hans; !739]
|
||||
* Support shadow framebuffers for offscreen rendering [Olivier; !877]
|
||||
* Fix hang after interacting with desktop icons on X11 [Marco; !909]
|
||||
* Don't double scale when getting absolute surface coordinates [Xiang; !915]
|
||||
* Respect NET_WM_TRANSIENT_FOR for override-redirect windows [Marco; !920]
|
||||
* Kill window effects on destroy [Robert; !924]
|
||||
* Remove deprecated ClutterTexture [Jonas; !932]
|
||||
* Use regions instead of bounding box for clipping and culling [Carlos; !867]
|
||||
* Use partial damage for dma-buf and EGLImage buffers on wayland [Robert; #947]
|
||||
* Do not stack transients underneath their always-on-top parent [Florian; #587]
|
||||
* Add explicit paint/pick contexts [Jonas; !935]
|
||||
* Fix KMS freeze after pageflip fallback [Pekka; !953]
|
||||
* Fixed crashes [Robert, Carlos, Jonas, Marco, Hans, Tim; !856, !869, !912,
|
||||
!895, !928, #591, !823, !960]
|
||||
* Plugged memory leaks [Niels, Robert, Carlos, Marco; !847, !868, !873, #908]
|
||||
* Misc. bug fixes and cleanups [Niels, Robert, Jonas, Marco, Carlos, Daniel,
|
||||
Jan, Adam, Cosimo, Florian, Thomas, Georges, Hans, Corentin, Christian,
|
||||
Benjamin; !853, !822, !451, !854, !816, !857, !859, !734, !844, !851, #876,
|
||||
!874, !673, !692, !888, !889, !894, !901, !905, !872, !898, !911, !918, !863,
|
||||
#878, !811, !893, !925, !926, !890, !931, !927, !934, !938, !940, !947, !941,
|
||||
!929, !949, !952, !871, !955, !956, !958, !907, !965, !964, !966]
|
||||
|
||||
Contributors:
|
||||
Marco Trevisan (Treviño), Jan Alexander Steffens (heftig),
|
||||
Thomas Hindoe Paaboel Andersen, Benjamin Berg, Cosimo Cecchi, Tim Crawford,
|
||||
Piotr Drąg, Xiang Fan, Olivier Fourdan, Carlos Garnacho, Hans de Goede,
|
||||
Niels De Graef, Christian Hergert, Adam Jackson, Robert Mader,
|
||||
Florian Müllner, Georges Basile Stavracas Neto, Bastien Nocera, Corentin Noël,
|
||||
Pekka Paalanen, Jasper St. Pierre, Christian Rauch, Daniel van Vugt,
|
||||
Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
Bruce Cowan [en_GB]
|
||||
|
||||
3.35.1
|
||||
======
|
||||
* Fix immediate screen blank after releaseing inhibitor [Tim; #573]
|
||||
|
@@ -315,7 +315,6 @@ void _clutter_actor_queue_relayout_on_clones
|
||||
void _clutter_actor_queue_only_relayout (ClutterActor *actor);
|
||||
void _clutter_actor_queue_update_resource_scale_recursive (ClutterActor *actor);
|
||||
|
||||
CoglFramebuffer * _clutter_actor_get_active_framebuffer (ClutterActor *actor);
|
||||
gboolean _clutter_actor_get_real_resource_scale (ClutterActor *actor,
|
||||
float *resource_scale);
|
||||
|
||||
|
@@ -643,6 +643,7 @@
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-mutter.h"
|
||||
#include "clutter-paint-context-private.h"
|
||||
#include "clutter-paint-nodes.h"
|
||||
#include "clutter-paint-node-private.h"
|
||||
#include "clutter-paint-volume-private.h"
|
||||
@@ -1286,10 +1287,12 @@ clutter_actor_verify_map_state (ClutterActor *self)
|
||||
static gboolean
|
||||
_clutter_actor_transform_local_box_to_stage (ClutterActor *self,
|
||||
ClutterStage *stage,
|
||||
ClutterPickContext *pick_context,
|
||||
const ClutterActorBox *box,
|
||||
graphene_point_t vertices[4])
|
||||
{
|
||||
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
|
||||
CoglFramebuffer *fb =
|
||||
clutter_pick_context_get_framebuffer (pick_context);
|
||||
CoglMatrix stage_transform, inv_stage_transform;
|
||||
CoglMatrix modelview, transform_to_stage;
|
||||
int v;
|
||||
@@ -1330,6 +1333,7 @@ _clutter_actor_transform_local_box_to_stage (ClutterActor *self,
|
||||
/**
|
||||
* clutter_actor_pick_box:
|
||||
* @self: The #ClutterActor being "pick" painted.
|
||||
* @pick_context: The #ClutterPickContext
|
||||
* @box: A rectangle in the actor's own local coordinates.
|
||||
*
|
||||
* Logs (does a virtual paint of) a rectangle for picking. Note that @box is
|
||||
@@ -1340,6 +1344,7 @@ _clutter_actor_transform_local_box_to_stage (ClutterActor *self,
|
||||
*/
|
||||
void
|
||||
clutter_actor_pick_box (ClutterActor *self,
|
||||
ClutterPickContext *pick_context,
|
||||
const ClutterActorBox *box)
|
||||
{
|
||||
ClutterStage *stage;
|
||||
@@ -1353,12 +1358,14 @@ clutter_actor_pick_box (ClutterActor *self,
|
||||
|
||||
stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self));
|
||||
|
||||
if (_clutter_actor_transform_local_box_to_stage (self, stage, box, vertices))
|
||||
if (_clutter_actor_transform_local_box_to_stage (self, stage, pick_context,
|
||||
box, vertices))
|
||||
clutter_stage_log_pick (stage, vertices, self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_clutter_actor_push_pick_clip (ClutterActor *self,
|
||||
ClutterPickContext *pick_context,
|
||||
const ClutterActorBox *clip)
|
||||
{
|
||||
ClutterStage *stage;
|
||||
@@ -1366,7 +1373,8 @@ _clutter_actor_push_pick_clip (ClutterActor *self,
|
||||
|
||||
stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self));
|
||||
|
||||
if (!_clutter_actor_transform_local_box_to_stage (self, stage, clip, vertices))
|
||||
if (!_clutter_actor_transform_local_box_to_stage (self, stage, pick_context,
|
||||
clip, vertices))
|
||||
return FALSE;
|
||||
|
||||
clutter_stage_push_pick_clip (stage, vertices);
|
||||
@@ -2321,7 +2329,8 @@ _clutter_actor_rerealize (ClutterActor *self,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_real_pick (ClutterActor *self)
|
||||
clutter_actor_real_pick (ClutterActor *self,
|
||||
ClutterPickContext *pick_context)
|
||||
{
|
||||
if (clutter_actor_should_pick_paint (self))
|
||||
{
|
||||
@@ -2332,7 +2341,7 @@ clutter_actor_real_pick (ClutterActor *self)
|
||||
.y2 = clutter_actor_get_height (self),
|
||||
};
|
||||
|
||||
clutter_actor_pick_box (self, &box);
|
||||
clutter_actor_pick_box (self, pick_context, &box);
|
||||
}
|
||||
|
||||
/* XXX - this thoroughly sucks, but we need to maintain compatibility
|
||||
@@ -2349,7 +2358,7 @@ clutter_actor_real_pick (ClutterActor *self)
|
||||
for (iter = self->priv->first_child;
|
||||
iter != NULL;
|
||||
iter = iter->priv->next_sibling)
|
||||
clutter_actor_pick (iter);
|
||||
clutter_actor_pick (iter, pick_context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3591,8 +3600,9 @@ in_clone_paint (void)
|
||||
* means there's no point in trying to cull descendants of the current
|
||||
* node. */
|
||||
static gboolean
|
||||
cull_actor (ClutterActor *self,
|
||||
ClutterCullResult *result_out)
|
||||
cull_actor (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context,
|
||||
ClutterCullResult *result_out)
|
||||
{
|
||||
ClutterActorPrivate *priv = self->priv;
|
||||
ClutterStage *stage;
|
||||
@@ -3619,10 +3629,10 @@ cull_actor (ClutterActor *self,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (cogl_get_draw_framebuffer () != _clutter_stage_get_active_framebuffer (stage))
|
||||
if (clutter_paint_context_is_drawing_off_stage (paint_context))
|
||||
{
|
||||
CLUTTER_NOTE (CLIPPING, "Bail from cull_actor without culling (%s): "
|
||||
"Current framebuffer doesn't correspond to stage",
|
||||
"Drawing off stage",
|
||||
_clutter_actor_get_debug_name (self));
|
||||
return FALSE;
|
||||
}
|
||||
@@ -3760,7 +3770,8 @@ add_or_remove_flatten_effect (ClutterActor *self)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_real_paint (ClutterActor *actor)
|
||||
clutter_actor_real_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterActorPrivate *priv = actor->priv;
|
||||
ClutterActor *iter;
|
||||
@@ -3777,21 +3788,19 @@ clutter_actor_real_paint (ClutterActor *actor)
|
||||
iter->priv->allocation.x2 - iter->priv->allocation.x1,
|
||||
iter->priv->allocation.y2 - iter->priv->allocation.y1);
|
||||
|
||||
clutter_actor_paint (iter);
|
||||
clutter_actor_paint (iter, paint_context);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_actor_paint_node (ClutterActor *actor,
|
||||
ClutterPaintNode *root)
|
||||
clutter_actor_paint_node (ClutterActor *actor,
|
||||
ClutterPaintNode *root,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterActorPrivate *priv = actor->priv;
|
||||
ClutterActorBox box;
|
||||
ClutterColor bg_color;
|
||||
|
||||
if (root == NULL)
|
||||
return FALSE;
|
||||
|
||||
box.x1 = 0.f;
|
||||
box.y1 = 0.f;
|
||||
box.x2 = clutter_actor_box_get_width (&priv->allocation);
|
||||
@@ -3805,7 +3814,7 @@ clutter_actor_paint_node (ClutterActor *actor,
|
||||
CoglFramebuffer *fb;
|
||||
CoglBufferBit clear_flags;
|
||||
|
||||
fb = _clutter_stage_get_active_framebuffer (CLUTTER_STAGE (actor));
|
||||
fb = clutter_paint_context_get_base_framebuffer (paint_context);
|
||||
|
||||
if (clutter_stage_get_use_alpha (CLUTTER_STAGE (actor)))
|
||||
{
|
||||
@@ -3847,7 +3856,7 @@ clutter_actor_paint_node (ClutterActor *actor,
|
||||
}
|
||||
|
||||
if (priv->content != NULL)
|
||||
_clutter_content_paint_content (priv->content, actor, root);
|
||||
_clutter_content_paint_content (priv->content, actor, root, paint_context);
|
||||
|
||||
if (CLUTTER_ACTOR_GET_CLASS (actor)->paint_node != NULL)
|
||||
CLUTTER_ACTOR_GET_CLASS (actor)->paint_node (actor, root);
|
||||
@@ -3863,7 +3872,7 @@ clutter_actor_paint_node (ClutterActor *actor,
|
||||
}
|
||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||
|
||||
clutter_paint_node_paint (root);
|
||||
clutter_paint_node_paint (root, paint_context);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -3887,7 +3896,8 @@ clutter_actor_paint_node (ClutterActor *actor,
|
||||
* unless it is performing a pick paint.
|
||||
*/
|
||||
void
|
||||
clutter_actor_paint (ClutterActor *self)
|
||||
clutter_actor_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_autoptr (ClutterPaintNode) actor_node = NULL;
|
||||
g_autoptr (ClutterPaintNode) root_node = NULL;
|
||||
@@ -4052,7 +4062,7 @@ clutter_actor_paint (ClutterActor *self)
|
||||
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS)))
|
||||
_clutter_actor_update_last_paint_volume (self);
|
||||
|
||||
success = cull_actor (self, &result);
|
||||
success = cull_actor (self, paint_context, &result);
|
||||
|
||||
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS))
|
||||
_clutter_actor_paint_cull_result (self, success, result, actor_node);
|
||||
@@ -4069,7 +4079,7 @@ clutter_actor_paint (ClutterActor *self)
|
||||
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES))
|
||||
_clutter_actor_draw_paint_volume (self, actor_node);
|
||||
|
||||
clutter_paint_node_paint (root_node);
|
||||
clutter_paint_node_paint (root_node, paint_context);
|
||||
|
||||
/* If we make it here then the actor has run through a complete
|
||||
paint run including all the effects so it's no longer dirty */
|
||||
@@ -4089,7 +4099,8 @@ clutter_actor_paint (ClutterActor *self)
|
||||
* Since: 1.8
|
||||
*/
|
||||
void
|
||||
clutter_actor_continue_paint (ClutterActor *self)
|
||||
clutter_actor_continue_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterActorPrivate *priv;
|
||||
|
||||
@@ -4109,6 +4120,7 @@ clutter_actor_continue_paint (ClutterActor *self)
|
||||
actual actor */
|
||||
if (priv->next_effect_to_paint == NULL)
|
||||
{
|
||||
CoglFramebuffer *framebuffer;
|
||||
ClutterPaintNode *dummy;
|
||||
|
||||
/* XXX - this will go away in 2.0, when we can get rid of this
|
||||
@@ -4116,21 +4128,22 @@ clutter_actor_continue_paint (ClutterActor *self)
|
||||
* for the entire frame, starting from the Stage; the paint()
|
||||
* virtual function can then be called directly.
|
||||
*/
|
||||
dummy = _clutter_dummy_node_new (self);
|
||||
framebuffer = clutter_paint_context_get_base_framebuffer (paint_context);
|
||||
dummy = _clutter_dummy_node_new (self, framebuffer);
|
||||
clutter_paint_node_set_name (dummy, "Root");
|
||||
|
||||
/* XXX - for 1.12, we use the return value of paint_node() to
|
||||
* decide whether we should emit the ::paint signal.
|
||||
*/
|
||||
clutter_actor_paint_node (self, dummy);
|
||||
clutter_actor_paint_node (self, dummy, paint_context);
|
||||
clutter_paint_node_unref (dummy);
|
||||
|
||||
/* XXX:2.0 - Call the paint() virtual directly */
|
||||
if (g_signal_has_handler_pending (self, actor_signals[PAINT],
|
||||
0, TRUE))
|
||||
g_signal_emit (self, actor_signals[PAINT], 0);
|
||||
g_signal_emit (self, actor_signals[PAINT], 0, paint_context);
|
||||
else
|
||||
CLUTTER_ACTOR_GET_CLASS (self)->paint (self);
|
||||
CLUTTER_ACTOR_GET_CLASS (self)->paint (self, paint_context);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4157,7 +4170,7 @@ clutter_actor_continue_paint (ClutterActor *self)
|
||||
run_flags |= CLUTTER_EFFECT_PAINT_ACTOR_DIRTY;
|
||||
}
|
||||
|
||||
_clutter_effect_paint (priv->current_effect, run_flags);
|
||||
_clutter_effect_paint (priv->current_effect, paint_context, run_flags);
|
||||
|
||||
priv->current_effect = old_current_effect;
|
||||
}
|
||||
@@ -4170,9 +4183,11 @@ clutter_actor_continue_paint (ClutterActor *self)
|
||||
* Asks @actor to perform a pick.
|
||||
*/
|
||||
void
|
||||
clutter_actor_pick (ClutterActor *actor)
|
||||
clutter_actor_pick (ClutterActor *actor,
|
||||
ClutterPickContext *pick_context)
|
||||
{
|
||||
ClutterActorPrivate *priv;
|
||||
CoglFramebuffer *framebuffer;
|
||||
ClutterActorBox clip;
|
||||
gboolean clip_set = FALSE;
|
||||
|
||||
@@ -4192,15 +4207,16 @@ clutter_actor_pick (ClutterActor *actor)
|
||||
/* mark that we are in the paint process */
|
||||
CLUTTER_SET_PRIVATE_FLAGS (actor, CLUTTER_IN_PICK);
|
||||
|
||||
cogl_push_matrix ();
|
||||
framebuffer = clutter_pick_context_get_framebuffer (pick_context);
|
||||
cogl_framebuffer_push_matrix (framebuffer);
|
||||
|
||||
if (priv->enable_model_view_transform)
|
||||
{
|
||||
CoglMatrix matrix;
|
||||
|
||||
cogl_get_modelview_matrix (&matrix);
|
||||
cogl_framebuffer_get_modelview_matrix (framebuffer, &matrix);
|
||||
_clutter_actor_apply_modelview_transform (actor, &matrix);
|
||||
cogl_set_modelview_matrix (&matrix);
|
||||
cogl_framebuffer_set_modelview_matrix (framebuffer, &matrix);
|
||||
}
|
||||
|
||||
if (priv->has_clip)
|
||||
@@ -4221,7 +4237,7 @@ clutter_actor_pick (ClutterActor *actor)
|
||||
}
|
||||
|
||||
if (clip_set)
|
||||
clip_set = _clutter_actor_push_pick_clip (actor, &clip);
|
||||
clip_set = _clutter_actor_push_pick_clip (actor, pick_context, &clip);
|
||||
|
||||
priv->next_effect_to_paint = NULL;
|
||||
if (priv->effects)
|
||||
@@ -4230,12 +4246,12 @@ clutter_actor_pick (ClutterActor *actor)
|
||||
_clutter_meta_group_peek_metas (priv->effects);
|
||||
}
|
||||
|
||||
clutter_actor_continue_pick (actor);
|
||||
clutter_actor_continue_pick (actor, pick_context);
|
||||
|
||||
if (clip_set)
|
||||
_clutter_actor_pop_pick_clip (actor);
|
||||
|
||||
cogl_pop_matrix ();
|
||||
cogl_framebuffer_pop_matrix (framebuffer);
|
||||
|
||||
/* paint sequence complete */
|
||||
CLUTTER_UNSET_PRIVATE_FLAGS (actor, CLUTTER_IN_PICK);
|
||||
@@ -4252,7 +4268,8 @@ clutter_actor_pick (ClutterActor *actor)
|
||||
* is the last effect in the chain.
|
||||
*/
|
||||
void
|
||||
clutter_actor_continue_pick (ClutterActor *actor)
|
||||
clutter_actor_continue_pick (ClutterActor *actor,
|
||||
ClutterPickContext *pick_context)
|
||||
{
|
||||
ClutterActorPrivate *priv;
|
||||
|
||||
@@ -4278,9 +4295,9 @@ clutter_actor_continue_pick (ClutterActor *actor)
|
||||
*/
|
||||
if (g_signal_has_handler_pending (actor, actor_signals[PICK],
|
||||
0, TRUE))
|
||||
g_signal_emit (actor, actor_signals[PICK], 0);
|
||||
g_signal_emit (actor, actor_signals[PICK], 0, pick_context);
|
||||
else
|
||||
CLUTTER_ACTOR_GET_CLASS (actor)->pick (actor);
|
||||
CLUTTER_ACTOR_GET_CLASS (actor)->pick (actor, pick_context);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4294,7 +4311,7 @@ clutter_actor_continue_pick (ClutterActor *actor)
|
||||
priv->current_effect = priv->next_effect_to_paint->data;
|
||||
priv->next_effect_to_paint = priv->next_effect_to_paint->next;
|
||||
|
||||
_clutter_effect_pick (priv->current_effect);
|
||||
_clutter_effect_pick (priv->current_effect, pick_context);
|
||||
|
||||
priv->current_effect = old_current_effect;
|
||||
}
|
||||
@@ -8534,6 +8551,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
||||
/**
|
||||
* ClutterActor::paint:
|
||||
* @actor: the #ClutterActor that received the signal
|
||||
* @paint_context: a #ClutterPaintContext
|
||||
*
|
||||
* The ::paint signal is emitted each time an actor is being painted.
|
||||
*
|
||||
@@ -8561,7 +8579,8 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
||||
G_SIGNAL_DEPRECATED,
|
||||
G_STRUCT_OFFSET (ClutterActorClass, paint),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_PAINT_CONTEXT);
|
||||
/**
|
||||
* ClutterActor::realize:
|
||||
* @actor: the #ClutterActor that received the signal
|
||||
@@ -8604,6 +8623,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
||||
/**
|
||||
* ClutterActor::pick:
|
||||
* @actor: the #ClutterActor that received the signal
|
||||
* @pick_context: a #ClutterPickContext
|
||||
*
|
||||
* The ::pick signal is emitted each time an actor is being painted
|
||||
* in "pick mode". The pick mode is used to identify the actor during
|
||||
@@ -8625,7 +8645,8 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED,
|
||||
G_STRUCT_OFFSET (ClutterActorClass, pick),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_PICK_CONTEXT);
|
||||
|
||||
/**
|
||||
* ClutterActor::allocation-changed:
|
||||
@@ -15660,7 +15681,7 @@ update_pango_context (ClutterBackend *backend,
|
||||
* stored by the #ClutterBackend change.
|
||||
*
|
||||
* You can use the returned #PangoContext to create a #PangoLayout
|
||||
* and render text using cogl_pango_render_layout() to reuse the
|
||||
* and render text using cogl_pango_show_layout() to reuse the
|
||||
* glyphs cache also used by Clutter.
|
||||
*
|
||||
* Return value: (transfer none): the #PangoContext for a #ClutterActor.
|
||||
@@ -20793,32 +20814,6 @@ clutter_actor_has_mapped_clones (ClutterActor *self)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CoglFramebuffer *
|
||||
_clutter_actor_get_active_framebuffer (ClutterActor *self)
|
||||
{
|
||||
ClutterStage *stage;
|
||||
|
||||
if (!CLUTTER_ACTOR_IN_PAINT (self))
|
||||
{
|
||||
g_critical ("The active framebuffer of actor '%s' can only be "
|
||||
"retrieved during the paint sequence. Please, check "
|
||||
"your code.",
|
||||
_clutter_actor_get_debug_name (self));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
stage = (ClutterStage *) _clutter_actor_get_stage_internal (self);
|
||||
if (stage == NULL)
|
||||
{
|
||||
g_critical ("The active framebuffer of actor '%s' is only available "
|
||||
"if the actor is associated to a ClutterStage.",
|
||||
_clutter_actor_get_debug_name (self));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return _clutter_stage_get_active_framebuffer (stage);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_child_model__items_changed (GListModel *model,
|
||||
guint position,
|
||||
|
@@ -39,6 +39,8 @@
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
#include <clutter/clutter-event.h>
|
||||
#include <clutter/clutter-paint-context.h>
|
||||
#include <clutter/clutter-pick-context.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -228,12 +230,14 @@ struct _ClutterActorClass
|
||||
void (* unrealize) (ClutterActor *self);
|
||||
void (* map) (ClutterActor *self);
|
||||
void (* unmap) (ClutterActor *self);
|
||||
void (* paint) (ClutterActor *self);
|
||||
void (* paint) (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context);
|
||||
void (* parent_set) (ClutterActor *actor,
|
||||
ClutterActor *old_parent);
|
||||
|
||||
void (* destroy) (ClutterActor *self);
|
||||
void (* pick) (ClutterActor *actor);
|
||||
void (* pick) (ClutterActor *actor,
|
||||
ClutterPickContext *pick_context);
|
||||
|
||||
gboolean (* queue_redraw) (ClutterActor *actor,
|
||||
ClutterActor *leaf_that_queued,
|
||||
@@ -349,13 +353,17 @@ void clutter_actor_map
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_unmap (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_paint (ClutterActor *self);
|
||||
void clutter_actor_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_continue_paint (ClutterActor *self);
|
||||
void clutter_actor_continue_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_pick (ClutterActor *actor);
|
||||
void clutter_actor_pick (ClutterActor *actor,
|
||||
ClutterPickContext *pick_context);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_continue_pick (ClutterActor *actor);
|
||||
void clutter_actor_continue_pick (ClutterActor *actor,
|
||||
ClutterPickContext *pick_context);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_queue_redraw (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
@@ -907,6 +915,7 @@ void clutter_actor_bind_model_with_properties
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_pick_box (ClutterActor *self,
|
||||
ClutterPickContext *pick_context,
|
||||
const ClutterActorBox *box);
|
||||
|
||||
G_END_DECLS
|
||||
|
@@ -90,6 +90,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorBox, clutter_actor_box_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColor, clutter_color_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMargin, clutter_margin_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMatrix, clutter_matrix_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintContext, clutter_paint_context_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintNode, clutter_paint_node_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintVolume, clutter_paint_volume_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPathNode, clutter_path_node_free)
|
||||
|
@@ -141,9 +141,6 @@ gint32 _clutter_backend_get_units_serial (Clutter
|
||||
|
||||
PangoDirection _clutter_backend_get_keymap_direction (ClutterBackend *backend);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend);
|
||||
|
||||
void clutter_set_allowed_drivers (const char *drivers);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
|
@@ -1009,27 +1009,6 @@ _clutter_backend_get_keymap_direction (ClutterBackend *backend)
|
||||
return PANGO_DIRECTION_NEUTRAL;
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend)
|
||||
{
|
||||
if (backend->dummy_onscreen == NULL)
|
||||
{
|
||||
GError *internal_error = NULL;
|
||||
|
||||
backend->dummy_onscreen = cogl_onscreen_new (backend->cogl_context, 1, 1);
|
||||
|
||||
if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (backend->dummy_onscreen),
|
||||
&internal_error))
|
||||
{
|
||||
g_critical ("Unable to create dummy onscreen: %s", internal_error->message);
|
||||
g_error_free (internal_error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
cogl_set_framebuffer (COGL_FRAMEBUFFER (backend->dummy_onscreen));
|
||||
}
|
||||
|
||||
void
|
||||
clutter_set_allowed_drivers (const char *drivers)
|
||||
{
|
||||
|
@@ -99,7 +99,8 @@ G_DEFINE_TYPE (ClutterBlurEffect,
|
||||
CLUTTER_TYPE_OFFSCREEN_EFFECT);
|
||||
|
||||
static gboolean
|
||||
clutter_blur_effect_pre_paint (ClutterEffect *effect)
|
||||
clutter_blur_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (effect);
|
||||
ClutterEffectClass *parent_class;
|
||||
@@ -124,7 +125,7 @@ clutter_blur_effect_pre_paint (ClutterEffect *effect)
|
||||
}
|
||||
|
||||
parent_class = CLUTTER_EFFECT_CLASS (clutter_blur_effect_parent_class);
|
||||
if (parent_class->pre_paint (effect))
|
||||
if (parent_class->pre_paint (effect, paint_context))
|
||||
{
|
||||
ClutterOffscreenEffect *offscreen_effect =
|
||||
CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
@@ -157,10 +158,12 @@ clutter_blur_effect_pre_paint (ClutterEffect *effect)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_blur_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
clutter_blur_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (effect);
|
||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
guint8 paint_opacity;
|
||||
|
||||
paint_opacity = clutter_actor_get_paint_opacity (self->actor);
|
||||
|
@@ -121,16 +121,17 @@ G_DEFINE_TYPE (ClutterBrightnessContrastEffect,
|
||||
static gboolean
|
||||
will_have_no_effect (ClutterBrightnessContrastEffect *self)
|
||||
{
|
||||
return (self->brightness_red == no_change &&
|
||||
self->brightness_green == no_change &&
|
||||
self->brightness_blue == no_change &&
|
||||
self->contrast_red == no_change &&
|
||||
self->contrast_green == no_change &&
|
||||
self->contrast_blue == no_change);
|
||||
return (G_APPROX_VALUE (self->brightness_red, no_change, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (self->brightness_green, no_change, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (self->brightness_blue, no_change, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (self->contrast_red, no_change, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (self->contrast_green, no_change, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (self->contrast_blue, no_change, FLT_EPSILON));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect)
|
||||
clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
|
||||
ClutterEffectClass *parent_class;
|
||||
@@ -156,7 +157,7 @@ clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect)
|
||||
|
||||
parent_class =
|
||||
CLUTTER_EFFECT_CLASS (clutter_brightness_contrast_effect_parent_class);
|
||||
if (parent_class->pre_paint (effect))
|
||||
if (parent_class->pre_paint (effect, paint_context))
|
||||
{
|
||||
ClutterOffscreenEffect *offscreen_effect =
|
||||
CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
@@ -175,10 +176,12 @@ clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_brightness_contrast_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
clutter_brightness_contrast_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
|
||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
ClutterActor *actor;
|
||||
guint8 paint_opacity;
|
||||
|
||||
@@ -494,9 +497,9 @@ clutter_brightness_contrast_effect_set_brightness_full (ClutterBrightnessContras
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect));
|
||||
|
||||
if (red == effect->brightness_red &&
|
||||
green == effect->brightness_green &&
|
||||
blue == effect->brightness_blue)
|
||||
if (G_APPROX_VALUE (red, effect->brightness_red, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (green, effect->brightness_green, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (blue, effect->brightness_blue, FLT_EPSILON))
|
||||
return;
|
||||
|
||||
effect->brightness_red = red;
|
||||
@@ -584,9 +587,9 @@ clutter_brightness_contrast_effect_set_contrast_full (ClutterBrightnessContrastE
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect));
|
||||
|
||||
if (red == effect->contrast_red &&
|
||||
green == effect->contrast_green &&
|
||||
blue == effect->contrast_blue)
|
||||
if (G_APPROX_VALUE (red, effect->contrast_red, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (green, effect->contrast_green, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (blue, effect->contrast_blue, FLT_EPSILON))
|
||||
return;
|
||||
|
||||
effect->contrast_red = red;
|
||||
|
@@ -328,9 +328,10 @@ clutter_canvas_init (ClutterCanvas *self)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_canvas_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *root)
|
||||
clutter_canvas_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *root,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterCanvas *self = CLUTTER_CANVAS (content);
|
||||
ClutterCanvasPrivate *priv = self->priv;
|
||||
|
@@ -152,7 +152,8 @@ clutter_clone_apply_transform (ClutterActor *self, CoglMatrix *matrix)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_clone_paint (ClutterActor *actor)
|
||||
clutter_clone_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterClone *self = CLUTTER_CLONE (actor);
|
||||
ClutterClonePrivate *priv = self->priv;
|
||||
@@ -189,7 +190,7 @@ clutter_clone_paint (ClutterActor *actor)
|
||||
if (clutter_actor_is_realized (priv->clone_source))
|
||||
{
|
||||
_clutter_actor_push_clone_paint ();
|
||||
clutter_actor_paint (priv->clone_source);
|
||||
clutter_actor_paint (priv->clone_source, paint_context);
|
||||
_clutter_actor_pop_clone_paint ();
|
||||
}
|
||||
|
||||
|
@@ -105,7 +105,8 @@ G_DEFINE_TYPE (ClutterColorizeEffect,
|
||||
CLUTTER_TYPE_OFFSCREEN_EFFECT);
|
||||
|
||||
static gboolean
|
||||
clutter_colorize_effect_pre_paint (ClutterEffect *effect)
|
||||
clutter_colorize_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterColorizeEffect *self = CLUTTER_COLORIZE_EFFECT (effect);
|
||||
ClutterEffectClass *parent_class;
|
||||
@@ -126,7 +127,7 @@ clutter_colorize_effect_pre_paint (ClutterEffect *effect)
|
||||
}
|
||||
|
||||
parent_class = CLUTTER_EFFECT_CLASS (clutter_colorize_effect_parent_class);
|
||||
if (parent_class->pre_paint (effect))
|
||||
if (parent_class->pre_paint (effect, paint_context))
|
||||
{
|
||||
ClutterOffscreenEffect *offscreen_effect =
|
||||
CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
@@ -145,10 +146,12 @@ clutter_colorize_effect_pre_paint (ClutterEffect *effect)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_colorize_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
clutter_colorize_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterColorizeEffect *self = CLUTTER_COLORIZE_EFFECT (effect);
|
||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
ClutterActor *actor;
|
||||
guint8 paint_opacity;
|
||||
|
||||
|
@@ -34,9 +34,10 @@ void _clutter_content_attached (ClutterContent *conte
|
||||
void _clutter_content_detached (ClutterContent *content,
|
||||
ClutterActor *actor);
|
||||
|
||||
void _clutter_content_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *node);
|
||||
void _clutter_content_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -96,9 +96,10 @@ clutter_content_real_invalidate_size (ClutterContent *content)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_content_real_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *context)
|
||||
clutter_content_real_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *context,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -300,7 +301,8 @@ _clutter_content_detached (ClutterContent *content,
|
||||
* _clutter_content_paint_content:
|
||||
* @content: a #ClutterContent
|
||||
* @actor: a #ClutterActor
|
||||
* @context: a #ClutterPaintNode
|
||||
* @node: a #ClutterPaintNode
|
||||
* @paint_context: a #ClutterPaintContext
|
||||
*
|
||||
* Creates the render tree for the @content and @actor.
|
||||
*
|
||||
@@ -308,11 +310,13 @@ _clutter_content_detached (ClutterContent *content,
|
||||
* virtual function.
|
||||
*/
|
||||
void
|
||||
_clutter_content_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *node)
|
||||
_clutter_content_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
CLUTTER_CONTENT_GET_IFACE (content)->paint_content (content, actor, node);
|
||||
CLUTTER_CONTENT_GET_IFACE (content)->paint_content (content, actor, node,
|
||||
paint_context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -65,9 +65,10 @@ struct _ClutterContentInterface
|
||||
gboolean (* get_preferred_size) (ClutterContent *content,
|
||||
gfloat *width,
|
||||
gfloat *height);
|
||||
void (* paint_content) (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *node);
|
||||
void (* paint_content) (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
|
||||
void (* attached) (ClutterContent *content,
|
||||
ClutterActor *actor);
|
||||
|
@@ -166,14 +166,16 @@ clutter_deform_effect_set_actor (ClutterActorMeta *meta,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterDeformEffect *self= CLUTTER_DEFORM_EFFECT (effect);
|
||||
ClutterDeformEffectPrivate *priv = self->priv;
|
||||
CoglHandle material;
|
||||
CoglPipeline *pipeline;
|
||||
CoglDepthState depth_state;
|
||||
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
|
||||
CoglFramebuffer *fb =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
|
||||
if (priv->is_dirty)
|
||||
{
|
||||
|
@@ -112,7 +112,8 @@ G_DEFINE_TYPE (ClutterDesaturateEffect,
|
||||
CLUTTER_TYPE_OFFSCREEN_EFFECT);
|
||||
|
||||
static gboolean
|
||||
clutter_desaturate_effect_pre_paint (ClutterEffect *effect)
|
||||
clutter_desaturate_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterDesaturateEffect *self = CLUTTER_DESATURATE_EFFECT (effect);
|
||||
ClutterEffectClass *parent_class;
|
||||
@@ -133,7 +134,7 @@ clutter_desaturate_effect_pre_paint (ClutterEffect *effect)
|
||||
}
|
||||
|
||||
parent_class = CLUTTER_EFFECT_CLASS (clutter_desaturate_effect_parent_class);
|
||||
if (parent_class->pre_paint (effect))
|
||||
if (parent_class->pre_paint (effect, paint_context))
|
||||
{
|
||||
ClutterOffscreenEffect *offscreen_effect =
|
||||
CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
@@ -152,10 +153,12 @@ clutter_desaturate_effect_pre_paint (ClutterEffect *effect)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_desaturate_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
clutter_desaturate_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterDesaturateEffect *self = CLUTTER_DESATURATE_EFFECT (effect);
|
||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
ClutterActor *actor;
|
||||
CoglHandle texture;
|
||||
guint8 paint_opacity;
|
||||
|
@@ -5,14 +5,18 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
gboolean _clutter_effect_pre_paint (ClutterEffect *effect);
|
||||
void _clutter_effect_post_paint (ClutterEffect *effect);
|
||||
gboolean _clutter_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context);
|
||||
void _clutter_effect_post_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context);
|
||||
gboolean _clutter_effect_modify_paint_volume (ClutterEffect *effect,
|
||||
ClutterPaintVolume *volume);
|
||||
gboolean _clutter_effect_has_custom_paint_volume (ClutterEffect *effect);
|
||||
void _clutter_effect_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context,
|
||||
ClutterEffectPaintFlags flags);
|
||||
void _clutter_effect_pick (ClutterEffect *effect);
|
||||
void _clutter_effect_pick (ClutterEffect *effect,
|
||||
ClutterPickContext *pick_context);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -177,13 +177,15 @@ G_DEFINE_ABSTRACT_TYPE (ClutterEffect,
|
||||
CLUTTER_TYPE_ACTOR_META);
|
||||
|
||||
static gboolean
|
||||
clutter_effect_real_pre_paint (ClutterEffect *effect)
|
||||
clutter_effect_real_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_effect_real_post_paint (ClutterEffect *effect)
|
||||
clutter_effect_real_post_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -196,6 +198,7 @@ clutter_effect_real_modify_paint_volume (ClutterEffect *effect,
|
||||
|
||||
static void
|
||||
clutter_effect_real_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context,
|
||||
ClutterEffectPaintFlags flags)
|
||||
{
|
||||
ClutterActorMeta *actor_meta = CLUTTER_ACTOR_META (effect);
|
||||
@@ -206,23 +209,24 @@ clutter_effect_real_paint (ClutterEffect *effect,
|
||||
effects that haven't migrated to use the 'paint' virtual yet. This
|
||||
just calls the old pre and post virtuals before chaining on */
|
||||
|
||||
pre_paint_succeeded = _clutter_effect_pre_paint (effect);
|
||||
pre_paint_succeeded = _clutter_effect_pre_paint (effect, paint_context);
|
||||
|
||||
actor = clutter_actor_meta_get_actor (actor_meta);
|
||||
clutter_actor_continue_paint (actor);
|
||||
clutter_actor_continue_paint (actor, paint_context);
|
||||
|
||||
if (pre_paint_succeeded)
|
||||
_clutter_effect_post_paint (effect);
|
||||
_clutter_effect_post_paint (effect, paint_context);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_effect_real_pick (ClutterEffect *effect)
|
||||
clutter_effect_real_pick (ClutterEffect *effect,
|
||||
ClutterPickContext *pick_context)
|
||||
{
|
||||
ClutterActorMeta *actor_meta = CLUTTER_ACTOR_META (effect);
|
||||
ClutterActor *actor;
|
||||
|
||||
actor = clutter_actor_meta_get_actor (actor_meta);
|
||||
clutter_actor_continue_pick (actor);
|
||||
clutter_actor_continue_pick (actor, pick_context);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -262,36 +266,40 @@ clutter_effect_init (ClutterEffect *self)
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_effect_pre_paint (ClutterEffect *effect)
|
||||
_clutter_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_EFFECT (effect), FALSE);
|
||||
|
||||
return CLUTTER_EFFECT_GET_CLASS (effect)->pre_paint (effect);
|
||||
return CLUTTER_EFFECT_GET_CLASS (effect)->pre_paint (effect, paint_context);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_effect_post_paint (ClutterEffect *effect)
|
||||
_clutter_effect_post_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_EFFECT (effect));
|
||||
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->post_paint (effect);
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->post_paint (effect, paint_context);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_effect_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context,
|
||||
ClutterEffectPaintFlags flags)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_EFFECT (effect));
|
||||
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->paint (effect, flags);
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->paint (effect, paint_context, flags);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_effect_pick (ClutterEffect *effect)
|
||||
_clutter_effect_pick (ClutterEffect *effect,
|
||||
ClutterPickContext *pick_context)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_EFFECT (effect));
|
||||
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->pick (effect);
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->pick (effect, pick_context);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@@ -30,6 +30,8 @@
|
||||
#endif
|
||||
|
||||
#include <clutter/clutter-actor-meta.h>
|
||||
#include <clutter/clutter-paint-context.h>
|
||||
#include <clutter/clutter-pick-context.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -74,15 +76,19 @@ struct _ClutterEffectClass
|
||||
ClutterActorMetaClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
gboolean (* pre_paint) (ClutterEffect *effect);
|
||||
void (* post_paint) (ClutterEffect *effect);
|
||||
gboolean (* pre_paint) (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context);
|
||||
void (* post_paint) (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context);
|
||||
|
||||
gboolean (* modify_paint_volume) (ClutterEffect *effect,
|
||||
ClutterPaintVolume *volume);
|
||||
|
||||
void (* paint) (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context,
|
||||
ClutterEffectPaintFlags flags);
|
||||
void (* pick) (ClutterEffect *effect);
|
||||
void (* pick) (ClutterEffect *effect,
|
||||
ClutterPickContext *pick_context);
|
||||
|
||||
/*< private >*/
|
||||
void (* _clutter_effect4) (void);
|
||||
|
@@ -118,9 +118,10 @@ clutter_image_init (ClutterImage *self)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_image_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *root)
|
||||
clutter_image_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *root,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterImagePrivate *priv = CLUTTER_IMAGE (content)->priv;
|
||||
ClutterPaintNode *node;
|
||||
|
@@ -74,6 +74,7 @@
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-stage-private.h"
|
||||
#include "clutter-paint-context-private.h"
|
||||
#include "clutter-paint-volume-private.h"
|
||||
#include "clutter-actor-box-private.h"
|
||||
|
||||
@@ -117,11 +118,7 @@ clutter_offscreen_effect_set_actor (ClutterActorMeta *meta,
|
||||
meta_class->set_actor (meta, actor);
|
||||
|
||||
/* clear out the previous state */
|
||||
if (priv->offscreen != NULL)
|
||||
{
|
||||
cogl_object_unref (priv->offscreen);
|
||||
priv->offscreen = NULL;
|
||||
}
|
||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||
|
||||
/* we keep a back pointer here, to avoid going through the ActorMeta */
|
||||
priv->actor = clutter_actor_meta_get_actor (meta);
|
||||
@@ -197,17 +194,8 @@ update_fbo (ClutterEffect *effect,
|
||||
ensure_pipeline_filter_for_scale (self, resource_scale);
|
||||
}
|
||||
|
||||
if (priv->texture != NULL)
|
||||
{
|
||||
cogl_object_unref (priv->texture);
|
||||
priv->texture = NULL;
|
||||
}
|
||||
|
||||
if (priv->offscreen != NULL)
|
||||
{
|
||||
cogl_object_unref (priv->offscreen);
|
||||
priv->offscreen = NULL;
|
||||
}
|
||||
g_clear_pointer (&priv->texture, cogl_object_unref);
|
||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||
|
||||
priv->texture =
|
||||
clutter_offscreen_effect_create_texture (self, target_width, target_height);
|
||||
@@ -237,7 +225,8 @@ update_fbo (ClutterEffect *effect,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
|
||||
clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
ClutterOffscreenEffectPrivate *priv = self->priv;
|
||||
@@ -248,6 +237,7 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
|
||||
CoglColor transparent;
|
||||
gfloat stage_width, stage_height;
|
||||
gfloat target_width = -1, target_height = -1;
|
||||
CoglFramebuffer *framebuffer;
|
||||
gfloat resource_scale;
|
||||
gfloat ceiled_resource_scale;
|
||||
graphene_point3d_t local_offset;
|
||||
@@ -312,10 +302,10 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
|
||||
if (!update_fbo (effect, target_width, target_height, resource_scale))
|
||||
return FALSE;
|
||||
|
||||
cogl_get_modelview_matrix (&old_modelview);
|
||||
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
|
||||
cogl_framebuffer_get_modelview_matrix (framebuffer, &old_modelview);
|
||||
|
||||
/* let's draw offscreen */
|
||||
cogl_push_framebuffer (priv->offscreen);
|
||||
clutter_paint_context_push_framebuffer (paint_context, priv->offscreen);
|
||||
|
||||
/* We don't want the FBO contents to be transformed. That could waste memory
|
||||
* (e.g. during zoom), or result in something that's not rectangular (clipped
|
||||
@@ -325,7 +315,7 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
|
||||
* contents on screen...
|
||||
*/
|
||||
clutter_actor_get_transform (priv->stage, &modelview);
|
||||
cogl_set_modelview_matrix (&modelview);
|
||||
cogl_framebuffer_set_modelview_matrix (priv->offscreen, &modelview);
|
||||
|
||||
/* Save the original viewport for calculating priv->position */
|
||||
_clutter_stage_get_viewport (CLUTTER_STAGE (priv->stage),
|
||||
@@ -337,10 +327,11 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
|
||||
/* Set up the viewport so that it has the same size as the stage (avoid
|
||||
* distortion), but translated to account for the FBO offset...
|
||||
*/
|
||||
cogl_set_viewport (-priv->fbo_offset_x,
|
||||
-priv->fbo_offset_y,
|
||||
stage_width,
|
||||
stage_height);
|
||||
cogl_framebuffer_set_viewport (priv->offscreen,
|
||||
-priv->fbo_offset_x,
|
||||
-priv->fbo_offset_y,
|
||||
stage_width,
|
||||
stage_height);
|
||||
|
||||
/* Copy the stage's projection matrix across to the framebuffer */
|
||||
_clutter_stage_get_projection_matrix (CLUTTER_STAGE (priv->stage),
|
||||
@@ -357,14 +348,15 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
|
||||
&priv->position,
|
||||
1);
|
||||
|
||||
cogl_set_projection_matrix (&projection);
|
||||
cogl_framebuffer_set_projection_matrix (priv->offscreen, &projection);
|
||||
|
||||
cogl_color_init_from_4ub (&transparent, 0, 0, 0, 0);
|
||||
cogl_clear (&transparent,
|
||||
COGL_BUFFER_BIT_COLOR |
|
||||
COGL_BUFFER_BIT_DEPTH);
|
||||
cogl_framebuffer_clear (priv->offscreen,
|
||||
COGL_BUFFER_BIT_COLOR |
|
||||
COGL_BUFFER_BIT_DEPTH,
|
||||
&transparent);
|
||||
|
||||
cogl_push_matrix ();
|
||||
cogl_framebuffer_push_matrix (priv->offscreen);
|
||||
|
||||
/* Override the actor's opacity to fully opaque - we paint the offscreen
|
||||
* texture with the actor's paint opacity, so we need to do this to avoid
|
||||
@@ -378,10 +370,12 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect)
|
||||
clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterOffscreenEffectPrivate *priv = effect->priv;
|
||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
guint8 paint_opacity;
|
||||
|
||||
paint_opacity = clutter_actor_get_paint_opacity (priv->actor);
|
||||
@@ -407,18 +401,21 @@ clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect)
|
||||
clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterOffscreenEffectPrivate *priv = effect->priv;
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
CoglMatrix modelview;
|
||||
float resource_scale;
|
||||
|
||||
cogl_push_matrix ();
|
||||
cogl_framebuffer_push_matrix (framebuffer);
|
||||
|
||||
/* The current modelview matrix is *almost* perfect already. It's only
|
||||
* missing a correction for the expanded FBO and offset rendering within...
|
||||
*/
|
||||
cogl_get_modelview_matrix (&modelview);
|
||||
cogl_framebuffer_get_modelview_matrix (framebuffer, &modelview);
|
||||
|
||||
if (clutter_actor_get_resource_scale (priv->actor, &resource_scale) &&
|
||||
resource_scale != 1.0f)
|
||||
@@ -431,21 +428,23 @@ clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect)
|
||||
priv->fbo_offset_x,
|
||||
priv->fbo_offset_y,
|
||||
0.0f);
|
||||
cogl_set_modelview_matrix (&modelview);
|
||||
cogl_framebuffer_set_modelview_matrix (framebuffer, &modelview);
|
||||
|
||||
/* paint the target material; this is virtualized for
|
||||
* sub-classes that require special hand-holding
|
||||
*/
|
||||
clutter_offscreen_effect_paint_target (effect);
|
||||
clutter_offscreen_effect_paint_target (effect, paint_context);
|
||||
|
||||
cogl_pop_matrix ();
|
||||
cogl_framebuffer_pop_matrix (framebuffer);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_offscreen_effect_post_paint (ClutterEffect *effect)
|
||||
clutter_offscreen_effect_post_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
ClutterOffscreenEffectPrivate *priv = self->priv;
|
||||
CoglFramebuffer *framebuffer;
|
||||
|
||||
if (priv->offscreen == NULL ||
|
||||
priv->target == NULL ||
|
||||
@@ -455,14 +454,16 @@ clutter_offscreen_effect_post_paint (ClutterEffect *effect)
|
||||
/* Restore the previous opacity override */
|
||||
clutter_actor_set_opacity_override (priv->actor, priv->old_opacity_override);
|
||||
|
||||
cogl_pop_matrix ();
|
||||
cogl_pop_framebuffer ();
|
||||
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
|
||||
cogl_framebuffer_pop_matrix (framebuffer);
|
||||
clutter_paint_context_pop_framebuffer (paint_context);
|
||||
|
||||
clutter_offscreen_effect_paint_texture (self);
|
||||
clutter_offscreen_effect_paint_texture (self, paint_context);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_offscreen_effect_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context,
|
||||
ClutterEffectPaintFlags flags)
|
||||
{
|
||||
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
@@ -473,13 +474,33 @@ clutter_offscreen_effect_paint (ClutterEffect *effect,
|
||||
*/
|
||||
if (priv->offscreen == NULL || (flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY))
|
||||
{
|
||||
/* Chain up to the parent paint method which will call the pre and
|
||||
post paint functions to update the image */
|
||||
CLUTTER_EFFECT_CLASS (clutter_offscreen_effect_parent_class)->
|
||||
paint (effect, flags);
|
||||
ClutterEffectClass *effect_class = CLUTTER_EFFECT_GET_CLASS (effect);
|
||||
gboolean pre_paint_succeeded;
|
||||
|
||||
pre_paint_succeeded = effect_class->pre_paint (effect, paint_context);
|
||||
|
||||
clutter_actor_continue_paint (priv->actor, paint_context);
|
||||
|
||||
if (pre_paint_succeeded)
|
||||
effect_class->post_paint (effect, paint_context);
|
||||
else
|
||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||
}
|
||||
else
|
||||
clutter_offscreen_effect_paint_texture (self);
|
||||
clutter_offscreen_effect_paint_texture (self, paint_context);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_offscreen_effect_notify (GObject *gobject,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterOffscreenEffect *offscreen_effect = CLUTTER_OFFSCREEN_EFFECT (gobject);
|
||||
ClutterOffscreenEffectPrivate *priv = offscreen_effect->priv;
|
||||
|
||||
if (strcmp (pspec->name, "enabled") == 0)
|
||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||
|
||||
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->notify (gobject, pspec);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -488,14 +509,9 @@ clutter_offscreen_effect_finalize (GObject *gobject)
|
||||
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (gobject);
|
||||
ClutterOffscreenEffectPrivate *priv = self->priv;
|
||||
|
||||
if (priv->offscreen)
|
||||
cogl_object_unref (priv->offscreen);
|
||||
|
||||
if (priv->target)
|
||||
cogl_object_unref (priv->target);
|
||||
|
||||
if (priv->texture)
|
||||
cogl_object_unref (priv->texture);
|
||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||
g_clear_pointer (&priv->texture, cogl_object_unref);
|
||||
g_clear_pointer (&priv->target, cogl_object_unref);
|
||||
|
||||
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->finalize (gobject);
|
||||
}
|
||||
@@ -517,6 +533,7 @@ clutter_offscreen_effect_class_init (ClutterOffscreenEffectClass *klass)
|
||||
effect_class->paint = clutter_offscreen_effect_paint;
|
||||
|
||||
gobject_class->finalize = clutter_offscreen_effect_finalize;
|
||||
gobject_class->notify = clutter_offscreen_effect_notify;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -582,17 +599,20 @@ clutter_offscreen_effect_get_target (ClutterOffscreenEffect *effect)
|
||||
/**
|
||||
* clutter_offscreen_effect_paint_target:
|
||||
* @effect: a #ClutterOffscreenEffect
|
||||
* @paint_context: a #ClutterPaintContext
|
||||
*
|
||||
* Calls the paint_target() virtual function of the @effect
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
void
|
||||
clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_OFFSCREEN_EFFECT (effect));
|
||||
|
||||
CLUTTER_OFFSCREEN_EFFECT_GET_CLASS (effect)->paint_target (effect);
|
||||
CLUTTER_OFFSCREEN_EFFECT_GET_CLASS (effect)->paint_target (effect,
|
||||
paint_context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -79,7 +79,8 @@ struct _ClutterOffscreenEffectClass
|
||||
CoglHandle (* create_texture) (ClutterOffscreenEffect *effect,
|
||||
gfloat width,
|
||||
gfloat height);
|
||||
void (* paint_target) (ClutterOffscreenEffect *effect);
|
||||
void (* paint_target) (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context);
|
||||
|
||||
/*< private >*/
|
||||
void (* _clutter_offscreen1) (void);
|
||||
@@ -101,7 +102,8 @@ CLUTTER_EXPORT
|
||||
CoglHandle clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *effect);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect);
|
||||
void clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context);
|
||||
CLUTTER_EXPORT
|
||||
CoglHandle clutter_offscreen_effect_create_texture (ClutterOffscreenEffect *effect,
|
||||
gfloat width,
|
||||
|
29
clutter/clutter/clutter-paint-context-private.h
Normal file
29
clutter/clutter/clutter-paint-context-private.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CLUTTER_PAINT_CONTEXT_PRIVATE_H
|
||||
#define CLUTTER_PAINT_CONTEXT_PRIVATE_H
|
||||
|
||||
#include "clutter-paint-context.h"
|
||||
|
||||
ClutterPaintContext * clutter_paint_context_new_for_view (ClutterStageView *view);
|
||||
|
||||
gboolean clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context);
|
||||
|
||||
CoglFramebuffer * clutter_paint_context_get_base_framebuffer (ClutterPaintContext *paint_context);
|
||||
|
||||
#endif /* CLUTTER_PAINT_CONTEXT_PRIVATE_H */
|
161
clutter/clutter/clutter-paint-context.c
Normal file
161
clutter/clutter/clutter-paint-context.c
Normal file
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-paint-context-private.h"
|
||||
|
||||
struct _ClutterPaintContext
|
||||
{
|
||||
grefcount ref_count;
|
||||
|
||||
GList *framebuffers;
|
||||
|
||||
ClutterStageView *view;
|
||||
};
|
||||
|
||||
G_DEFINE_BOXED_TYPE (ClutterPaintContext, clutter_paint_context,
|
||||
clutter_paint_context_ref,
|
||||
clutter_paint_context_unref)
|
||||
|
||||
ClutterPaintContext *
|
||||
clutter_paint_context_new_for_view (ClutterStageView *view)
|
||||
{
|
||||
ClutterPaintContext *paint_context;
|
||||
CoglFramebuffer *framebuffer;
|
||||
|
||||
paint_context = g_new0 (ClutterPaintContext, 1);
|
||||
g_ref_count_init (&paint_context->ref_count);
|
||||
paint_context->view = view;
|
||||
|
||||
framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||
clutter_paint_context_push_framebuffer (paint_context, framebuffer);
|
||||
|
||||
return paint_context;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_paint_context_new_for_framebuffer: (skip)
|
||||
*/
|
||||
ClutterPaintContext *
|
||||
clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer)
|
||||
{
|
||||
ClutterPaintContext *paint_context;
|
||||
|
||||
paint_context = g_new0 (ClutterPaintContext, 1);
|
||||
g_ref_count_init (&paint_context->ref_count);
|
||||
|
||||
clutter_paint_context_push_framebuffer (paint_context, framebuffer);
|
||||
|
||||
return paint_context;
|
||||
}
|
||||
|
||||
ClutterPaintContext *
|
||||
clutter_paint_context_ref (ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_ref_count_inc (&paint_context->ref_count);
|
||||
return paint_context;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_paint_context_dispose (ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_list_free_full (paint_context->framebuffers,
|
||||
cogl_object_unref);
|
||||
paint_context->framebuffers = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
clutter_paint_context_unref (ClutterPaintContext *paint_context)
|
||||
{
|
||||
if (g_ref_count_dec (&paint_context->ref_count))
|
||||
{
|
||||
clutter_paint_context_dispose (paint_context);
|
||||
g_free (paint_context);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
clutter_paint_context_destroy (ClutterPaintContext *paint_context)
|
||||
{
|
||||
clutter_paint_context_dispose (paint_context);
|
||||
clutter_paint_context_unref (paint_context);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_paint_context_push_framebuffer (ClutterPaintContext *paint_context,
|
||||
CoglFramebuffer *framebuffer)
|
||||
{
|
||||
paint_context->framebuffers = g_list_prepend (paint_context->framebuffers,
|
||||
cogl_object_ref (framebuffer));
|
||||
}
|
||||
|
||||
void
|
||||
clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_return_if_fail (paint_context->framebuffers);
|
||||
|
||||
cogl_object_unref (paint_context->framebuffers->data);
|
||||
paint_context->framebuffers =
|
||||
g_list_delete_link (paint_context->framebuffers,
|
||||
paint_context->framebuffers);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_paint_context_get_framebuffer:
|
||||
* @paint_context: The #ClutterPaintContext
|
||||
*
|
||||
* Returns: (transfer none): The #CoglFramebuffer used for drawing
|
||||
*/
|
||||
CoglFramebuffer *
|
||||
clutter_paint_context_get_framebuffer (ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_return_val_if_fail (paint_context->framebuffers, NULL);
|
||||
|
||||
return paint_context->framebuffers->data;
|
||||
}
|
||||
|
||||
CoglFramebuffer *
|
||||
clutter_paint_context_get_base_framebuffer (ClutterPaintContext *paint_context)
|
||||
{
|
||||
return g_list_last (paint_context->framebuffers)->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_paint_context_get_stage_view: (skip)
|
||||
*/
|
||||
ClutterStageView *
|
||||
clutter_paint_context_get_stage_view (ClutterPaintContext *paint_context)
|
||||
{
|
||||
return paint_context->view;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_paint_context_is_drawing_off_stage: (skip)
|
||||
*
|
||||
* Return %TRUE if the paint context is currently drawing off stage.
|
||||
* This happens if there are any framebuffers pushed, and the base framebuffer
|
||||
* comes from the stage view.
|
||||
*/
|
||||
gboolean
|
||||
clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context)
|
||||
{
|
||||
if (g_list_length (paint_context->framebuffers) > 1)
|
||||
return TRUE;
|
||||
|
||||
return !paint_context->view;
|
||||
}
|
62
clutter/clutter/clutter-paint-context.h
Normal file
62
clutter/clutter/clutter-paint-context.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CLUTTER_PAINT_CONTEXT_H
|
||||
#define CLUTTER_PAINT_CONTEXT_H
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "clutter-macros.h"
|
||||
#include "clutter-stage-view.h"
|
||||
|
||||
typedef struct _ClutterPaintContext ClutterPaintContext;
|
||||
|
||||
#define CLUTTER_TYPE_PAINT_CONTEXT (clutter_paint_context_get_type ())
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_paint_context_get_type (void);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintContext * clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintContext * clutter_paint_context_ref (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_context_unref (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_context_destroy (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
CoglFramebuffer * clutter_paint_context_get_framebuffer (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterStageView * clutter_paint_context_get_stage_view (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_context_push_framebuffer (ClutterPaintContext *paint_context,
|
||||
CoglFramebuffer *framebuffer);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context);
|
||||
|
||||
#endif /* CLUTTER_PAINT_CONTEXT_H */
|
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <json-glib/json-glib.h>
|
||||
#include <clutter/clutter-paint-context.h>
|
||||
#include <clutter/clutter-paint-node.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@@ -63,9 +64,12 @@ struct _ClutterPaintNodeClass
|
||||
|
||||
void (* finalize) (ClutterPaintNode *node);
|
||||
|
||||
gboolean (* pre_draw) (ClutterPaintNode *node);
|
||||
void (* draw) (ClutterPaintNode *node);
|
||||
void (* post_draw) (ClutterPaintNode *node);
|
||||
gboolean (* pre_draw) (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
void (* draw) (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
void (* post_draw) (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
|
||||
JsonNode*(* serialize) (ClutterPaintNode *node);
|
||||
|
||||
@@ -111,7 +115,8 @@ void _clutter_paint_node_init_types (void);
|
||||
gpointer _clutter_paint_node_create (GType gtype);
|
||||
|
||||
ClutterPaintNode * _clutter_transform_node_new (const CoglMatrix *matrix);
|
||||
ClutterPaintNode * _clutter_dummy_node_new (ClutterActor *actor);
|
||||
ClutterPaintNode * _clutter_dummy_node_new (ClutterActor *actor,
|
||||
CoglFramebuffer *framebuffer);
|
||||
|
||||
void _clutter_paint_node_dump_tree (ClutterPaintNode *root);
|
||||
|
||||
|
@@ -202,18 +202,21 @@ clutter_paint_node_real_finalize (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_paint_node_real_pre_draw (ClutterPaintNode *node)
|
||||
clutter_paint_node_real_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_paint_node_real_draw (ClutterPaintNode *node)
|
||||
clutter_paint_node_real_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_paint_node_real_post_draw (ClutterPaintNode *node)
|
||||
clutter_paint_node_real_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -997,29 +1000,30 @@ clutter_paint_node_add_primitive (ClutterPaintNode *node,
|
||||
* its children, if any.
|
||||
*/
|
||||
void
|
||||
clutter_paint_node_paint (ClutterPaintNode *node)
|
||||
clutter_paint_node_paint (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterPaintNodeClass *klass = CLUTTER_PAINT_NODE_GET_CLASS (node);
|
||||
ClutterPaintNode *iter;
|
||||
gboolean res;
|
||||
|
||||
res = klass->pre_draw (node);
|
||||
res = klass->pre_draw (node, paint_context);
|
||||
|
||||
if (res)
|
||||
{
|
||||
klass->draw (node);
|
||||
klass->draw (node, paint_context);
|
||||
}
|
||||
|
||||
for (iter = node->first_child;
|
||||
iter != NULL;
|
||||
iter = iter->next_sibling)
|
||||
{
|
||||
clutter_paint_node_paint (iter);
|
||||
clutter_paint_node_paint (iter, paint_context);
|
||||
}
|
||||
|
||||
if (res)
|
||||
{
|
||||
klass->post_draw (node);
|
||||
klass->post_draw (node, paint_context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1199,9 +1203,10 @@ clutter_paint_node_get_root (ClutterPaintNode *node)
|
||||
* @node: a #ClutterPaintNode
|
||||
*
|
||||
* Retrieves the #CoglFramebuffer that @node will draw
|
||||
* into.
|
||||
* into, if it the root node has a custom framebuffer set.
|
||||
*
|
||||
* Returns: (transfer none): a #CoglFramebuffer
|
||||
* Returns: (transfer none): a #CoglFramebuffer or %NULL if no custom one is
|
||||
* set.
|
||||
*/
|
||||
CoglFramebuffer *
|
||||
clutter_paint_node_get_framebuffer (ClutterPaintNode *node)
|
||||
@@ -1209,12 +1214,9 @@ clutter_paint_node_get_framebuffer (ClutterPaintNode *node)
|
||||
ClutterPaintNode *root = clutter_paint_node_get_root (node);
|
||||
ClutterPaintNodeClass *klass;
|
||||
|
||||
if (root == NULL)
|
||||
return NULL;
|
||||
|
||||
klass = CLUTTER_PAINT_NODE_GET_CLASS (root);
|
||||
if (klass->get_framebuffer != NULL)
|
||||
return klass->get_framebuffer (root);
|
||||
|
||||
return cogl_get_draw_framebuffer ();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -50,7 +50,8 @@ CLUTTER_EXPORT
|
||||
void clutter_paint_node_unref (ClutterPaintNode *node);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_node_paint (ClutterPaintNode *node);
|
||||
void clutter_paint_node_paint (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_node_set_name (ClutterPaintNode *node,
|
||||
|
@@ -44,6 +44,7 @@
|
||||
#include "clutter-color.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-paint-context-private.h"
|
||||
|
||||
#include "clutter-paint-nodes.h"
|
||||
|
||||
@@ -103,11 +104,12 @@ struct _ClutterRootNode
|
||||
G_DEFINE_TYPE (ClutterRootNode, clutter_root_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_root_node_pre_draw (ClutterPaintNode *node)
|
||||
clutter_root_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterRootNode *rnode = (ClutterRootNode *) node;
|
||||
|
||||
cogl_push_framebuffer (rnode->framebuffer);
|
||||
clutter_paint_context_push_framebuffer (paint_context, rnode->framebuffer);
|
||||
|
||||
cogl_framebuffer_clear (rnode->framebuffer,
|
||||
rnode->clear_flags,
|
||||
@@ -117,9 +119,10 @@ clutter_root_node_pre_draw (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_root_node_post_draw (ClutterPaintNode *node)
|
||||
clutter_root_node_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
cogl_pop_framebuffer ();
|
||||
clutter_paint_context_pop_framebuffer (paint_context);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -163,6 +166,8 @@ clutter_root_node_new (CoglFramebuffer *framebuffer,
|
||||
{
|
||||
ClutterRootNode *res;
|
||||
|
||||
g_return_val_if_fail (framebuffer, NULL);
|
||||
|
||||
res = _clutter_paint_node_create (CLUTTER_TYPE_ROOT_NODE);
|
||||
|
||||
cogl_color_init_from_4ub (&res->clear_color,
|
||||
@@ -172,11 +177,7 @@ clutter_root_node_new (CoglFramebuffer *framebuffer,
|
||||
clear_color->alpha);
|
||||
cogl_color_premultiply (&res->clear_color);
|
||||
|
||||
if (G_LIKELY (framebuffer != NULL))
|
||||
res->framebuffer = cogl_object_ref (framebuffer);
|
||||
else
|
||||
res->framebuffer = cogl_object_ref (cogl_get_draw_framebuffer ());
|
||||
|
||||
res->framebuffer = cogl_object_ref (framebuffer);
|
||||
res->clear_flags = clear_flags;
|
||||
|
||||
return (ClutterPaintNode *) res;
|
||||
@@ -201,10 +202,12 @@ struct _ClutterTransformNodeClass
|
||||
G_DEFINE_TYPE (ClutterTransformNode, clutter_transform_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_transform_node_pre_draw (ClutterPaintNode *node)
|
||||
clutter_transform_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterTransformNode *transform_node = (ClutterTransformNode *) node;
|
||||
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
|
||||
CoglFramebuffer *fb =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
|
||||
cogl_framebuffer_push_matrix (fb);
|
||||
cogl_framebuffer_transform (fb, &transform_node->transform);
|
||||
@@ -213,9 +216,11 @@ clutter_transform_node_pre_draw (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_transform_node_post_draw (ClutterPaintNode *node)
|
||||
clutter_transform_node_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
|
||||
CoglFramebuffer *fb =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
|
||||
cogl_framebuffer_pop_matrix (fb);
|
||||
}
|
||||
@@ -278,7 +283,8 @@ struct _ClutterDummyNode
|
||||
G_DEFINE_TYPE (ClutterDummyNode, clutter_dummy_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_dummy_node_pre_draw (ClutterPaintNode *node)
|
||||
clutter_dummy_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@@ -315,6 +321,16 @@ clutter_dummy_node_get_framebuffer (ClutterPaintNode *node)
|
||||
return dnode->framebuffer;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_dummy_node_finalize (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterDummyNode *dnode = (ClutterDummyNode *) node;
|
||||
|
||||
cogl_clear_object (&dnode->framebuffer);
|
||||
|
||||
CLUTTER_PAINT_NODE_CLASS (clutter_dummy_node_parent_class)->finalize (node);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_dummy_node_class_init (ClutterDummyNodeClass *klass)
|
||||
{
|
||||
@@ -323,6 +339,7 @@ clutter_dummy_node_class_init (ClutterDummyNodeClass *klass)
|
||||
node_class->pre_draw = clutter_dummy_node_pre_draw;
|
||||
node_class->serialize = clutter_dummy_node_serialize;
|
||||
node_class->get_framebuffer = clutter_dummy_node_get_framebuffer;
|
||||
node_class->finalize = clutter_dummy_node_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -331,7 +348,8 @@ clutter_dummy_node_init (ClutterDummyNode *self)
|
||||
}
|
||||
|
||||
ClutterPaintNode *
|
||||
_clutter_dummy_node_new (ClutterActor *actor)
|
||||
_clutter_dummy_node_new (ClutterActor *actor,
|
||||
CoglFramebuffer *framebuffer)
|
||||
{
|
||||
ClutterPaintNode *res;
|
||||
ClutterDummyNode *dnode;
|
||||
@@ -340,7 +358,7 @@ _clutter_dummy_node_new (ClutterActor *actor)
|
||||
|
||||
dnode = (ClutterDummyNode *) res;
|
||||
dnode->actor = actor;
|
||||
dnode->framebuffer = _clutter_actor_get_active_framebuffer (actor);
|
||||
dnode->framebuffer = cogl_object_ref (framebuffer);
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -383,22 +401,34 @@ clutter_pipeline_node_finalize (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_pipeline_node_pre_draw (ClutterPaintNode *node)
|
||||
clutter_pipeline_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterPipelineNode *pnode = CLUTTER_PIPELINE_NODE (node);
|
||||
|
||||
if (node->operations != NULL &&
|
||||
pnode->pipeline != NULL)
|
||||
{
|
||||
cogl_push_source (pnode->pipeline);
|
||||
return TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static CoglFramebuffer *
|
||||
get_target_framebuffer (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
CoglFramebuffer *framebuffer;
|
||||
|
||||
framebuffer = clutter_paint_node_get_framebuffer (node);
|
||||
if (framebuffer)
|
||||
return framebuffer;
|
||||
|
||||
return clutter_paint_context_get_framebuffer (paint_context);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_pipeline_node_draw (ClutterPaintNode *node)
|
||||
clutter_pipeline_node_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterPipelineNode *pnode = CLUTTER_PIPELINE_NODE (node);
|
||||
CoglFramebuffer *fb;
|
||||
@@ -410,7 +440,7 @@ clutter_pipeline_node_draw (ClutterPaintNode *node)
|
||||
if (node->operations == NULL)
|
||||
return;
|
||||
|
||||
fb = clutter_paint_node_get_framebuffer (node);
|
||||
fb = clutter_paint_context_get_framebuffer (paint_context);
|
||||
|
||||
for (i = 0; i < node->operations->len; i++)
|
||||
{
|
||||
@@ -424,18 +454,20 @@ clutter_pipeline_node_draw (ClutterPaintNode *node)
|
||||
break;
|
||||
|
||||
case PAINT_OP_TEX_RECT:
|
||||
cogl_rectangle_with_texture_coords (op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
op->op.texrect[2],
|
||||
op->op.texrect[3],
|
||||
op->op.texrect[4],
|
||||
op->op.texrect[5],
|
||||
op->op.texrect[6],
|
||||
op->op.texrect[7]);
|
||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
||||
pnode->pipeline,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
op->op.texrect[2],
|
||||
op->op.texrect[3],
|
||||
op->op.texrect[4],
|
||||
op->op.texrect[5],
|
||||
op->op.texrect[6],
|
||||
op->op.texrect[7]);
|
||||
break;
|
||||
|
||||
case PAINT_OP_MULTITEX_RECT:
|
||||
cogl_framebuffer_draw_multitextured_rectangle (cogl_get_draw_framebuffer (),
|
||||
cogl_framebuffer_draw_multitextured_rectangle (fb,
|
||||
pnode->pipeline,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
@@ -446,7 +478,7 @@ clutter_pipeline_node_draw (ClutterPaintNode *node)
|
||||
break;
|
||||
|
||||
case PAINT_OP_PATH:
|
||||
cogl_path_fill (op->op.path);
|
||||
cogl_framebuffer_fill_path (fb, pnode->pipeline, op->op.path);
|
||||
break;
|
||||
|
||||
case PAINT_OP_PRIMITIVE:
|
||||
@@ -459,9 +491,9 @@ clutter_pipeline_node_draw (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_pipeline_node_post_draw (ClutterPaintNode *node)
|
||||
clutter_pipeline_node_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
cogl_pop_source ();
|
||||
}
|
||||
|
||||
static JsonNode *
|
||||
@@ -780,7 +812,8 @@ clutter_text_node_finalize (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_text_node_pre_draw (ClutterPaintNode *node)
|
||||
clutter_text_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterTextNode *tnode = CLUTTER_TEXT_NODE (node);
|
||||
|
||||
@@ -788,7 +821,8 @@ clutter_text_node_pre_draw (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_text_node_draw (ClutterPaintNode *node)
|
||||
clutter_text_node_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterTextNode *tnode = CLUTTER_TEXT_NODE (node);
|
||||
PangoRectangle extents;
|
||||
@@ -798,7 +832,7 @@ clutter_text_node_draw (ClutterPaintNode *node)
|
||||
if (node->operations == NULL)
|
||||
return;
|
||||
|
||||
fb = clutter_paint_node_get_framebuffer (node);
|
||||
fb = get_target_framebuffer (node, paint_context);
|
||||
|
||||
pango_layout_get_pixel_extents (tnode->layout, NULL, &extents);
|
||||
|
||||
@@ -831,11 +865,11 @@ clutter_text_node_draw (ClutterPaintNode *node)
|
||||
clipped = TRUE;
|
||||
}
|
||||
|
||||
cogl_pango_render_layout (tnode->layout,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
&tnode->color,
|
||||
0);
|
||||
cogl_pango_show_layout (fb,
|
||||
tnode->layout,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
&tnode->color);
|
||||
|
||||
if (clipped)
|
||||
cogl_framebuffer_pop_clip (fb);
|
||||
@@ -974,7 +1008,8 @@ struct _ClutterClipNodeClass
|
||||
G_DEFINE_TYPE (ClutterClipNode, clutter_clip_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_clip_node_pre_draw (ClutterPaintNode *node)
|
||||
clutter_clip_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
gboolean retval = FALSE;
|
||||
CoglFramebuffer *fb;
|
||||
@@ -983,7 +1018,7 @@ clutter_clip_node_pre_draw (ClutterPaintNode *node)
|
||||
if (node->operations == NULL)
|
||||
return FALSE;
|
||||
|
||||
fb = clutter_paint_node_get_framebuffer (node);
|
||||
fb = get_target_framebuffer (node, paint_context);
|
||||
|
||||
for (i = 0; i < node->operations->len; i++)
|
||||
{
|
||||
@@ -1018,7 +1053,8 @@ clutter_clip_node_pre_draw (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_clip_node_post_draw (ClutterPaintNode *node)
|
||||
clutter_clip_node_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
CoglFramebuffer *fb;
|
||||
guint i;
|
||||
@@ -1026,7 +1062,7 @@ clutter_clip_node_post_draw (ClutterPaintNode *node)
|
||||
if (node->operations == NULL)
|
||||
return;
|
||||
|
||||
fb = clutter_paint_node_get_framebuffer (node);
|
||||
fb = get_target_framebuffer (node, paint_context);
|
||||
|
||||
for (i = 0; i < node->operations->len; i++)
|
||||
{
|
||||
@@ -1100,7 +1136,8 @@ struct _ClutterActorNodeClass
|
||||
G_DEFINE_TYPE (ClutterActorNode, clutter_actor_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_actor_node_pre_draw (ClutterPaintNode *node)
|
||||
clutter_actor_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
|
||||
|
||||
@@ -1110,15 +1147,17 @@ clutter_actor_node_pre_draw (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_node_draw (ClutterPaintNode *node)
|
||||
clutter_actor_node_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
|
||||
|
||||
clutter_actor_continue_paint (actor_node->actor);
|
||||
clutter_actor_continue_paint (actor_node->actor, paint_context);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_node_post_draw (ClutterPaintNode *node)
|
||||
clutter_actor_node_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
|
||||
|
||||
@@ -1143,6 +1182,7 @@ clutter_actor_node_serialize (ClutterPaintNode *node)
|
||||
|
||||
return json_builder_get_root (builder);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_node_class_init (ClutterActorNodeClass *klass)
|
||||
{
|
||||
@@ -1217,9 +1257,11 @@ struct _ClutterLayerNodeClass
|
||||
G_DEFINE_TYPE (ClutterLayerNode, clutter_layer_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_layer_node_pre_draw (ClutterPaintNode *node)
|
||||
clutter_layer_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterLayerNode *lnode = (ClutterLayerNode *) node;
|
||||
CoglFramebuffer *framebuffer;
|
||||
CoglMatrix matrix;
|
||||
|
||||
/* if we were unable to create an offscreen buffer for this node, then
|
||||
@@ -1235,9 +1277,10 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node)
|
||||
/* copy the same modelview from the current framebuffer to the one we
|
||||
* are going to use
|
||||
*/
|
||||
cogl_get_modelview_matrix (&matrix);
|
||||
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
|
||||
cogl_framebuffer_get_modelview_matrix (framebuffer, &matrix);
|
||||
|
||||
cogl_push_framebuffer (lnode->offscreen);
|
||||
clutter_paint_context_push_framebuffer (paint_context, lnode->offscreen);
|
||||
|
||||
cogl_framebuffer_set_modelview_matrix (lnode->offscreen, &matrix);
|
||||
|
||||
@@ -1255,7 +1298,7 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node)
|
||||
COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_DEPTH,
|
||||
0.f, 0.f, 0.f, 0.f);
|
||||
|
||||
cogl_push_matrix ();
|
||||
cogl_framebuffer_push_matrix (lnode->offscreen);
|
||||
|
||||
/* every draw operation after this point will happen an offscreen
|
||||
* framebuffer
|
||||
@@ -1265,17 +1308,18 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_layer_node_post_draw (ClutterPaintNode *node)
|
||||
clutter_layer_node_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterLayerNode *lnode = CLUTTER_LAYER_NODE (node);
|
||||
CoglFramebuffer *fb;
|
||||
guint i;
|
||||
|
||||
/* switch to the previous framebuffer */
|
||||
cogl_pop_matrix ();
|
||||
cogl_pop_framebuffer ();
|
||||
cogl_framebuffer_pop_matrix (lnode->offscreen);
|
||||
clutter_paint_context_pop_framebuffer (paint_context);
|
||||
|
||||
fb = cogl_get_draw_framebuffer ();
|
||||
fb = clutter_paint_context_get_framebuffer (paint_context);
|
||||
|
||||
for (i = 0; i < node->operations->len; i++)
|
||||
{
|
||||
@@ -1289,20 +1333,20 @@ clutter_layer_node_post_draw (ClutterPaintNode *node)
|
||||
|
||||
case PAINT_OP_TEX_RECT:
|
||||
/* now we need to paint the texture */
|
||||
cogl_push_source (lnode->state);
|
||||
cogl_rectangle_with_texture_coords (op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
op->op.texrect[2],
|
||||
op->op.texrect[3],
|
||||
op->op.texrect[4],
|
||||
op->op.texrect[5],
|
||||
op->op.texrect[6],
|
||||
op->op.texrect[7]);
|
||||
cogl_pop_source ();
|
||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
||||
lnode->state,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
op->op.texrect[2],
|
||||
op->op.texrect[3],
|
||||
op->op.texrect[4],
|
||||
op->op.texrect[5],
|
||||
op->op.texrect[6],
|
||||
op->op.texrect[7]);
|
||||
break;
|
||||
|
||||
case PAINT_OP_MULTITEX_RECT:
|
||||
cogl_framebuffer_draw_multitextured_rectangle (cogl_get_draw_framebuffer (),
|
||||
cogl_framebuffer_draw_multitextured_rectangle (fb,
|
||||
lnode->state,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
@@ -1313,9 +1357,7 @@ clutter_layer_node_post_draw (ClutterPaintNode *node)
|
||||
break;
|
||||
|
||||
case PAINT_OP_PATH:
|
||||
cogl_push_source (lnode->state);
|
||||
cogl_path_fill (op->op.path);
|
||||
cogl_pop_source ();
|
||||
cogl_framebuffer_fill_path (fb, lnode->state, op->op.path);
|
||||
break;
|
||||
|
||||
case PAINT_OP_PRIMITIVE:
|
||||
|
25
clutter/clutter/clutter-pick-context-private.h
Normal file
25
clutter/clutter/clutter-pick-context-private.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CLUTTER_PICK_CONTEXT_PRIVATE_H
|
||||
#define CLUTTER_PICK_CONTEXT_PRIVATE_H
|
||||
|
||||
#include "clutter-pick-context.h"
|
||||
|
||||
ClutterPickContext * clutter_pick_context_new_for_view (ClutterStageView *view);
|
||||
|
||||
#endif /* CLUTTER_PICK_CONTEXT_PRIVATE_H */
|
83
clutter/clutter/clutter-pick-context.c
Normal file
83
clutter/clutter/clutter-pick-context.c
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-pick-context-private.h"
|
||||
|
||||
struct _ClutterPickContext
|
||||
{
|
||||
grefcount ref_count;
|
||||
|
||||
CoglFramebuffer *framebuffer;
|
||||
};
|
||||
|
||||
G_DEFINE_BOXED_TYPE (ClutterPickContext, clutter_pick_context,
|
||||
clutter_pick_context_ref,
|
||||
clutter_pick_context_unref)
|
||||
|
||||
ClutterPickContext *
|
||||
clutter_pick_context_new_for_view (ClutterStageView *view)
|
||||
{
|
||||
ClutterPickContext *pick_context;
|
||||
|
||||
pick_context = g_new0 (ClutterPickContext, 1);
|
||||
g_ref_count_init (&pick_context->ref_count);
|
||||
pick_context->framebuffer =
|
||||
cogl_object_ref (clutter_stage_view_get_framebuffer (view));
|
||||
|
||||
return pick_context;
|
||||
}
|
||||
|
||||
ClutterPickContext *
|
||||
clutter_pick_context_ref (ClutterPickContext *pick_context)
|
||||
{
|
||||
g_ref_count_inc (&pick_context->ref_count);
|
||||
return pick_context;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_pick_context_dispose (ClutterPickContext *pick_context)
|
||||
{
|
||||
g_clear_pointer (&pick_context->framebuffer, cogl_object_unref);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_pick_context_unref (ClutterPickContext *pick_context)
|
||||
{
|
||||
if (g_ref_count_dec (&pick_context->ref_count))
|
||||
{
|
||||
clutter_pick_context_dispose (pick_context);
|
||||
g_free (pick_context);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
clutter_pick_context_destroy (ClutterPickContext *pick_context)
|
||||
{
|
||||
clutter_pick_context_dispose (pick_context);
|
||||
clutter_pick_context_unref (pick_context);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_pick_context_get_framebuffer: (skip)
|
||||
*/
|
||||
CoglFramebuffer *
|
||||
clutter_pick_context_get_framebuffer (ClutterPickContext *pick_context)
|
||||
{
|
||||
return pick_context->framebuffer;
|
||||
}
|
49
clutter/clutter/clutter-pick-context.h
Normal file
49
clutter/clutter/clutter-pick-context.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CLUTTER_PICK_CONTEXT_H
|
||||
#define CLUTTER_PICK_CONTEXT_H
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "clutter-macros.h"
|
||||
#include "clutter-stage-view.h"
|
||||
|
||||
typedef struct _ClutterPickContext ClutterPickContext;
|
||||
|
||||
#define CLUTTER_TYPE_PICK_CONTEXT (clutter_pick_context_get_type ())
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_pick_context_get_type (void);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPickContext * clutter_pick_context_ref (ClutterPickContext *pick_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_pick_context_unref (ClutterPickContext *pick_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_pick_context_destroy (ClutterPickContext *pick_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
CoglFramebuffer * clutter_pick_context_get_framebuffer (ClutterPickContext *pick_context);
|
||||
|
||||
#endif /* CLUTTER_PICK_CONTEXT_H */
|
@@ -395,7 +395,8 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterShaderEffect *self = CLUTTER_SHADER_EFFECT (effect);
|
||||
ClutterShaderEffectPrivate *priv = self->priv;
|
||||
@@ -425,7 +426,7 @@ clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
out:
|
||||
/* paint the offscreen buffer */
|
||||
parent = CLUTTER_OFFSCREEN_EFFECT_CLASS (clutter_shader_effect_parent_class);
|
||||
parent->paint_target (effect);
|
||||
parent->paint_target (effect, paint_context);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -104,8 +104,6 @@ ClutterStageQueueRedrawEntry *_clutter_stage_queue_actor_redraw (Clut
|
||||
const ClutterPaintVolume *clip);
|
||||
void _clutter_stage_queue_redraw_entry_invalidate (ClutterStageQueueRedrawEntry *entry);
|
||||
|
||||
CoglFramebuffer *_clutter_stage_get_active_framebuffer (ClutterStage *stage);
|
||||
|
||||
void _clutter_stage_add_pointer_drag_actor (ClutterStage *stage,
|
||||
ClutterInputDevice *device,
|
||||
ClutterActor *actor);
|
||||
|
@@ -33,5 +33,7 @@ gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view);
|
||||
void clutter_stage_view_set_dirty_projection (ClutterStageView *view,
|
||||
gboolean dirty);
|
||||
|
||||
void clutter_stage_view_add_redraw_clip (ClutterStageView *view,
|
||||
cairo_rectangle_int_t *clip);
|
||||
|
||||
#endif /* __CLUTTER_STAGE_VIEW_PRIVATE_H__ */
|
||||
|
@@ -68,7 +68,9 @@
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-master-clock.h"
|
||||
#include "clutter-mutter.h"
|
||||
#include "clutter-paint-context-private.h"
|
||||
#include "clutter-paint-volume-private.h"
|
||||
#include "clutter-pick-context-private.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-stage-manager-private.h"
|
||||
#include "clutter-stage-private.h"
|
||||
@@ -120,8 +122,6 @@ struct _ClutterStagePrivate
|
||||
|
||||
GList *pending_queue_redraws;
|
||||
|
||||
CoglFramebuffer *active_framebuffer;
|
||||
|
||||
gint sync_delay;
|
||||
|
||||
GTimer *fps_timer;
|
||||
@@ -443,9 +443,9 @@ is_inside_axis_aligned_rectangle (const graphene_point_t *point,
|
||||
const graphene_point_t *vertices)
|
||||
{
|
||||
float min_x = FLT_MAX;
|
||||
float max_x = FLT_MIN;
|
||||
float max_x = -FLT_MAX;
|
||||
float min_y = FLT_MAX;
|
||||
float max_y = FLT_MIN;
|
||||
float max_y = -FLT_MAX;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
@@ -838,20 +838,6 @@ _cogl_util_get_eye_planes_for_screen_poly (float *polygon,
|
||||
graphene_vec3_normalize (&plane->n, &plane->n);
|
||||
}
|
||||
|
||||
static void
|
||||
_clutter_stage_update_active_framebuffer (ClutterStage *stage,
|
||||
CoglFramebuffer *framebuffer)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
|
||||
/* We track the CoglFramebuffer that corresponds to the stage itself
|
||||
* so, for example, we can disable culling when rendering to an
|
||||
* offscreen framebuffer.
|
||||
*/
|
||||
|
||||
priv->active_framebuffer = framebuffer;
|
||||
}
|
||||
|
||||
/* XXX: Instead of having a toplevel 2D clip region, it might be
|
||||
* better to have a clip volume within the view frustum. This could
|
||||
* allow us to avoid projecting actors into window coordinates to
|
||||
@@ -863,7 +849,6 @@ setup_view_for_pick_or_paint (ClutterStage *stage,
|
||||
const cairo_rectangle_int_t *clip)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||
cairo_rectangle_int_t view_layout;
|
||||
float clip_poly[8];
|
||||
float viewport[4];
|
||||
@@ -914,7 +899,6 @@ setup_view_for_pick_or_paint (ClutterStage *stage,
|
||||
priv->current_clip_planes);
|
||||
|
||||
_clutter_stage_paint_volume_stack_free_all (stage);
|
||||
_clutter_stage_update_active_framebuffer (stage, framebuffer);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -922,8 +906,13 @@ clutter_stage_do_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip)
|
||||
{
|
||||
ClutterPaintContext *paint_context;
|
||||
|
||||
paint_context = clutter_paint_context_new_for_view (view);
|
||||
|
||||
setup_view_for_pick_or_paint (stage, view, clip);
|
||||
clutter_actor_paint (CLUTTER_ACTOR (stage));
|
||||
clutter_actor_paint (CLUTTER_ACTOR (stage), paint_context);
|
||||
clutter_paint_context_destroy (paint_context);
|
||||
}
|
||||
|
||||
/* This provides a common point of entry for painting the scenegraph
|
||||
@@ -963,18 +952,20 @@ _clutter_stage_emit_after_paint (ClutterStage *stage)
|
||||
* respect the Z order as it uses our empty sort_depth_order.
|
||||
*/
|
||||
static void
|
||||
clutter_stage_paint (ClutterActor *self)
|
||||
clutter_stage_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterActorIter iter;
|
||||
ClutterActor *child;
|
||||
|
||||
clutter_actor_iter_init (&iter, self);
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
clutter_actor_paint (child);
|
||||
clutter_actor_paint (child, paint_context);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_pick (ClutterActor *self)
|
||||
clutter_stage_pick (ClutterActor *self,
|
||||
ClutterPickContext *pick_context)
|
||||
{
|
||||
ClutterActorIter iter;
|
||||
ClutterActor *child;
|
||||
@@ -985,7 +976,7 @@ clutter_stage_pick (ClutterActor *self)
|
||||
*/
|
||||
clutter_actor_iter_init (&iter, self);
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
clutter_actor_pick (child);
|
||||
clutter_actor_pick (child, pick_context);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -1638,24 +1629,25 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
|
||||
{
|
||||
ClutterMainContext *context = _clutter_context_get_default ();
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
CoglFramebuffer *fb = clutter_stage_view_get_framebuffer (view);
|
||||
int i;
|
||||
|
||||
g_assert (context->pick_mode == CLUTTER_PICK_NONE);
|
||||
|
||||
if (mode != priv->cached_pick_mode)
|
||||
{
|
||||
ClutterPickContext *pick_context;
|
||||
|
||||
_clutter_stage_clear_pick_stack (stage);
|
||||
|
||||
cogl_push_framebuffer (fb);
|
||||
pick_context = clutter_pick_context_new_for_view (view);
|
||||
|
||||
context->pick_mode = mode;
|
||||
setup_view_for_pick_or_paint (stage, view, NULL);
|
||||
clutter_actor_pick (CLUTTER_ACTOR (stage));
|
||||
clutter_actor_pick (CLUTTER_ACTOR (stage), pick_context);
|
||||
context->pick_mode = CLUTTER_PICK_NONE;
|
||||
priv->cached_pick_mode = mode;
|
||||
|
||||
cogl_pop_framebuffer ();
|
||||
clutter_pick_context_destroy (pick_context);
|
||||
|
||||
add_pick_stack_weak_refs (stage);
|
||||
}
|
||||
@@ -2165,6 +2157,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
/**
|
||||
* ClutterStage::after-paint:
|
||||
* @stage: the stage that received the event
|
||||
* @paint_Context: the paint context
|
||||
*
|
||||
* The ::after-paint signal is emitted after the stage is painted,
|
||||
* but before the results are displayed on the screen.
|
||||
@@ -2776,7 +2769,6 @@ clutter_stage_read_pixels (ClutterStage *stage,
|
||||
return NULL;
|
||||
|
||||
framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||
cogl_push_framebuffer (framebuffer);
|
||||
clutter_stage_do_paint_view (stage, view, &clip_rect);
|
||||
|
||||
view_scale = clutter_stage_view_get_scale (view);
|
||||
@@ -2791,8 +2783,6 @@ clutter_stage_read_pixels (ClutterStage *stage,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888,
|
||||
pixels);
|
||||
|
||||
cogl_pop_framebuffer ();
|
||||
|
||||
return pixels;
|
||||
}
|
||||
|
||||
@@ -4012,18 +4002,6 @@ clutter_stage_get_motion_events_enabled (ClutterStage *stage)
|
||||
return stage->priv->motion_events_enabled;
|
||||
}
|
||||
|
||||
/* NB: The presumption shouldn't be that a stage can't be comprised
|
||||
* of multiple internal framebuffers, so instead of simply naming
|
||||
* this function _clutter_stage_get_framebuffer(), the "active"
|
||||
* infix is intended to clarify that it gets the framebuffer that
|
||||
* is currently in use/being painted.
|
||||
*/
|
||||
CoglFramebuffer *
|
||||
_clutter_stage_get_active_framebuffer (ClutterStage *stage)
|
||||
{
|
||||
return stage->priv->active_framebuffer;
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_stage_add_pointer_drag_actor (ClutterStage *stage,
|
||||
ClutterInputDevice *device,
|
||||
@@ -4433,7 +4411,6 @@ capture_view_into (ClutterStage *stage,
|
||||
|
||||
if (paint)
|
||||
{
|
||||
cogl_push_framebuffer (framebuffer);
|
||||
_clutter_stage_maybe_setup_viewport (stage, view);
|
||||
clutter_stage_do_paint_view (stage, view, rect);
|
||||
}
|
||||
@@ -4458,9 +4435,6 @@ capture_view_into (ClutterStage *stage,
|
||||
COGL_READ_PIXELS_COLOR_BUFFER,
|
||||
bitmap);
|
||||
|
||||
if (paint)
|
||||
cogl_pop_framebuffer ();
|
||||
|
||||
cogl_object_unref (bitmap);
|
||||
}
|
||||
|
||||
|
@@ -1991,7 +1991,7 @@ selection_paint (ClutterText *self,
|
||||
color->blue,
|
||||
paint_opacity * color->alpha / 255);
|
||||
|
||||
cogl_pango_render_layout (layout, priv->text_x, 0, &cogl_color, 0);
|
||||
cogl_pango_show_layout (fb, layout, priv->text_x, 0, &cogl_color);
|
||||
|
||||
cogl_framebuffer_pop_clip (fb);
|
||||
}
|
||||
@@ -2548,7 +2548,8 @@ clutter_text_compute_layout_offsets (ClutterText *self,
|
||||
#define TEXT_PADDING 2
|
||||
|
||||
static void
|
||||
clutter_text_paint (ClutterActor *self)
|
||||
clutter_text_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (self);
|
||||
ClutterTextPrivate *priv = text->priv;
|
||||
@@ -2566,7 +2567,7 @@ clutter_text_paint (ClutterActor *self)
|
||||
float alloc_height;
|
||||
float resource_scale;
|
||||
|
||||
fb = cogl_get_draw_framebuffer ();
|
||||
fb = clutter_paint_context_get_framebuffer (paint_context);
|
||||
|
||||
/* Note that if anything in this paint method changes it needs to be
|
||||
reflected in the get_paint_volume implementation which is tightly
|
||||
@@ -2754,7 +2755,7 @@ clutter_text_paint (ClutterActor *self)
|
||||
priv->text_color.green,
|
||||
priv->text_color.blue,
|
||||
real_opacity);
|
||||
cogl_pango_render_layout (layout, priv->text_x, priv->text_y, &color, 0);
|
||||
cogl_pango_show_layout (fb, layout, priv->text_x, priv->text_y, &color);
|
||||
|
||||
selection_paint (text, fb);
|
||||
|
||||
|
@@ -1038,15 +1038,15 @@ clutter_timeline_do_frame (ClutterTimeline *timeline)
|
||||
* to correpondingly reduce elapsed_time_delta to reflect the correct
|
||||
* range of times */
|
||||
if (priv->direction == CLUTTER_TIMELINE_FORWARD)
|
||||
{
|
||||
elapsed_time_delta -= (priv->elapsed_time - priv->duration);
|
||||
priv->elapsed_time = priv->duration;
|
||||
}
|
||||
{
|
||||
elapsed_time_delta -= (priv->elapsed_time - priv->duration);
|
||||
priv->elapsed_time = priv->duration;
|
||||
}
|
||||
else if (priv->direction == CLUTTER_TIMELINE_BACKWARD)
|
||||
{
|
||||
elapsed_time_delta -= - priv->elapsed_time;
|
||||
priv->elapsed_time = 0;
|
||||
}
|
||||
{
|
||||
elapsed_time_delta -= - priv->elapsed_time;
|
||||
priv->elapsed_time = 0;
|
||||
}
|
||||
|
||||
end_msecs = priv->elapsed_time;
|
||||
|
||||
@@ -1756,12 +1756,12 @@ _clutter_timeline_do_tick (ClutterTimeline *timeline,
|
||||
}
|
||||
|
||||
if (msecs != 0)
|
||||
{
|
||||
/* Avoid accumulating error */
|
||||
{
|
||||
/* Avoid accumulating error */
|
||||
priv->last_frame_time += msecs;
|
||||
priv->msecs_delta = msecs;
|
||||
clutter_timeline_do_frame (timeline);
|
||||
}
|
||||
priv->msecs_delta = msecs;
|
||||
clutter_timeline_do_frame (timeline);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -869,7 +869,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
}
|
||||
}
|
||||
|
||||
cogl_push_framebuffer (fb);
|
||||
if (use_clipped_redraw && clip_region_empty)
|
||||
{
|
||||
CLUTTER_NOTE (CLIPPING, "Empty stage output paint\n");
|
||||
@@ -960,7 +959,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
cairo_region_destroy (view_region);
|
||||
}
|
||||
}
|
||||
cogl_pop_framebuffer ();
|
||||
|
||||
cairo_region_get_extents (redraw_clip, &redraw_rect);
|
||||
|
||||
|
@@ -5,12 +5,6 @@
|
||||
#include <clutter/clutter-backend.h>
|
||||
#include <clutter/clutter-stage.h>
|
||||
|
||||
#ifdef COGL_HAS_X11_SUPPORT
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xutil.h>
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-stage-window.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@@ -277,28 +277,30 @@ clutter_container_iface_init (ClutterContainerIface *iface)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_group_real_paint (ClutterActor *actor)
|
||||
clutter_group_real_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv;
|
||||
|
||||
CLUTTER_NOTE (PAINT, "ClutterGroup paint enter '%s'",
|
||||
_clutter_actor_get_debug_name (actor));
|
||||
|
||||
g_list_foreach (priv->children, (GFunc) clutter_actor_paint, NULL);
|
||||
g_list_foreach (priv->children, (GFunc) clutter_actor_paint, paint_context);
|
||||
|
||||
CLUTTER_NOTE (PAINT, "ClutterGroup paint leave '%s'",
|
||||
_clutter_actor_get_debug_name (actor));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_group_real_pick (ClutterActor *actor)
|
||||
clutter_group_real_pick (ClutterActor *actor,
|
||||
ClutterPickContext *pick_context)
|
||||
{
|
||||
ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv;
|
||||
|
||||
/* Chain up so we get a bounding box pained (if we are reactive) */
|
||||
CLUTTER_ACTOR_CLASS (clutter_group_parent_class)->pick (actor);
|
||||
CLUTTER_ACTOR_CLASS (clutter_group_parent_class)->pick (actor, pick_context);
|
||||
|
||||
g_list_foreach (priv->children, (GFunc) clutter_actor_pick, NULL);
|
||||
g_list_foreach (priv->children, (GFunc) clutter_actor_pick, pick_context);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -78,10 +78,12 @@ static const ClutterColor default_border_color = { 0, 0, 0, 255 };
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterRectangle, clutter_rectangle, CLUTTER_TYPE_ACTOR)
|
||||
|
||||
static void
|
||||
clutter_rectangle_paint (ClutterActor *self)
|
||||
clutter_rectangle_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterRectanglePrivate *priv = CLUTTER_RECTANGLE (self)->priv;
|
||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
static CoglPipeline *default_color_pipeline = NULL;
|
||||
CoglPipeline *content_pipeline;
|
||||
ClutterActorBox alloc;
|
||||
|
@@ -37,12 +37,6 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xutil.h>
|
||||
#endif
|
||||
|
||||
#include "clutter-egl-headers.h"
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
|
@@ -58,11 +58,13 @@ clutter_headers = [
|
||||
'clutter-mutter.h',
|
||||
'clutter-offscreen-effect.h',
|
||||
'clutter-page-turn-effect.h',
|
||||
'clutter-paint-context.h',
|
||||
'clutter-paint-nodes.h',
|
||||
'clutter-paint-node.h',
|
||||
'clutter-pan-action.h',
|
||||
'clutter-path-constraint.h',
|
||||
'clutter-path.h',
|
||||
'clutter-pick-context.h',
|
||||
'clutter-property-transition.h',
|
||||
'clutter-rotate-action.h',
|
||||
'clutter-script.h',
|
||||
@@ -146,11 +148,13 @@ clutter_sources = [
|
||||
'clutter-master-clock-default.c',
|
||||
'clutter-offscreen-effect.c',
|
||||
'clutter-page-turn-effect.c',
|
||||
'clutter-paint-context.c',
|
||||
'clutter-paint-nodes.c',
|
||||
'clutter-paint-node.c',
|
||||
'clutter-pan-action.c',
|
||||
'clutter-path-constraint.c',
|
||||
'clutter-path.c',
|
||||
'clutter-pick-context.c',
|
||||
'clutter-property-transition.c',
|
||||
'clutter-rotate-action.c',
|
||||
'clutter-script.c',
|
||||
@@ -200,6 +204,7 @@ clutter_private_headers = [
|
||||
'clutter-master-clock.h',
|
||||
'clutter-master-clock-default.h',
|
||||
'clutter-offscreen-effect-private.h',
|
||||
'clutter-paint-context-private.h',
|
||||
'clutter-paint-node-private.h',
|
||||
'clutter-paint-volume-private.h',
|
||||
'clutter-private.h',
|
||||
|
@@ -454,34 +454,6 @@ cogl_pango_show_layout (CoglFramebuffer *fb,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cogl_pango_render_layout_subpixel (PangoLayout *layout,
|
||||
int x,
|
||||
int y,
|
||||
const CoglColor *color,
|
||||
int flags)
|
||||
{
|
||||
cogl_pango_show_layout (cogl_get_draw_framebuffer (),
|
||||
layout,
|
||||
x / (float) PANGO_SCALE,
|
||||
y / (float) PANGO_SCALE,
|
||||
color);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_pango_render_layout (PangoLayout *layout,
|
||||
int x,
|
||||
int y,
|
||||
const CoglColor *color,
|
||||
int flags)
|
||||
{
|
||||
cogl_pango_render_layout_subpixel (layout,
|
||||
x * PANGO_SCALE,
|
||||
y * PANGO_SCALE,
|
||||
color,
|
||||
flags);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_pango_show_layout_line (CoglFramebuffer *fb,
|
||||
PangoLayoutLine *line,
|
||||
@@ -519,19 +491,6 @@ cogl_pango_show_layout_line (CoglFramebuffer *fb,
|
||||
priv->display_list = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_pango_render_layout_line (PangoLayoutLine *line,
|
||||
int x,
|
||||
int y,
|
||||
const CoglColor *color)
|
||||
{
|
||||
cogl_pango_show_layout_line (cogl_get_draw_framebuffer (),
|
||||
line,
|
||||
x / (float) PANGO_SCALE,
|
||||
y / (float) PANGO_SCALE,
|
||||
color);
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_pango_renderer_clear_glyph_cache (CoglPangoRenderer *renderer)
|
||||
{
|
||||
|
@@ -229,71 +229,6 @@ typedef struct _CoglPangoRendererClass CoglPangoRendererClass;
|
||||
|
||||
GType cogl_pango_renderer_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/**
|
||||
* cogl_pango_render_layout_subpixel:
|
||||
* @layout: a #PangoLayout
|
||||
* @x: X coordinate (in Pango units) to render the layout at
|
||||
* @y: Y coordinate (in Pango units) to render the layout at
|
||||
* @color: color to use when rendering the layout
|
||||
* @flags:
|
||||
*
|
||||
* Draws a solidly coloured @layout on the given @framebuffer at (@x,
|
||||
* @y) within the @framebuffer<!-- -->'s current model-view coordinate
|
||||
* space.
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.16: Use cogl_pango_show_layout() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_pango_show_layout)
|
||||
void
|
||||
cogl_pango_render_layout_subpixel (PangoLayout *layout,
|
||||
int x,
|
||||
int y,
|
||||
const CoglColor *color,
|
||||
int flags);
|
||||
|
||||
/**
|
||||
* cogl_pango_render_layout:
|
||||
* @layout: a #PangoLayout
|
||||
* @x: X coordinate to render the layout at
|
||||
* @y: Y coordinate to render the layout at
|
||||
* @color: color to use when rendering the layout
|
||||
* @flags:
|
||||
*
|
||||
* Draws a solidly coloured @layout on the given @framebuffer at (@x,
|
||||
* @y) within the @framebuffer<!-- -->'s current model-view coordinate
|
||||
* space.
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.16: Use cogl_pango_show_layout() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_pango_show_layout)
|
||||
void
|
||||
cogl_pango_render_layout (PangoLayout *layout,
|
||||
int x,
|
||||
int y,
|
||||
const CoglColor *color,
|
||||
int flags);
|
||||
|
||||
/**
|
||||
* cogl_pango_render_layout_line:
|
||||
* @line: a #PangoLayoutLine
|
||||
* @x: X coordinate to render the line at
|
||||
* @y: Y coordinate to render the line at
|
||||
* @color: color to use when rendering the line
|
||||
*
|
||||
* Renders @line at the given coordinates using the given color.
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.16: Use cogl_pango_show_layout() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_pango_show_layout_line)
|
||||
void
|
||||
cogl_pango_render_layout_line (PangoLayoutLine *line,
|
||||
int x,
|
||||
int y,
|
||||
const CoglColor *color);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_PANGO_H__ */
|
||||
|
@@ -7,6 +7,3 @@ cogl_pango_font_map_new
|
||||
cogl_pango_font_map_set_resolution
|
||||
cogl_pango_font_map_set_use_mipmapping
|
||||
cogl_pango_renderer_get_type
|
||||
cogl_pango_render_layout
|
||||
cogl_pango_render_layout_line
|
||||
cogl_pango_render_layout_subpixel
|
||||
|
@@ -422,26 +422,6 @@ cogl_path_set_fill_rule (CoglPath *path, CoglPathFillRule fill_rule);
|
||||
CoglPathFillRule
|
||||
cogl_path_get_fill_rule (CoglPath *path);
|
||||
|
||||
#define cogl_path_fill cogl2_path_fill
|
||||
/**
|
||||
* cogl_path_fill:
|
||||
*
|
||||
* Fills the interior of the constructed shape using the current
|
||||
* drawing color.
|
||||
*
|
||||
* The interior of the shape is determined using the fill rule of the
|
||||
* path. See %CoglPathFillRule for details.
|
||||
*
|
||||
* <note>The result of referencing sliced textures in your current
|
||||
* pipeline when filling a path are undefined. You should pass
|
||||
* the %COGL_TEXTURE_NO_SLICING flag when loading any texture you will
|
||||
* use while filling a path.</note>
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_fill (CoglPath *path);
|
||||
|
||||
/**
|
||||
* cogl_framebuffer_fill_path:
|
||||
* @framebuffer: A #CoglFramebuffer
|
||||
@@ -466,19 +446,6 @@ cogl_framebuffer_fill_path (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglPath *path);
|
||||
|
||||
#define cogl_path_stroke cogl2_path_stroke
|
||||
/**
|
||||
* cogl_path_stroke:
|
||||
*
|
||||
* Strokes the constructed shape using the current drawing color and a
|
||||
* width of 1 pixel (regardless of the current transformation
|
||||
* matrix).
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_stroke (CoglPath *path);
|
||||
|
||||
/**
|
||||
* cogl_framebuffer_stroke_path:
|
||||
* @framebuffer: A #CoglFramebuffer
|
||||
@@ -513,22 +480,6 @@ void
|
||||
cogl_framebuffer_push_path_clip (CoglFramebuffer *framebuffer,
|
||||
CoglPath *path);
|
||||
|
||||
#define cogl_clip_push_from_path cogl2_clip_push_from_path
|
||||
/**
|
||||
* cogl_clip_push_from_path:
|
||||
* @path: The path to clip with.
|
||||
*
|
||||
* Sets a new clipping area using the silhouette of the specified,
|
||||
* filled @path. The clipping area is intersected with the previous
|
||||
* clipping area. To restore the previous clipping area, call
|
||||
* call cogl_clip_pop().
|
||||
*
|
||||
* Since: 1.8
|
||||
* Stability: Unstable
|
||||
*/
|
||||
void
|
||||
cogl_clip_push_from_path (CoglPath *path);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_PATH_FUNCTIONS_H__ */
|
||||
|
@@ -385,38 +385,6 @@ _cogl_path_fill_nodes (CoglPath *path,
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: Update to the protoype used in the Cogl master branch.
|
||||
* This is experimental API but not in sync with the cogl_path_fill()
|
||||
* api in Cogl master which takes explicit framebuffer and pipeline
|
||||
* arguments */
|
||||
void
|
||||
cogl2_path_fill (CoglPath *path)
|
||||
{
|
||||
g_return_if_fail (cogl_is_path (path));
|
||||
|
||||
_cogl_path_fill_nodes (path,
|
||||
cogl_get_draw_framebuffer (),
|
||||
cogl_get_source (),
|
||||
0 /* flags */);
|
||||
}
|
||||
|
||||
/* TODO: Update to the protoype used in the Cogl master branch.
|
||||
* This is experimental API but not in sync with the cogl_path_fill()
|
||||
* api in Cogl master which takes explicit framebuffer and pipeline
|
||||
* arguments */
|
||||
void
|
||||
cogl2_path_stroke (CoglPath *path)
|
||||
{
|
||||
g_return_if_fail (cogl_is_path (path));
|
||||
|
||||
if (path->data->path_nodes->len == 0)
|
||||
return;
|
||||
|
||||
_cogl_path_stroke_nodes (path,
|
||||
cogl_get_draw_framebuffer (),
|
||||
cogl_get_source ());
|
||||
}
|
||||
|
||||
void
|
||||
cogl2_path_move_to (CoglPath *path,
|
||||
float x,
|
||||
@@ -1504,12 +1472,6 @@ cogl_framebuffer_push_path_clip (CoglFramebuffer *framebuffer,
|
||||
COGL_FRAMEBUFFER_STATE_CLIP;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_clip_push_from_path (CoglPath *path)
|
||||
{
|
||||
cogl_framebuffer_push_path_clip (cogl_get_draw_framebuffer (), path);
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_path_build_stroke_attribute_buffer (CoglPath *path)
|
||||
{
|
||||
|
@@ -90,17 +90,16 @@ typedef enum
|
||||
COGL_DRAW_SKIP_JOURNAL_FLUSH = 1 << 0,
|
||||
COGL_DRAW_SKIP_PIPELINE_VALIDATION = 1 << 1,
|
||||
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH = 1 << 2,
|
||||
COGL_DRAW_SKIP_LEGACY_STATE = 1 << 3,
|
||||
/* By default the vertex attribute drawing code will assume that if
|
||||
there is a color attribute array enabled then we can't determine
|
||||
if the colors will be opaque so we need to enabling
|
||||
blending. However when drawing from the journal we know what the
|
||||
contents of the color array is so we can override this by passing
|
||||
this flag. */
|
||||
COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE = 1 << 4,
|
||||
COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE = 1 << 3,
|
||||
/* This forcibly disables the debug option to divert all drawing to
|
||||
* wireframes */
|
||||
COGL_DRAW_SKIP_DEBUG_WIREFRAME = 1 << 5
|
||||
COGL_DRAW_SKIP_DEBUG_WIREFRAME = 1 << 4
|
||||
} CoglDrawFlags;
|
||||
|
||||
/* During CoglContext initialization we register the "cogl_color_in"
|
||||
|
@@ -650,15 +650,6 @@ _cogl_flush_attributes_state (CoglFramebuffer *framebuffer,
|
||||
* when the framebuffer really does get drawn to. */
|
||||
_cogl_framebuffer_mark_clear_clip_dirty (framebuffer);
|
||||
|
||||
if (G_UNLIKELY (!(flags & COGL_DRAW_SKIP_LEGACY_STATE)) &&
|
||||
G_UNLIKELY (ctx->legacy_state_set) &&
|
||||
_cogl_get_enable_legacy_state ())
|
||||
{
|
||||
copy = cogl_pipeline_copy (pipeline);
|
||||
pipeline = copy;
|
||||
_cogl_pipeline_apply_legacy_state (pipeline);
|
||||
}
|
||||
|
||||
ctx->driver_vtable->flush_attributes_state (framebuffer,
|
||||
pipeline,
|
||||
&layers_state,
|
||||
|
@@ -36,7 +36,6 @@
|
||||
#include <glib.h>
|
||||
|
||||
#include "cogl-clip-stack.h"
|
||||
#include "cogl-primitives.h"
|
||||
#include "cogl-context-private.h"
|
||||
#include "cogl-framebuffer-private.h"
|
||||
#include "cogl-journal-private.h"
|
||||
|
@@ -34,12 +34,7 @@
|
||||
#include "cogl-context.h"
|
||||
#include "cogl-flags.h"
|
||||
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
#include "cogl-xlib-private.h"
|
||||
#endif
|
||||
|
||||
#include "cogl-display-private.h"
|
||||
#include "cogl-primitives.h"
|
||||
#include "cogl-clip-stack.h"
|
||||
#include "cogl-matrix-stack.h"
|
||||
#include "cogl-pipeline-private.h"
|
||||
@@ -146,16 +141,12 @@ struct _CoglContext
|
||||
GArray *texture_units;
|
||||
int active_texture_unit;
|
||||
|
||||
/* Pipelines */
|
||||
CoglPipeline *opaque_color_pipeline; /* used for set_source_color */
|
||||
CoglPipeline *blended_color_pipeline; /* used for set_source_color */
|
||||
CoglPipeline *texture_pipeline; /* used for set_source_texture */
|
||||
/* Only used for comparing other pipelines when reading pixels. */
|
||||
CoglPipeline *opaque_color_pipeline;
|
||||
|
||||
GString *codegen_header_buffer;
|
||||
GString *codegen_source_buffer;
|
||||
GString *codegen_boilerplate_buffer;
|
||||
GList *source_stack;
|
||||
|
||||
int legacy_state_set;
|
||||
|
||||
CoglPipelineCache *pipeline_cache;
|
||||
|
||||
@@ -192,8 +183,6 @@ struct _CoglContext
|
||||
CoglBuffer *current_buffer[COGL_BUFFER_BIND_TARGET_COUNT];
|
||||
|
||||
/* Framebuffers */
|
||||
GSList *framebuffer_stack;
|
||||
CoglFramebuffer *window_buffer;
|
||||
unsigned long current_draw_buffer_state_flushed;
|
||||
unsigned long current_draw_buffer_changes;
|
||||
CoglFramebuffer *current_draw_buffer;
|
||||
@@ -280,18 +269,6 @@ struct _CoglContext
|
||||
|
||||
CoglSamplerCache *sampler_cache;
|
||||
|
||||
/* FIXME: remove these when we remove the last xlib based clutter
|
||||
* backend. they should be tracked as part of the renderer but e.g.
|
||||
* the eglx backend doesn't yet have a corresponding Cogl winsys
|
||||
* and so we wont have a renderer in that case. */
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
/* List of callback functions that will be given every Xlib event */
|
||||
GSList *event_filters;
|
||||
/* Current top of the XError trap state stack. The actual memory for
|
||||
these is expected to be allocated on the stack by the caller */
|
||||
CoglXlibTrapState *trap_state;
|
||||
#endif
|
||||
|
||||
unsigned long winsys_features
|
||||
[COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_WINSYS_FEATURE_N_FEATURES)];
|
||||
void *winsys;
|
||||
|
@@ -47,8 +47,6 @@
|
||||
#include "cogl1-context.h"
|
||||
#include "cogl-gpu-info-private.h"
|
||||
#include "cogl-gtype-private.h"
|
||||
#include "driver/gl/cogl-pipeline-opengl-private.h"
|
||||
#include "driver/gl/cogl-util-gl-private.h"
|
||||
#include "winsys/cogl-winsys-private.h"
|
||||
|
||||
#include <string.h>
|
||||
@@ -104,6 +102,12 @@ _cogl_context_get_winsys (CoglContext *context)
|
||||
return context->display->renderer->winsys_vtable;
|
||||
}
|
||||
|
||||
static const CoglDriverVtable *
|
||||
_cogl_context_get_driver (CoglContext *context)
|
||||
{
|
||||
return context->driver_vtable;
|
||||
}
|
||||
|
||||
/* For reference: There was some deliberation over whether to have a
|
||||
* constructor that could throw an exception but looking at standard
|
||||
* practices with several high level OO languages including python, C++,
|
||||
@@ -207,6 +211,13 @@ cogl_context_new (CoglDisplay *display,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!context->driver_vtable->context_init (context, error))
|
||||
{
|
||||
cogl_object_unref (display);
|
||||
g_free (context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
context->attribute_name_states_hash =
|
||||
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
||||
context->attribute_name_index_map = NULL;
|
||||
@@ -243,26 +254,11 @@ cogl_context_new (CoglDisplay *display,
|
||||
|
||||
context->flushed_matrix_mode = COGL_MATRIX_MODELVIEW;
|
||||
|
||||
context->texture_units =
|
||||
g_array_new (FALSE, FALSE, sizeof (CoglTextureUnit));
|
||||
|
||||
if (_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_ANY_GL))
|
||||
{
|
||||
/* See cogl-pipeline.c for more details about why we leave texture unit 1
|
||||
* active by default... */
|
||||
context->active_texture_unit = 1;
|
||||
GE (context, glActiveTexture (GL_TEXTURE1));
|
||||
}
|
||||
|
||||
context->opaque_color_pipeline = cogl_pipeline_new (context);
|
||||
context->blended_color_pipeline = cogl_pipeline_new (context);
|
||||
context->texture_pipeline = cogl_pipeline_new (context);
|
||||
|
||||
context->codegen_header_buffer = g_string_new ("");
|
||||
context->codegen_source_buffer = g_string_new ("");
|
||||
context->codegen_boilerplate_buffer = g_string_new ("");
|
||||
context->source_stack = NULL;
|
||||
|
||||
context->legacy_state_set = 0;
|
||||
|
||||
context->default_gl_texture_2d_tex = NULL;
|
||||
|
||||
@@ -318,9 +314,6 @@ cogl_context_new (CoglDisplay *display,
|
||||
for (i = 0; i < COGL_BUFFER_BIND_TARGET_COUNT; i++)
|
||||
context->current_buffer[i] = NULL;
|
||||
|
||||
context->window_buffer = NULL;
|
||||
context->framebuffer_stack = _cogl_create_framebuffer_stack ();
|
||||
|
||||
context->current_path = NULL;
|
||||
context->stencil_pipeline = cogl_pipeline_new (context);
|
||||
|
||||
@@ -335,31 +328,6 @@ cogl_context_new (CoglDisplay *display,
|
||||
context->texture_download_pipeline = NULL;
|
||||
context->blit_texture_pipeline = NULL;
|
||||
|
||||
#ifdef HAVE_COGL_GL
|
||||
if (_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_ALPHA_TEST))
|
||||
/* The default for GL_ALPHA_TEST is to always pass which is equivalent to
|
||||
* the test being disabled therefore we assume that for all drivers there
|
||||
* will be no performance impact if we always leave the test enabled which
|
||||
* makes things a bit simpler for us. Under GLES2 the alpha test is
|
||||
* implemented in the fragment shader so there is no enable for it
|
||||
*/
|
||||
GE (context, glEnable (GL_ALPHA_TEST));
|
||||
|
||||
if (context->driver == COGL_DRIVER_GL3)
|
||||
{
|
||||
GLuint vertex_array;
|
||||
|
||||
/* In a forward compatible context, GL 3 doesn't support rendering
|
||||
* using the default vertex array object. Cogl doesn't use vertex
|
||||
* array objects yet so for now we just create a dummy array
|
||||
* object that we will use as our own default object. Eventually
|
||||
* it could be good to attach the vertex array objects to
|
||||
* CoglPrimitives */
|
||||
context->glGenVertexArrays (1, &vertex_array);
|
||||
context->glBindVertexArray (vertex_array);
|
||||
}
|
||||
#endif
|
||||
|
||||
context->current_modelview_entry = NULL;
|
||||
context->current_projection_entry = NULL;
|
||||
_cogl_matrix_entry_identity_init (&context->identity_entry);
|
||||
@@ -375,24 +343,12 @@ cogl_context_new (CoglDisplay *display,
|
||||
white_pixel,
|
||||
NULL); /* abort on error */
|
||||
|
||||
cogl_push_source (context->opaque_color_pipeline);
|
||||
|
||||
context->atlases = NULL;
|
||||
g_hook_list_init (&context->atlas_reorganize_callbacks, sizeof (GHook));
|
||||
|
||||
context->buffer_map_fallback_array = g_byte_array_new ();
|
||||
context->buffer_map_fallback_in_use = FALSE;
|
||||
|
||||
/* As far as I can tell, GL_POINT_SPRITE doesn't have any effect
|
||||
unless GL_COORD_REPLACE is enabled for an individual layer.
|
||||
Therefore it seems like it should be ok to just leave it enabled
|
||||
all the time instead of having to have a set property on each
|
||||
pipeline to track whether any layers have point sprite coords
|
||||
enabled. We don't need to do this for GL3 or GLES2 because point
|
||||
sprites are handled using a builtin varying in the shader. */
|
||||
if (_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_GL_FIXED))
|
||||
GE (context, glEnable (GL_POINT_SPRITE));
|
||||
|
||||
_cogl_list_init (&context->fences);
|
||||
|
||||
return context;
|
||||
@@ -402,11 +358,10 @@ static void
|
||||
_cogl_context_free (CoglContext *context)
|
||||
{
|
||||
const CoglWinsysVtable *winsys = _cogl_context_get_winsys (context);
|
||||
const CoglDriverVtable *driver = _cogl_context_get_driver (context);
|
||||
|
||||
winsys->context_deinit (context);
|
||||
|
||||
_cogl_free_framebuffer_stack (context->framebuffer_stack);
|
||||
|
||||
if (context->current_path)
|
||||
cogl_object_unref (context->current_path);
|
||||
|
||||
@@ -415,10 +370,6 @@ _cogl_context_free (CoglContext *context)
|
||||
|
||||
if (context->opaque_color_pipeline)
|
||||
cogl_object_unref (context->opaque_color_pipeline);
|
||||
if (context->blended_color_pipeline)
|
||||
cogl_object_unref (context->blended_color_pipeline);
|
||||
if (context->texture_pipeline)
|
||||
cogl_object_unref (context->texture_pipeline);
|
||||
|
||||
if (context->blit_texture_pipeline)
|
||||
cogl_object_unref (context->blit_texture_pipeline);
|
||||
@@ -479,8 +430,6 @@ _cogl_context_free (CoglContext *context)
|
||||
|
||||
_cogl_sampler_cache_free (context->sampler_cache);
|
||||
|
||||
_cogl_destroy_texture_units ();
|
||||
|
||||
g_ptr_array_free (context->uniform_names, TRUE);
|
||||
g_hash_table_destroy (context->uniform_name_hash);
|
||||
|
||||
@@ -489,6 +438,8 @@ _cogl_context_free (CoglContext *context)
|
||||
|
||||
g_byte_array_free (context->buffer_map_fallback_array, TRUE);
|
||||
|
||||
driver->context_deinit (context);
|
||||
|
||||
cogl_object_unref (context->display);
|
||||
|
||||
g_free (context);
|
||||
|
@@ -102,7 +102,7 @@ G_BEGIN_DECLS
|
||||
GType cogl_context_get_gtype (void);
|
||||
|
||||
/**
|
||||
* cogl_context_new: (constructor)
|
||||
* cogl_context_new: (constructor) (skip)
|
||||
* @display: (allow-none): A #CoglDisplay pointer
|
||||
* @error: A GError return location.
|
||||
*
|
||||
@@ -118,7 +118,7 @@ cogl_context_new (CoglDisplay *display,
|
||||
GError **error);
|
||||
|
||||
/**
|
||||
* cogl_context_get_display:
|
||||
* cogl_context_get_display: (skip)
|
||||
* @context: A #CoglContext pointer
|
||||
*
|
||||
* Retrieves the #CoglDisplay that is internally associated with the
|
||||
@@ -136,7 +136,7 @@ CoglDisplay *
|
||||
cogl_context_get_display (CoglContext *context);
|
||||
|
||||
/**
|
||||
* cogl_context_get_renderer:
|
||||
* cogl_context_get_renderer: (skip)
|
||||
* @context: A #CoglContext pointer
|
||||
*
|
||||
* Retrieves the #CoglRenderer that is internally associated with the
|
||||
|
@@ -40,6 +40,12 @@ typedef struct _CoglDriverVtable CoglDriverVtable;
|
||||
|
||||
struct _CoglDriverVtable
|
||||
{
|
||||
gboolean
|
||||
(* context_init) (CoglContext *context, GError **error);
|
||||
|
||||
void
|
||||
(* context_deinit) (CoglContext *context);
|
||||
|
||||
/* TODO: factor this out since this is OpenGL specific and
|
||||
* so can be ignored by non-OpenGL drivers. */
|
||||
gboolean
|
||||
|
@@ -41,15 +41,6 @@
|
||||
#include "cogl-gl-header.h"
|
||||
#include "cogl-clip-stack.h"
|
||||
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef COGL_HAS_GLX_SUPPORT
|
||||
#include <GL/glx.h>
|
||||
#include <GL/glxext.h>
|
||||
#endif
|
||||
|
||||
typedef enum _CoglFramebufferType {
|
||||
COGL_FRAMEBUFFER_TYPE_ONSCREEN,
|
||||
COGL_FRAMEBUFFER_TYPE_OFFSCREEN
|
||||
@@ -341,21 +332,6 @@ _cogl_offscreen_new_with_texture_full (CoglTexture *texture,
|
||||
CoglOffscreenFlags create_flags,
|
||||
int level);
|
||||
|
||||
/*
|
||||
* _cogl_push_framebuffers:
|
||||
* @draw_buffer: A pointer to the buffer used for drawing
|
||||
* @read_buffer: A pointer to the buffer used for reading back pixels
|
||||
*
|
||||
* Redirects drawing and reading to the specified framebuffers as in
|
||||
* cogl_push_framebuffer() except that it allows the draw and read
|
||||
* buffer to be different. The buffers are pushed as a pair so that
|
||||
* they can later both be restored with a single call to
|
||||
* cogl_pop_framebuffer().
|
||||
*/
|
||||
void
|
||||
_cogl_push_framebuffers (CoglFramebuffer *draw_buffer,
|
||||
CoglFramebuffer *read_buffer);
|
||||
|
||||
void
|
||||
_cogl_framebuffer_push_projection (CoglFramebuffer *framebuffer);
|
||||
|
||||
|
@@ -2172,8 +2172,7 @@ cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglPrimitive *primitive)
|
||||
{
|
||||
_cogl_primitive_draw (primitive, framebuffer, pipeline,
|
||||
COGL_DRAW_SKIP_LEGACY_STATE);
|
||||
_cogl_primitive_draw (primitive, framebuffer, pipeline, 0);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2199,8 +2198,7 @@ cogl_framebuffer_draw_rectangle (CoglFramebuffer *framebuffer,
|
||||
_cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
|
||||
pipeline,
|
||||
&rect,
|
||||
1,
|
||||
TRUE);
|
||||
1);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2231,8 +2229,7 @@ cogl_framebuffer_draw_textured_rectangle (CoglFramebuffer *framebuffer,
|
||||
_cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
|
||||
pipeline,
|
||||
&rect,
|
||||
1,
|
||||
TRUE);
|
||||
1);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2260,8 +2257,7 @@ cogl_framebuffer_draw_multitextured_rectangle (CoglFramebuffer *framebuffer,
|
||||
_cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
|
||||
pipeline,
|
||||
&rect,
|
||||
1,
|
||||
TRUE);
|
||||
1);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2290,8 +2286,7 @@ cogl_framebuffer_draw_rectangles (CoglFramebuffer *framebuffer,
|
||||
_cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
|
||||
pipeline,
|
||||
rects,
|
||||
n_rectangles,
|
||||
TRUE);
|
||||
n_rectangles);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2320,6 +2315,5 @@ cogl_framebuffer_draw_textured_rectangles (CoglFramebuffer *framebuffer,
|
||||
_cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
|
||||
pipeline,
|
||||
rects,
|
||||
n_rectangles,
|
||||
TRUE);
|
||||
n_rectangles);
|
||||
}
|
||||
|
@@ -987,7 +987,7 @@ cogl_framebuffer_resolve_samples_region (CoglFramebuffer *framebuffer,
|
||||
int height);
|
||||
|
||||
/**
|
||||
* cogl_framebuffer_get_context: (skip)
|
||||
* cogl_framebuffer_get_context:
|
||||
* @framebuffer: A #CoglFramebuffer
|
||||
*
|
||||
* Can be used to query the #CoglContext a given @framebuffer was
|
||||
@@ -1463,19 +1463,6 @@ cogl_framebuffer_read_pixels (CoglFramebuffer *framebuffer,
|
||||
CoglPixelFormat format,
|
||||
uint8_t *pixels);
|
||||
|
||||
/**
|
||||
* cogl_get_draw_framebuffer:
|
||||
*
|
||||
* Gets the current #CoglFramebuffer as set using
|
||||
* cogl_push_framebuffer()
|
||||
*
|
||||
* Return value: (transfer none): The current #CoglFramebuffer
|
||||
* Stability: unstable
|
||||
* Since: 1.8
|
||||
*/
|
||||
CoglFramebuffer *
|
||||
cogl_get_draw_framebuffer (void);
|
||||
|
||||
uint32_t
|
||||
cogl_framebuffer_error_quark (void);
|
||||
|
||||
|
@@ -76,7 +76,7 @@ G_BEGIN_DECLS
|
||||
* vertices multiple times.
|
||||
*
|
||||
* |[
|
||||
* CoglVertex2f quad_vertices[] = {
|
||||
* CoglVertexP2 quad_vertices[] = {
|
||||
* {x0, y0}, //0 = top left
|
||||
* {x1, y1}, //1 = bottom left
|
||||
* {x2, y2}, //2 = bottom right
|
||||
|
@@ -280,8 +280,7 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
|
||||
CoglAttribute **attributes;
|
||||
CoglDrawFlags draw_flags = (COGL_DRAW_SKIP_JOURNAL_FLUSH |
|
||||
COGL_DRAW_SKIP_PIPELINE_VALIDATION |
|
||||
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH |
|
||||
COGL_DRAW_SKIP_LEGACY_STATE);
|
||||
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
|
||||
|
||||
COGL_STATIC_TIMER (time_flush_modelview_and_entries,
|
||||
"flush: pipeline+entries", /* parent */
|
||||
|
@@ -42,10 +42,6 @@
|
||||
#include "cogl-poll-private.h"
|
||||
#include "cogl-gtype-private.h"
|
||||
|
||||
#ifdef COGL_HAS_X11_SUPPORT
|
||||
#include "cogl-xlib-renderer.h"
|
||||
#endif
|
||||
|
||||
static void _cogl_onscreen_free (CoglOnscreen *onscreen);
|
||||
|
||||
COGL_OBJECT_DEFINE_WITH_CODE_GTYPE (Onscreen, onscreen,
|
||||
@@ -161,9 +157,6 @@ _cogl_onscreen_free (CoglOnscreen *onscreen)
|
||||
cogl_object_unref (frame_info);
|
||||
g_queue_clear (&onscreen->pending_frame_infos);
|
||||
|
||||
if (framebuffer->context->window_buffer == COGL_FRAMEBUFFER (onscreen))
|
||||
framebuffer->context->window_buffer = NULL;
|
||||
|
||||
winsys->onscreen_deinit (onscreen);
|
||||
g_return_if_fail (onscreen->winsys == NULL);
|
||||
|
||||
|
@@ -193,27 +193,9 @@ dump_pipeline_cb (CoglNode *node, void *user_data)
|
||||
|
||||
if (pipeline->differences & COGL_PIPELINE_STATE_BLEND)
|
||||
{
|
||||
const char *blend_enable_name;
|
||||
|
||||
changes = TRUE;
|
||||
|
||||
switch (pipeline->blend_enable)
|
||||
{
|
||||
case COGL_PIPELINE_BLEND_ENABLE_AUTOMATIC:
|
||||
blend_enable_name = "AUTO";
|
||||
break;
|
||||
case COGL_PIPELINE_BLEND_ENABLE_ENABLED:
|
||||
blend_enable_name = "ENABLED";
|
||||
break;
|
||||
case COGL_PIPELINE_BLEND_ENABLE_DISABLED:
|
||||
blend_enable_name = "DISABLED";
|
||||
break;
|
||||
default:
|
||||
blend_enable_name = "UNKNOWN";
|
||||
}
|
||||
g_string_append_printf (changes_label,
|
||||
"\\lblend=%s\\n",
|
||||
blend_enable_name);
|
||||
"\\lblend\\n");
|
||||
}
|
||||
|
||||
if (pipeline->differences & COGL_PIPELINE_STATE_LAYERS)
|
||||
|
@@ -62,7 +62,6 @@ typedef enum
|
||||
{
|
||||
/* sparse state */
|
||||
COGL_PIPELINE_STATE_COLOR_INDEX,
|
||||
COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX,
|
||||
COGL_PIPELINE_STATE_LAYERS_INDEX,
|
||||
COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX,
|
||||
COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE_INDEX,
|
||||
@@ -99,8 +98,6 @@ typedef enum _CoglPipelineState
|
||||
{
|
||||
COGL_PIPELINE_STATE_COLOR =
|
||||
1L<<COGL_PIPELINE_STATE_COLOR_INDEX,
|
||||
COGL_PIPELINE_STATE_BLEND_ENABLE =
|
||||
1L<<COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX,
|
||||
COGL_PIPELINE_STATE_LAYERS =
|
||||
1L<<COGL_PIPELINE_STATE_LAYERS_INDEX,
|
||||
|
||||
@@ -147,7 +144,6 @@ typedef enum _CoglPipelineState
|
||||
|
||||
#define COGL_PIPELINE_STATE_AFFECTS_BLENDING \
|
||||
(COGL_PIPELINE_STATE_COLOR | \
|
||||
COGL_PIPELINE_STATE_BLEND_ENABLE | \
|
||||
COGL_PIPELINE_STATE_LAYERS | \
|
||||
COGL_PIPELINE_STATE_BLEND | \
|
||||
COGL_PIPELINE_STATE_USER_SHADER | \
|
||||
@@ -184,15 +180,6 @@ typedef struct
|
||||
float alpha_func_reference;
|
||||
} CoglPipelineAlphaFuncState;
|
||||
|
||||
typedef enum _CoglPipelineBlendEnable
|
||||
{
|
||||
/* XXX: we want to detect users mistakenly using TRUE or FALSE
|
||||
* so start the enum at 2. */
|
||||
COGL_PIPELINE_BLEND_ENABLE_ENABLED = 2,
|
||||
COGL_PIPELINE_BLEND_ENABLE_DISABLED,
|
||||
COGL_PIPELINE_BLEND_ENABLE_AUTOMATIC
|
||||
} CoglPipelineBlendEnable;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* Determines how this pipeline is blended with other primitives */
|
||||
@@ -367,13 +354,6 @@ struct _CoglPipeline
|
||||
/* Determines if pipeline->big_state is valid */
|
||||
unsigned int has_big_state:1;
|
||||
|
||||
/* By default blending is enabled automatically depending on the
|
||||
* unlit color, the lighting colors or the texture format. The user
|
||||
* can override this to explicitly enable or disable blending.
|
||||
*
|
||||
* This is a sparse property */
|
||||
unsigned int blend_enable:3;
|
||||
|
||||
/* There are many factors that can determine if we need to enable
|
||||
* blending, this holds our final decision */
|
||||
unsigned int real_blend_enable:1;
|
||||
@@ -774,13 +754,6 @@ void
|
||||
_cogl_pipeline_apply_overrides (CoglPipeline *pipeline,
|
||||
CoglPipelineFlushOptions *options);
|
||||
|
||||
CoglPipelineBlendEnable
|
||||
_cogl_pipeline_get_blend_enabled (CoglPipeline *pipeline);
|
||||
|
||||
void
|
||||
_cogl_pipeline_set_blend_enabled (CoglPipeline *pipeline,
|
||||
CoglPipelineBlendEnable enable);
|
||||
|
||||
#ifdef COGL_DEBUG_ENABLED
|
||||
void
|
||||
_cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline,
|
||||
|
@@ -108,10 +108,6 @@ void
|
||||
_cogl_pipeline_hash_color_state (CoglPipeline *authority,
|
||||
CoglPipelineHashState *state);
|
||||
|
||||
void
|
||||
_cogl_pipeline_hash_blend_enable_state (CoglPipeline *authority,
|
||||
CoglPipelineHashState *state);
|
||||
|
||||
void
|
||||
_cogl_pipeline_hash_layers_state (CoglPipeline *authority,
|
||||
CoglPipelineHashState *state);
|
||||
|
@@ -407,56 +407,6 @@ cogl_pipeline_set_color4f (CoglPipeline *pipeline,
|
||||
cogl_pipeline_set_color (pipeline, &color);
|
||||
}
|
||||
|
||||
CoglPipelineBlendEnable
|
||||
_cogl_pipeline_get_blend_enabled (CoglPipeline *pipeline)
|
||||
{
|
||||
CoglPipeline *authority;
|
||||
|
||||
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
|
||||
|
||||
authority =
|
||||
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_BLEND_ENABLE);
|
||||
return authority->blend_enable;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cogl_pipeline_blend_enable_equal (CoglPipeline *authority0,
|
||||
CoglPipeline *authority1)
|
||||
{
|
||||
return authority0->blend_enable == authority1->blend_enable ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_pipeline_set_blend_enabled (CoglPipeline *pipeline,
|
||||
CoglPipelineBlendEnable enable)
|
||||
{
|
||||
CoglPipelineState state = COGL_PIPELINE_STATE_BLEND_ENABLE;
|
||||
CoglPipeline *authority;
|
||||
|
||||
g_return_if_fail (cogl_is_pipeline (pipeline));
|
||||
g_return_if_fail (enable > 1 &&
|
||||
"don't pass TRUE or FALSE to _set_blend_enabled!");
|
||||
|
||||
authority = _cogl_pipeline_get_authority (pipeline, state);
|
||||
|
||||
if (authority->blend_enable == enable)
|
||||
return;
|
||||
|
||||
/* - Flush journal primitives referencing the current state.
|
||||
* - Make sure the pipeline has no dependants so it may be modified.
|
||||
* - If the pipeline isn't currently an authority for the state being
|
||||
* changed, then initialize that state from the current authority.
|
||||
*/
|
||||
_cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE);
|
||||
|
||||
pipeline->blend_enable = enable;
|
||||
|
||||
_cogl_pipeline_update_authority (pipeline, authority, state,
|
||||
_cogl_pipeline_blend_enable_equal);
|
||||
|
||||
pipeline->dirty_real_blend_enable = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_pipeline_set_alpha_test_function (CoglPipeline *pipeline,
|
||||
CoglPipelineAlphaFunc alpha_func)
|
||||
@@ -1379,14 +1329,6 @@ _cogl_pipeline_hash_color_state (CoglPipeline *authority,
|
||||
_COGL_COLOR_DATA_SIZE);
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_pipeline_hash_blend_enable_state (CoglPipeline *authority,
|
||||
CoglPipelineHashState *state)
|
||||
{
|
||||
uint8_t blend_enable = authority->blend_enable;
|
||||
state->hash = _cogl_util_one_at_a_time_hash (state->hash, &blend_enable, 1);
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_pipeline_hash_alpha_func_state (CoglPipeline *authority,
|
||||
CoglPipelineHashState *state)
|
||||
|
@@ -104,7 +104,6 @@ _cogl_pipeline_init_default_pipeline (void)
|
||||
|
||||
pipeline->real_blend_enable = FALSE;
|
||||
|
||||
pipeline->blend_enable = COGL_PIPELINE_BLEND_ENABLE_AUTOMATIC;
|
||||
pipeline->layer_differences = NULL;
|
||||
pipeline->n_layers = 0;
|
||||
|
||||
@@ -721,24 +720,12 @@ _cogl_pipeline_needs_blending_enabled (CoglPipeline *pipeline,
|
||||
const CoglColor *override_color,
|
||||
gboolean unknown_color_alpha)
|
||||
{
|
||||
CoglPipeline *enable_authority;
|
||||
CoglPipeline *blend_authority;
|
||||
CoglPipelineBlendState *blend_state;
|
||||
CoglPipelineBlendEnable enabled;
|
||||
|
||||
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_BLENDING)))
|
||||
return FALSE;
|
||||
|
||||
/* We unconditionally check the _BLEND_ENABLE state first because
|
||||
* all the other changes are irrelevent if blend_enable != _AUTOMATIC
|
||||
*/
|
||||
enable_authority =
|
||||
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_BLEND_ENABLE);
|
||||
|
||||
enabled = enable_authority->blend_enable;
|
||||
if (enabled != COGL_PIPELINE_BLEND_ENABLE_AUTOMATIC)
|
||||
return enabled == COGL_PIPELINE_BLEND_ENABLE_ENABLED ? TRUE : FALSE;
|
||||
|
||||
blend_authority =
|
||||
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_BLEND);
|
||||
|
||||
@@ -826,9 +813,6 @@ _cogl_pipeline_copy_differences (CoglPipeline *dest,
|
||||
if (differences & COGL_PIPELINE_STATE_COLOR)
|
||||
dest->color = src->color;
|
||||
|
||||
if (differences & COGL_PIPELINE_STATE_BLEND_ENABLE)
|
||||
dest->blend_enable = src->blend_enable;
|
||||
|
||||
if (differences & COGL_PIPELINE_STATE_LAYERS)
|
||||
{
|
||||
GList *l;
|
||||
@@ -977,7 +961,6 @@ _cogl_pipeline_init_multi_property_sparse_state (CoglPipeline *pipeline,
|
||||
/* XXX: avoid using a default: label so we get a warning if we
|
||||
* don't explicitly handle a newly defined state-group here. */
|
||||
case COGL_PIPELINE_STATE_COLOR:
|
||||
case COGL_PIPELINE_STATE_BLEND_ENABLE:
|
||||
case COGL_PIPELINE_STATE_ALPHA_FUNC:
|
||||
case COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE:
|
||||
case COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE:
|
||||
@@ -2170,7 +2153,6 @@ _cogl_pipeline_equal (CoglPipeline *pipeline0,
|
||||
break;
|
||||
}
|
||||
|
||||
case COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX:
|
||||
case COGL_PIPELINE_STATE_REAL_BLEND_ENABLE_INDEX:
|
||||
case COGL_PIPELINE_STATE_COUNT:
|
||||
g_warn_if_reached ();
|
||||
@@ -2388,37 +2370,6 @@ _cogl_pipeline_journal_unref (CoglPipeline *pipeline)
|
||||
}
|
||||
|
||||
#ifdef COGL_DEBUG_ENABLED
|
||||
void
|
||||
_cogl_pipeline_apply_legacy_state (CoglPipeline *pipeline)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
/* It was a mistake that we ever copied the OpenGL style API for
|
||||
* associating these things directly with the context when we
|
||||
* originally wrote Cogl. Until the corresponding deprecated APIs
|
||||
* can be removed though we now shoehorn the state changes through
|
||||
* the cogl_pipeline API instead.
|
||||
*/
|
||||
|
||||
/* A program explicitly set on the pipeline has higher precedence than
|
||||
* one associated with the context using cogl_program_use() */
|
||||
if (ctx->current_program &&
|
||||
cogl_pipeline_get_user_program (pipeline) == NULL)
|
||||
cogl_pipeline_set_user_program (pipeline, ctx->current_program);
|
||||
|
||||
if (ctx->legacy_depth_test_enabled)
|
||||
{
|
||||
CoglDepthState depth_state;
|
||||
cogl_depth_state_init (&depth_state);
|
||||
cogl_depth_state_set_test_enabled (&depth_state, TRUE);
|
||||
cogl_pipeline_set_depth_state (pipeline, &depth_state, NULL);
|
||||
}
|
||||
|
||||
if (ctx->legacy_backface_culling_enabled)
|
||||
cogl_pipeline_set_cull_face_mode (pipeline,
|
||||
COGL_PIPELINE_CULL_FACE_MODE_BACK);
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline,
|
||||
const char *breadcrumb)
|
||||
@@ -2545,8 +2496,6 @@ _cogl_pipeline_init_state_hash_functions (void)
|
||||
{
|
||||
state_hash_functions[COGL_PIPELINE_STATE_COLOR_INDEX] =
|
||||
_cogl_pipeline_hash_color_state;
|
||||
state_hash_functions[COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX] =
|
||||
_cogl_pipeline_hash_blend_enable_state;
|
||||
state_hash_functions[COGL_PIPELINE_STATE_LAYERS_INDEX] =
|
||||
_cogl_pipeline_hash_layers_state;
|
||||
state_hash_functions[COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX] =
|
||||
@@ -2576,7 +2525,7 @@ _cogl_pipeline_init_state_hash_functions (void)
|
||||
|
||||
{
|
||||
/* So we get a big error if we forget to update this code! */
|
||||
_COGL_STATIC_ASSERT (COGL_PIPELINE_STATE_SPARSE_COUNT == 15,
|
||||
_COGL_STATIC_ASSERT (COGL_PIPELINE_STATE_SPARSE_COUNT == 14,
|
||||
"Make sure to install a hash function for "
|
||||
"newly added pipeline state and update assert "
|
||||
"in _cogl_pipeline_init_state_hash_functions");
|
||||
|
@@ -72,7 +72,7 @@ G_BEGIN_DECLS
|
||||
GType cogl_pipeline_get_gtype (void);
|
||||
|
||||
/**
|
||||
* cogl_pipeline_new: (skip)
|
||||
* cogl_pipeline_new: (constructor)
|
||||
* @context: a #CoglContext
|
||||
*
|
||||
* Allocates and initializes a default simple pipeline that will color
|
||||
|
@@ -102,37 +102,6 @@ cogl_pixel_buffer_new (CoglContext *context,
|
||||
gboolean
|
||||
cogl_is_pixel_buffer (void *object);
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* cogl_pixel_buffer_set_region:
|
||||
* @buffer: A #CoglPixelBuffer object
|
||||
* @data: pixel data to upload to @array
|
||||
* @src_width: width in pixels of the region to update
|
||||
* @src_height: height in pixels of the region to update
|
||||
* @src_rowstride: row stride in bytes of the source array
|
||||
* @dst_x: upper left destination horizontal coordinate
|
||||
* @dst_y: upper left destination vertical coordinate
|
||||
*
|
||||
* Uploads new data into a pixel array. The source data pointed by @data can
|
||||
* have a different stride than @array in which case the function will do the
|
||||
* right thing for you. For performance reasons, it is recommended for the
|
||||
* source data to have the same stride than @array.
|
||||
*
|
||||
* Return value: %TRUE if the upload succeeded, %FALSE otherwise
|
||||
*
|
||||
* Since: 1.2
|
||||
* Stability: Unstable
|
||||
*/
|
||||
gboolean
|
||||
cogl_pixel_buffer_set_region (CoglPixelBuffer *buffer,
|
||||
uint8_t *data,
|
||||
unsigned int src_width,
|
||||
unsigned int src_height,
|
||||
unsigned int src_rowstride,
|
||||
unsigned int dst_x,
|
||||
unsigned int dst_y);
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_PIXEL_BUFFER_H__ */
|
||||
|
@@ -47,6 +47,13 @@ _cogl_rectangle_immediate (CoglFramebuffer *framebuffer,
|
||||
float x_2,
|
||||
float y_2);
|
||||
|
||||
void
|
||||
cogl_2d_primitives_immediate (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
const CoglVertexP2 *vertices,
|
||||
unsigned int n_vertices);
|
||||
|
||||
typedef struct _CoglMultiTexturedRect
|
||||
{
|
||||
const float *position; /* x0,y0,x1,y1 */
|
||||
@@ -59,8 +66,7 @@ _cogl_framebuffer_draw_multitextured_rectangles (
|
||||
CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglMultiTexturedRect *rects,
|
||||
int n_rects,
|
||||
gboolean disable_legacy_state);
|
||||
int n_rects);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -629,8 +629,7 @@ _cogl_framebuffer_draw_multitextured_rectangles (
|
||||
CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglMultiTexturedRect *rects,
|
||||
int n_rects,
|
||||
gboolean disable_legacy_state)
|
||||
int n_rects)
|
||||
{
|
||||
CoglContext *ctx = framebuffer->context;
|
||||
CoglPipeline *original_pipeline;
|
||||
@@ -654,18 +653,6 @@ _cogl_framebuffer_draw_multitextured_rectangles (
|
||||
if (state.override_source)
|
||||
pipeline = state.override_source;
|
||||
|
||||
if (!disable_legacy_state)
|
||||
{
|
||||
if (G_UNLIKELY (ctx->legacy_state_set) &&
|
||||
_cogl_get_enable_legacy_state ())
|
||||
{
|
||||
/* If we haven't already made a pipeline copy */
|
||||
if (pipeline == original_pipeline)
|
||||
pipeline = cogl_pipeline_copy (pipeline);
|
||||
_cogl_pipeline_apply_legacy_state (pipeline);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Emit geometry for each of the rectangles...
|
||||
*/
|
||||
@@ -720,134 +707,41 @@ _cogl_framebuffer_draw_multitextured_rectangles (
|
||||
cogl_object_unref (pipeline);
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_rectangles_with_multitexture_coords (
|
||||
CoglMultiTexturedRect *rects,
|
||||
int n_rects)
|
||||
{
|
||||
_cogl_framebuffer_draw_multitextured_rectangles (cogl_get_draw_framebuffer (),
|
||||
cogl_get_source (),
|
||||
rects,
|
||||
n_rects,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_rectangles (const float *verts,
|
||||
unsigned int n_rects)
|
||||
cogl_2d_primitives_immediate (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
const CoglVertexP2 *vertices,
|
||||
unsigned int n_vertices)
|
||||
{
|
||||
CoglMultiTexturedRect *rects;
|
||||
int i;
|
||||
CoglContext *ctx = framebuffer->context;
|
||||
CoglAttributeBuffer *attribute_buffer;
|
||||
CoglAttribute *attributes[1];
|
||||
size_t vertices_size = sizeof (CoglVertexP2) * n_vertices;
|
||||
|
||||
/* XXX: All the cogl_rectangle* APIs normalize their input into an array of
|
||||
* CoglMultiTexturedRect rectangles and pass these on to our work horse;
|
||||
* _cogl_rectangles_with_multitexture_coords.
|
||||
*/
|
||||
attribute_buffer =
|
||||
cogl_attribute_buffer_new (ctx, vertices_size, vertices);
|
||||
attributes[0] = cogl_attribute_new (attribute_buffer,
|
||||
"cogl_position_in",
|
||||
sizeof (CoglVertexP2), /* stride */
|
||||
0, /* offset */
|
||||
2, /* n_components */
|
||||
COGL_ATTRIBUTE_TYPE_FLOAT);
|
||||
|
||||
rects = g_alloca (n_rects * sizeof (CoglMultiTexturedRect));
|
||||
_cogl_framebuffer_draw_attributes (framebuffer,
|
||||
pipeline,
|
||||
mode,
|
||||
0, /* first_index */
|
||||
n_vertices,
|
||||
attributes,
|
||||
1,
|
||||
COGL_DRAW_SKIP_JOURNAL_FLUSH |
|
||||
COGL_DRAW_SKIP_PIPELINE_VALIDATION |
|
||||
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
|
||||
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
rects[i].position = &verts[i * 4];
|
||||
rects[i].tex_coords = NULL;
|
||||
rects[i].tex_coords_len = 0;
|
||||
}
|
||||
|
||||
_cogl_rectangles_with_multitexture_coords (rects, n_rects);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_rectangles_with_texture_coords (const float *verts,
|
||||
unsigned int n_rects)
|
||||
{
|
||||
CoglMultiTexturedRect *rects;
|
||||
int i;
|
||||
|
||||
/* XXX: All the cogl_rectangle* APIs normalize their input into an array of
|
||||
* CoglMultiTexturedRect rectangles and pass these on to our work horse;
|
||||
* _cogl_rectangles_with_multitexture_coords.
|
||||
*/
|
||||
|
||||
rects = g_alloca (n_rects * sizeof (CoglMultiTexturedRect));
|
||||
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
rects[i].position = &verts[i * 8];
|
||||
rects[i].tex_coords = &verts[i * 8 + 4];
|
||||
rects[i].tex_coords_len = 4;
|
||||
}
|
||||
|
||||
_cogl_rectangles_with_multitexture_coords (rects, n_rects);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_rectangle_with_texture_coords (float x_1,
|
||||
float y_1,
|
||||
float x_2,
|
||||
float y_2,
|
||||
float tx_1,
|
||||
float ty_1,
|
||||
float tx_2,
|
||||
float ty_2)
|
||||
{
|
||||
const float position[4] = {x_1, y_1, x_2, y_2};
|
||||
const float tex_coords[4] = {tx_1, ty_1, tx_2, ty_2};
|
||||
CoglMultiTexturedRect rect;
|
||||
|
||||
/* XXX: All the cogl_rectangle* APIs normalize their input into an array of
|
||||
* CoglMultiTexturedRect rectangles and pass these on to our work horse;
|
||||
* _cogl_rectangles_with_multitexture_coords.
|
||||
*/
|
||||
|
||||
rect.position = position;
|
||||
rect.tex_coords = tex_coords;
|
||||
rect.tex_coords_len = 4;
|
||||
|
||||
_cogl_rectangles_with_multitexture_coords (&rect, 1);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_rectangle_with_multitexture_coords (float x_1,
|
||||
float y_1,
|
||||
float x_2,
|
||||
float y_2,
|
||||
const float *user_tex_coords,
|
||||
int user_tex_coords_len)
|
||||
{
|
||||
const float position[4] = {x_1, y_1, x_2, y_2};
|
||||
CoglMultiTexturedRect rect;
|
||||
|
||||
/* XXX: All the cogl_rectangle* APIs normalize their input into an array of
|
||||
* CoglMultiTexturedRect rectangles and pass these on to our work horse;
|
||||
* _cogl_rectangles_with_multitexture_coords.
|
||||
*/
|
||||
|
||||
rect.position = position;
|
||||
rect.tex_coords = user_tex_coords;
|
||||
rect.tex_coords_len = user_tex_coords_len;
|
||||
|
||||
_cogl_rectangles_with_multitexture_coords (&rect, 1);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_rectangle (float x_1,
|
||||
float y_1,
|
||||
float x_2,
|
||||
float y_2)
|
||||
{
|
||||
const float position[4] = {x_1, y_1, x_2, y_2};
|
||||
CoglMultiTexturedRect rect;
|
||||
|
||||
/* XXX: All the cogl_rectangle* APIs normalize their input into an array of
|
||||
* CoglMultiTexturedRect rectangles and pass these on to our work horse;
|
||||
* _cogl_rectangles_with_multitexture_coords.
|
||||
*/
|
||||
|
||||
rect.position = position;
|
||||
rect.tex_coords = NULL;
|
||||
rect.tex_coords_len = 0;
|
||||
|
||||
_cogl_rectangles_with_multitexture_coords (&rect, 1);
|
||||
cogl_object_unref (attributes[0]);
|
||||
cogl_object_unref (attribute_buffer);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -858,283 +752,17 @@ _cogl_rectangle_immediate (CoglFramebuffer *framebuffer,
|
||||
float x_2,
|
||||
float y_2)
|
||||
{
|
||||
/* Draw a rectangle using the vertex array API to avoid going
|
||||
through the journal. This should only be used in cases where the
|
||||
code might be called while the journal is already being flushed
|
||||
such as when flushing the clip state */
|
||||
CoglContext *ctx = framebuffer->context;
|
||||
float vertices[8] =
|
||||
CoglVertexP2 vertices[4] =
|
||||
{
|
||||
x_1, y_1,
|
||||
x_1, y_2,
|
||||
x_2, y_1,
|
||||
x_2, y_2
|
||||
{x_1, y_1},
|
||||
{x_1, y_2},
|
||||
{x_2, y_1},
|
||||
{x_2, y_2}
|
||||
};
|
||||
CoglAttributeBuffer *attribute_buffer;
|
||||
CoglAttribute *attributes[1];
|
||||
|
||||
attribute_buffer =
|
||||
cogl_attribute_buffer_new (ctx, sizeof (vertices), vertices);
|
||||
attributes[0] = cogl_attribute_new (attribute_buffer,
|
||||
"cogl_position_in",
|
||||
sizeof (float) * 2, /* stride */
|
||||
0, /* offset */
|
||||
2, /* n_components */
|
||||
COGL_ATTRIBUTE_TYPE_FLOAT);
|
||||
|
||||
_cogl_framebuffer_draw_attributes (framebuffer,
|
||||
pipeline,
|
||||
COGL_VERTICES_MODE_TRIANGLE_STRIP,
|
||||
0, /* first_index */
|
||||
4, /* n_vertices */
|
||||
attributes,
|
||||
1,
|
||||
COGL_DRAW_SKIP_JOURNAL_FLUSH |
|
||||
COGL_DRAW_SKIP_PIPELINE_VALIDATION |
|
||||
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH |
|
||||
COGL_DRAW_SKIP_LEGACY_STATE);
|
||||
|
||||
|
||||
cogl_object_unref (attributes[0]);
|
||||
cogl_object_unref (attribute_buffer);
|
||||
}
|
||||
|
||||
typedef struct _AppendTexCoordsState
|
||||
{
|
||||
const CoglTextureVertex *vertices_in;
|
||||
int vertex;
|
||||
int layer;
|
||||
float *vertices_out;
|
||||
} AppendTexCoordsState;
|
||||
|
||||
static gboolean
|
||||
append_tex_coord_attributes_cb (CoglPipeline *pipeline,
|
||||
int layer_index,
|
||||
void *user_data)
|
||||
{
|
||||
AppendTexCoordsState *state = user_data;
|
||||
CoglTexture *texture;
|
||||
float tx, ty;
|
||||
float *t;
|
||||
|
||||
tx = state->vertices_in[state->vertex].tx;
|
||||
ty = state->vertices_in[state->vertex].ty;
|
||||
|
||||
/* NULL textures will be handled in
|
||||
* _cogl_pipeline_flush_layers_gl_state but there is no need to worry
|
||||
* about scaling texture coordinates in this case */
|
||||
texture = cogl_pipeline_get_layer_texture (pipeline, layer_index);
|
||||
if (texture != NULL)
|
||||
_cogl_texture_transform_coords_to_gl (texture, &tx, &ty);
|
||||
|
||||
/* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
|
||||
t = state->vertices_out + 3 + 2 * state->layer;
|
||||
t[0] = tx;
|
||||
t[1] = ty;
|
||||
|
||||
state->layer++;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
typedef struct _ValidateState
|
||||
{
|
||||
CoglPipeline *original_pipeline;
|
||||
CoglPipeline *pipeline;
|
||||
} ValidateState;
|
||||
|
||||
static gboolean
|
||||
_cogl_polygon_validate_layer_cb (CoglPipeline *pipeline,
|
||||
int layer_index,
|
||||
void *user_data)
|
||||
{
|
||||
ValidateState *state = user_data;
|
||||
|
||||
/* By default COGL_PIPELINE_WRAP_MODE_AUTOMATIC becomes
|
||||
* GL_CLAMP_TO_EDGE but we want the polygon API to use GL_REPEAT to
|
||||
* maintain compatibility with previous releases
|
||||
*/
|
||||
|
||||
if (cogl_pipeline_get_layer_wrap_mode_s (pipeline, layer_index) ==
|
||||
COGL_PIPELINE_WRAP_MODE_AUTOMATIC)
|
||||
{
|
||||
if (state->original_pipeline == state->pipeline)
|
||||
state->pipeline = cogl_pipeline_copy (pipeline);
|
||||
|
||||
cogl_pipeline_set_layer_wrap_mode_s (state->pipeline, layer_index,
|
||||
COGL_PIPELINE_WRAP_MODE_REPEAT);
|
||||
}
|
||||
|
||||
if (cogl_pipeline_get_layer_wrap_mode_t (pipeline, layer_index) ==
|
||||
COGL_PIPELINE_WRAP_MODE_AUTOMATIC)
|
||||
{
|
||||
if (state->original_pipeline == state->pipeline)
|
||||
state->pipeline = cogl_pipeline_copy (pipeline);
|
||||
|
||||
cogl_pipeline_set_layer_wrap_mode_t (state->pipeline, layer_index,
|
||||
COGL_PIPELINE_WRAP_MODE_REPEAT);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_polygon (const CoglTextureVertex *vertices,
|
||||
unsigned int n_vertices,
|
||||
gboolean use_color)
|
||||
{
|
||||
CoglPipeline *pipeline;
|
||||
ValidateState validate_state;
|
||||
int n_layers;
|
||||
int n_attributes;
|
||||
CoglAttribute **attributes;
|
||||
int i;
|
||||
unsigned int stride;
|
||||
size_t stride_bytes;
|
||||
CoglAttributeBuffer *attribute_buffer;
|
||||
float *v;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
pipeline = cogl_get_source ();
|
||||
|
||||
validate_state.original_pipeline = pipeline;
|
||||
validate_state.pipeline = pipeline;
|
||||
cogl_pipeline_foreach_layer (pipeline,
|
||||
_cogl_polygon_validate_layer_cb,
|
||||
&validate_state);
|
||||
pipeline = validate_state.pipeline;
|
||||
|
||||
n_layers = cogl_pipeline_get_n_layers (pipeline);
|
||||
|
||||
n_attributes = 1 + n_layers + (use_color ? 1 : 0);
|
||||
attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes);
|
||||
|
||||
/* Our data is arranged like:
|
||||
* [X, Y, Z, TX0, TY0, TX1, TY1..., R, G, B, A,...] */
|
||||
stride = 3 + (2 * n_layers) + (use_color ? 1 : 0);
|
||||
stride_bytes = stride * sizeof (float);
|
||||
|
||||
/* Make sure there is enough space in the global vertex array. This
|
||||
* is used so we can render the polygon with a single call to OpenGL
|
||||
* but still support any number of vertices */
|
||||
g_array_set_size (ctx->polygon_vertices, n_vertices * stride);
|
||||
|
||||
attribute_buffer =
|
||||
cogl_attribute_buffer_new (ctx, n_vertices * stride_bytes, NULL);
|
||||
|
||||
attributes[0] = cogl_attribute_new (attribute_buffer,
|
||||
"cogl_position_in",
|
||||
stride_bytes,
|
||||
0,
|
||||
3,
|
||||
COGL_ATTRIBUTE_TYPE_FLOAT);
|
||||
|
||||
for (i = 0; i < n_layers; i++)
|
||||
{
|
||||
static const char *names[] = {
|
||||
"cogl_tex_coord0_in",
|
||||
"cogl_tex_coord1_in",
|
||||
"cogl_tex_coord2_in",
|
||||
"cogl_tex_coord3_in",
|
||||
"cogl_tex_coord4_in",
|
||||
"cogl_tex_coord5_in",
|
||||
"cogl_tex_coord6_in",
|
||||
"cogl_tex_coord7_in"
|
||||
};
|
||||
char *allocated_name = NULL;
|
||||
const char *name;
|
||||
|
||||
if (i < 8)
|
||||
name = names[i];
|
||||
else
|
||||
name = allocated_name = g_strdup_printf ("cogl_tex_coord%d_in", i);
|
||||
|
||||
attributes[i + 1] = cogl_attribute_new (attribute_buffer,
|
||||
name,
|
||||
stride_bytes,
|
||||
/* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
|
||||
12 + 8 * i,
|
||||
2,
|
||||
COGL_ATTRIBUTE_TYPE_FLOAT);
|
||||
|
||||
g_free (allocated_name);
|
||||
}
|
||||
|
||||
if (use_color)
|
||||
{
|
||||
attributes[n_attributes - 1] =
|
||||
cogl_attribute_new (attribute_buffer,
|
||||
"cogl_color_in",
|
||||
stride_bytes,
|
||||
/* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
|
||||
12 + 8 * n_layers,
|
||||
4,
|
||||
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
|
||||
}
|
||||
|
||||
/* Convert the vertices into an array of float vertex attributes */
|
||||
v = (float *)ctx->polygon_vertices->data;
|
||||
for (i = 0; i < n_vertices; i++)
|
||||
{
|
||||
AppendTexCoordsState append_tex_coords_state;
|
||||
uint8_t *c;
|
||||
|
||||
/* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
|
||||
v[0] = vertices[i].x;
|
||||
v[1] = vertices[i].y;
|
||||
v[2] = vertices[i].z;
|
||||
|
||||
append_tex_coords_state.vertices_in = vertices;
|
||||
append_tex_coords_state.vertex = i;
|
||||
append_tex_coords_state.layer = 0;
|
||||
append_tex_coords_state.vertices_out = v;
|
||||
cogl_pipeline_foreach_layer (pipeline,
|
||||
append_tex_coord_attributes_cb,
|
||||
&append_tex_coords_state);
|
||||
|
||||
if (use_color)
|
||||
{
|
||||
/* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
|
||||
c = (uint8_t *) (v + 3 + 2 * n_layers);
|
||||
c[0] = cogl_color_get_red_byte (&vertices[i].color);
|
||||
c[1] = cogl_color_get_green_byte (&vertices[i].color);
|
||||
c[2] = cogl_color_get_blue_byte (&vertices[i].color);
|
||||
c[3] = cogl_color_get_alpha_byte (&vertices[i].color);
|
||||
}
|
||||
|
||||
v += stride;
|
||||
}
|
||||
|
||||
v = (float *)ctx->polygon_vertices->data;
|
||||
cogl_buffer_set_data (COGL_BUFFER (attribute_buffer),
|
||||
0,
|
||||
v,
|
||||
ctx->polygon_vertices->len * sizeof (float));
|
||||
|
||||
/* XXX: although this may seem redundant, we need to do this since
|
||||
* cogl_polygon() can be used with legacy state and its the source stack
|
||||
* which track whether legacy state is enabled.
|
||||
*
|
||||
* (We only have a CoglDrawFlag to disable legacy state not one
|
||||
* to enable it) */
|
||||
cogl_push_source (pipeline);
|
||||
|
||||
_cogl_framebuffer_draw_attributes (cogl_get_draw_framebuffer (),
|
||||
pipeline,
|
||||
COGL_VERTICES_MODE_TRIANGLE_FAN,
|
||||
0, n_vertices,
|
||||
attributes,
|
||||
n_attributes,
|
||||
0 /* no draw flags */);
|
||||
|
||||
cogl_pop_source ();
|
||||
|
||||
if (pipeline != validate_state.original_pipeline)
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
cogl_object_unref (attribute_buffer);
|
||||
|
||||
for (i = 0; i < n_attributes; i++)
|
||||
cogl_object_unref (attributes[i]);
|
||||
cogl_2d_primitives_immediate (framebuffer,
|
||||
pipeline,
|
||||
COGL_VERTICES_MODE_TRIANGLE_STRIP,
|
||||
vertices,
|
||||
4);
|
||||
}
|
||||
|
@@ -1,197 +0,0 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* A Low Level GPU Graphics and Utilities API
|
||||
*
|
||||
* Copyright (C) 2007,2008,2009 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __COGL_PRIMITIVES_H
|
||||
#define __COGL_PRIMITIVES_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* SECTION:cogl-primitives
|
||||
* @short_description: Functions that draw various primitive 3D shapes
|
||||
*
|
||||
* The primitives API provides utilities for drawing some
|
||||
* common 3D shapes in a more convenient way than the CoglVertexBuffer
|
||||
* API provides.
|
||||
*/
|
||||
|
||||
/**
|
||||
* cogl_rectangle:
|
||||
* @x_1: X coordinate of the top-left corner
|
||||
* @y_1: Y coordinate of the top-left corner
|
||||
* @x_2: X coordinate of the bottom-right corner
|
||||
* @y_2: Y coordinate of the bottom-right corner
|
||||
*
|
||||
* Fills a rectangle at the given coordinates with the current source material
|
||||
**/
|
||||
void
|
||||
cogl_rectangle (float x_1,
|
||||
float y_1,
|
||||
float x_2,
|
||||
float y_2);
|
||||
|
||||
/**
|
||||
* cogl_rectangle_with_texture_coords:
|
||||
* @x1: x coordinate upper left on screen.
|
||||
* @y1: y coordinate upper left on screen.
|
||||
* @x2: x coordinate lower right on screen.
|
||||
* @y2: y coordinate lower right on screen.
|
||||
* @tx1: x part of texture coordinate to use for upper left pixel
|
||||
* @ty1: y part of texture coordinate to use for upper left pixel
|
||||
* @tx2: x part of texture coordinate to use for lower right pixel
|
||||
* @ty2: y part of texture coordinate to use for left pixel
|
||||
*
|
||||
* Draw a rectangle using the current material and supply texture coordinates
|
||||
* to be used for the first texture layer of the material. To draw the entire
|
||||
* texture pass in @tx1=0.0 @ty1=0.0 @tx2=1.0 @ty2=1.0.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
cogl_rectangle_with_texture_coords (float x1,
|
||||
float y1,
|
||||
float x2,
|
||||
float y2,
|
||||
float tx1,
|
||||
float ty1,
|
||||
float tx2,
|
||||
float ty2);
|
||||
|
||||
/**
|
||||
* cogl_rectangle_with_multitexture_coords:
|
||||
* @x1: x coordinate upper left on screen.
|
||||
* @y1: y coordinate upper left on screen.
|
||||
* @x2: x coordinate lower right on screen.
|
||||
* @y2: y coordinate lower right on screen.
|
||||
* @tex_coords: (in) (array) (transfer none): An array containing groups of
|
||||
* 4 float values: [tx1, ty1, tx2, ty2] that are interpreted as two texture
|
||||
* coordinates; one for the upper left texel, and one for the lower right
|
||||
* texel. Each value should be between 0.0 and 1.0, where the coordinate
|
||||
* (0.0, 0.0) represents the top left of the texture, and (1.0, 1.0) the
|
||||
* bottom right.
|
||||
* @tex_coords_len: The length of the tex_coords array. (e.g. for one layer
|
||||
* and one group of texture coordinates, this would be 4)
|
||||
*
|
||||
* This function draws a rectangle using the current source material to
|
||||
* texture or fill with. As a material may contain multiple texture layers
|
||||
* this interface lets you supply texture coordinates for each layer of the
|
||||
* material.
|
||||
*
|
||||
* The first pair of coordinates are for the first layer (with the smallest
|
||||
* layer index) and if you supply less texture coordinates than there are
|
||||
* layers in the current source material then default texture coordinates
|
||||
* (0.0, 0.0, 1.0, 1.0) are generated.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
cogl_rectangle_with_multitexture_coords (float x1,
|
||||
float y1,
|
||||
float x2,
|
||||
float y2,
|
||||
const float *tex_coords,
|
||||
int tex_coords_len);
|
||||
|
||||
/**
|
||||
* cogl_rectangles_with_texture_coords:
|
||||
* @verts: (in) (array) (transfer none): an array of vertices
|
||||
* @n_rects: number of rectangles to draw
|
||||
*
|
||||
* Draws a series of rectangles in the same way that
|
||||
* cogl_rectangle_with_texture_coords() does. In some situations it can give a
|
||||
* significant performance boost to use this function rather than
|
||||
* calling cogl_rectangle_with_texture_coords() separately for each rectangle.
|
||||
*
|
||||
* @verts should point to an array of #float<!-- -->s with
|
||||
* @n_rects * 8 elements. Each group of 8 values corresponds to the
|
||||
* parameters x1, y1, x2, y2, tx1, ty1, tx2 and ty2 and have the same
|
||||
* meaning as in cogl_rectangle_with_texture_coords().
|
||||
*
|
||||
* Since: 0.8.6
|
||||
*/
|
||||
void
|
||||
cogl_rectangles_with_texture_coords (const float *verts,
|
||||
unsigned int n_rects);
|
||||
|
||||
/**
|
||||
* cogl_rectangles:
|
||||
* @verts: (in) (array) (transfer none): an array of vertices
|
||||
* @n_rects: number of rectangles to draw
|
||||
*
|
||||
* Draws a series of rectangles in the same way that
|
||||
* cogl_rectangle() does. In some situations it can give a
|
||||
* significant performance boost to use this function rather than
|
||||
* calling cogl_rectangle() separately for each rectangle.
|
||||
*
|
||||
* @verts should point to an array of #float<!-- -->s with
|
||||
* @n_rects * 4 elements. Each group of 4 values corresponds to the
|
||||
* parameters x1, y1, x2, and y2, and have the same
|
||||
* meaning as in cogl_rectangle().
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
cogl_rectangles (const float *verts,
|
||||
unsigned int n_rects);
|
||||
|
||||
/**
|
||||
* cogl_polygon:
|
||||
* @vertices: An array of #CoglTextureVertex structs
|
||||
* @n_vertices: The length of the vertices array
|
||||
* @use_color: %TRUE if the color member of #CoglTextureVertex should be used
|
||||
*
|
||||
* Draws a convex polygon using the current source material to fill / texture
|
||||
* with according to the texture coordinates passed.
|
||||
*
|
||||
* If @use_color is %TRUE then the color will be changed for each vertex using
|
||||
* the value specified in the color member of #CoglTextureVertex. This can be
|
||||
* used for example to make the texture fade out by setting the alpha value of
|
||||
* the color.
|
||||
*
|
||||
* All of the texture coordinates must be in the range [0,1] and repeating the
|
||||
* texture is not supported.
|
||||
*
|
||||
* Because of the way this function is implemented it will currently
|
||||
* only work if either the texture is not sliced or the backend is not
|
||||
* OpenGL ES and the minifying and magnifying functions are both set
|
||||
* to COGL_MATERIAL_FILTER_NEAREST.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
cogl_polygon (const CoglTextureVertex *vertices,
|
||||
unsigned int n_vertices,
|
||||
gboolean use_color);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_PRIMITIVES_H */
|
@@ -64,14 +64,10 @@ typedef enum
|
||||
* is first allocated or when it is shown or resized */
|
||||
COGL_PRIVATE_FEATURE_DIRTY_EVENTS,
|
||||
COGL_PRIVATE_FEATURE_ENABLE_PROGRAM_POINT_SIZE,
|
||||
/* These features let us avoid conditioning code based on the exact
|
||||
* driver being used and instead check for broad opengl feature
|
||||
* sets that can be shared by several GL apis */
|
||||
/* This feature allows for explicitly selecting a GL-based backend,
|
||||
* as opposed to nop or (in the future) Vulkan.
|
||||
*/
|
||||
COGL_PRIVATE_FEATURE_ANY_GL,
|
||||
COGL_PRIVATE_FEATURE_GL_FIXED,
|
||||
COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE,
|
||||
COGL_PRIVATE_FEATURE_GL_EMBEDDED,
|
||||
COGL_PRIVATE_FEATURE_GL_WEB,
|
||||
|
||||
COGL_N_PRIVATE_FEATURES
|
||||
} CoglPrivateFeature;
|
||||
@@ -94,18 +90,9 @@ _cogl_transform_point (const CoglMatrix *matrix_mv,
|
||||
gboolean
|
||||
_cogl_check_extension (const char *name, char * const *ext);
|
||||
|
||||
void
|
||||
_cogl_clear (const CoglColor *color, unsigned long buffers);
|
||||
|
||||
void
|
||||
_cogl_init (void);
|
||||
|
||||
void
|
||||
_cogl_push_source (CoglPipeline *pipeline, gboolean enable_legacy);
|
||||
|
||||
gboolean
|
||||
_cogl_get_enable_legacy_state (void);
|
||||
|
||||
#define _cogl_has_private_feature(ctx, feature) \
|
||||
COGL_FLAGS_GET ((ctx)->private_features, (feature))
|
||||
|
||||
|
@@ -40,10 +40,6 @@
|
||||
#include "cogl-closure-list-private.h"
|
||||
#include "winsys/cogl-winsys-private.h"
|
||||
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
typedef const CoglWinsysVtable *(*CoglCustomWinsysVtableGetter) (CoglRenderer *renderer);
|
||||
|
||||
struct _CoglRenderer
|
||||
|
@@ -91,8 +91,6 @@ static CoglDriverDescription _cogl_drivers[] =
|
||||
COGL_DRIVER_GL,
|
||||
"gl",
|
||||
{ COGL_PRIVATE_FEATURE_ANY_GL,
|
||||
COGL_PRIVATE_FEATURE_GL_FIXED,
|
||||
COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE,
|
||||
-1 },
|
||||
&_cogl_driver_gl,
|
||||
&_cogl_texture_driver_gl,
|
||||
@@ -102,7 +100,6 @@ static CoglDriverDescription _cogl_drivers[] =
|
||||
COGL_DRIVER_GL3,
|
||||
"gl3",
|
||||
{ COGL_PRIVATE_FEATURE_ANY_GL,
|
||||
COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE,
|
||||
-1 },
|
||||
&_cogl_driver_gl,
|
||||
&_cogl_texture_driver_gl,
|
||||
@@ -114,8 +111,6 @@ static CoglDriverDescription _cogl_drivers[] =
|
||||
COGL_DRIVER_GLES2,
|
||||
"gles2",
|
||||
{ COGL_PRIVATE_FEATURE_ANY_GL,
|
||||
COGL_PRIVATE_FEATURE_GL_EMBEDDED,
|
||||
COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE,
|
||||
-1 },
|
||||
&_cogl_driver_gles,
|
||||
&_cogl_texture_driver_gles,
|
||||
|
@@ -52,7 +52,6 @@
|
||||
#include "cogl-context-private.h"
|
||||
#include "cogl-object-private.h"
|
||||
#include "cogl-object-private.h"
|
||||
#include "cogl-primitives.h"
|
||||
#include "cogl-framebuffer-private.h"
|
||||
#include "cogl1-context.h"
|
||||
#include "cogl-sub-texture.h"
|
||||
|
411
cogl/cogl/cogl.c
411
cogl/cogl/cogl.c
@@ -53,8 +53,6 @@
|
||||
#include "cogl-offscreen.h"
|
||||
#include "winsys/cogl-winsys-private.h"
|
||||
|
||||
#include "deprecated/cogl-framebuffer-deprecated.h"
|
||||
|
||||
GCallback
|
||||
cogl_get_proc_address (const char* name)
|
||||
{
|
||||
@@ -75,14 +73,6 @@ _cogl_check_extension (const char *name, char * const *ext)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* XXX: it's expected that we'll deprecated this with
|
||||
* cogl_framebuffer_clear at some point. */
|
||||
void
|
||||
cogl_clear (const CoglColor *color, unsigned long buffers)
|
||||
{
|
||||
cogl_framebuffer_clear (cogl_get_draw_framebuffer (), buffers, color);
|
||||
}
|
||||
|
||||
/* XXX: This API has been deprecated */
|
||||
void
|
||||
cogl_set_depth_test_enabled (gboolean setting)
|
||||
@@ -93,10 +83,6 @@ cogl_set_depth_test_enabled (gboolean setting)
|
||||
return;
|
||||
|
||||
ctx->legacy_depth_test_enabled = setting;
|
||||
if (ctx->legacy_depth_test_enabled)
|
||||
ctx->legacy_state_set++;
|
||||
else
|
||||
ctx->legacy_state_set--;
|
||||
}
|
||||
|
||||
/* XXX: This API has been deprecated */
|
||||
@@ -116,11 +102,6 @@ cogl_set_backface_culling_enabled (gboolean setting)
|
||||
return;
|
||||
|
||||
ctx->legacy_backface_culling_enabled = setting;
|
||||
|
||||
if (ctx->legacy_backface_culling_enabled)
|
||||
ctx->legacy_state_set++;
|
||||
else
|
||||
ctx->legacy_state_set--;
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -131,57 +112,6 @@ cogl_get_backface_culling_enabled (void)
|
||||
return ctx->legacy_backface_culling_enabled;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_set_source_color (const CoglColor *color)
|
||||
{
|
||||
CoglPipeline *pipeline;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
if (cogl_color_get_alpha_byte (color) == 0xff)
|
||||
{
|
||||
cogl_pipeline_set_color (ctx->opaque_color_pipeline, color);
|
||||
pipeline = ctx->opaque_color_pipeline;
|
||||
}
|
||||
else
|
||||
{
|
||||
CoglColor premultiplied = *color;
|
||||
cogl_color_premultiply (&premultiplied);
|
||||
cogl_pipeline_set_color (ctx->blended_color_pipeline, &premultiplied);
|
||||
pipeline = ctx->blended_color_pipeline;
|
||||
}
|
||||
|
||||
cogl_set_source (pipeline);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_set_viewport (int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
CoglFramebuffer *framebuffer;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
framebuffer = cogl_get_draw_framebuffer ();
|
||||
|
||||
cogl_framebuffer_set_viewport (framebuffer,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height);
|
||||
}
|
||||
|
||||
/* XXX: This should be deprecated, and we should expose a way to also
|
||||
* specify an x and y viewport offset */
|
||||
void
|
||||
cogl_viewport (unsigned int width,
|
||||
unsigned int height)
|
||||
{
|
||||
cogl_set_viewport (0, 0, width, height);
|
||||
}
|
||||
|
||||
gboolean
|
||||
cogl_has_feature (CoglContext *ctx, CoglFeatureID feature)
|
||||
{
|
||||
@@ -214,44 +144,6 @@ cogl_foreach_feature (CoglContext *ctx,
|
||||
callback (i, user_data);
|
||||
}
|
||||
|
||||
/* XXX: This function should either be replaced with one returning
|
||||
* integers, or removed/deprecated and make the
|
||||
* _cogl_framebuffer_get_viewport* functions public.
|
||||
*/
|
||||
void
|
||||
cogl_get_viewport (float viewport[4])
|
||||
{
|
||||
CoglFramebuffer *framebuffer;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
framebuffer = cogl_get_draw_framebuffer ();
|
||||
cogl_framebuffer_get_viewport4fv (framebuffer, viewport);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_get_bitmasks (int *red,
|
||||
int *green,
|
||||
int *blue,
|
||||
int *alpha)
|
||||
{
|
||||
CoglFramebuffer *framebuffer;
|
||||
|
||||
framebuffer = cogl_get_draw_framebuffer ();
|
||||
|
||||
if (red)
|
||||
*red = cogl_framebuffer_get_red_bits (framebuffer);
|
||||
|
||||
if (green)
|
||||
*green = cogl_framebuffer_get_green_bits (framebuffer);
|
||||
|
||||
if (blue)
|
||||
*blue = cogl_framebuffer_get_blue_bits (framebuffer);
|
||||
|
||||
if (alpha)
|
||||
*alpha = cogl_framebuffer_get_alpha_bits (framebuffer);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_flush (void)
|
||||
{
|
||||
@@ -263,315 +155,12 @@ cogl_flush (void)
|
||||
_cogl_framebuffer_flush_journal (l->data);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_read_pixels (int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
CoglReadPixelsFlags source,
|
||||
CoglPixelFormat format,
|
||||
uint8_t *pixels)
|
||||
{
|
||||
int bpp;
|
||||
CoglBitmap *bitmap;
|
||||
|
||||
g_return_if_fail (format != COGL_PIXEL_FORMAT_ANY);
|
||||
g_return_if_fail (cogl_pixel_format_get_n_planes (format) == 1);
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
bpp = cogl_pixel_format_get_bytes_per_pixel (format, 0);
|
||||
bitmap = cogl_bitmap_new_for_data (ctx,
|
||||
width, height,
|
||||
format,
|
||||
bpp * width, /* rowstride */
|
||||
pixels);
|
||||
cogl_framebuffer_read_pixels_into_bitmap (_cogl_get_read_framebuffer (),
|
||||
x, y,
|
||||
source,
|
||||
bitmap);
|
||||
cogl_object_unref (bitmap);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_push_matrix (void)
|
||||
{
|
||||
cogl_framebuffer_push_matrix (cogl_get_draw_framebuffer ());
|
||||
}
|
||||
|
||||
void
|
||||
cogl_pop_matrix (void)
|
||||
{
|
||||
cogl_framebuffer_pop_matrix (cogl_get_draw_framebuffer ());
|
||||
}
|
||||
|
||||
void
|
||||
cogl_scale (float x, float y, float z)
|
||||
{
|
||||
cogl_framebuffer_scale (cogl_get_draw_framebuffer (), x, y, z);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_translate (float x, float y, float z)
|
||||
{
|
||||
cogl_framebuffer_translate (cogl_get_draw_framebuffer (), x, y, z);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_rotate (float angle, float x, float y, float z)
|
||||
{
|
||||
cogl_framebuffer_rotate (cogl_get_draw_framebuffer (), angle, x, y, z);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_transform (const CoglMatrix *matrix)
|
||||
{
|
||||
cogl_framebuffer_transform (cogl_get_draw_framebuffer (), matrix);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_perspective (float fov_y,
|
||||
float aspect,
|
||||
float z_near,
|
||||
float z_far)
|
||||
{
|
||||
cogl_framebuffer_perspective (cogl_get_draw_framebuffer (),
|
||||
fov_y, aspect, z_near, z_far);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_frustum (float left,
|
||||
float right,
|
||||
float bottom,
|
||||
float top,
|
||||
float z_near,
|
||||
float z_far)
|
||||
{
|
||||
cogl_framebuffer_frustum (cogl_get_draw_framebuffer (),
|
||||
left, right, bottom, top, z_near, z_far);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_ortho (float left,
|
||||
float right,
|
||||
float bottom,
|
||||
float top,
|
||||
float near,
|
||||
float far)
|
||||
{
|
||||
cogl_framebuffer_orthographic (cogl_get_draw_framebuffer (),
|
||||
left, top, right, bottom, near, far);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_get_modelview_matrix (CoglMatrix *matrix)
|
||||
{
|
||||
cogl_framebuffer_get_modelview_matrix (cogl_get_draw_framebuffer (), matrix);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_set_modelview_matrix (CoglMatrix *matrix)
|
||||
{
|
||||
cogl_framebuffer_set_modelview_matrix (cogl_get_draw_framebuffer (), matrix);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_get_projection_matrix (CoglMatrix *matrix)
|
||||
{
|
||||
cogl_framebuffer_get_projection_matrix (cogl_get_draw_framebuffer (), matrix);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_set_projection_matrix (CoglMatrix *matrix)
|
||||
{
|
||||
cogl_framebuffer_set_projection_matrix (cogl_get_draw_framebuffer (), matrix);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
_cogl_driver_error_quark (void)
|
||||
{
|
||||
return g_quark_from_static_string ("cogl-driver-error-quark");
|
||||
}
|
||||
|
||||
typedef struct _CoglSourceState
|
||||
{
|
||||
CoglPipeline *pipeline;
|
||||
int push_count;
|
||||
/* If this is TRUE then the pipeline will be copied and the legacy
|
||||
state will be applied whenever the pipeline is used. This is
|
||||
necessary because some internal Cogl code expects to be able to
|
||||
push a temporary pipeline to put GL into a known state. For that
|
||||
to work it also needs to prevent applying the legacy state */
|
||||
gboolean enable_legacy;
|
||||
} CoglSourceState;
|
||||
|
||||
static void
|
||||
_push_source_real (CoglPipeline *pipeline, gboolean enable_legacy)
|
||||
{
|
||||
CoglSourceState *top = g_slice_new (CoglSourceState);
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
top->pipeline = cogl_object_ref (pipeline);
|
||||
top->enable_legacy = enable_legacy;
|
||||
top->push_count = 1;
|
||||
|
||||
ctx->source_stack = g_list_prepend (ctx->source_stack, top);
|
||||
}
|
||||
|
||||
/* FIXME: This should take a context pointer for Cogl 2.0 Technically
|
||||
* we could make it so we can retrieve a context reference from the
|
||||
* pipeline, but this would not by symmetric with cogl_pop_source. */
|
||||
void
|
||||
cogl_push_source (void *material_or_pipeline)
|
||||
{
|
||||
CoglPipeline *pipeline = COGL_PIPELINE (material_or_pipeline);
|
||||
|
||||
g_return_if_fail (cogl_is_pipeline (pipeline));
|
||||
|
||||
_cogl_push_source (pipeline, TRUE);
|
||||
}
|
||||
|
||||
/* This internal version of cogl_push_source is the same except it
|
||||
never applies the legacy state. Some parts of Cogl use this
|
||||
internally to set a temporary pipeline with a known state */
|
||||
void
|
||||
_cogl_push_source (CoglPipeline *pipeline, gboolean enable_legacy)
|
||||
{
|
||||
CoglSourceState *top;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
g_return_if_fail (cogl_is_pipeline (pipeline));
|
||||
|
||||
if (ctx->source_stack)
|
||||
{
|
||||
top = ctx->source_stack->data;
|
||||
if (top->pipeline == pipeline && top->enable_legacy == enable_legacy)
|
||||
{
|
||||
top->push_count++;
|
||||
return;
|
||||
}
|
||||
else
|
||||
_push_source_real (pipeline, enable_legacy);
|
||||
}
|
||||
else
|
||||
_push_source_real (pipeline, enable_legacy);
|
||||
}
|
||||
|
||||
/* FIXME: This needs to take a context pointer for Cogl 2.0 */
|
||||
void
|
||||
cogl_pop_source (void)
|
||||
{
|
||||
CoglSourceState *top;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
g_return_if_fail (ctx->source_stack);
|
||||
|
||||
top = ctx->source_stack->data;
|
||||
top->push_count--;
|
||||
if (top->push_count == 0)
|
||||
{
|
||||
cogl_object_unref (top->pipeline);
|
||||
g_slice_free (CoglSourceState, top);
|
||||
ctx->source_stack = g_list_delete_link (ctx->source_stack,
|
||||
ctx->source_stack);
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: This needs to take a context pointer for Cogl 2.0 */
|
||||
void *
|
||||
cogl_get_source (void)
|
||||
{
|
||||
CoglSourceState *top;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NULL);
|
||||
|
||||
g_return_val_if_fail (ctx->source_stack, NULL);
|
||||
|
||||
top = ctx->source_stack->data;
|
||||
return top->pipeline;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_cogl_get_enable_legacy_state (void)
|
||||
{
|
||||
CoglSourceState *top;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||
|
||||
g_return_val_if_fail (ctx->source_stack, FALSE);
|
||||
|
||||
top = ctx->source_stack->data;
|
||||
return top->enable_legacy;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_set_source (void *material_or_pipeline)
|
||||
{
|
||||
CoglSourceState *top;
|
||||
CoglPipeline *pipeline = COGL_PIPELINE (material_or_pipeline);
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
g_return_if_fail (cogl_is_pipeline (pipeline));
|
||||
g_return_if_fail (ctx->source_stack);
|
||||
|
||||
top = ctx->source_stack->data;
|
||||
if (top->pipeline == pipeline && top->enable_legacy)
|
||||
return;
|
||||
|
||||
if (top->push_count == 1)
|
||||
{
|
||||
/* NB: top->pipeline may be only thing keeping pipeline
|
||||
* alive currently so ref pipeline first... */
|
||||
cogl_object_ref (pipeline);
|
||||
cogl_object_unref (top->pipeline);
|
||||
top->pipeline = pipeline;
|
||||
top->enable_legacy = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
top->push_count--;
|
||||
cogl_push_source (pipeline);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cogl_set_source_texture (CoglTexture *texture)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
g_return_if_fail (texture != NULL);
|
||||
|
||||
cogl_pipeline_set_layer_texture (ctx->texture_pipeline, 0, texture);
|
||||
cogl_set_source (ctx->texture_pipeline);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_set_source_color4ub (uint8_t red,
|
||||
uint8_t green,
|
||||
uint8_t blue,
|
||||
uint8_t alpha)
|
||||
{
|
||||
CoglColor c = { 0, };
|
||||
|
||||
cogl_color_init_from_4ub (&c, red, green, blue, alpha);
|
||||
cogl_set_source_color (&c);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_set_source_color4f (float red,
|
||||
float green,
|
||||
float blue,
|
||||
float alpha)
|
||||
{
|
||||
CoglColor c = { 0, };
|
||||
|
||||
cogl_color_init_from_4f (&c, red, green, blue, alpha);
|
||||
cogl_set_source_color (&c);
|
||||
}
|
||||
|
||||
/* Scale from OpenGL normalized device coordinates (ranging from -1 to 1)
|
||||
* to Cogl window/framebuffer coordinates (ranging from 0 to buffer-size) with
|
||||
* (0,0) being top left. */
|
||||
|
@@ -65,7 +65,6 @@
|
||||
#include <cogl/cogl-matrix-stack.h>
|
||||
#include <cogl/cogl-offscreen.h>
|
||||
#include <cogl/cogl-pixel-format.h>
|
||||
#include <cogl/cogl-primitives.h>
|
||||
#include <cogl/cogl-texture.h>
|
||||
#include <cogl/cogl-types.h>
|
||||
#include <cogl/cogl-version.h>
|
||||
@@ -84,11 +83,9 @@
|
||||
* they enable the experimental api... */
|
||||
#include <cogl/deprecated/cogl-type-casts.h>
|
||||
|
||||
#include <cogl/deprecated/cogl-framebuffer-deprecated.h>
|
||||
#include <cogl/deprecated/cogl-auto-texture.h>
|
||||
#include <cogl/deprecated/cogl-shader.h>
|
||||
#include <cogl/deprecated/cogl-material-compat.h>
|
||||
#include <cogl/deprecated/cogl-vertex-buffer.h>
|
||||
|
||||
#ifdef COGL_ENABLE_MUTTER_API
|
||||
#include <cogl/cogl-mutter.h>
|
||||
|
@@ -79,313 +79,6 @@ cogl_get_option_group (void);
|
||||
GCallback
|
||||
cogl_get_proc_address (const char *name);
|
||||
|
||||
/**
|
||||
* cogl_get_bitmasks:
|
||||
* @red: (out): Return location for the number of red bits or %NULL
|
||||
* @green: (out): Return location for the number of green bits or %NULL
|
||||
* @blue: (out): Return location for the number of blue bits or %NULL
|
||||
* @alpha: (out): Return location for the number of alpha bits or %NULL
|
||||
*
|
||||
* Gets the number of bitplanes used for each of the color components
|
||||
* in the color buffer. Pass %NULL for any of the arguments if the
|
||||
* value is not required.
|
||||
*
|
||||
* Deprecated: 1.8: Use cogl_framebuffer_get_red/green/blue/alpha_bits()
|
||||
* instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_framebuffer_get_red_OR_green_OR_blue_OR_alpha_bits)
|
||||
void
|
||||
cogl_get_bitmasks (int *red,
|
||||
int *green,
|
||||
int *blue,
|
||||
int *alpha);
|
||||
|
||||
/**
|
||||
* cogl_perspective:
|
||||
* @fovy: Vertical field of view angle in degrees.
|
||||
* @aspect: The (width over height) aspect ratio for display
|
||||
* @z_near: The distance to the near clipping plane (Must be positive)
|
||||
* @z_far: The distance to the far clipping plane (Must be positive)
|
||||
*
|
||||
* Replaces the current projection matrix with a perspective matrix
|
||||
* based on the provided values.
|
||||
*
|
||||
* <note>You should be careful not to have to great a @z_far / @z_near
|
||||
* ratio since that will reduce the effectiveness of depth testing
|
||||
* since there wont be enough precision to identify the depth of
|
||||
* objects near to each other.</note>
|
||||
*
|
||||
* Deprecated: 1.10: Use cogl_framebuffer_perspective() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_framebuffer_perspective)
|
||||
void
|
||||
cogl_perspective (float fovy,
|
||||
float aspect,
|
||||
float z_near,
|
||||
float z_far);
|
||||
|
||||
/**
|
||||
* cogl_frustum:
|
||||
* @left: X position of the left clipping plane where it
|
||||
* intersects the near clipping plane
|
||||
* @right: X position of the right clipping plane where it
|
||||
* intersects the near clipping plane
|
||||
* @bottom: Y position of the bottom clipping plane where it
|
||||
* intersects the near clipping plane
|
||||
* @top: Y position of the top clipping plane where it intersects
|
||||
* the near clipping plane
|
||||
* @z_near: The distance to the near clipping plane (Must be positive)
|
||||
* @z_far: The distance to the far clipping plane (Must be positive)
|
||||
*
|
||||
* Replaces the current projection matrix with a perspective matrix
|
||||
* for a given viewing frustum defined by 4 side clip planes that
|
||||
* all cross through the origin and 2 near and far clip planes.
|
||||
*
|
||||
* Since: 0.8.2
|
||||
* Deprecated: 1.10: Use cogl_framebuffer_frustum() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_framebuffer_frustum)
|
||||
void
|
||||
cogl_frustum (float left,
|
||||
float right,
|
||||
float bottom,
|
||||
float top,
|
||||
float z_near,
|
||||
float z_far);
|
||||
|
||||
/**
|
||||
* cogl_ortho:
|
||||
* @left: The coordinate for the left clipping plane
|
||||
* @right: The coordinate for the right clipping plane
|
||||
* @bottom: The coordinate for the bottom clipping plane
|
||||
* @top: The coordinate for the top clipping plane
|
||||
* @near: The <emphasis>distance</emphasis> to the near clipping
|
||||
* plane (negative if the plane is behind the viewer)
|
||||
* @far: The <emphasis>distance</emphasis> for the far clipping
|
||||
* plane (negative if the plane is behind the viewer)
|
||||
*
|
||||
* Replaces the current projection matrix with an orthographic projection
|
||||
* matrix. See <xref linkend="cogl-ortho-matrix"/> to see how the matrix is
|
||||
* calculated.
|
||||
*
|
||||
* <figure id="cogl-ortho-matrix">
|
||||
* <title></title>
|
||||
* <graphic fileref="cogl_ortho.png" format="PNG"/>
|
||||
* </figure>
|
||||
*
|
||||
* <note>This function copies the arguments from OpenGL's glOrtho() even
|
||||
* though they are unnecessarily confusing due to the z near and z far
|
||||
* arguments actually being a "distance" from the origin, where
|
||||
* negative values are behind the viewer, instead of coordinates for
|
||||
* the z clipping planes which would have been consistent with the
|
||||
* left, right bottom and top arguments.</note>
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.10: Use cogl_framebuffer_orthographic() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_framebuffer_orthographic)
|
||||
void
|
||||
cogl_ortho (float left,
|
||||
float right,
|
||||
float bottom,
|
||||
float top,
|
||||
float near,
|
||||
float far);
|
||||
|
||||
/**
|
||||
* cogl_viewport:
|
||||
* @width: Width of the viewport
|
||||
* @height: Height of the viewport
|
||||
*
|
||||
* Replace the current viewport with the given values.
|
||||
*
|
||||
* Since: 0.8.2
|
||||
* Deprecated: 1.8: Use cogl_framebuffer_set_viewport instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_framebuffer_set_viewport)
|
||||
void
|
||||
cogl_viewport (unsigned int width,
|
||||
unsigned int height);
|
||||
|
||||
/**
|
||||
* cogl_set_viewport:
|
||||
* @x: X offset of the viewport
|
||||
* @y: Y offset of the viewport
|
||||
* @width: Width of the viewport
|
||||
* @height: Height of the viewport
|
||||
*
|
||||
* Replaces the current viewport with the given values.
|
||||
*
|
||||
* Since: 1.2
|
||||
* Deprecated: 1.8: Use cogl_framebuffer_set_viewport() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_framebuffer_set_viewport)
|
||||
void
|
||||
cogl_set_viewport (int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
/**
|
||||
* cogl_push_matrix:
|
||||
*
|
||||
* Stores the current model-view matrix on the matrix stack. The matrix
|
||||
* can later be restored with cogl_pop_matrix().
|
||||
*
|
||||
* Deprecated: 1.10: Use cogl_framebuffer_push_matrix() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_framebuffer_push_matrix)
|
||||
void
|
||||
cogl_push_matrix (void);
|
||||
|
||||
/**
|
||||
* cogl_pop_matrix:
|
||||
*
|
||||
* Restores the current model-view matrix from the matrix stack.
|
||||
*
|
||||
* Deprecated: 1.10: Use cogl_framebuffer_pop_matrix() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_framebuffer_push_matrix)
|
||||
void
|
||||
cogl_pop_matrix (void);
|
||||
|
||||
/**
|
||||
* cogl_scale:
|
||||
* @x: Amount to scale along the x-axis
|
||||
* @y: Amount to scale along the y-axis
|
||||
* @z: Amount to scale along the z-axis
|
||||
*
|
||||
* Multiplies the current model-view matrix by one that scales the x,
|
||||
* y and z axes by the given values.
|
||||
*
|
||||
* Deprecated: 1.10: Use cogl_framebuffer_pop_matrix() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_framebuffer_scale)
|
||||
void
|
||||
cogl_scale (float x,
|
||||
float y,
|
||||
float z);
|
||||
|
||||
/**
|
||||
* cogl_translate:
|
||||
* @x: Distance to translate along the x-axis
|
||||
* @y: Distance to translate along the y-axis
|
||||
* @z: Distance to translate along the z-axis
|
||||
*
|
||||
* Multiplies the current model-view matrix by one that translates the
|
||||
* model along all three axes according to the given values.
|
||||
*
|
||||
* Deprecated: 1.10: Use cogl_framebuffer_translate() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_framebuffer_translate)
|
||||
void
|
||||
cogl_translate (float x,
|
||||
float y,
|
||||
float z);
|
||||
|
||||
/**
|
||||
* cogl_rotate:
|
||||
* @angle: Angle in degrees to rotate.
|
||||
* @x: X-component of vertex to rotate around.
|
||||
* @y: Y-component of vertex to rotate around.
|
||||
* @z: Z-component of vertex to rotate around.
|
||||
*
|
||||
* Multiplies the current model-view matrix by one that rotates the
|
||||
* model around the vertex specified by @x, @y and @z. The rotation
|
||||
* follows the right-hand thumb rule so for example rotating by 10
|
||||
* degrees about the vertex (0, 0, 1) causes a small counter-clockwise
|
||||
* rotation.
|
||||
*
|
||||
* Deprecated: 1.10: Use cogl_framebuffer_rotate() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_framebuffer_rotate)
|
||||
void
|
||||
cogl_rotate (float angle,
|
||||
float x,
|
||||
float y,
|
||||
float z);
|
||||
|
||||
/**
|
||||
* cogl_transform:
|
||||
* @matrix: the matrix to multiply with the current model-view
|
||||
*
|
||||
* Multiplies the current model-view matrix by the given matrix.
|
||||
*
|
||||
* Since: 1.4
|
||||
* Deprecated: 1.10: Use cogl_framebuffer_transform() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_framebuffer_transform)
|
||||
void
|
||||
cogl_transform (const CoglMatrix *matrix);
|
||||
|
||||
/**
|
||||
* cogl_get_modelview_matrix:
|
||||
* @matrix: (out): return location for the model-view matrix
|
||||
*
|
||||
* Stores the current model-view matrix in @matrix.
|
||||
*
|
||||
* Deprecated: 1.10: Use cogl_framebuffer_get_modelview_matrix()
|
||||
* instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_framebuffer_get_modelview_matrix)
|
||||
void
|
||||
cogl_get_modelview_matrix (CoglMatrix *matrix);
|
||||
|
||||
/**
|
||||
* cogl_set_modelview_matrix:
|
||||
* @matrix: the new model-view matrix
|
||||
*
|
||||
* Loads @matrix as the new model-view matrix.
|
||||
*
|
||||
* Deprecated: 1.10: Use cogl_framebuffer_set_modelview_matrix()
|
||||
* instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_framebuffer_set_modelview_matrix)
|
||||
void
|
||||
cogl_set_modelview_matrix (CoglMatrix *matrix);
|
||||
|
||||
/**
|
||||
* cogl_get_projection_matrix:
|
||||
* @matrix: (out): return location for the projection matrix
|
||||
*
|
||||
* Stores the current projection matrix in @matrix.
|
||||
*
|
||||
* Deprecated: 1.10: Use cogl_framebuffer_get_projection_matrix()
|
||||
* instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_framebuffer_get_projection_matrix)
|
||||
void
|
||||
cogl_get_projection_matrix (CoglMatrix *matrix);
|
||||
|
||||
/**
|
||||
* cogl_set_projection_matrix:
|
||||
* @matrix: the new projection matrix
|
||||
*
|
||||
* Loads matrix as the new projection matrix.
|
||||
*
|
||||
* Deprecated: 1.10: Use cogl_framebuffer_set_projection_matrix()
|
||||
* instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_framebuffer_set_projection_matrix)
|
||||
void
|
||||
cogl_set_projection_matrix (CoglMatrix *matrix);
|
||||
|
||||
/**
|
||||
* cogl_get_viewport:
|
||||
* @v: (out) (array fixed-size=4): pointer to a 4 element array
|
||||
* of #float<!-- -->s to receive the viewport dimensions.
|
||||
*
|
||||
* Stores the current viewport in @v. @v[0] and @v[1] get the x and y
|
||||
* position of the viewport and @v[2] and @v[3] get the width and
|
||||
* height.
|
||||
*
|
||||
* Deprecated: 1.10: Use cogl_framebuffer_get_viewport4fv()
|
||||
* instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_framebuffer_get_viewport4fv)
|
||||
void
|
||||
cogl_get_viewport (float v[4]);
|
||||
|
||||
/**
|
||||
* cogl_set_depth_test_enabled:
|
||||
* @setting: %TRUE to enable depth testing or %FALSE to disable.
|
||||
@@ -445,200 +138,6 @@ COGL_DEPRECATED_FOR (cogl_pipeline_get_cull_face_mode)
|
||||
gboolean
|
||||
cogl_get_backface_culling_enabled (void);
|
||||
|
||||
/**
|
||||
* cogl_clear:
|
||||
* @color: Background color to clear to
|
||||
* @buffers: A mask of #CoglBufferBit<!-- -->'s identifying which auxiliary
|
||||
* buffers to clear
|
||||
*
|
||||
* Clears all the auxiliary buffers identified in the @buffers mask, and if
|
||||
* that includes the color buffer then the specified @color is used.
|
||||
*
|
||||
* Deprecated: 1.16: Use cogl_framebuffer_clear() api instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_framebuffer_clear)
|
||||
void
|
||||
cogl_clear (const CoglColor *color,
|
||||
unsigned long buffers);
|
||||
|
||||
/**
|
||||
* cogl_set_source:
|
||||
* @material: A #CoglMaterial
|
||||
*
|
||||
* This function changes the material at the top of the source stack.
|
||||
* The material at the top of this stack defines the GPU state used to
|
||||
* process subsequent primitives, such as rectangles drawn with
|
||||
* cogl_rectangle() or vertices drawn using cogl_vertex_buffer_draw().
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.16: Latest drawing apis all take an explicit
|
||||
* #CoglPipeline argument so this stack of
|
||||
* #CoglMaterial<!-- -->s shouldn't be used.
|
||||
*/
|
||||
COGL_DEPRECATED
|
||||
void
|
||||
cogl_set_source (void *material);
|
||||
|
||||
/**
|
||||
* cogl_get_source:
|
||||
*
|
||||
* Returns the current source material as previously set using
|
||||
* cogl_set_source().
|
||||
*
|
||||
* <note>You should typically consider the returned material immutable
|
||||
* and not try to change any of its properties unless you own a
|
||||
* reference to that material. At times you may be able to get a
|
||||
* reference to an internally managed materials and the result of
|
||||
* modifying such materials is undefined.</note>
|
||||
*
|
||||
* Return value: The current source material.
|
||||
*
|
||||
* Since: 1.6
|
||||
* Deprecated: 1.16: Latest drawing apis all take an explicit
|
||||
* #CoglPipeline argument so this stack of
|
||||
* #CoglMaterial<!-- -->s shouldn't be used.
|
||||
*/
|
||||
COGL_DEPRECATED
|
||||
void *
|
||||
cogl_get_source (void);
|
||||
|
||||
/**
|
||||
* cogl_push_source:
|
||||
* @material: A #CoglMaterial
|
||||
*
|
||||
* Pushes the given @material to the top of the source stack. The
|
||||
* material at the top of this stack defines the GPU state used to
|
||||
* process later primitives as defined by cogl_set_source().
|
||||
*
|
||||
* Since: 1.6
|
||||
* Deprecated: 1.16: Latest drawing apis all take an explicit
|
||||
* #CoglPipeline argument so this stack of
|
||||
* #CoglMaterial<!-- -->s shouldn't be used.
|
||||
*/
|
||||
COGL_DEPRECATED
|
||||
void
|
||||
cogl_push_source (void *material);
|
||||
|
||||
/**
|
||||
* cogl_pop_source:
|
||||
*
|
||||
* Removes the material at the top of the source stack. The material
|
||||
* at the top of this stack defines the GPU state used to process
|
||||
* later primitives as defined by cogl_set_source().
|
||||
*
|
||||
* Since: 1.6
|
||||
* Deprecated: 1.16: Latest drawing apis all take an explicit
|
||||
* #CoglPipeline argument so this stack of
|
||||
* #CoglMaterial<!-- -->s shouldn't be used.
|
||||
*/
|
||||
COGL_DEPRECATED
|
||||
void
|
||||
cogl_pop_source (void);
|
||||
|
||||
/**
|
||||
* cogl_set_source_color:
|
||||
* @color: a #CoglColor
|
||||
*
|
||||
* This is a convenience function for creating a solid fill source material
|
||||
* from the given color. This color will be used for any subsequent drawing
|
||||
* operation.
|
||||
*
|
||||
* The color will be premultiplied by Cogl, so the color should be
|
||||
* non-premultiplied. For example: use (1.0, 0.0, 0.0, 0.5) for
|
||||
* semi-transparent red.
|
||||
*
|
||||
* See also cogl_set_source_color4ub() and cogl_set_source_color4f()
|
||||
* if you already have the color components.
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.16: Latest drawing apis all take an explicit
|
||||
* #CoglPipeline argument so this stack of
|
||||
* #CoglMaterial<!-- -->s shouldn't be used.
|
||||
*/
|
||||
COGL_DEPRECATED
|
||||
void
|
||||
cogl_set_source_color (const CoglColor *color);
|
||||
|
||||
/**
|
||||
* cogl_set_source_color4ub:
|
||||
* @red: value of the red channel, between 0 and 255
|
||||
* @green: value of the green channel, between 0 and 255
|
||||
* @blue: value of the blue channel, between 0 and 255
|
||||
* @alpha: value of the alpha channel, between 0 and 255
|
||||
*
|
||||
* This is a convenience function for creating a solid fill source material
|
||||
* from the given color using unsigned bytes for each component. This
|
||||
* color will be used for any subsequent drawing operation.
|
||||
*
|
||||
* The value for each component is an unsigned byte in the range
|
||||
* between 0 and 255.
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.16: Latest drawing apis all take an explicit
|
||||
* #CoglPipeline argument so this stack of
|
||||
* #CoglMaterial<!-- -->s shouldn't be used.
|
||||
*/
|
||||
COGL_DEPRECATED
|
||||
void
|
||||
cogl_set_source_color4ub (uint8_t red,
|
||||
uint8_t green,
|
||||
uint8_t blue,
|
||||
uint8_t alpha);
|
||||
|
||||
/**
|
||||
* cogl_set_source_color4f:
|
||||
* @red: value of the red channel, between 0 and %1.0
|
||||
* @green: value of the green channel, between 0 and %1.0
|
||||
* @blue: value of the blue channel, between 0 and %1.0
|
||||
* @alpha: value of the alpha channel, between 0 and %1.0
|
||||
*
|
||||
* This is a convenience function for creating a solid fill source material
|
||||
* from the given color using normalized values for each component. This color
|
||||
* will be used for any subsequent drawing operation.
|
||||
*
|
||||
* The value for each component is a fixed point number in the range
|
||||
* between 0 and %1.0. If the values passed in are outside that
|
||||
* range, they will be clamped.
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.16: Latest drawing apis all take an explicit
|
||||
* #CoglPipeline argument so this stack of
|
||||
* #CoglMaterial<!-- -->s shouldn't be used.
|
||||
*/
|
||||
COGL_DEPRECATED
|
||||
void
|
||||
cogl_set_source_color4f (float red,
|
||||
float green,
|
||||
float blue,
|
||||
float alpha);
|
||||
|
||||
/**
|
||||
* cogl_set_source_texture:
|
||||
* @texture: The #CoglTexture you want as your source
|
||||
*
|
||||
* This is a convenience function for creating a material with the first
|
||||
* layer set to @texture and setting that material as the source with
|
||||
* cogl_set_source.
|
||||
*
|
||||
* Note: There is no interaction between calls to cogl_set_source_color
|
||||
* and cogl_set_source_texture. If you need to blend a texture with a color then
|
||||
* you can create a simple material like this:
|
||||
* <programlisting>
|
||||
* material = cogl_material_new ();
|
||||
* cogl_material_set_color4ub (material, 0xff, 0x00, 0x00, 0x80);
|
||||
* cogl_material_set_layer (material, 0, tex_handle);
|
||||
* cogl_set_source (material);
|
||||
* </programlisting>
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.16: Latest drawing apis all take an explicit
|
||||
* #CoglPipeline argument so this stack of
|
||||
* #CoglMaterial<!-- -->s shouldn't be used.
|
||||
*/
|
||||
COGL_DEPRECATED
|
||||
void
|
||||
cogl_set_source_texture (CoglTexture *texture);
|
||||
|
||||
/**
|
||||
* cogl_flush:
|
||||
*
|
||||
|
@@ -160,8 +160,7 @@ cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
|
||||
* data is actually allocated.
|
||||
*
|
||||
* Sub textures have undefined behaviour texture coordinates outside
|
||||
* of the range [0,1] are used. They also do not work with
|
||||
* CoglVertexBuffers.
|
||||
* of the range [0,1] are used.
|
||||
*
|
||||
* The sub texture will keep a reference to the full texture so you do
|
||||
* not need to keep one separately if you only want to use the sub
|
||||
|
@@ -1,260 +0,0 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* A Low Level GPU Graphics and Utilities API
|
||||
*
|
||||
* Copyright (C) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "cogl-config.h"
|
||||
|
||||
#include "cogl-types.h"
|
||||
#include "cogl-context-private.h"
|
||||
#include "cogl-framebuffer-private.h"
|
||||
#include "cogl-framebuffer-deprecated.h"
|
||||
|
||||
typedef struct _CoglFramebufferStackEntry
|
||||
{
|
||||
CoglFramebuffer *draw_buffer;
|
||||
CoglFramebuffer *read_buffer;
|
||||
} CoglFramebufferStackEntry;
|
||||
|
||||
|
||||
static CoglFramebufferStackEntry *
|
||||
create_stack_entry (CoglFramebuffer *draw_buffer,
|
||||
CoglFramebuffer *read_buffer)
|
||||
{
|
||||
CoglFramebufferStackEntry *entry = g_slice_new (CoglFramebufferStackEntry);
|
||||
|
||||
entry->draw_buffer = draw_buffer;
|
||||
entry->read_buffer = read_buffer;
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
GSList *
|
||||
_cogl_create_framebuffer_stack (void)
|
||||
{
|
||||
CoglFramebufferStackEntry *entry;
|
||||
GSList *stack = NULL;
|
||||
|
||||
entry = create_stack_entry (NULL, NULL);
|
||||
|
||||
return g_slist_prepend (stack, entry);
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_free_framebuffer_stack (GSList *stack)
|
||||
{
|
||||
GSList *l;
|
||||
|
||||
for (l = stack; l != NULL; l = l->next)
|
||||
{
|
||||
CoglFramebufferStackEntry *entry = l->data;
|
||||
|
||||
if (entry->draw_buffer)
|
||||
cogl_object_unref (entry->draw_buffer);
|
||||
|
||||
if (entry->read_buffer)
|
||||
cogl_object_unref (entry->read_buffer);
|
||||
|
||||
g_slice_free (CoglFramebufferStackEntry, entry);
|
||||
}
|
||||
g_slist_free (stack);
|
||||
}
|
||||
|
||||
static void
|
||||
notify_buffers_changed (CoglFramebuffer *old_draw_buffer,
|
||||
CoglFramebuffer *new_draw_buffer,
|
||||
CoglFramebuffer *old_read_buffer,
|
||||
CoglFramebuffer *new_read_buffer)
|
||||
{
|
||||
/* XXX: To support the deprecated cogl_set_draw_buffer API we keep
|
||||
* track of the last onscreen framebuffer that was set so that it
|
||||
* can be restored if the COGL_WINDOW_BUFFER enum is used. A
|
||||
* reference isn't taken to the framebuffer because otherwise we
|
||||
* would have a circular reference between the context and the
|
||||
* framebuffer. Instead the pointer is set to NULL in
|
||||
* _cogl_onscreen_free as a kind of a cheap weak reference */
|
||||
if (new_draw_buffer &&
|
||||
new_draw_buffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN)
|
||||
new_draw_buffer->context->window_buffer = new_draw_buffer;
|
||||
}
|
||||
|
||||
/* Set the current framebuffer without checking if it's already the
|
||||
* current framebuffer. This is used by cogl_pop_framebuffer while
|
||||
* the top of the stack is currently not up to date. */
|
||||
static void
|
||||
_cogl_set_framebuffers_real (CoglFramebuffer *draw_buffer,
|
||||
CoglFramebuffer *read_buffer)
|
||||
{
|
||||
CoglFramebufferStackEntry *entry;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
g_return_if_fail (ctx != NULL);
|
||||
g_return_if_fail (draw_buffer && read_buffer ?
|
||||
draw_buffer->context == read_buffer->context : TRUE);
|
||||
|
||||
entry = ctx->framebuffer_stack->data;
|
||||
|
||||
notify_buffers_changed (entry->draw_buffer,
|
||||
draw_buffer,
|
||||
entry->read_buffer,
|
||||
read_buffer);
|
||||
|
||||
if (draw_buffer)
|
||||
cogl_object_ref (draw_buffer);
|
||||
if (entry->draw_buffer)
|
||||
cogl_object_unref (entry->draw_buffer);
|
||||
|
||||
if (read_buffer)
|
||||
cogl_object_ref (read_buffer);
|
||||
if (entry->read_buffer)
|
||||
cogl_object_unref (entry->read_buffer);
|
||||
|
||||
entry->draw_buffer = draw_buffer;
|
||||
entry->read_buffer = read_buffer;
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_set_framebuffers (CoglFramebuffer *draw_buffer,
|
||||
CoglFramebuffer *read_buffer)
|
||||
{
|
||||
CoglFramebuffer *current_draw_buffer;
|
||||
CoglFramebuffer *current_read_buffer;
|
||||
|
||||
g_return_if_fail (cogl_is_framebuffer (draw_buffer));
|
||||
g_return_if_fail (cogl_is_framebuffer (read_buffer));
|
||||
|
||||
current_draw_buffer = cogl_get_draw_framebuffer ();
|
||||
current_read_buffer = _cogl_get_read_framebuffer ();
|
||||
|
||||
if (current_draw_buffer != draw_buffer ||
|
||||
current_read_buffer != read_buffer)
|
||||
_cogl_set_framebuffers_real (draw_buffer, read_buffer);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_set_framebuffer (CoglFramebuffer *framebuffer)
|
||||
{
|
||||
_cogl_set_framebuffers (framebuffer, framebuffer);
|
||||
}
|
||||
|
||||
CoglFramebuffer *
|
||||
cogl_get_draw_framebuffer (void)
|
||||
{
|
||||
CoglFramebufferStackEntry *entry;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NULL);
|
||||
|
||||
g_assert (ctx->framebuffer_stack);
|
||||
|
||||
entry = ctx->framebuffer_stack->data;
|
||||
|
||||
return entry->draw_buffer;
|
||||
}
|
||||
|
||||
CoglFramebuffer *
|
||||
_cogl_get_read_framebuffer (void)
|
||||
{
|
||||
CoglFramebufferStackEntry *entry;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NULL);
|
||||
|
||||
g_assert (ctx->framebuffer_stack);
|
||||
|
||||
entry = ctx->framebuffer_stack->data;
|
||||
|
||||
return entry->read_buffer;
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_push_framebuffers (CoglFramebuffer *draw_buffer,
|
||||
CoglFramebuffer *read_buffer)
|
||||
{
|
||||
CoglContext *ctx;
|
||||
CoglFramebuffer *old_draw_buffer, *old_read_buffer;
|
||||
|
||||
g_return_if_fail (cogl_is_framebuffer (draw_buffer));
|
||||
g_return_if_fail (cogl_is_framebuffer (read_buffer));
|
||||
|
||||
ctx = draw_buffer->context;
|
||||
g_return_if_fail (ctx != NULL);
|
||||
g_return_if_fail (draw_buffer->context == read_buffer->context);
|
||||
|
||||
g_return_if_fail (ctx->framebuffer_stack != NULL);
|
||||
|
||||
/* Copy the top of the stack so that when we call cogl_set_framebuffer
|
||||
it will still know what the old framebuffer was */
|
||||
old_draw_buffer = cogl_get_draw_framebuffer ();
|
||||
if (old_draw_buffer)
|
||||
cogl_object_ref (old_draw_buffer);
|
||||
old_read_buffer = _cogl_get_read_framebuffer ();
|
||||
if (old_read_buffer)
|
||||
cogl_object_ref (old_read_buffer);
|
||||
ctx->framebuffer_stack =
|
||||
g_slist_prepend (ctx->framebuffer_stack,
|
||||
create_stack_entry (old_draw_buffer,
|
||||
old_read_buffer));
|
||||
|
||||
_cogl_set_framebuffers (draw_buffer, read_buffer);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_push_framebuffer (CoglFramebuffer *buffer)
|
||||
{
|
||||
_cogl_push_framebuffers (buffer, buffer);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_pop_framebuffer (void)
|
||||
{
|
||||
CoglFramebufferStackEntry *to_pop;
|
||||
CoglFramebufferStackEntry *to_restore;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
g_assert (ctx->framebuffer_stack != NULL);
|
||||
g_assert (ctx->framebuffer_stack->next != NULL);
|
||||
|
||||
to_pop = ctx->framebuffer_stack->data;
|
||||
to_restore = ctx->framebuffer_stack->next->data;
|
||||
|
||||
if (to_pop->draw_buffer != to_restore->draw_buffer ||
|
||||
to_pop->read_buffer != to_restore->read_buffer)
|
||||
notify_buffers_changed (to_pop->draw_buffer,
|
||||
to_restore->draw_buffer,
|
||||
to_pop->read_buffer,
|
||||
to_restore->read_buffer);
|
||||
|
||||
cogl_object_unref (to_pop->draw_buffer);
|
||||
cogl_object_unref (to_pop->read_buffer);
|
||||
g_slice_free (CoglFramebufferStackEntry, to_pop);
|
||||
|
||||
ctx->framebuffer_stack =
|
||||
g_slist_delete_link (ctx->framebuffer_stack,
|
||||
ctx->framebuffer_stack);
|
||||
}
|
@@ -153,40 +153,6 @@ COGL_DEPRECATED
|
||||
void
|
||||
cogl_pop_framebuffer (void);
|
||||
|
||||
/**
|
||||
* cogl_read_pixels:
|
||||
* @x: The window x position to start reading from
|
||||
* @y: The window y position to start reading from
|
||||
* @width: The width of the rectangle you want to read
|
||||
* @height: The height of the rectangle you want to read
|
||||
* @source: Identifies which auxillary buffer you want to read
|
||||
* (only COGL_READ_PIXELS_COLOR_BUFFER supported currently)
|
||||
* @format: The pixel format you want the result in
|
||||
* (only COGL_PIXEL_FORMAT_RGBA_8888 supported currently)
|
||||
* @pixels: The location to write the pixel data.
|
||||
*
|
||||
* This reads a rectangle of pixels from the current framebuffer where
|
||||
* position (0, 0) is the top left. The pixel at (x, y) is the first
|
||||
* read, and the data is returned with a rowstride of (width * 4).
|
||||
*
|
||||
* Currently Cogl assumes that the framebuffer is in a premultiplied
|
||||
* format so if @format is non-premultiplied it will convert it. To
|
||||
* read the pixel values without any conversion you should either
|
||||
* specify a format that doesn't use an alpha channel or use one of
|
||||
* the formats ending in PRE.
|
||||
*
|
||||
* Deprecated: 1.16: Use cogl_framebuffer_read_pixels() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_framebuffer_read_pixels)
|
||||
void
|
||||
cogl_read_pixels (int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
CoglReadPixelsFlags source,
|
||||
CoglPixelFormat format,
|
||||
uint8_t *pixels);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_FRAMEBUFFER_DEPRECATED_H__ */
|
||||
|
@@ -126,11 +126,6 @@ cogl_program_use (CoglHandle handle)
|
||||
|
||||
g_return_if_fail (handle == NULL || cogl_is_program (handle));
|
||||
|
||||
if (ctx->current_program == 0 && handle != 0)
|
||||
ctx->legacy_state_set++;
|
||||
else if (handle == 0 && ctx->current_program != 0)
|
||||
ctx->legacy_state_set--;
|
||||
|
||||
if (handle != NULL)
|
||||
cogl_object_ref (handle);
|
||||
if (ctx->current_program != NULL)
|
||||
|
@@ -1,165 +0,0 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* A Low Level GPU Graphics and Utilities API
|
||||
*
|
||||
* Copyright (C) 2008,2009 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors:
|
||||
* Robert Bragg <robert@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef __COGL_VERTEX_BUFFER_H
|
||||
#define __COGL_VERTEX_BUFFER_H
|
||||
|
||||
#include "cogl-object-private.h"
|
||||
|
||||
#include "cogl-primitive.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
/* Note we put quite a bit into the flags here to help keep
|
||||
* the down size of the CoglVertexBufferAttrib struct below. */
|
||||
typedef enum _CoglVertexBufferAttribFlags
|
||||
{
|
||||
/* Types */
|
||||
/* NB: update the _TYPE_MASK below if these are changed */
|
||||
COGL_VERTEX_BUFFER_ATTRIB_FLAG_COLOR_ARRAY = 1<<0,
|
||||
COGL_VERTEX_BUFFER_ATTRIB_FLAG_NORMAL_ARRAY = 1<<1,
|
||||
COGL_VERTEX_BUFFER_ATTRIB_FLAG_TEXTURE_COORD_ARRAY = 1<<2,
|
||||
COGL_VERTEX_BUFFER_ATTRIB_FLAG_VERTEX_ARRAY = 1<<3,
|
||||
COGL_VERTEX_BUFFER_ATTRIB_FLAG_CUSTOM_ARRAY = 1<<4,
|
||||
COGL_VERTEX_BUFFER_ATTRIB_FLAG_INVALID = 1<<5,
|
||||
|
||||
COGL_VERTEX_BUFFER_ATTRIB_FLAG_NORMALIZED = 1<<6,
|
||||
COGL_VERTEX_BUFFER_ATTRIB_FLAG_ENABLED = 1<<7,
|
||||
|
||||
/* Usage hints */
|
||||
/* FIXME - flatten into one flag, since its used as a boolean */
|
||||
COGL_VERTEX_BUFFER_ATTRIB_FLAG_INFREQUENT_RESUBMIT = 1<<8,
|
||||
COGL_VERTEX_BUFFER_ATTRIB_FLAG_FREQUENT_RESUBMIT = 1<<9,
|
||||
|
||||
/* GL Data types */
|
||||
/* NB: Update the _GL_TYPE_MASK below if these are changed */
|
||||
COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_BYTE = 1<<10,
|
||||
COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_UNSIGNED_BYTE = 1<<11,
|
||||
COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_SHORT = 1<<12,
|
||||
COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_UNSIGNED_SHORT = 1<<13,
|
||||
COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_INT = 1<<14,
|
||||
COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_UNSIGNED_INT = 1<<15,
|
||||
COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_FLOAT = 1<<16,
|
||||
COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_DOUBLE = 1<<17,
|
||||
|
||||
COGL_VERTEX_BUFFER_ATTRIB_FLAG_SUBMITTED = 1<<18,
|
||||
COGL_VERTEX_BUFFER_ATTRIB_FLAG_UNUSED = 1<<19
|
||||
|
||||
/* XXX NB: If we need > 24 bits then look at changing the layout
|
||||
* of struct _CoglVertexBufferAttrib below */
|
||||
} CoglVertexBufferAttribFlags;
|
||||
|
||||
#define COGL_VERTEX_BUFFER_ATTRIB_FLAG_TYPE_MASK \
|
||||
(COGL_VERTEX_BUFFER_ATTRIB_FLAG_COLOR_ARRAY \
|
||||
| COGL_VERTEX_BUFFER_ATTRIB_FLAG_NORMAL_ARRAY \
|
||||
| COGL_VERTEX_BUFFER_ATTRIB_FLAG_TEXTURE_COORD_ARRAY \
|
||||
| COGL_VERTEX_BUFFER_ATTRIB_FLAG_VERTEX_ARRAY \
|
||||
| COGL_VERTEX_BUFFER_ATTRIB_FLAG_CUSTOM_ARRAY \
|
||||
| COGL_VERTEX_BUFFER_ATTRIB_FLAG_INVALID)
|
||||
|
||||
typedef struct _CoglVertexBufferAttrib
|
||||
{
|
||||
/* TODO: look at breaking up the flags into seperate
|
||||
* bitfields and seperate enums */
|
||||
CoglVertexBufferAttribFlags flags:24;
|
||||
uint8_t id;
|
||||
GQuark name;
|
||||
char *name_without_detail;
|
||||
union _u
|
||||
{
|
||||
const void *pointer;
|
||||
size_t vbo_offset;
|
||||
} u;
|
||||
CoglAttributeType type;
|
||||
size_t span_bytes;
|
||||
uint16_t stride;
|
||||
uint8_t n_components;
|
||||
uint8_t texture_unit;
|
||||
|
||||
int attribute_first;
|
||||
CoglAttribute *attribute;
|
||||
|
||||
} CoglVertexBufferAttrib;
|
||||
|
||||
typedef enum _CoglVertexBufferVBOFlags
|
||||
{
|
||||
COGL_VERTEX_BUFFER_VBO_FLAG_STRIDED = 1<<0,
|
||||
COGL_VERTEX_BUFFER_VBO_FLAG_MULTIPACK = 1<<1,
|
||||
|
||||
/* FIXME - flatten into one flag, since its used as a boolean */
|
||||
COGL_VERTEX_BUFFER_VBO_FLAG_INFREQUENT_RESUBMIT = 1<<3,
|
||||
COGL_VERTEX_BUFFER_VBO_FLAG_FREQUENT_RESUBMIT = 1<<4,
|
||||
|
||||
COGL_VERTEX_BUFFER_VBO_FLAG_SUBMITTED = 1<<5
|
||||
} CoglVertexBufferVBOFlags;
|
||||
|
||||
/*
|
||||
* A CoglVertexBufferVBO represents one or more attributes in a single
|
||||
* buffer object
|
||||
*/
|
||||
typedef struct _CoglVertexBufferVBO
|
||||
{
|
||||
CoglVertexBufferVBOFlags flags;
|
||||
|
||||
CoglAttributeBuffer *attribute_buffer;
|
||||
size_t buffer_bytes;
|
||||
|
||||
GList *attributes;
|
||||
} CoglVertexBufferVBO;
|
||||
|
||||
typedef struct _CoglVertexBufferIndices
|
||||
{
|
||||
CoglHandleObject _parent;
|
||||
|
||||
CoglIndices *indices;
|
||||
} CoglVertexBufferIndices;
|
||||
|
||||
typedef struct _CoglVertexBuffer
|
||||
{
|
||||
CoglHandleObject _parent;
|
||||
|
||||
int n_vertices; /*!< The number of vertices in the buffer */
|
||||
GList *submitted_vbos; /* The VBOs currently submitted to the GPU */
|
||||
|
||||
/* Note: new_attributes is normally NULL and only valid while
|
||||
* modifying a buffer. */
|
||||
GList *new_attributes; /*!< attributes pending submission */
|
||||
|
||||
gboolean dirty_attributes;
|
||||
|
||||
CoglPrimitive *primitive;
|
||||
|
||||
} CoglVertexBuffer;
|
||||
|
||||
#endif /* __COGL_VERTEX_BUFFER_H */
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,425 +0,0 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* A Low Level GPU Graphics and Utilities API
|
||||
*
|
||||
* Copyright (C) 2008,2009 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors:
|
||||
* Robert Bragg <robert@linux.intel.com>
|
||||
*/
|
||||
|
||||
#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION)
|
||||
#error "Only <cogl/cogl.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __COGL_VERTEX_BUFFER_H__
|
||||
#define __COGL_VERTEX_BUFFER_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <cogl/cogl-defines.h>
|
||||
#include <cogl/cogl-types.h>
|
||||
#include <cogl/cogl-macros.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* SECTION:cogl-vertex-buffer
|
||||
* @short_description: An API for submitting extensible arrays of vertex
|
||||
* attributes to be mapped into the GPU for fast drawing.
|
||||
*
|
||||
* For example to describe a textured triangle, you could create a new cogl
|
||||
* vertex buffer with 3 vertices, and then you might add 2 attributes for each
|
||||
* vertex:
|
||||
* <orderedlist>
|
||||
* <listitem>
|
||||
* a "gl_Position" describing the (x,y,z) position for each vertex.
|
||||
* </listitem>
|
||||
* <listitem>
|
||||
* a "gl_MultiTexCoord0" describing the (tx,ty) texture coordinates for each
|
||||
* vertex.
|
||||
* </listitem>
|
||||
* </orderedlist>
|
||||
*
|
||||
* The Vertex Buffer API is designed to be a fairly raw mechanism for
|
||||
* developers to be able to submit geometry to Cogl in a format that can be
|
||||
* directly consumed by an OpenGL driver and mapped into your GPU for fast
|
||||
* re-use. It is designed to avoid repeated validation of the attributes by the
|
||||
* driver; to minimize transport costs (e.g. considering indirect GLX
|
||||
* use-cases) and to potentially avoid repeated format conversions when
|
||||
* attributes are supplied in a format that is not natively supported by the
|
||||
* GPU.
|
||||
*
|
||||
* Although this API does allow you to modify attributes after they have been
|
||||
* submitted to the GPU you should be aware that modification is not that
|
||||
* cheap, since it implies validating the new data and potentially the
|
||||
* OpenGL driver will need to reformat it for the GPU.
|
||||
*
|
||||
* If at all possible think of tricks that let you re-use static attributes,
|
||||
* and if you do need to repeatedly update attributes (e.g. for some kind of
|
||||
* morphing geometry) then only update and re-submit the specific attributes
|
||||
* that have changed.
|
||||
*/
|
||||
|
||||
/**
|
||||
* cogl_vertex_buffer_new:
|
||||
* @n_vertices: The number of vertices that your attributes will correspond to.
|
||||
*
|
||||
* Creates a new vertex buffer that you can use to add attributes.
|
||||
*
|
||||
* Return value: a new #CoglHandle
|
||||
* Deprecated: 1.16: Use the #CoglPrimitive api instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_primitive_API)
|
||||
CoglHandle
|
||||
cogl_vertex_buffer_new (unsigned int n_vertices);
|
||||
|
||||
/**
|
||||
* cogl_vertex_buffer_get_n_vertices:
|
||||
* @handle: A vertex buffer handle
|
||||
*
|
||||
* Retrieves the number of vertices that @handle represents
|
||||
*
|
||||
* Return value: the number of vertices
|
||||
* Deprecated: 1.16: Use the #CoglPrimitive api instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_primitive_API)
|
||||
unsigned int
|
||||
cogl_vertex_buffer_get_n_vertices (CoglHandle handle);
|
||||
|
||||
/**
|
||||
* cogl_vertex_buffer_add:
|
||||
* @handle: A vertex buffer handle
|
||||
* @attribute_name: The name of your attribute. It should be a valid GLSL
|
||||
* variable name and standard attribute types must use one of following
|
||||
* built-in names: (Note: they correspond to the built-in names of GLSL)
|
||||
* <itemizedlist>
|
||||
* <listitem>"gl_Color"</listitem>
|
||||
* <listitem>"gl_Normal"</listitem>
|
||||
* <listitem>"gl_MultiTexCoord0, gl_MultiTexCoord1, ..."</listitem>
|
||||
* <listitem>"gl_Vertex"</listitem>
|
||||
* </itemizedlist>
|
||||
* To support adding multiple variations of the same attribute the name
|
||||
* can have a detail component, E.g. "gl_Color::active" or
|
||||
* "gl_Color::inactive"
|
||||
* @n_components: The number of components per attribute and must be 1, 2,
|
||||
* 3 or 4
|
||||
* @type: a #CoglAttributeType specifying the data type of each component.
|
||||
* @normalized: If %TRUE, this specifies that values stored in an integer
|
||||
* format should be mapped into the range [-1.0, 1.0] or [0.0, 1.0]
|
||||
* for unsigned values. If %FALSE they are converted to floats
|
||||
* directly.
|
||||
* @stride: This specifies the number of bytes from the start of one attribute
|
||||
* value to the start of the next value (for the same attribute). So, for
|
||||
* example, with a position interleved with color like this:
|
||||
* XYRGBAXYRGBAXYRGBA, then if each letter represents a byte, the
|
||||
* stride for both attributes is 6. The special value 0 means the
|
||||
* values are stored sequentially in memory.
|
||||
* @pointer: This addresses the first attribute in the vertex array. This
|
||||
* must remain valid until you either call cogl_vertex_buffer_submit() or
|
||||
* issue a draw call.
|
||||
*
|
||||
* Adds an attribute to a buffer, or replaces a previously added
|
||||
* attribute with the same name.
|
||||
*
|
||||
* You either can use one of the built-in names such as "gl_Vertex", or
|
||||
* "gl_MultiTexCoord0" to add standard attributes, like positions, colors
|
||||
* and normals, or you can add custom attributes for use in shaders.
|
||||
*
|
||||
* The number of vertices declared when calling cogl_vertex_buffer_new()
|
||||
* determines how many attribute values will be read from the supplied
|
||||
* @pointer.
|
||||
*
|
||||
* The data for your attribute isn't copied anywhere until you call
|
||||
* cogl_vertex_buffer_submit(), or issue a draw call which automatically
|
||||
* submits pending attribute changes. so the supplied pointer must remain
|
||||
* valid until then. If you are updating an existing attribute (done by
|
||||
* re-adding it) then you still need to re-call cogl_vertex_buffer_submit()
|
||||
* to commit the changes to the GPU. Be carefull to minimize the number
|
||||
* of calls to cogl_vertex_buffer_submit(), though.
|
||||
*
|
||||
* <note>If you are interleving attributes it is assumed that each interleaved
|
||||
* attribute starts no farther than +- stride bytes from the other attributes
|
||||
* it is interleved with. I.e. this is ok:
|
||||
* <programlisting>
|
||||
* |-0-0-0-0-0-0-0-0-0-0|
|
||||
* </programlisting>
|
||||
* This is not ok:
|
||||
* <programlisting>
|
||||
* |- - - - -0-0-0-0-0-0 0 0 0 0|
|
||||
* </programlisting>
|
||||
* (Though you can have multiple groups of interleved attributes)</note>
|
||||
*
|
||||
* Deprecated: 1.16: Use the #CoglPrimitive api instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_primitive_API)
|
||||
void
|
||||
cogl_vertex_buffer_add (CoglHandle handle,
|
||||
const char *attribute_name,
|
||||
uint8_t n_components,
|
||||
CoglAttributeType type,
|
||||
gboolean normalized,
|
||||
uint16_t stride,
|
||||
const void *pointer);
|
||||
|
||||
/**
|
||||
* cogl_vertex_buffer_delete:
|
||||
* @handle: A vertex buffer handle
|
||||
* @attribute_name: The name of a previously added attribute
|
||||
*
|
||||
* Deletes an attribute from a buffer. You will need to call
|
||||
* cogl_vertex_buffer_submit() or issue a draw call to commit this
|
||||
* change to the GPU.
|
||||
*
|
||||
* Deprecated: 1.16: Use the #CoglPrimitive api instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_primitive_API)
|
||||
void
|
||||
cogl_vertex_buffer_delete (CoglHandle handle,
|
||||
const char *attribute_name);
|
||||
|
||||
/**
|
||||
* cogl_vertex_buffer_submit:
|
||||
* @handle: A vertex buffer handle
|
||||
*
|
||||
* Submits all the user added attributes to the GPU; once submitted, the
|
||||
* attributes can be used for drawing.
|
||||
*
|
||||
* You should aim to minimize calls to this function since it implies
|
||||
* validating your data; it potentially incurs a transport cost (especially if
|
||||
* you are using GLX indirect rendering) and potentially a format conversion
|
||||
* cost if the GPU doesn't natively support any of the given attribute formats.
|
||||
*
|
||||
* Deprecated: 1.16: Use the #CoglPrimitive api instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_primitive_API)
|
||||
void
|
||||
cogl_vertex_buffer_submit (CoglHandle handle);
|
||||
|
||||
/**
|
||||
* cogl_vertex_buffer_disable:
|
||||
* @handle: A vertex buffer handle
|
||||
* @attribute_name: The name of the attribute you want to disable
|
||||
*
|
||||
* Disables a previosuly added attribute.
|
||||
*
|
||||
* Since it can be costly to add and remove new attributes to buffers; to make
|
||||
* individual buffers more reuseable it is possible to enable and disable
|
||||
* attributes before using a buffer for drawing.
|
||||
*
|
||||
* You don't need to call cogl_vertex_buffer_submit() after using this
|
||||
* function.
|
||||
*
|
||||
* Deprecated: 1.16: Use the #CoglPrimitive api instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_primitive_API)
|
||||
void
|
||||
cogl_vertex_buffer_disable (CoglHandle handle,
|
||||
const char *attribute_name);
|
||||
|
||||
/**
|
||||
* cogl_vertex_buffer_enable:
|
||||
* @handle: A vertex buffer handle
|
||||
* @attribute_name: The name of the attribute you want to enable
|
||||
*
|
||||
* Enables a previosuly disabled attribute.
|
||||
*
|
||||
* Since it can be costly to add and remove new attributes to buffers; to make
|
||||
* individual buffers more reuseable it is possible to enable and disable
|
||||
* attributes before using a buffer for drawing.
|
||||
*
|
||||
* You don't need to call cogl_vertex_buffer_submit() after using this function
|
||||
*
|
||||
* Deprecated: 1.16: Use the #CoglPrimitive api instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_primitive_API)
|
||||
void
|
||||
cogl_vertex_buffer_enable (CoglHandle handle,
|
||||
const char *attribute_name);
|
||||
|
||||
/**
|
||||
* cogl_vertex_buffer_draw:
|
||||
* @handle: A vertex buffer handle
|
||||
* @mode: A #CoglVerticesMode specifying how the vertices should be
|
||||
* interpreted.
|
||||
* @first: Specifies the index of the first vertex you want to draw with
|
||||
* @count: Specifies the number of vertices you want to draw.
|
||||
*
|
||||
* Allows you to draw geometry using all or a subset of the
|
||||
* vertices in a vertex buffer.
|
||||
*
|
||||
* Any un-submitted attribute changes are automatically submitted before
|
||||
* drawing.
|
||||
*
|
||||
* Deprecated: 1.16: Use the #CoglPrimitive api instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_primitive_API)
|
||||
void
|
||||
cogl_vertex_buffer_draw (CoglHandle handle,
|
||||
CoglVerticesMode mode,
|
||||
int first,
|
||||
int count);
|
||||
|
||||
/**
|
||||
* cogl_vertex_buffer_indices_new: (skip)
|
||||
* @indices_type: a #CoglIndicesType specifying the data type used for
|
||||
* the indices.
|
||||
* @indices_array: (array length=indices_len): Specifies the address of
|
||||
* your array of indices
|
||||
* @indices_len: The number of indices in indices_array
|
||||
*
|
||||
* Depending on how much geometry you are submitting it can be worthwhile
|
||||
* optimizing the number of redundant vertices you submit. Using an index
|
||||
* array allows you to reference vertices multiple times, for example
|
||||
* during triangle strips.
|
||||
*
|
||||
* Return value: A CoglHandle for the indices which you can pass to
|
||||
* cogl_vertex_buffer_draw_elements().
|
||||
*
|
||||
* Deprecated: 1.16: Use the #CoglPrimitive api instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_primitive_API)
|
||||
CoglHandle
|
||||
cogl_vertex_buffer_indices_new (CoglIndicesType indices_type,
|
||||
const void *indices_array,
|
||||
int indices_len);
|
||||
|
||||
/**
|
||||
* cogl_vertex_buffer_indices_get_type:
|
||||
* @indices: An indices handle
|
||||
*
|
||||
* Queries back the data type used for the given indices
|
||||
*
|
||||
* Returns: The CoglIndicesType used
|
||||
*
|
||||
* Deprecated: 1.16: Use the #CoglPrimitive api instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_primitive_API)
|
||||
CoglIndicesType
|
||||
cogl_vertex_buffer_indices_get_type (CoglHandle indices);
|
||||
|
||||
/**
|
||||
* cogl_vertex_buffer_draw_elements:
|
||||
* @handle: A vertex buffer handle
|
||||
* @mode: A #CoglVerticesMode specifying how the vertices should be
|
||||
* interpreted.
|
||||
* @indices: A CoglHandle for a set of indices allocated via
|
||||
* cogl_vertex_buffer_indices_new ()
|
||||
* @min_index: Specifies the minimum vertex index contained in indices
|
||||
* @max_index: Specifies the maximum vertex index contained in indices
|
||||
* @indices_offset: An offset into named indices. The offset marks the first
|
||||
* index to use for drawing.
|
||||
* @count: Specifies the number of vertices you want to draw.
|
||||
*
|
||||
* This function lets you use an array of indices to specify the vertices
|
||||
* within your vertex buffer that you want to draw. The indices themselves
|
||||
* are created by calling cogl_vertex_buffer_indices_new ()
|
||||
*
|
||||
* Any un-submitted attribute changes are automatically submitted before
|
||||
* drawing.
|
||||
* Deprecated: 1.16: Use the #CoglPrimitive api instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_primitive_API)
|
||||
void
|
||||
cogl_vertex_buffer_draw_elements (CoglHandle handle,
|
||||
CoglVerticesMode mode,
|
||||
CoglHandle indices,
|
||||
int min_index,
|
||||
int max_index,
|
||||
int indices_offset,
|
||||
int count);
|
||||
|
||||
/**
|
||||
* cogl_vertex_buffer_indices_get_for_quads:
|
||||
* @n_indices: the number of indices in the vertex buffer.
|
||||
*
|
||||
* Creates a vertex buffer containing the indices needed to draw pairs
|
||||
* of triangles from a list of vertices grouped as quads. There will
|
||||
* be at least @n_indices entries in the buffer (but there may be
|
||||
* more).
|
||||
*
|
||||
* The indices will follow this pattern:
|
||||
*
|
||||
* 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7 ... etc
|
||||
*
|
||||
* For example, if you submit vertices for a quad like like that shown
|
||||
* in <xref linkend="quad-indices-order"/> then you can request 6
|
||||
* indices to render two triangles like those shown in <xref
|
||||
* linkend="quad-indices-triangles"/>.
|
||||
*
|
||||
* <figure id="quad-indices-order">
|
||||
* <title>Example of vertices submitted to form a quad</title>
|
||||
* <graphic fileref="quad-indices-order.png" format="PNG"/>
|
||||
* </figure>
|
||||
*
|
||||
* <figure id="quad-indices-triangles">
|
||||
* <title>Illustration of the triangle indices that will be generated</title>
|
||||
* <graphic fileref="quad-indices-triangles.png" format="PNG"/>
|
||||
* </figure>
|
||||
*
|
||||
* Returns: A %CoglHandle containing the indices. The handled is
|
||||
* owned by Cogl and should not be modified or unref'd.
|
||||
*
|
||||
* Deprecated: 1.16: Use the #CoglPrimitive api instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_primitive_API)
|
||||
CoglHandle
|
||||
cogl_vertex_buffer_indices_get_for_quads (unsigned int n_indices);
|
||||
|
||||
/**
|
||||
* cogl_is_vertex_buffer:
|
||||
* @handle: a #CoglHandle for a vertex buffer object
|
||||
*
|
||||
* Checks whether @handle is a Vertex Buffer Object
|
||||
*
|
||||
* Return value: %TRUE if the handle is a VBO, and %FALSE
|
||||
* otherwise
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.16: Use the #CoglPrimitive api instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_primitive_API)
|
||||
gboolean
|
||||
cogl_is_vertex_buffer (CoglHandle handle);
|
||||
|
||||
/**
|
||||
* cogl_is_vertex_buffer_indices:
|
||||
* @handle: a #CoglHandle
|
||||
*
|
||||
* Checks whether @handle is a handle to the indices for a vertex
|
||||
* buffer object
|
||||
*
|
||||
* Return value: %TRUE if the handle is indices, and %FALSE
|
||||
* otherwise
|
||||
*
|
||||
* Since: 1.4
|
||||
* Deprecated: 1.16: Use the #CoglPrimitive api instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_primitive_API)
|
||||
gboolean
|
||||
cogl_is_vertex_buffer_indices (CoglHandle handle);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_VERTEX_BUFFER_H__ */
|
@@ -59,8 +59,7 @@ toggle_builtin_attribute_enabled_cb (int bit_num, void *user_data)
|
||||
ForeachChangedBitState *state = user_data;
|
||||
CoglContext *context = state->context;
|
||||
|
||||
g_return_val_if_fail (_cogl_has_private_feature
|
||||
(context, COGL_PRIVATE_FEATURE_GL_FIXED),
|
||||
g_return_val_if_fail (context->driver == COGL_DRIVER_GL,
|
||||
FALSE);
|
||||
|
||||
#ifdef HAVE_COGL_GL
|
||||
@@ -98,8 +97,7 @@ toggle_texcood_attribute_enabled_cb (int bit_num, void *user_data)
|
||||
ForeachChangedBitState *state = user_data;
|
||||
CoglContext *context = state->context;
|
||||
|
||||
g_return_val_if_fail (_cogl_has_private_feature
|
||||
(context, COGL_PRIVATE_FEATURE_GL_FIXED),
|
||||
g_return_val_if_fail (context->driver == COGL_DRIVER_GL,
|
||||
FALSE);
|
||||
|
||||
#ifdef HAVE_COGL_GL
|
||||
|
@@ -124,6 +124,7 @@ add_stencil_clip_region (CoglFramebuffer *framebuffer,
|
||||
CoglMatrix matrix;
|
||||
int num_rectangles = cairo_region_num_rectangles (region);
|
||||
int i;
|
||||
CoglVertexP2 *vertices;
|
||||
|
||||
/* NB: This can be called while flushing the journal so we need
|
||||
* to be very conservative with what state we change.
|
||||
@@ -167,31 +168,50 @@ add_stencil_clip_region (CoglFramebuffer *framebuffer,
|
||||
GE( ctx, glStencilOp (GL_KEEP, GL_KEEP, GL_REPLACE) );
|
||||
}
|
||||
|
||||
vertices = g_alloca (sizeof (CoglVertexP2) * num_rectangles * 6);
|
||||
|
||||
for (i = 0; i < num_rectangles; i++)
|
||||
{
|
||||
cairo_rectangle_int_t rect;
|
||||
float tl[4], br[4];
|
||||
float x1, y1, z1, w1;
|
||||
float x2, y2, z2, w2;
|
||||
CoglVertexP2 *v = vertices + i * 6;
|
||||
|
||||
cairo_region_get_rectangle (region, i, &rect);
|
||||
|
||||
tl[0] = rect.x;
|
||||
tl[1] = rect.y;
|
||||
tl[2] = 0.;
|
||||
tl[3] = 1.;
|
||||
x1 = rect.x;
|
||||
y1 = rect.y;
|
||||
z1 = 0.f;
|
||||
w1 = 1.f;
|
||||
|
||||
br[0] = rect.x + rect.width;
|
||||
br[1] = rect.y + rect.height;
|
||||
br[2] = 0.;
|
||||
br[3] = 1.;
|
||||
x2 = rect.x + rect.width;
|
||||
y2 = rect.y + rect.height;
|
||||
z2 = 0.f;
|
||||
w2 = 1.f;
|
||||
|
||||
cogl_matrix_transform_point (&matrix, &tl[0], &tl[1], &tl[2], &tl[3]);
|
||||
cogl_matrix_transform_point (&matrix, &br[0], &br[1], &br[2], &br[3]);
|
||||
cogl_matrix_transform_point (&matrix, &x1, &y1, &z1, &w1);
|
||||
cogl_matrix_transform_point (&matrix, &x2, &y2, &z2, &w2);
|
||||
|
||||
_cogl_rectangle_immediate (framebuffer,
|
||||
ctx->stencil_pipeline,
|
||||
tl[0], tl[1], br[0], br[1]);
|
||||
v[0].x = x1;
|
||||
v[0].y = y1;
|
||||
v[1].x = x1;
|
||||
v[1].y = y2;
|
||||
v[2].x = x2;
|
||||
v[2].y = y1;
|
||||
v[3].x = x1;
|
||||
v[3].y = y2;
|
||||
v[4].x = x2;
|
||||
v[4].y = y2;
|
||||
v[5].x = x2;
|
||||
v[5].y = y1;
|
||||
}
|
||||
|
||||
cogl_2d_primitives_immediate (framebuffer,
|
||||
ctx->stencil_pipeline,
|
||||
COGL_VERTICES_MODE_TRIANGLES,
|
||||
vertices,
|
||||
6 * num_rectangles);
|
||||
|
||||
if (merge)
|
||||
{
|
||||
/* Subtract one from all pixels in the stencil buffer so that
|
||||
@@ -322,8 +342,7 @@ paint_primitive_silhouette (CoglFramebuffer *framebuffer,
|
||||
pipeline,
|
||||
COGL_DRAW_SKIP_JOURNAL_FLUSH |
|
||||
COGL_DRAW_SKIP_PIPELINE_VALIDATION |
|
||||
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH |
|
||||
COGL_DRAW_SKIP_LEGACY_STATE);
|
||||
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -106,6 +106,9 @@
|
||||
#ifndef GL_PACK_INVERT_MESA
|
||||
#define GL_PACK_INVERT_MESA 0x8758
|
||||
#endif
|
||||
#ifndef GL_PACK_REVERSE_ROW_ORDER_ANGLE
|
||||
#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4
|
||||
#endif
|
||||
#ifndef GL_BACK_LEFT
|
||||
#define GL_BACK_LEFT 0x0402
|
||||
#endif
|
||||
@@ -1190,6 +1193,7 @@ _cogl_framebuffer_gl_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
|
||||
GLenum gl_intformat;
|
||||
GLenum gl_format;
|
||||
GLenum gl_type;
|
||||
GLenum gl_pack_enum = GL_FALSE;
|
||||
gboolean pack_invert_set;
|
||||
int status = FALSE;
|
||||
|
||||
@@ -1220,7 +1224,12 @@ _cogl_framebuffer_gl_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
|
||||
(source & COGL_READ_PIXELS_NO_FLIP) == 0 &&
|
||||
!cogl_is_offscreen (framebuffer))
|
||||
{
|
||||
GE (ctx, glPixelStorei (GL_PACK_INVERT_MESA, TRUE));
|
||||
if (ctx->driver == COGL_DRIVER_GLES2)
|
||||
gl_pack_enum = GL_PACK_REVERSE_ROW_ORDER_ANGLE;
|
||||
else
|
||||
gl_pack_enum = GL_PACK_INVERT_MESA;
|
||||
|
||||
GE (ctx, glPixelStorei (gl_pack_enum, TRUE));
|
||||
pack_invert_set = TRUE;
|
||||
}
|
||||
else
|
||||
@@ -1414,7 +1423,7 @@ EXIT:
|
||||
* to interfere with other Cogl components so all other code can assume that
|
||||
* we leave the pack_invert state off. */
|
||||
if (pack_invert_set)
|
||||
GE (ctx, glPixelStorei (GL_PACK_INVERT_MESA, FALSE));
|
||||
GE (ctx, glPixelStorei (gl_pack_enum, FALSE));
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@@ -127,7 +127,7 @@ CoglTextureUnit *
|
||||
_cogl_get_texture_unit (int index_);
|
||||
|
||||
void
|
||||
_cogl_destroy_texture_units (void);
|
||||
_cogl_destroy_texture_units (CoglContext *ctx);
|
||||
|
||||
void
|
||||
_cogl_set_active_texture_unit (int unit_index);
|
||||
|
@@ -116,12 +116,10 @@ _cogl_get_texture_unit (int index_)
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_destroy_texture_units (void)
|
||||
_cogl_destroy_texture_units (CoglContext *ctx)
|
||||
{
|
||||
int i;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
for (i = 0; i < ctx->texture_units->len; i++)
|
||||
{
|
||||
CoglTextureUnit *unit =
|
||||
@@ -309,7 +307,7 @@ flush_depth_state (CoglContext *ctx,
|
||||
if ((ctx->depth_range_near_cache != depth_state->range_near ||
|
||||
ctx->depth_range_far_cache != depth_state->range_far))
|
||||
{
|
||||
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_EMBEDDED))
|
||||
if (ctx->driver == COGL_DRIVER_GLES2)
|
||||
GE (ctx, glDepthRangef (depth_state->range_near,
|
||||
depth_state->range_far));
|
||||
else
|
||||
@@ -362,8 +360,7 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
/* On GLES2 we'll flush the color later */
|
||||
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED) &&
|
||||
!with_color_attrib)
|
||||
if (ctx->driver == COGL_DRIVER_GL && !with_color_attrib)
|
||||
{
|
||||
if ((pipelines_difference & COGL_PIPELINE_STATE_COLOR) ||
|
||||
/* Assume if we were previously told to skip the color, then
|
||||
@@ -538,7 +535,7 @@ get_max_activateable_texture_units (void)
|
||||
int i;
|
||||
|
||||
#ifdef HAVE_COGL_GL
|
||||
if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_EMBEDDED))
|
||||
if (ctx->driver != COGL_DRIVER_GLES2)
|
||||
{
|
||||
/* GL_MAX_TEXTURE_COORDS defines the number of texture coordinates
|
||||
* that can be uploaded (but doesn't necessarily relate to how many
|
||||
@@ -551,8 +548,7 @@ get_max_activateable_texture_units (void)
|
||||
#endif /* HAVE_COGL_GL */
|
||||
|
||||
#ifdef HAVE_COGL_GLES2
|
||||
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_EMBEDDED) &&
|
||||
_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE))
|
||||
if (ctx->driver == COGL_DRIVER_GLES2)
|
||||
{
|
||||
GE (ctx, glGetIntegerv (GL_MAX_VERTEX_ATTRIBS, values + n_values));
|
||||
/* Two of the vertex attribs need to be used for the position
|
||||
@@ -565,7 +561,7 @@ get_max_activateable_texture_units (void)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_COGL_GL
|
||||
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED))
|
||||
if (ctx->driver == COGL_DRIVER_GL)
|
||||
{
|
||||
/* GL_MAX_TEXTURE_UNITS defines the number of units that are
|
||||
usable from the fixed function pipeline, therefore it isn't
|
||||
@@ -697,7 +693,7 @@ flush_layers_common_gl_state_cb (CoglPipelineLayer *layer, void *user_data)
|
||||
* glsl progend.
|
||||
*/
|
||||
#ifdef HAVE_COGL_GL
|
||||
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED) &&
|
||||
if (ctx->driver == COGL_DRIVER_GL &&
|
||||
(layers_difference & COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS))
|
||||
{
|
||||
CoglPipelineState change = COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS;
|
||||
@@ -985,7 +981,7 @@ fragend_add_layer_cb (CoglPipelineLayer *layer,
|
||||
*
|
||||
* Currently for textured rectangles we manually calculate the texture
|
||||
* coords for each slice based on the users given coords, but this solution
|
||||
* isn't ideal, and can't be used with CoglVertexBuffers.
|
||||
* isn't ideal.
|
||||
*/
|
||||
void
|
||||
_cogl_pipeline_flush_gl_state (CoglContext *ctx,
|
||||
|
@@ -76,6 +76,13 @@ _cogl_gl_error_to_string (GLenum error_code);
|
||||
|
||||
#endif /* COGL_GL_DEBUG */
|
||||
|
||||
gboolean
|
||||
_cogl_driver_gl_context_init (CoglContext *context,
|
||||
GError **error);
|
||||
|
||||
void
|
||||
_cogl_driver_gl_context_deinit (CoglContext *context);
|
||||
|
||||
GLenum
|
||||
_cogl_gl_util_get_error (CoglContext *ctx);
|
||||
|
||||
|
@@ -42,6 +42,61 @@
|
||||
#include "driver/gl/cogl-attribute-gl-private.h"
|
||||
#include "driver/gl/cogl-clip-stack-gl-private.h"
|
||||
#include "driver/gl/cogl-buffer-gl-private.h"
|
||||
#include "driver/gl/cogl-pipeline-opengl-private.h"
|
||||
|
||||
gboolean
|
||||
_cogl_driver_gl_context_init (CoglContext *context,
|
||||
GError **error)
|
||||
{
|
||||
context->texture_units =
|
||||
g_array_new (FALSE, FALSE, sizeof (CoglTextureUnit));
|
||||
|
||||
/* See cogl-pipeline.c for more details about why we leave texture unit 1
|
||||
* active by default... */
|
||||
context->active_texture_unit = 1;
|
||||
GE (context, glActiveTexture (GL_TEXTURE1));
|
||||
|
||||
if (_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_ALPHA_TEST))
|
||||
/* The default for GL_ALPHA_TEST is to always pass which is equivalent to
|
||||
* the test being disabled therefore we assume that for all drivers there
|
||||
* will be no performance impact if we always leave the test enabled which
|
||||
* makes things a bit simpler for us. Under GLES2 the alpha test is
|
||||
* implemented in the fragment shader so there is no enable for it
|
||||
*/
|
||||
GE (context, glEnable (GL_ALPHA_TEST));
|
||||
|
||||
if ((context->driver == COGL_DRIVER_GL3))
|
||||
{
|
||||
GLuint vertex_array;
|
||||
|
||||
/* In a forward compatible context, GL 3 doesn't support rendering
|
||||
* using the default vertex array object. Cogl doesn't use vertex
|
||||
* array objects yet so for now we just create a dummy array
|
||||
* object that we will use as our own default object. Eventually
|
||||
* it could be good to attach the vertex array objects to
|
||||
* CoglPrimitives */
|
||||
context->glGenVertexArrays (1, &vertex_array);
|
||||
context->glBindVertexArray (vertex_array);
|
||||
}
|
||||
|
||||
/* As far as I can tell, GL_POINT_SPRITE doesn't have any effect
|
||||
unless GL_COORD_REPLACE is enabled for an individual layer.
|
||||
Therefore it seems like it should be ok to just leave it enabled
|
||||
all the time instead of having to have a set property on each
|
||||
pipeline to track whether any layers have point sprite coords
|
||||
enabled. We don't need to do this for GL3 or GLES2 because point
|
||||
sprites are handled using a builtin varying in the shader. */
|
||||
if (context->driver == COGL_DRIVER_GL)
|
||||
GE (context, glEnable (GL_POINT_SPRITE));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_driver_gl_context_deinit (CoglContext *context)
|
||||
{
|
||||
_cogl_destroy_texture_units (context);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cogl_driver_pixel_format_from_gl_internal (CoglContext *context,
|
||||
@@ -449,7 +504,6 @@ _cogl_driver_update_features (CoglContext *ctx,
|
||||
if (ctx->driver == COGL_DRIVER_GL)
|
||||
{
|
||||
/* Features which are not available in GL 3 */
|
||||
COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_GL_FIXED, TRUE);
|
||||
COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_ALPHA_TEST, TRUE);
|
||||
COGL_FLAGS_SET (private_features,
|
||||
COGL_PRIVATE_FEATURE_ALPHA_TEXTURES, TRUE);
|
||||
@@ -499,6 +553,8 @@ _cogl_driver_update_features (CoglContext *ctx,
|
||||
const CoglDriverVtable
|
||||
_cogl_driver_gl =
|
||||
{
|
||||
_cogl_driver_gl_context_init,
|
||||
_cogl_driver_gl_context_deinit,
|
||||
_cogl_driver_pixel_format_from_gl_internal,
|
||||
_cogl_driver_pixel_format_to_gl,
|
||||
_cogl_driver_update_features,
|
||||
|
@@ -43,7 +43,6 @@
|
||||
#include "cogl-pipeline.h"
|
||||
#include "cogl-context-private.h"
|
||||
#include "cogl-object-private.h"
|
||||
#include "cogl-primitives.h"
|
||||
#include "driver/gl/cogl-pipeline-opengl-private.h"
|
||||
#include "driver/gl/cogl-util-gl-private.h"
|
||||
#include "driver/gl/cogl-texture-gl-private.h"
|
||||
|
@@ -300,6 +300,10 @@ _cogl_driver_update_features (CoglContext *context,
|
||||
gl_minor,
|
||||
gl_extensions);
|
||||
|
||||
if (_cogl_check_extension ("GL_ANGLE_pack_reverse_row_order", gl_extensions))
|
||||
COGL_FLAGS_SET (private_features,
|
||||
COGL_PRIVATE_FEATURE_MESA_PACK_INVERT, TRUE);
|
||||
|
||||
/* Note GLES 2 core doesn't support mipmaps for npot textures or
|
||||
* repeat modes other than CLAMP_TO_EDGE. */
|
||||
|
||||
@@ -378,6 +382,8 @@ _cogl_driver_texture_2d_is_get_data_supported (CoglTexture2D *tex_2d)
|
||||
const CoglDriverVtable
|
||||
_cogl_driver_gles =
|
||||
{
|
||||
_cogl_driver_gl_context_init,
|
||||
_cogl_driver_gl_context_deinit,
|
||||
_cogl_driver_pixel_format_from_gl_internal,
|
||||
_cogl_driver_pixel_format_to_gl,
|
||||
_cogl_driver_update_features,
|
||||
|
@@ -43,7 +43,6 @@
|
||||
#include "cogl-pipeline.h"
|
||||
#include "cogl-context-private.h"
|
||||
#include "cogl-object-private.h"
|
||||
#include "cogl-primitives.h"
|
||||
#include "driver/gl/cogl-pipeline-opengl-private.h"
|
||||
#include "driver/gl/cogl-util-gl-private.h"
|
||||
#include "driver/gl/cogl-texture-gl-private.h"
|
||||
|
@@ -52,9 +52,23 @@ _cogl_driver_update_features (CoglContext *ctx,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cogl_driver_nop_context_init( CoglContext *context,
|
||||
GError **error)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_driver_nop_context_deinit (CoglContext *context)
|
||||
{
|
||||
}
|
||||
|
||||
const CoglDriverVtable
|
||||
_cogl_driver_nop =
|
||||
{
|
||||
_cogl_driver_nop_context_init,
|
||||
_cogl_driver_nop_context_deinit,
|
||||
NULL, /* pixel_format_from_gl_internal */
|
||||
NULL, /* pixel_format_to_gl */
|
||||
_cogl_driver_update_features,
|
||||
|
@@ -65,21 +65,17 @@ built_headers += [cogl_gl_header_h]
|
||||
|
||||
cogl_deprecated_headers = [
|
||||
'deprecated/cogl-material-compat.h',
|
||||
'deprecated/cogl-vertex-buffer.h',
|
||||
'deprecated/cogl-shader.h',
|
||||
'deprecated/cogl-clutter.h',
|
||||
'deprecated/cogl-type-casts.h',
|
||||
'deprecated/cogl-auto-texture.h',
|
||||
]
|
||||
|
||||
cogl_deprecated_nonintrospected_headers = [
|
||||
'deprecated/cogl-framebuffer-deprecated.h',
|
||||
]
|
||||
|
||||
cogl_headers = [
|
||||
'cogl1-context.h',
|
||||
'cogl-bitmap.h',
|
||||
'cogl-color.h',
|
||||
'cogl-context.h',
|
||||
'cogl-framebuffer.h',
|
||||
'cogl-matrix.h',
|
||||
'cogl-object.h',
|
||||
@@ -89,7 +85,6 @@ cogl_headers = [
|
||||
'cogl-pipeline-state.h',
|
||||
'cogl-pipeline-layer-state.h',
|
||||
'cogl-pixel-format.h',
|
||||
'cogl-primitives.h',
|
||||
'cogl-texture.h',
|
||||
'cogl-texture-2d.h',
|
||||
'cogl-texture-2d-sliced.h',
|
||||
@@ -102,7 +97,6 @@ cogl_nonintrospected_headers = [
|
||||
'cogl-swap-chain.h',
|
||||
'cogl-onscreen-template.h',
|
||||
'cogl-display.h',
|
||||
'cogl-context.h',
|
||||
'cogl-snippet.h',
|
||||
'cogl-index-buffer.h',
|
||||
'cogl-attribute-buffer.h',
|
||||
@@ -238,7 +232,6 @@ cogl_sources = [
|
||||
'cogl-bitmap-conversion.c',
|
||||
'cogl-bitmap-packing.h',
|
||||
'cogl-primitives-private.h',
|
||||
'cogl-primitives.h',
|
||||
'cogl-primitives.c',
|
||||
'cogl-bitmap-pixbuf.c',
|
||||
'cogl-clip-stack.h',
|
||||
@@ -352,8 +345,6 @@ cogl_sources = [
|
||||
'cogl-closure-list.c',
|
||||
'cogl-fence.c',
|
||||
'cogl-fence-private.h',
|
||||
'deprecated/cogl-vertex-buffer-private.h',
|
||||
'deprecated/cogl-vertex-buffer.c',
|
||||
'deprecated/cogl-material-compat.c',
|
||||
'deprecated/cogl-program.c',
|
||||
'deprecated/cogl-program-private.h',
|
||||
@@ -361,7 +352,6 @@ cogl_sources = [
|
||||
'deprecated/cogl-shader-private.h',
|
||||
'deprecated/cogl-shader.c',
|
||||
'deprecated/cogl-clutter.c',
|
||||
'deprecated/cogl-framebuffer-deprecated.c',
|
||||
'cogl-glib-source.c',
|
||||
'cogl-mutter.h',
|
||||
]
|
||||
@@ -386,11 +376,11 @@ endif
|
||||
|
||||
if have_glx
|
||||
cogl_nonintrospected_headers += [
|
||||
'cogl-glx.h',
|
||||
'winsys/cogl-glx.h',
|
||||
]
|
||||
cogl_sources += [
|
||||
'cogl-glx-display-private.h',
|
||||
'cogl-glx-renderer-private.h',
|
||||
'winsys/cogl-glx-display-private.h',
|
||||
'winsys/cogl-glx-renderer-private.h',
|
||||
'winsys/cogl-winsys-glx-feature-functions.h',
|
||||
'winsys/cogl-winsys-glx-private.h',
|
||||
'winsys/cogl-winsys-glx.c',
|
||||
@@ -432,7 +422,6 @@ cogl_headers_all = [
|
||||
cogl_introspected_headers,
|
||||
cogl_nonintrospected_headers,
|
||||
cogl_deprecated_headers,
|
||||
cogl_deprecated_nonintrospected_headers,
|
||||
]
|
||||
|
||||
cogl_test_deps = []
|
||||
@@ -502,7 +491,6 @@ install_headers([
|
||||
|
||||
install_headers([
|
||||
cogl_deprecated_headers,
|
||||
cogl_deprecated_nonintrospected_headers,
|
||||
],
|
||||
subdir: join_paths(cogl_cogl_includesubdir, 'deprecated'))
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user