Upgrade to newer agg version#288
Conversation
|
I think this is really good idea for the medium term. Moving to celiagg is not as straightforward as it should be. That said, the history of this branch looks a bit crazy. Can you rebase/redo to get rid of the commits from your Also, the Also, it might be better to source this from matplotlib, since that's where I grabbed it from when building celiagg. |
|
One more thing: You could make this diff a bit smaller by avoiding build scripts within agg (
Everything else should be ignored |
* Now using the same version of AGG as matplotlib * Removed unittest skips that were hampered by a bug with the old agg version * Some small changes to the unit test as the rendering changed * Adapted function `void transform_image_interpolate` to make it compile * Changed signature of `agg24::rendering_buffer* graphics_context_base::rendering_buffer_ptr()` to `agg24::rendering_buffer& graphics_context_base::rendering_buffer()`
|
I redid a new branch with the same version of AGG as matplotlib. This is a lot cleaner now. |
|
There are some failures in the travis build:
P.S. I will try to setup the appveyor and travis for mac os soon, to make sure it is being tested correctly. |
|
|
||
|
|
||
| agg24::path_storage img_outline = img.boundary_path(img_mtx); | ||
| agg24::rendering_buffer* src_buf = img.rendering_buffer_ptr(); |
There was a problem hiding this comment.
Right. So everywhere you used agg_pixfmt in this method, it appears you should have used other_format instead. Did that not compile for you?
I've tested this locally (macOS) and everything appears to be working as it always did.
There was a problem hiding this comment.
The unit tests pass when I make this change
There was a problem hiding this comment.
That's the first thing I tried but it doesn't compile on windows. I get a template error diarrhea. Here is an excerpt.
kiva\agg\src\kiva_graphics_context.h(711): note: while compiling class template member function 'kiva::graphics_context<agg24::pixfmt_abgr32>::graphics_context(unsigned char *,int,int,int,kiva::interpolation_e)'
kiva\agg\agg_wrap.cpp(4177): note: see reference to function template instantiation 'kiva::graphics_context<agg24::pixfmt_abgr32>::graphics_context(unsigned char *,int,int,int,kiva::interpolation_e)' being compiled
kiva\agg\src\kiva_graphics_context.h(618): error C2664: 'agg24::image_accessor_clip<agg24::pixfmt_rgb24>::image_accessor_clip(agg24::image_accessor_clip<agg24::pixfmt_rgb24> &&)': cannot convert argument 1 from 'agg24::pixfmt_abgr32' to 'agg24::pixfmt_alpha_blend_rgb<agg24::blender_rgb24,agg24::rendering_buffer,3,0> &'
There was a problem hiding this comment.
Oups, brain fart. Looks like it works just fine. Thanks!
| def test_determinant(self): | ||
| orig = array((1.0,2.0,3.0,1.0,4.0,5.0)) | ||
| desired = -0.2 | ||
| desired = -5.0 |
There was a problem hiding this comment.
In agg_trans_perspective.h they had the method determinant which was actually a determinant reciprocal. They fixed the method in the new version and added a new method for the reciprocal.
There was a problem hiding this comment.
Crazy. Looks like the matrix inversion code also changed, which explains why none of the other unit tests broke...
|
@mdickinson: Once the |
|
The image is working perfectly now! There is a big issue with the scrolling though. I don't think it is related to my branch. |
Codecov Report
@@ Coverage Diff @@
## master #288 +/- ##
=========================================
+ Coverage 33.59% 33.6% +0.01%
=========================================
Files 206 206
Lines 18278 18278
Branches 2407 2407
=========================================
+ Hits 6140 6142 +2
+ Misses 11745 11744 -1
+ Partials 393 392 -1
Continue to review full report at Codecov.
|
|
False alarm. Enable doesn't like it if using the mouse wheel while pyqt4 and pyqt5 are installed on the same environment. |
|
I'm generally 👍 on this, but it would be nice if some others look into whether or not it actually solves the crashing bugs with image rendering. I hope that it does, because that would be awesome. I'll be on vacation for the next three weeks, so if any Enthought persons feel reasonably confident about this, then merge away (don't forget to squash). |
|
Just a comment about licensing. As far as I understand, these changes have been adapted from the matplotlib fork of agg 2.4, correct? We should make sure we provide the appropriate attribution. |
|
@itziakos I'm trying to figure out what the right approach is here in terms of licensing. Judging from the Matplotlib license (https://github.com/matplotlib/matplotlib/blob/master/LICENSE/LICENSE) we should be good to go if we reproduce the Matplotlib license along with the Agg source code (and perhaps add a clarifying note somewhere that the Matplotlib license applies only to Agg sources). Do you agree? |
|
My take on this is that the agg source at the matplotlib repo has a separate license https://github.com/matplotlib/matplotlib/blob/master/extern/agg24-svn/src/copying. I think we should append a copy of that license in our agg source license and mention in a note that changes added in this PR have been ported from the matplotlib fork of agg (link to matplotlib) and are subject to https://github.com/matplotlib/matplotlib/blob/master/extern/agg24-svn/src/copying Maybe, we should check with @jwiggins and @corranwebster, they might have some more experience on such things. |
|
I'm a little unclear on exactly what the origins of the code in this branch are, but I think it's something like:
If this is the case, then we need to:
Does this seem reasonable/correct? |
|
The approach was:
Also, there were extra modifications in the matplotlib repository. |
|
This fixes enthought/chaco#339 for me (segfault before, nice image plot after), nice work! As for licensing, since there are changes made by the matplotlib community, it does look like we need to include the matplotlib license as well (along with a brief description of the changes made in this PR). @corranwebster I'm not sure what your 3rd point would look like (BSD license with appropriate contributors...). Can you follow up on this? |
|
Yes, I agree, looks like we need the matplotlib license. The 3rd point would just be a copy of the main Enable project LICENSE.txt with appropriate dates (ie. should probably update copyright 2006-17 or something). I'd also suggest adding a README.txt to enable/kiva/agg with a brief explanation of the provenance of the code. That should hopefully cover the licensing aspects. We can possibly do this in a separate PR as long as we are good about doing it immediately upon the merge of this code. |
|
@jdeschenes Would you be able to take care of the remaining license issues? |
|
For AGG, are we not already covered by https://github.com/enthought/enable/blob/master/kiva/agg/agg-24/copying? Matplotlib did make changes to the AGG source code which we are getting here. So I think we now need to include https://github.com/matplotlib/matplotlib/blob/master/LICENSE/LICENSE as well. Where shall it go? Is it time to add a LICENSE directory to enable? |
|
@jdeschenes @corranwebster @jwiggins I added the licensing info in a separate PR jdeschenes#1 against @jdeschenes' branch. Let me know what you think. |
Licensing info for Agg-2.4
|
It works for me... I just accepted your modifications. |
|
Licensing LGTM. Unless anyone has objections, I think that this is good to go. |
|
Thanks for clearing that up @jvkersch, and thanks to @jdeschenes for the upgrade! |
This is a pretty big diff. I don't know if you guys will want to pursue this option. Essentially, there are several issues in enable that are caused by issues with the current agg version in enable. This could close:
Undefined behavior: left shift of negative value#221This pull uses the same version of agg as celiagg fixes those issues. While the diff is rather large, it can be summarized and reviewed quite easily:
agg24was changed toagg(To make sure that the two agg were identical)kiva/agg/src/kiva_graphics_context.htransform_image_interpolate to make it compilekiva/agg/src/kiva_graphics_context_base.hofrendering_buffer_ptrtorendering_bufferI have tested this pretty extensively on my Windows machine and so far, there is only one small issue that I saw, where the image doesn't interpolate correctly. My guess is that it is caused by the change to kiva_graphics_context.h. I am sure you guys could spot quickly the error I made.
As far as I am aware, you guys were probably leaning toward using celiagg instead, but this pull could be a good stepping stone in that direction as they would now be sharing the same library underneath.
Let me know if you are interested in pursuing this.