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.
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
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
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.
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 :)
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.
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.
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
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.
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.
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.
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).
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
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).
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>
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>
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>
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).
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 :)
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?
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).
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.
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.