Remove unnecessary clip cairo #1526

Closed
wants to merge 3 commits into from

3 participants

@mdehoon

When the draw_image function was simplified, the cairo backend was not updated.
Specifically, it's not necessary to perform clipping separately -- this has already been done when draw_image is being called.

Michiel de Hoon added some commits Nov 23, 2012
@dmcdougall dmcdougall commented on the diff Nov 26, 2012
lib/matplotlib/backends/backend_cairo.py
im.flipud_out()
rows, cols, buf = im.color_conv (BYTE_FORMAT)
surface = cairo.ImageSurface.create_for_data (
buf, cairo.FORMAT_ARGB32, cols, rows, cols*4)
- # function does not pass a 'gc' so use renderer.ctx
- ctx = self.gc.ctx
- ctx.save()
- if clippath is not None:
- ctx.new_path()
- RendererCairo.convert_path(ctx, clippath, clippath_trans)
- ctx.clip()
+ ctx = gc.ctx
@dmcdougall
Matplotlib Developers member

Is there any difference between gc.ctx and self.gc.ctx?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@mdehoon

gc and self.gc are the same object. gc is obtained by calling new_gc, and new_gc always returns self.gc, which is created only once, in the initializer of RendererCairo.

@mdboom
Matplotlib Developers member

+1

@dmcdougall
Matplotlib Developers member

Great.

@mdehoon Would you be able to squash this down to a single commit?

@mdehoon

See mdehoon@8d15940
I hope I did this right -- usually with git I have no clue what I am doing.

@dmcdougall
Matplotlib Developers member

Fixed by #1538.

@dmcdougall dmcdougall closed this Dec 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment