summaryrefslogtreecommitdiff
path: root/clutter/clutter-offscreen-effect.c
Commit message (Collapse)AuthorAgeFilesLines
* ClutterActor: expose setter for the opacity overrideGiovanni Campagna2015-02-211-3/+3
| | | | | | | | | | Toolkits may need to paint actors internally outside the normal tree (for example to create a shadow shape), in which case they need to control the opacity directly. https://bugzilla.gnome.org/show_bug.cgi?id=677412 Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
* docs: Move to markdownEmmanuele Bassi2014-03-171-20/+21
| | | | We're removing docbook tags in favour of the markdown syntax.
* Revert "clutter-offscreen-effect: Allocate the cogl texture directly"Emmanuele Bassi2013-09-021-15/+3
| | | | | | This reverts commit 180e7d74f3325731ac5e91350233c26200a44fd7. The lazy texture allocation is gone in Cogl 1.15.9.
* Use the new macros for adding private dataEmmanuele Bassi2013-07-031-8/+4
|
* clutter-offscreen-effect: Allocate the cogl texture directlyAdel Gadllah2013-06-251-3/+15
| | | | | | | Cogl now lazy loads the textures so we cannot rely on getting NULL from cogl_texture_new_with_size so we have to allocate it by ourselves. https://bugzilla.redhat.com/show_bug.cgi?id=975171
* offscreen-effect: limit offscreen fbo size to the stage's sizeLionel Landwerlin2013-05-151-7/+16
| | | | | | | | | | | | | When using a ClutterOffscreenEffect, the size of the offscreen buffer allocated to perform the effect is currently computed using the paint volume of the actor it's attached to and in the case the paint volume cannot be computed, the effect falls back to using the stage's size. If you scale an actor enough so its paint volume is much bigger that the size of the stage, you can end up running out of memory (which leads to your application crashing). https://bugzilla.gnome.org/show_bug.cgi?id=699675
* offscreen-effect: Add a method to get the target areaEmmanuele Bassi2013-03-041-0/+42
| | | | | | | | | | | | | | | The target size is not always enough, there are cases where the offset used to paint the target must also be available for developers implementing an OffscreenEffect. The get_target_rect() method returns the rectangle used to paint the target, with the offsets in the ClutterRect:origin and the texture size in the ClutterRect:size fields, respectively. The get_target_size() method should be deprecated, given that its replacement is generally more useful. https://bugzilla.gnome.org/show_bug.cgi?id=670004
* Fixes for the API referenceEmmanuele Bassi2012-04-271-2/+2
| | | | Typos, missing symbols, and missing documentation.
* Reduce our internal dependence on the Cogl 1.x apiRobert Bragg2012-02-211-12/+12
| | | | | | | | | | | | | | Since Cogl has started restricting what cogl 1.x api is exposed when COGL_ENABLE_EXPERIMENTAL_2_0_API is defined and since we build all Clutter internals with COGL_ENABLE_EXPERIMENTAL_2_0_API defined this patch makes a first pass at reducing our internal use of the Cogl 1.x api. The most notable api that's no longer exposed to us internally is the cogl_material_ api so this switches all Clutter internals to use the cogl_pipeline_ api instead. This patch also makes quite a bit of progress removing internal uses of CoglHandle although there is still more to go.
* Pass a CoglContext when calling cogl_pipeline_newRobert Bragg2012-02-211-12/+17
| | | | | | The experimental cogl_pipeline_new() api was recently changed so it explicitly takes a CoglContext. This updates all calls to cogl_pipeline_new() in clutter accordingly.
* offscreen-effect: Add clutter_offscreen_effect_get_textureNeil Roberts2012-02-141-30/+58
| | | | | | | | | Sometimes a subclass of ClutterOffscreenEffect wants to paint with a completely custom material. In that case it is awkward to modify the material returned owned by ClutterOffscreenEffect so it makes more sense to just get the texture and manage its own material. Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
* offscreen-effect: Track the size of the actor separatelyNeil Roberts2011-11-281-2/+15
| | | | | | | | | | | | | | | Previously the offscreen effect was keeping track of the size of the texture so that it could detect when a different size is requested and create a new texture. However this breaks if a subclass overrides create_texture to make the texture bigger because in that case the size of the texture will always be different from the calculated size of the actor. This patch makes it also track the size of the fbo that was requested before being passed through create_texture() and it instead uses that to detect when a new FBO is needed. https://bugzilla.gnome.org/show_bug.cgi?id=665040 Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
* clutter-offscreen-effect: Apply matrix expansion to proj not mvNeil Roberts2011-09-221-20/+11
| | | | | | | | | | | | | | | | | When the viewport gets expanded because the actor extends off the edge of the screen, instead of applying the transformation to the root of the modelview transformation it is now applied to the end of the projection transformation. This should end up with the same transformation. This fixes a problem when the offscreen effects are nested and the inner effect would try to pick up the current modelview transformation to rescale it to fit the new viewport size. In this case the modelview would have already been scaled for the size of the outer viewport so it would end up wrong. https://bugzilla.gnome.org/show_bug.cgi?id=659601 Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com> Reviewed-by: Robert Bragg <robert@linux.intel.com>
* effect: Rename RunFlags to PaintFlagsEmmanuele Bassi2011-06-131-3/+3
| | | | | | | Since run() was replaced and both paint() and pick() use the enumeration. https://bugzilla.gnome.org/show_bug.cgi?id=651700
* Rename ClutterEffect::run to ClutterEffect::paintTomeu Vizoso2011-06-131-5/+5
| | | | | | In preparation for adding ClutterEffect::pick https://bugzilla.gnome.org/show_bug.cgi?id=651700
* clutter-offscreen-effect: use target size when setting up the viewportTomeu Vizoso2011-05-201-4/+4
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=650650
* clutter-offscreen-effect: Don't redraw the actor if cached offscreenNeil Roberts2011-05-131-15/+65
| | | | | | | | When painting an actor, it now tries to determine if the last paint of the offscreen was using the same matrix and the actor isn't dirty. If so, it can skip calling clutter_actor_continue_paint and avoid actually painting the actor. Instead just the offscreen image will be painted.
* clutter-offscreen-effect: Paint with 'nearest' texture filter modeNeil Roberts2011-03-171-1/+11
| | | | | | | The texture containing the image for the redirected actor will always be painted at a 1:1 texel:pixel ratio so there's no need to use linear filtering. This should also counteract some of the effects of rounding errors when calculating the geometry for the quad.
* clutter-offscreen-effect: Use 0,0 as the offset if no actor boxNeil Roberts2011-03-041-2/+6
| | | | | | clutter_offscreen_effect_pre_paint was using the unitialized value of the ‘box’ variable whenever the actor doesn't have a paint volume. This patch makes it just set the offset to 0,0 instead.
* clutter-offscreen-effect: Preserve the old opacity overrideNeil Roberts2011-03-031-2/+6
| | | | | | | | | | | | | When removing the opacity override in the post_paint implementation, ClutterOffscreenEffect would always set the override back to -1. This ends up cancelling out the effect of any overrides from outer effects which means that if any actor has multiple effects attached then it would apply the opacity multiple times. To fix this, the effect now preserves the old value of the opacity override and restores that instead of setting -1. http://bugzilla.clutter-project.org/show_bug.cgi?id=2541
* offscreen-effect: Add public accessor for target sizeEmmanuele Bassi2011-02-281-4/+26
| | | | | | | | | | | The OffscreenEffect class needs to expose a way for sub-classes to track the size of FBO it creates, in case it has to do some geometry deformations like the DeformEffect sub-classes. Let's move the private symbol we used internally in 1.6 to fix DeformEffect to the list of public symbols of OffscreenEffect. http://bugzilla.clutter-project.org/show_bug.cgi?id=2570
* offscreen-effect: Add private API for getting the target sizeEmmanuele Bassi2011-02-191-0/+19
| | | | | | | | | | Since the FBO target might have a different size than the mere paint box of the actor, we need API to get it out of the ClutterOffscreenEffect private data structure and on to sub-classes. Since we cannot add new API in a stable cycle, we need a private function; we'll leave it there even when opening 1.7, since it's useful for internal purposes.
* offscreen: Fix partially off-stage actors being clipped in the fboChris Lord2011-02-111-1/+42
| | | | | | | | | | | If an actor was partially off of the stage, it would be clipped because of the stage viewport. This produces problems if you use an offscreen effect that relies on the entire actor being rendered (e.g. shadows). Expand the viewport in this scenario so that the offscreen-rendering isn't clipped. This fixes http://bugzilla.clutter-project.org/show_bug.cgi?id=2550
* offscreen-effect: Use actor's opacity_override when redirecting paintingChris Lord2011-02-111-0/+9
| | | | | | | | Override the actor's paint opacity so that it will appear fully opaque in the offscreen surface. This avoids multiple multiplications of an actor's opacity. Fixes http://bugzilla.clutter-project.org/show_bug.cgi?id=2541
* ClutterOffscreenEffect: Don't throw away the material for a new actorNeil Roberts2010-11-291-6/+0
| | | | | | | | | | When a new actor is set for ClutterOffscreenEffect it would throw away the old material. I don't think there is anything specifically tied to the actor in the material so throwing away just loses Cogl's cached state about the material. This ends up relinking the shader every time a new actor is set in ClutterShaderEffect. http://bugzilla.clutter-project.org/show_bug.cgi?id=2454
* Don't bail out from creating the FBO if we don't have it yet.Tomeu Vizoso2010-11-291-1/+2
| | | | | | This happens when reattaching an effect to another actor. http://bugzilla.clutter-project.org/show_bug.cgi?id=2453
* clutter-offscreen-effect: Don't recreate the material when FBO changesNeil Roberts2010-11-251-7/+5
| | | | | | | | | | Previously whenever the size of the FBO changes it would create a new material and attach the texture to it. This is not good for Cogl because it throws away any cached state for the material. In test-rotate the size of the FBO changes constantly so it effectively uses a new material every paint. For shader effects this also ends up relinking the shader every paint because the linked programs are part of the material state.
* Clean up clutter-private.h/6Emmanuele Bassi2010-10-211-0/+1
| | | | Move all Actor private API to a separate file.
* Clean up clutter-private.h/3Emmanuele Bassi2010-10-211-0/+1
| | | | Move Stage private API to a separate header.
* paint volumes: another pass at the designRobert Bragg2010-09-291-63/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a fairly extensive second pass at exposing paint volumes for actors. The API has changed to allow clutter_actor_get_paint_volume to fail since there are times - such as when an actor isn't a descendent of the stage - when the volume can't be determined. Another example is when something has connected to the "paint" signal of the actor and we simply have no way of knowing what might be drawn in that handler. The API has also be changed to return a const ClutterPaintVolume pointer (transfer none) so we can avoid having to dynamically allocate the volumes in the most common/performance critical code paths. Profiling was showing the slice allocation of volumes taking about 1% of an apps time, for some fairly basic tests. Most volumes can now simply be allocated on the stack; for clutter_actor_get_paint_volume we return a pointer to &priv->paint_volume and if we need a more dynamic allocation there is now a _clutter_stage_paint_volume_stack_allocate() mechanism which lets us allocate data which expires at the start of the next frame. The API has been extended to make it easier to implement get_paint_volume for containers by using clutter_actor_get_transformed_paint_volume and clutter_paint_volume_union. The first allows you to query the paint volume of a child but transformed into parent actor coordinates. The second lets you combine volumes together so you can union all the volumes for a container's children and report that as the container's own volume. The representation of paint volumes has been updated to consider that 2D actors are the most common. The effect apis, clutter-texture and clutter-group have been update accordingly.
* offscreen-effect: Use the paint box to size the FBOEmmanuele Bassi2010-09-291-26/+19
| | | | | | We should be using the real, on-screen, transformed size of the actor to size and position the offscreen buffer we use to paint the actor for an effect.
* offscreen-effect: Update handling of transformsRobert Bragg2010-09-161-41/+23
| | | | | | | | | In line with the changes made in f5f066df9ce7 to clean up how Clutter deals with transformations of actors this patch updates the code in clutter-offscreen-effect.c. We now query the projection matrix from the stage instead of the perspective and instead of duplicating the logic to setup the stage view transform we now use _clutter_actor_apply_modelview_transform for the stage instead.
* Add some more introspection annotationsEmmanuele Bassi2010-09-061-1/+3
|
* Replace cogl_color_set_from_* with cogl_color_init_from_*Emmanuele Bassi2010-09-031-1/+1
| | | | | The former is not yet "officially" deprecated by the latter, but it's confusing to have them both in the code base.
* offscreen-effect: Rename create_target to create_bufferEmmanuele Bassi2010-09-011-21/+24
| | | | | | | | | | | | | | | | | | | | | *** This is an API change *** The create_target() virtual function should return a CoglHandle to a texture; clutter_offscreen_effect_get_target(), instead, returns a CoglMaterial to be painted in the implementation of the paint_target() virtual function. Instead of equating textures with materials, and confusing the user of the API, we should mark the difference more prominently. First of all, we should return a CoglMaterial* (now that we have that as a public type) in get_target(); having handles all over the place does not make it easier to distinguish the semantics of the virtual functions. Then we should rename create_target() to create_texture(), to make it clear that what should be returned is a texture that is used as the backing for the offscreen framebuffer.
* offscreen-effect: Traslate the modelview with the offsetsEmmanuele Bassi2010-06-101-5/+7
| | | | | | Instead of using the stage offsets when painting we can simply traslate the current modelview. This allows sub-classes to fully override the paint_target() virtual function without chaining up.
* effects: Fix stacking of offscreen-based effectsEmmanuele Bassi2010-06-031-0/+12
| | | | | | Stacking multiple effects sub-classing ClutterOffscreenEffect requires a small fix in the code that computes the screen coordinates of the actor to position the FBO correctly with regards to the stage.
* effect: Rework the OffscreenEffect paintingEmmanuele Bassi2010-06-031-85/+219
| | | | | | | | | | | | | The OffscreenEffect should set up the off screen draw buffer so that it has the same projection and modelview as if it where on screen; we achieve that by setting up the viewport to be the same size of the stage but with an initial offset given by the left-most vertex of the actor. When we paint the texture attached to the FBO we then set up the modelview matrix of the on screen draw buffer so that it's the same as the stage one: this way, the texture will be painted in screen coordinates and it will occupy the same area as the actor would have had.
* effect: Add OffscreenEffectEmmanuele Bassi2010-06-031-0/+336
The OffscreenEffect class is meant to be used to implement Effect sub-classes that create an offscreen framebuffer and redirect the actor's paint sequence there. The OffscreenEffect is useful for effects using fragment shaders. Any shader-based effect being applied to an actor through an offscreen buffer should be used before painting the resulting target material and not for every actor. This means that doing: pre_paint: cogl_program_use(program) set up offscreen buffer paint: [ actors ] → offscreen buffer → target material post_paint: paint target material cogl_program_use(null) Is not correct. Unfortunately, we cannot really do: post_paint: cogl_program_use(program) paint target material cogl_program_use(null) Because the OffscreenEffect::post_paint() implementation also pops the offscreen buffer and re-instates the previous framebuffer: post_paint: cogl_program_use(program) change frame buffer ← ouch! paint target material cogl_program_use(null) One way to fix it is to allow using the shader right before painting the target material - which means adding a new virtual inside the OffscreenEffect class vtable in additions to the ones defined by the parent Effect class. The newly-added paint_target() virtual allows the correct sequence of actions by adding an entry point for sub-classes to wrap the "paint target material" operation with custom code, in order to implement the case above correctly as: post_paint: change frame buffer cogl_program_use(program) paint target material cogl_program_use(null) The added upside is that sub-classes of OffscreenEffect involving shaders really just need to override the prepare() and paint_target() virtuals, since the pre_paint() and post_paint() do all that's needed.