10000 GTK3Agg backend: Only convert the cairo context to a cairocffi context o... by timovwb · Pull Request #2813 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

GTK3Agg backend: Only convert the cairo context to a cairocffi context o... #2813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 14, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions lib/matplotlib/backends/backend_gtk3agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ def on_draw_event(self, widget, ctx):
else:
bbox_queue = self._bbox_queue

if HAS_CAIRO_CFFI:
ctx = cairo.Context._from_pointer(
cairo.ffi.cast('cairo_t **',
id(ctx) + object.__basicsize__)[0],
incref=True)

for bbox in bbox_queue:
area = self.copy_from_bbox(bbox)
buf = np.fromstring(area.to_string_argb(), dtype='uint8')
Expand All @@ -56,10 +62,6 @@ def on_draw_event(self, widget, ctx):
height = int(bbox.y1) - int(bbox.y0)

if HAS_CAIRO_CFFI:
ctx = cairo.Context._from_pointer(
cairo.ffi.cast('cairo_t **',
id(ctx) + object.__basicsize__)[0],
incref=True)
image = cairo.ImageSurface.create_for_data(
buf.data, cairo.FORMAT_ARGB32, width, height)
else:
Expand Down
0