Skip to content

Commit

Permalink
Merge pull request #1691 from dmcdougall/fix_svg_flip2
Browse files Browse the repository at this point in the history
Fix svg flipping (again)
  • Loading branch information
dmcdougall committed Jan 23, 2013
2 parents 527fd07 + 1606edb commit 6b20da4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
3 changes: 0 additions & 3 deletions lib/matplotlib/backends/backend_svg.py
Expand Up @@ -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}) self.writer.start(u'g', attrib={u'clip-path': u'url(#%s)' % clipid})


trans = [1,0,0,1,0,0] trans = [1,0,0,1,0,0]
h,w = im.get_size_out()
if rcParams['svg.image_noscale']: if rcParams['svg.image_noscale']:
trans = list(im.get_matrix()) trans = list(im.get_matrix())
trans[5] = -trans[5] trans[5] = -trans[5]
trans[3] = -trans[3]
y += h
attrib[u'transform'] = generate_transform([(u'matrix', tuple(trans))]) attrib[u'transform'] = generate_transform([(u'matrix', tuple(trans))])
assert trans[1] == 0 assert trans[1] == 0
assert trans[2] == 0 assert trans[2] == 0
Expand Down
14 changes: 5 additions & 9 deletions src/_image.cpp
Expand Up @@ -440,15 +440,11 @@ Image::resize(const Py::Tuple& args, const Py::Dict& kwargs)


case NEAREST: case NEAREST:
{ {
if (colsIn == numcols && rowsIn == numrows) { typedef agg::span_image_filter_rgba_nn<img_accessor_type, interpolator_type> span_gen_type;
memcpy(bufferOut, bufferIn, colsIn * rowsIn * 4); typedef agg::renderer_scanline_aa<renderer_base, span_alloc_type, span_gen_type> renderer_type;
} else { span_gen_type sg(ia, interpolator);
typedef agg::span_image_filter_rgba_nn<img_accessor_type, interpolator_type> span_gen_type; renderer_type ri(rb, sa, sg);
typedef agg::renderer_scanline_aa<renderer_base, span_alloc_type, span_gen_type> renderer_type; agg::render_scanlines(ras, sl, ri);
span_gen_type sg(ia, interpolator);
renderer_type ri(rb, sa, sg);
agg::render_scanlines(ras, sl, ri);
}
} }
break; break;


Expand Down

0 comments on commit 6b20da4

Please sign in to comment.