Properly minimize the rasterized layers#5815
Conversation
The creation of the bounding box of actual image content is wrong.
|
@tacaswell: Your discretion whether to put this on 1.5.1rc or 1.5.2... |
src/_backend_agg.cpp
Outdated
There was a problem hiding this comment.
weird, I can't find when these lines were introduced. Git blame said they were last touched during the CXX refactor, but when I go to that commit, I can't find these lines anywhere...
There was a problem hiding this comment.
It used to be called tostring_rgba_minimized. And actually it looks like it used to have this fix, which got transferred incorrectly in the C++ refactor:
// Expand the bounds by 1 pixel on all sides
xmin = std::max(0, xmin - 1);
ymin = std::max(0, ymin - 1);
xmax = std::min(xmax, (int)width);
ymax = std::min(ymax, (int)height);
There was a problem hiding this comment.
What's with the plus 1's and minus 1's?
There was a problem hiding this comment.
The +1 makes sense to me. The -1 I'm not sure, but it's been there forever.
There was a problem hiding this comment.
Nah, neither of them make sense to me. Instead, I think the -1 shouldn't be there for x1/y1, and instead of +1 on x2/y2, it should be -1 on width/height. Note, I am not entirely certain if the subsequent code assumes 0 or 1-based indexing. I presume it is 0-based.
There was a problem hiding this comment.
It's zero-based. The range is like a Python slice, where the lower value is inclusive and the upper value is exclusive. Hence the need for +1 on the upper values.
There was a problem hiding this comment.
ok, so the -1's doesn't make sense at all.
There was a problem hiding this comment.
well, except for the original comment saying that it is trying to expand the bounds on all sides, but doesn't say why
There was a problem hiding this comment.
Yeah -- we could take the -1's out and see what happens to the test suite. Now that we're not doing fuzzy testing, we shouldn't know pretty quickly if it has negative consequences.
|
hmm, the failure on 2.7 looks spurious, but it isn't one of the usual suspects (one of the stix tests). Restarted anyway. |
|
And Travis failed again, but on a completely different test this time. Restarted. |
|
Hmm, no failures in the Travis tests. Weird, but ok... waiting for appveyor. |
|
I think this should go into 1.5.1 since it fixes a pretty bad error, but I'll let @tacaswell decide if it is worth putting out a rc2 for. |
|
👍 to putting this in 1.5.1 👎 on needing an rc2. |
|
On 2016/01/08 9:45 AM, Thomas A Caswell wrote:
Agreed! |
|
appveyor failed with weird errors. I don't think I have the ability to restart them. |
Properly minimize the rasterized layers
…layer Properly minimize the rasterized layers Conflicts: lib/matplotlib/tests/test_image.py One too-many tests where cherry-picked
…layer Properly minimize the rasterized layers Conflicts: lib/matplotlib/tests/test_image.py One too-many tests were cherry-picked
Merge pull request #5815 from mdboom/fix-minimizing-raster-layer
|
Is this before or after #5834 went in? Which formats are failing? If it is all svg, part of the issue may be the rasterization via inkscape. |
|
The latest commit from #5834 (and the whole v1.5.x branch) seems to work just fine. |
|
Oh, we need to merge 1.5.x back into master. On Tue, Jan 12, 2016 at 5:42 PM Thomas Spura notifications@github.com
|

Fixes #5814.