Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Remove unnecessary clip cairo #1526

Closed
wants to merge 3 commits into from

3 participants

@mdehoon
Collaborator

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
@dmcdougall dmcdougall commented on the diff
lib/matplotlib/backends/backend_cairo.py
((6 lines not shown))
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 Collaborator

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
Collaborator

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
Owner

+1

@dmcdougall
Collaborator

Great.

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

@mdehoon
Collaborator

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

@dmcdougall
Collaborator

Fixed by #1538.

@dmcdougall dmcdougall closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 22, 2012
  1. Removing unnecessary clipping

    Michiel de Hoon authored
  2. Removing unnecessary clipping

    Michiel de Hoon authored
  3. Removing unnecessary clipping

    Michiel de Hoon authored
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 10 deletions.
  1. +1 −10 lib/matplotlib/backends/backend_cairo.py
View
11 lib/matplotlib/backends/backend_cairo.py
@@ -157,24 +157,15 @@ def draw_image(self, gc, x, y, im):
# bbox - not currently used
if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name())
- clippath, clippath_trans = gc.get_clip_path()
-
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 Collaborator

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
y = self.height - y - rows
ctx.set_source_surface (surface, x, y)
ctx.paint()
- ctx.restore()
im.flipud_out()
Something went wrong with that request. Please try again.