Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix svg flipping (again) #1691

Merged
merged 2 commits into from

2 participants

@dmcdougall
Collaborator

Fixes #1689.

dmcdougall added some commits
@dmcdougall dmcdougall Revert "When using nearest neighbor interpolation and not actually sc…
…aling, just copy the data. (Note we don't do this for other kinds of interpolation, because the filtering on those interpolations could have an effect even when not actually scaling.)"

This reverts commit 1c9f9b5.
aaae0bd
@dmcdougall dmcdougall Partial revert of 8c25664
This removes the flipping done in Python and keeps the regression tests.
1606edb
@dmcdougall dmcdougall referenced this pull request
Closed

SVG flip issue #1689

@dmcdougall
Collaborator

All tests pass locally with python 2.7.

@dmcdougall
Collaborator

Tests are passing on Travis, too.

@mdboom Is it ok for me to merge this?

@mdboom
Owner

Seems ok -- but I'm worried the change in _image.cpp may have a negative impact on other backends. Though I know you've looked into the problem in much greater depth than I have. If all tests are passing, I suspect we're ok on this.

@dmcdougall dmcdougall merged commit 6b20da4 into matplotlib:v1.2.x
@dmcdougall dmcdougall deleted the dmcdougall:fix_svg_flip2 branch
@dmcdougall
Collaborator

@mdboom It worries me too, but remember that it was a regression from v1.1.1, so I think we're ok. Problems may arise from changes in backends that deal with images in the v1.1.1--v1.2.0 range, but I think I'd rather deal with those piecemeal given the solid ground 1.1.1 gave us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 21, 2013
  1. @dmcdougall

    Revert "When using nearest neighbor interpolation and not actually sc…

    dmcdougall authored
    …aling, just copy the data. (Note we don't do this for other kinds of interpolation, because the filtering on those interpolations could have an effect even when not actually scaling.)"
    
    This reverts commit 1c9f9b5.
  2. @dmcdougall

    Partial revert of 8c25664

    dmcdougall authored
    This removes the flipping done in Python and keeps the regression tests.
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 12 deletions.
  1. +0 −3  lib/matplotlib/backends/backend_svg.py
  2. +5 −9 src/_image.cpp
View
3  lib/matplotlib/backends/backend_svg.py
@@ -743,12 +743,9 @@ def draw_image(self, gc, x, y, im, dx=None, dy=None, transform=None):
self.writer.start(u'g', attrib={u'clip-path': u'url(#%s)' % clipid})
trans = [1,0,0,1,0,0]
- h,w = im.get_size_out()
if rcParams['svg.image_noscale']:
trans = list(im.get_matrix())
trans[5] = -trans[5]
- trans[3] = -trans[3]
- y += h
attrib[u'transform'] = generate_transform([(u'matrix', tuple(trans))])
assert trans[1] == 0
assert trans[2] == 0
View
14 src/_image.cpp
@@ -440,15 +440,11 @@ Image::resize(const Py::Tuple& args, const Py::Dict& kwargs)
case NEAREST:
{
- if (colsIn == numcols && rowsIn == numrows) {
- memcpy(bufferOut, bufferIn, colsIn * rowsIn * 4);
- } else {
- typedef agg::span_image_filter_rgba_nn<img_accessor_type, interpolator_type> span_gen_type;
- typedef agg::renderer_scanline_aa<renderer_base, span_alloc_type, span_gen_type> renderer_type;
- span_gen_type sg(ia, interpolator);
- renderer_type ri(rb, sa, sg);
- agg::render_scanlines(ras, sl, ri);
- }
+ typedef agg::span_image_filter_rgba_nn<img_accessor_type, interpolator_type> span_gen_type;
+ typedef agg::renderer_scanline_aa<renderer_base, span_alloc_type, span_gen_type> renderer_type;
+ span_gen_type sg(ia, interpolator);
+ renderer_type ri(rb, sa, sg);
+ agg::render_scanlines(ras, sl, ri);
}
break;
Something went wrong with that request. Please try again.