Skip to content

MRG: Fix window size for screenshot on HiDPI#660

Merged
prabhuramachandran merged 1 commit into
enthought:masterfrom
larsoner:hidpi
Jun 27, 2018
Merged

MRG: Fix window size for screenshot on HiDPI#660
prabhuramachandran merged 1 commit into
enthought:masterfrom
larsoner:hidpi

Conversation

@larsoner
Copy link
Copy Markdown
Collaborator

On macOS with HiDPI mlab.screenshot is broken, only rendering 1/4 of the window (as expected by the 2x logical to physical pixel ratio for the monitor):

>>> from mayavi import mlab
mlab.>>> mlab.test_plot3d()
<mayavi.modules.surface.Surface object at 0x128adb728>
>>> img = mlab.screenshot()
>>> import matplotlib.pyplot as plt
>>> plt.imshow(img)
<matplotlib.image.AxesImage object at 0x133546ef0>
>>> plt.show()

On master:
figure_1

On this PR:

figure_2

Not 100% sure figure.scene.render_window.size is the right thing to use here, but it works.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Jun 27, 2018

Codecov Report

Merging #660 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #660   +/-   ##
=======================================
  Coverage   50.45%   50.45%           
=======================================
  Files         257      257           
  Lines       23328    23328           
  Branches     3181     3181           
=======================================
  Hits        11771    11771           
  Misses      10802    10802           
  Partials      755      755
Impacted Files Coverage Δ
mayavi/tools/figure.py 47.79% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5c2694b...0a0f49c. Read the comment docs.

@prabhuramachandran
Copy link
Copy Markdown
Member

Thanks! LGTM!

@prabhuramachandran prabhuramachandran merged commit aaf008e into enthought:master Jun 27, 2018
@larsoner
Copy link
Copy Markdown
Collaborator Author

FWIW I just noticed savefig does something different involving magnification:

https://github.com/enthought/mayavi/blob/master/mayavi/tools/figure.py#L234

Maybe the two approaches should be unified?

@larsoner larsoner deleted the hidpi branch June 27, 2018 18:00
@prabhuramachandran
Copy link
Copy Markdown
Member

Yes, that would be good. :)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants