Commit Graph

77 Commits

Author SHA1 Message Date
Jean-Philippe Andre 15f7cefa68 Evas masking: Fix major memory leak
The memory usage graph was going up and to the right!
I was told this is always a good thing!

... maybe not this time :)

Hopefully I didn't forget a case. An intense session of
genlist scrolling with masks all over the place and masks
of masks didn't show any glitch, crash or memory leak.
2015-01-21 17:51:15 +09:00
Jean-Philippe Andre a9630a77b6 Evas masking: Add clip_image_[un]set functions to draw context
This allows passing a mask image to the render functions.

@feature
2015-01-07 15:06:02 +09:00
Jean-Philippe Andre fe677a0518 Evas: Use common function for proxy_subrender
Merges functions from:
- filters
- image object
2014-11-12 17:11:49 +09:00
Jean-Philippe Andre 4fb138a65f Evas: Remove ugly REND_DBG
Here's a macro that's used for debugging in some of the ugliest
ways possible: avoid passing an extra argument to a function when the
cost of always passing it is negligible (it's an int).

Fixes T1749.
2014-11-12 15:26:59 +09:00
Tom Hacohen 7f3a44894b Evas canvas eolian: Fix namespace and class name for the evas canvas. 2014-06-30 17:47:06 +01:00
Jean-Philippe Andre c99449ea09 Evas filters: Allow use of a color multiplier
We couldn't do evas_object_color_set() on a filtered text
object simply because the color was not properly taken into
account.

This should simplify some effects as it'll be much easier to
set a color or alpha value to the text regardless of the filter.

Hmm, is this a fix or feature? O_o
2014-06-12 10:59:56 +09:00
Tom Hacohen 0fc3279db9 Efl: Update code to use the new class names generated by eolian. 2014-06-03 11:28:01 +01:00
Jean-Philippe Andre e0d3e20aed Evas filters: Remove logically dead code
CID 1181889
2014-05-14 18:39:53 +09:00
Jérémy Zurcher f8c2c57406 do not use EINA_FALSE instead of NULL 2014-05-07 17:45:11 +02: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
Tom Hacohen 35525a53e0 Adjust eo_do calls to work with the eo2 api. 2014-04-10 04:20:21 +01:00
Jean-Philippe Andre b045feefb1 Evas filters: Fix blur with src == dst
If dst == src, then we should not blend back to the buffer,
as we actually want to blur the content and not keep the sharp
version.
2014-03-26 10:48:12 +09:00
Jean-Philippe Andre eee3c1c773 Evas filters: Allow BLUR and GROW with radius 0
Fallback to a standard blend instruction instead of failing
miserably just because the radius is 0.
2014-03-21 15:23:02 +09:00
Jean-Philippe Andre 919b32be20 Evas filters: fix blur from rgba to output buffer
When blurring an RGBA buffer to the output buffer,
we don't need to convert the colorspace... but then we'll just
override what was already there.

Introduce a 'dirty' flag set to true whenever a command writes
to an output buffer.
2014-03-21 15:22:54 +09:00
Jean-Philippe Andre 96e58cebf7 Evas filters: Fix memory leak when destroying the object
The GL buffers set to be freed were released only the async case...
which doesn't make sense since GL is sync.

@fix
2014-03-12 14:08:02 +09:00
Jean-Philippe Andre 592204fe73 Evas filters: Optimize RGBA blur as well
Same as Alpha blur, use combination of box blurs,
and put all that code into optimizable functions.
2014-03-12 14:08:02 +09:00
Jean-Philippe Andre 4443ecfa8b Evas filters: Optimize alpha box blur
Use two optimizable functions for BOX blur: vertical and horizontal.
These functions will run as many times as requested (from 1 to 6 max).

The horizontal case is pretty straightforward as the source is already
contiguous (nice in terms of cache hits). The only catch is to swap
src and dst without ever writing to the input buffer.

In case of vertical blur, we apply the same method as above, after
rotating the column into a horizontal (contiguous) span, and rotating
it back afterwards.

Now, the same needs to be done for RGBA :)
2014-03-12 14:08: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 4e249143a5 Evas filters: Prepare optimization paths for BOX blur
Actually, there is a very nice trick with BOX blur.
Pass BOX blur 3 times and you can approximate a GAUSSIAN
blur with up to 3% accuracy. This is way more than enough
for just a simple graphical effect.

So, despite the crappy quality of BOX blur, we should
optimize it a lot so we can replace large GAUSSIAN blurs
with series of BOX blurs instead.

Source: Wikipedia's page on box blur :)

This commit also moves around some duplicated definitions.
2014-03-12 14:08:02 +09:00
Jean-Philippe Andre 0dace7721e Evas filters: Fix 1-D blurs on a single buffer
When a blur operation requires a copy-back to the source
buffer, then the render_op must be set to COPY instead of
BLEND. Otherwise the non blurred content will be visible.

@fix
2014-03-12 14:08:02 +09:00
Jean-Philippe Andre 6674ef5b35 Evas filters: Move DEBUG_TIME macro to be used in the main file
Optimization can happen at a higher level than the blur function
itself... so let's measure the whole filter running time.
2014-03-12 14:08:02 +09:00
Jean-Philippe Andre caa8789424 Evas filters: Improve debug logs
According to Gustavo's comment :)
2014-03-12 14:08:01 +09:00
Jean-Philippe Andre 5a77d1aae0 Evas filters: Reduce verbosity (INF --> DBG) 2014-03-07 11:07:15 +09:00
Jean-Philippe Andre 887585129b Evas filters: Improve detection of the GL engine
According to cedric's horrified comment :)

And add a comment in the code. Yes, this IS a temporary solution,
but the GL engineS being what they are (tons of duplicated code),
I think it's still better for now to just make things work.
2014-03-07 11:07:15 +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 ac8140ccd1 Evas filters: Rename RGBA_Image::mask.data into image.data8
The structure should not be changed, despite the union modification.

I am renaming for consistency with older branches that had a mask
field in RGBA_Image. Also, the mask.data or data8 is really just
a way to avoid casting between DATA8 and DATA32 (and it shows
clearly what kind of data you are dealing with).
2014-03-04 12:10:29 +09:00
Jean-Philippe Andre 51f216973a Evas filters: Minor fix for consistency (clip_to_target)
Make sure sx and sy are properly set.
No need to backport as the function actually expect these values to
be initialized to 0 in the first place.
2014-03-04 11:44:19 +09:00
Jean-Philippe Andre 8e795109ac Evas filters: fix clip to target calculation
It was possible to keep negative values for dx,dy which would
then draw pixels out of bounds (= crash).

Make check crashed after the previous commit.

@fix
2014-03-04 10:37:34 +09:00
Jean-Philippe Andre e05885e0e3 Evas filters: Fallback to normal rendering in case of error
If the filters fail to render at runtime (that is, parsing went fine
but a command failed to run properly), fallback to normal rendering.
This should prevent text from disappearing when using proxies and
the OpenGL engine (for now).
2014-03-04 10:37:34 +09:00
Jean-Philippe Andre c783b8d450 Evas filters: Avoid potential memory leaks
Properly free the buffers when they are not in the current context list.
2014-03-04 10:37:34 +09:00
Jean-Philippe ANDRE 6d4dd3f194 Evas filters: fix random cases of 'dancing text'
In some situations, text with filters would be rendered in an invalid
position (somewhere too high).
I am not entirely sure of the reason why the original code with BLEND
doesn't work, but this new version is simpler as GL and SW have more
similar behaviours:

- render text to our 'output' buffer
- draw this buffer as an image onto the set target

Thanks zmike for reporting the issue.
And thanks A LOT for using the filters :D

@fix

Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>
2014-03-04 10:37:28 +09:00
Jean-Philippe ANDRE 83746e5629 Evas filters: fix black squares with the GL engine
If a text object changes regularily, there might be cases where
the object will be rendered as a simple black rectangle for just
one frame.

It seems that the previous output buffer is deleted before being
actually rendered on screen. This patch will delay the deletion
of the previous buffer until the current one has been rendered
to the target surface.

And again, thanks zmike for reporting.

@fix

Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>
2014-03-04 10:37:19 +09:00
Jean-Philippe ANDRE 7f63b4a3eb Evas filters: Avoid CRI message when using the GL engine
A CRItical message was always displayed when setting a filter
on a text object, saying that proxy rendering is not supported on GL.

Reduce CRI to ERR and skip proxy rendering altogether if there are
no proxy sources.

This @fix needs to be backported.

Thanks zmike for reporting this.

Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>
2014-03-04 10:37:03 +09:00
Jean-Philippe Andre 74d8403217 Evas filters: Grow filter should gracefully blend
If grow() was used on top of another effect, it was simply
erasing all pixels. We need to use a temporary buffer and
blend it to the output.
2014-02-20 13:27:42 +09:00
Jean-Philippe Andre 0d9ffc2624 Evas filters: Fix padding in blur with offset
Test case was: blur(ox=40, rx=40);
This would crop the blurred text instead of having proper padding.
2014-02-20 13:27:42 +09:00
Jean-Philippe Andre df65e71e79 Evas filters: Another clang warning fix
Prevent error case from crashing.
2014-02-14 13:06:05 +09:00
Jean-Philippe Andre f603d5da86 Evas filters: Silence some clang warnings
Remove @hidden tag. It does not exist.
Initialize value of pow2_div. In theory not needed but better be safe :)
2014-02-14 12:07:54 +09:00
Carsten Haitzler a725924b53 evas - filter - fix memory leak if cmd not found by curve cmd 2014-02-13 18:57:27 +09:00
Carsten Haitzler bbefeae071 evas - filters - remove logically dead code
this addresses CID 1174084 - fix to remove useless code.
2014-02-13 18:57:27 +09:00
Jean-Philippe Andre 6301c6dc1e Evas filters: Remove undocumented files from Doxygen
Some files had Doxygen tags @file, which included them in the
Files list. But they are not documented, so remove them from
the index.
2014-02-13 11:24:47 +09:00
Jean-Philippe Andre 36b0bca4aa Evas filters: Add the reference documentation (script language)
In Doxygen format, write the reference documentation for the filters.
It will contain a few examples only, should serve more as a reference
just like edcref.

This is for the script language itself, not for the Eo APIs or the
internal APIs (those are already documented).
2014-02-13 11:24:43 +09:00
Jean-Philippe Andre 56d73cb897 Evas filters: Fix warnings on shadowed variables
Also, remove globals A, R, G, B from parser.c... these are
temp variables used in a macro.

My CFLAGS didn't include -Wshadow so I missed those.
Thanks Tom for spotting :)
2014-02-12 10:36:11 +09:00
Jean-Philippe Andre b9b8300f98 Evas filters: Check for EVAS_CSERVE2 when using cs2 APIs
This broke the windows build, because cserve2 isn't available on windows.
2014-02-10 11:15:54 +09:00
Carsten Haitzler 078099d63d fix warnings in evas filter plus a memleak in _vflip_cpu() 2014-02-08 12:15:35 +09:00
Jean-Philippe Andre 6d1356adea Evas filters: Disable proxies with the GL engine
Well, proxy sources are rendered to a... GL texture! But we
actually want the image pixels. So we'll need to call glReadPixels
to get them.

Yes, it will be horribly slow. But there isn't really a way around.
This will require a new internal API. For now, just disable the
feature. Hopefully I can make it work soon enough for the release?
2014-02-07 17:59:23 +09:00
Jean-Philippe Andre 9917962ffb Evas filters: Fix crash when using the GL backend
Buffer management was broken, and we tried to free the GL texture
as if it were a simple RGBA_Image.
2014-02-07 17:59:23 +09:00
Jean-Philippe Andre 71080b220e Evas filters: Prevent buffer creation when running filter
In async mode, the filter runs in the render thread, so can't
allocate buffers on the fly.
This case should not happen, unless maybe a source has a null
size (eg. it's invisible and not properly rendered).
2014-02-07 17:33:18 +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