Commit Graph

55 Commits

Author SHA1 Message Date
Vincent Torri f5b01ac5ce all: Simplify definition of EAPI
This will help in the transition from Autotools to Meson. This has been
tested on Windows for which EFL_XXX_BUILD were first introduced.
2018-01-18 18:04:03 +09:00
Jean-Philippe Andre 88bfba1fdd evas filters: Add "alphaonly" flag for blend and blur
This is very useful to specify precisely which kind of RGBA -> Alpha
conversion you want. If all you wanted was the alpha layer to use as a
mask, set this flag to true.

@feature
2017-12-14 18:03:49 +09:00
Jean-Philippe Andre c0514d948a filters: Safety++
This is an attempt at fixing crashes in empc.
Test scenario:
  ELM_ACCEL="" elementary_test -to "Gfx Filters"
  And mouse scroll like crazy in the spinner.

@fix
2017-09-06 09:12:28 +09:00
Cedric BAIL a5b4defdd5 evas: use output instead of default one during rendering of proxy. 2017-08-25 10:52:29 -07:00
Cedric BAIL fc1b7f7835 evas: make filter handle multi output. 2017-08-25 10:51:53 -07:00
Jean-Philippe Andre b10be4e2ed evas filters: Disable extra debug
Forgot to remove that! It's better to disable for the release,
DBG() and XDBG() are disabled anyway.

CID 1308611
2017-08-02 20:15:58 +09:00
Cedric BAIL 35e54acc46 evas: stat introducing a concept of engine and output in the backend. 2017-05-12 15:24:45 -07:00
Jean-Philippe Andre 3c92b32c13 evas filters: Fix async RW rendering
This fixes a crash (when deleting the output image), and rearranges
the code a bit.
2017-04-14 13:57:04 +09:00
Jean-Philippe Andre 30ac315631 evas filters: Cleanup unused buffers
This might not be used as over two consecutive runs all the
same buffers should be used. But it could happen if some
parameters in the filter change (eg. blur radius).

Fixes major (GPU) memory leaks. Reuse mode is still leaking.
2017-04-14 13:57:04 +09:00
Jean-Philippe Andre 01a4ecd92c evas filters: Adjust downscale coordinates to avoid artifacts
This avoids sampling artifacts when moving or resizing a
snapshot object over a region with sharp content (eg. text).
2017-04-14 13:57:04 +09:00
Jean-Philippe Andre 4cbff5f0ea evas filters: Fix maps with filtered snapshots
Another wonder of evas render... maps, clips, snapshots, filters...
This fixes animations with windows that have a snapshot decoration.
2017-04-14 11:26:44 +09:00
Jean-Philippe Andre 293438111c evas filters: Avoid creating input buffer for images
When the filtered object is an image, without borders, map,
fill info or anything of this sort, then the filter input
buffer is really just a copy of the original image. We can
skip that to save on memory usage and pixel fetches.
2017-04-14 11:26:44 +09:00
Jean-Philippe Andre 1bf24f8762 evas filters: Refactor to support reuse of buffers
This will reuse existing buffers by resetting only the minimum
required in the filter context (also reused). Work in progress,
as the actual reuse is disabled for now.
2017-04-14 11:26:44 +09:00
Jean-Philippe Andre b77cb960ca evas filters: Avoid unnecessary draw
This avoids creating one more FBO and doing one more draw,
by rendering the image input data directly into the input
buffer. This also makes the code common between SW and GL.
2017-04-14 11:26:43 +09:00
Jean-Philippe Andre 9b1ea2fc6b evas: Pass obscuring region to the filters
This will be most useful in a special case, where a filter is
used in a window decoration, applied to a snapshot object.

Another optimization that might be wanted is passing a list
of update regions (from the proxy or snapshot).

The filters don't support the obscuring region yet, only some
of the high-level logic is implemented.
2017-04-14 11:26:43 +09:00
Jean-Philippe Andre 92dfe1831c evas filters: Fix blur logic and GL buffer handling
This corrects two things:
- the blur filter high-level logic, that lead to reusing some
  temporary buffers which contained garbage;
- the versatile gl buffer implementation so that it now properly
  switches between the RGBA_Image and the FBO content (yes, this
  is insanely slow and inefficient... but it works and that was
  the only point).
2017-04-14 11:26:43 +09:00
Jean-Philippe Andre 2ef8d6f39a evas filters: Refactor ector and gfx filters A LOT
Alright, so this is a massive patch that is the result of
trying to get rid of unused or poorly implemented classes in
ector. Originally ector was meant to support VG but extend to
things like filters as well. At the moment, ector's design
makes it quite hard to plug in the filters.

For now I think it's easier to implement the GL support for
the filters directly in the engine, where I hope to interfere
as little as possible.

This massive patch keeps only the required minimum to support
a versatile gl buffer that can be mapped, drawn or rendered to (FBO).
It's extremely inefficient as it relies on glReadPixels and lots
of texture uploads, as well as conversions between ARGB and Alpha.

Another type of GL buffer is a wrap around an existing GL image,
but that one is read-only (map or draw: no write map, no FBO).

No, all the filters run fine, and the high-level implementation
(evas_filters.c) does not need to know whether the underlying engine
is SW or GL. One problem though appears with the blending or blurring
of some Alpha buffers, the colors are wrong.

This patch removes more lines than it adds so it must be good ;)
2017-04-14 11:26:43 +09:00
Jean-Philippe Andre 190d84e84b evas: Rename software filter function type
From Evas_Filter_Apply_Func to Software_Filter_Func.
Also fix include dir for out-of-tree builds of non-static sw generic.
2017-04-14 11:26:43 +09:00
Jean-Philippe Andre 0740010a06 evas filters: Move blend to software_generic (1/8)
This is an attempt at refactoring the filters code so I can
later implement GL support. This patch adds a few extra changes
to remove avoid calling functions of libevas from the software
engine: use the draw functions from static_libs/draw rather
than evas_common APIs.
2017-04-14 11:26:42 +09:00
Jean-Philippe Andre 40f4acae75 evas: Implement buffer caching for textblock filters
This is the most basic optimization that needs to be done for
filters to be useful: cache the output rgba buffers for each
filtered element. Hopefully this doesn't leak. I'm not making
any promises about that though :)
2017-01-17 14:35:29 +09:00
Jean-Philippe Andre 93965db815 evas: Implement filter sources support for textblock 2017-01-17 14:35:29 +09:00
Jean-Philippe Andre de47187dde evas: Fix tb filters spanning over multiple items
If a gfx filter was applied to a block of text spanning over
multiple text items, then it would improperly render as the
filter context was stored in the format, rather than the text
item. This is fixed by using a list of contexts in the format
node rather than a single context.
2017-01-17 14:35:28 +09:00
Jean-Philippe Andre b2a4039bda evas: Refactor evas filters a bit
This is a preparation step for (experimental) textblock support.
Textblock objects won't have a single filter, and the buffer's
geometry wouldn't be that of of the object itself. Thus a few
internal APIs need to be reworked first.
2017-01-17 14:35:27 +09:00
Jean-Philippe Andre 57902fffd3 Evas filters: Use Ector.Buffer instead of RGBA_Image
This is a major refactoring of the evas filters submodule.

Use Ector.Buffer and the map/unmap methods instead of directly
accessing image buffers with RGBA_Image. RGBA_Image is still
used under the hood, for two reasons:
 - Required for the final output (blend onto Evas itself)
 - Required for the scaling routines

FIXME:
 - Breaks proxy support (ie. all kind of texturing).
 - This breaks filters support for the GL engine.
2016-01-05 15:43:44 +09:00
Jean-Philippe Andre d15308efef Evas filters: Add explicit exec flag in data_set
This flag should be set iif the string passed is to be executed
rather than assigned. This is used to pass complex arguments
as data, like tables (eg. color class).
2015-06-25 14:36:09 +09:00
Jean-Philippe Andre 0e8f890dfb Edje & evas filters: Add extra data from EDC to Lua program
This also supports color classes (really rough implementation for
now, but the API should remain stable).

@feature
2015-06-25 14:36:09 +09:00
Jean-Philippe Andre 225c0f937a Evas filters: Pass edje state name & value to the filters
From Edje, pass the current state info (name and value) as well
as the next state and the transition position when applicable.
2015-06-25 14:36:08 +09:00
Jean-Philippe Andre ffea07a049 Evas filters: Pass text colors to the parser
This does not implement the full feature yet (Lua variable
is not set). This commit also brings various fixes.
2015-06-25 14:36:08 +09:00
Jean-Philippe Andre d148c0f0d2 Evas filters: Fix runtime, allow state change on the fly
Now we're ready to implement runtime changes to the filters'
state (color classes, edje state, etc...), as the Lua function
will be run whenver required.
2015-06-25 14:36:08 +09:00
Jean-Philippe Andre ed09b3af6d Evas filters: Add some @internal flags to the doxygen docs 2015-06-25 14:36:08 +09:00
Jean-Philippe Andre 2faaef966e Evas filters: Add internal function _program_run
This will allow changing the state of the filter and re-run it
without re-creating the Lua_State object. This is to handle size,
color, animation state and scale changes (amongst other things).
2015-06-25 14:36:08 +09:00
Cedric BAIL 71b7fc982a evas: remove the need to order the header correctly for Windows. 2015-05-07 09:53:10 +02:00
Jean-Philippe Andre 6935880171 Evas filters: Move filter COW to evas global stuff
It will be shared between TEXT and IMAGE objects.
2014-10-22 11:14:09 +09:00
Jean-Philippe Andre 59cf013db9 Evas filters: Add support for Evas_Object_Image
This adds filter support to Image objects as well.
The exact same filters can run on Text and on Images
(provided some colorspace limitations are respected).

This basically adds:
- Support for RGBA input buffer
- Eo entry points for Image filter support
- Implement basic filter support in Evas_Image
2014-04-27 17:41:40 +09:00
Jean-Philippe Andre 91a471b4dc Evas filters: Add new instruction padding_set
This will allow forcing a specific value for the filter padding,
instead of relying on auto calculation.

Two advantages:
- Auto calculation can't be perfect, since it will add as much
  padding as required for the full blur effect
- This prepares the path for animations with effects, where the
  object size does not change over time
2014-03-21 15:23:02 +09:00
Jean-Philippe Andre 2a1ba1b908 Evas filters: Use box blur by default
BOX blur is a lot faster (and easier to optimize, too)
than GAUSSIAN blur. Repeating 2x or 3x BOX blur will also
give similar results to GAUSSIAN blur (very smooth), but
in much less time.

Add a count parameter to the BOX blur instruction.
2014-03-12 14:08:02 +09:00
Jean-Philippe Andre 7690e33b49 Evas filters: Implement proxy rendering for GL
Make use of glReadPixel to access the source's pixel data.
Use all classic CPU functions to blend and use that data.
Save pointer to the GL image and update it with the latest data
during target render.

Use ENFN's surface_lock, read_pixels, unlock.

Also, add some more error checks to make sure the images are valid,
or return an error at runtime.
2014-03-07 11:07:15 +09:00
Jean-Philippe Andre 8ddfa35da6 Evas filters: Add return value in filter callback
This will inform the client whether an asynchronous filter properly
rendered or not.

I actually don't know any case where rendering can fail at runtime.
2014-03-04 15:17:11 +09:00
Jean-Philippe Andre 126cbbc7a9 Evas filters: Mark parser functions as EAPI for tests
The filter unit test case will directly call the parser functions.
2014-02-20 13:27:42 +09:00
Jean-Philippe Andre 9d821a402a Evas filters: Fix proxy usage (source unset)
Proxy sources & objects were not properly unset.
This results either in crashes (especially in the Edje tests)
or dangling objects with tons of references.

Remove the refcount increase/decrease, as it is redundant.
Store pairs proxy+source instead of just the source in all hashes,
so we can unset the is_proxy flag on the proxy when there are no
sources anymore.
2014-02-07 17:33:18 +09:00
Jean-Philippe Andre 8570b38dd1 Evas filters: Rename bind to source_set
Because that's what we call it for proxy images :)
2014-02-07 17:33:18 +09:00
Jean-Philippe Andre 43962135be Evas filters: Remove FIXME and unimplemented code
Remove compilation warnings: we don't really need cubic
interpolation at this point, we can still add it back
later if wanted.

Also, make it clear that buffer #2 is the output buffer.
Remove meaningless FIXME.
2014-02-07 17:33:17 +09:00
Jean-Philippe Andre 2e401c2e91 Evas filters: Allocate buffer in the main loop (part 2)
Now the allocation is really done in the main loop.
Rendering fails, only happens in case of redraw.
2014-02-07 17:33:17 +09:00
Jean-Philippe Andre eea049f988 Evas filters: Alloc/Dealloc buffers from the main loop only
This is a problem I didn't spot immediately... but with
tons of nasty consequences.
2014-02-07 17:33:17 +09:00
Jean-Philippe Andre 8062df320c Evas filters: OpenGL support part 2.
This patch implements the final draw from RGBA_Image to the
OpenGL surface. We can even steal the output buffer and
redraw it quickly, without having to re-render everything
(same as in SW).
2014-02-07 17:33:17 +09:00
Jean-Philippe Andre f007cd5665 Evas filters: Move font draw inside the filters functions
Since the filters will have to decide on which engine (SW, GL) to
choose from to render the font and the effects, move the font
draw call inside the filters module.
2014-02-07 17:33:17 +09:00
Jean-Philippe Andre e08a8fd934 Evas filters: Remove (never implemented) motion blur 2014-02-07 17:33:17 +09:00
Jean-Philippe Andre 209a7077a0 Evas filters: Add offset parameter to vflip
It is not possible to logically handle padding and offset at the same
time for a proper mirror effect, unless this is handled directly at the
transformation level.

Also, add support for blend() operation padding computation.
2014-02-07 17:33:17 +09:00
Jean-Philippe Andre d9fb0cdc34 Evas filters: Add transform filter
This is the simplest solution I can come up with for "mirror" effects.
Displacement maps are HARD to generate and use properly, since the buffer
size is unknown until runtime.
Even if we align the map to the text itself (using the padding information),
it's still hard to describe properly how to apply the displacement map, and
to generate it... So let's just add a simple flip operation.
2014-02-07 17:33:17 +09:00
Jean-Philippe Andre e7a67dd13b Evas filters: Remove complicated displacement flags
The displacement effect is way too complicated. Let's keep it
simple and have only one displacement map format (RG + Alpha).

Here's what's missing now:
- Alpha support, to blend in the input with a variable intensity
- Extra padding (see below)

Also, the intensity VS. map values are not perfectly defined yet.

Problems: How to create a complete mirror effect (map needs to go
over boundaries... add extra padding to the buffers).
2014-02-07 17:33:17 +09:00