Commit Graph

168 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 05aee3e370 Evas: Don't pass whole RGBA_Image to low-level render functions
Idea originated from Cedric the b0rker.

This is a big fat search-and-replace commit.
This commit also introduces space changes... Sorry for the mix.

NOTE: This commit may have one side effect as there was some very
      dubious code chaning the dst image's alpha flag in the
      Gfx get functions. Logically this didn't make sense (at
      draw time the dst alpha should already be well defined),
      so it should be safe.
2014-11-13 12:20:57 +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
Jean-Philippe Andre 3f73d20502 Evas filters: Prevent division by 0
While it really shouldn't happen, let's just add a quick if()
and make Coverity shut up.

Fixes:
 - CID 1191912
 - CID 1191911
 - CID 1191910
 - CID 1191909
2014-10-28 10:54:51 +09:00
Jean-Philippe ANDRE e096a3490b Evas filters: Fix parsing of argument lists
Make check would even fail on 32bit machines because of that:
Lua tables are not arrays and lua_next doesn't ensure the order
of the elements as I wrongly assumed.

@fix
Fixes T1615
2014-09-19 10:33:24 +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
Jean-Philippe Andre 793e2ee21e Evas filters: Report parsing error message from lua
Also, re-enable legacy code compatibility layer, as it
can still be used for compat with older code.
2014-06-11 10:02:42 +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 f731f8ffb4 Evas filters: Fix NULL dereference (legacy_strdup)
CID 1210809
CID 1210813

+ remove comment
2014-05-14 18:42:05 +09:00
Jean-Philippe Andre 2a5b3e2482 Evas filters: Fix NULL dereferences
CID 1210807
CID 1210808
2014-05-14 18:39:53 +09:00
Jean-Philippe Andre e0d3e20aed Evas filters: Remove logically dead code
CID 1181889
2014-05-14 18:39:53 +09:00
Jean-Philippe Andre 8c8816aca6 Evas filters: Fix some parsing errors 2014-05-09 16:57:39 +09:00
Jean-Philippe Andre 139f7bc178 Evas doc: Add example for padding_set (filters)
With preview and all.
2014-05-09 16:57:39 +09:00
Jean-Philippe Andre 87e09ff25e Evas doc: Move filters reference doc to Lua
Part 2: improve doc design, translate examples to Lua syntax and
        add a few words about Lua itself.
2014-05-09 16:57:39 +09:00
Jean-Philippe Andre 8a1b335bb1 Evas doc: Move filters examples to Lua
Part 1: auto-generated examples with previews
2014-05-09 16:57:39 +09:00
Jérémy Zurcher 9a79d1e864 silence a few warnings 2014-05-08 00:15:53 +02:00
Jérémy Zurcher f8c2c57406 do not use EINA_FALSE instead of NULL 2014-05-07 17:45:11 +02:00
Cedric Bail d590ad8041 evas: reuse buffer instead of leaking it.
CID 1210816
2014-05-04 00:18:55 +02:00
Jean-Philippe Andre 27650fb94a Evas filters: Fix parsing of instructions with unnamed arguments 2014-04-30 14:52:39 +09:00
Jean-Philippe Andre 64baafe176 Evas filters: Premultiply colors after parsing integers 2014-04-30 14:52:39 +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 de4969ccb2 Evas filters: Remove legacy code
The compatibility layer and Lua implementation are now complete.
2014-04-27 17:40:55 +09:00
Jean-Philippe Andre 103d8d08fa Evas filters: switch script language to Lua
It was a pretty stupid idea to write a parser for a custom language
when we already have Lua as a dependency and it's so beautiful and
easy.

There is a fallback function to allow for compatibility with legacy
filters. But that broken syntax is not recommended. I'll probably
remove it soon.

All the test cases I have in my example app work fine with this
compatibily layer.
2014-04-27 17:40:55 +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 deb8a637e4 Evas filters: Remove useless include 2014-04-04 18:35:22 +09:00
Jean-Philippe Andre 634034af46 Evas filters: Add template optimizable files for box blur
The new files (i386, sse3 and neon) are basically empty and fallback
to the C version. This is just to pave the way for full low-level
optimization... if someone has the time and skills to do it :)

Add both Alpha and RGBA template files.
2014-04-02 14:53:00 +09: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 27d97110cc Evas filters: Default mask fillmode should be repeat
Fillmode "NONE" has basically no practical use and shouldn't be
the default.
2014-03-26 10:48:12 +09:00
Jean-Philippe Andre 7e731ea10a Evas filters: Ignore ox,oy when stretching in the same direction
During padding calculation, ox and oy should be ignored unless the
blend operation is neither repeating nor stretching. Otherwise,
the buffer will grow without necessity.
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 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 c7616dd738 Evas filters: Fix blur corner cases with small images
If the buffer size is smaller than the blurring kernel, then
special precautions must be taken to properly read the source
pixels. Also, fix the corner cases near the left & right edges
(or top & bottom).
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 571d7b6287 Evas filters: Fix invalid error check in mapped_blend()
Some filters would not render because I checked the wrong
value. image_draw can not fail, it only returns a bool
indicating asynchronous processing.
2014-03-14 17:00:06 +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 a37a1d458d Evas filters: Fix uninitialized variable warning 2014-03-12 14:08:02 +09:00
Jean-Philippe Andre 9c3a3373b3 Evas filters: Add basic optimization for RGBA gaussian blur 2014-03-12 14:08:01 +09:00
Jean-Philippe Andre cb69700389 Evas filters: Add optimizable blur function
Prepare optimization paths for blur operations, as they are VERY
costly. This simple change, when using gcc -O3 flag, boosts
horizontal blur performance by > 50%, because STEP is 1 (and
so, memory accesses, increments, etc... are all very simple)

The objective is to have support for NEON, MMX, SSE, too, with
runtime detection.
2014-03-12 14:08:01 +09:00
Jean-Philippe Andre 1960c97eb4 Evas filters: Add more time debug marks in blur 2014-03-12 14:08:01 +09:00
Jean-Philippe Andre 2ea3cb6414 Evas filters: Remove dead code
Remove true Gaussian kernel code, as it is not usable over 12px and
was disabled because it gives different visual results than the
fake Gaussian curve using sin().
2014-03-12 14:08:01 +09:00
Jean-Philippe Andre caa8789424 Evas filters: Improve debug logs
According to Gustavo's comment :)
2014-03-12 14:08:01 +09:00