-
Notifications
You must be signed in to change notification settings - Fork 5.8k
More control over the rendered dimensions #19
Conversation
I've modified the first commit to allow passing in "top" and "left" parameters to renderSize(), so you can render a specific part of the page. "top" and "left" default to 0 if they are not set or less than 0. |
Thanks for the pull request! Some comments: If it contains left and top as well, then the name 'renderSize' is incorrect. Since literally it just clips the web page, something like 'clipRect' or 'renderClip' will be more suitable. Also, there is no need to allocate the offscreen buffer as big as the content size, with the proper translation set to the QPainter. |
You were right. No need to create such a big buffer and then copy it again. I've renamed the methods and fixed the buffer. |
Thanks. Final nitpick: coding style (see the spaces etc in the existing code). |
No probs. I didn't take care of this at all, my bad. |
Merged, thanks! |
Hi!
I've added phantom.renderSize() to be able to control the dimensions of the output. This is done by simply adding m_renderSize and the additional getters/setters. From the JS size, it works the same as setting the viewportSize. If no renderSize is set, render() will fallback to using the mainFrame()->contentsSize().
Cheers!
Wouter
ps. awesome project! :)