Skip to content
This repository was archived by the owner on May 30, 2023. It is now read-only.

More control over the rendered dimensions #19

Merged
merged 6 commits into from
Mar 30, 2011
Merged

More control over the rendered dimensions #19

merged 6 commits into from
Mar 30, 2011

Conversation

wouterdebie
Copy link

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! :)

@wouterdebie
Copy link
Author

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.

@ariya
Copy link
Owner

ariya commented Mar 29, 2011

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.

@wouterdebie
Copy link
Author

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.

@ariya
Copy link
Owner

ariya commented Mar 29, 2011

Thanks.

Final nitpick: coding style (see the spaces etc in the existing code).

@wouterdebie
Copy link
Author

No probs. I didn't take care of this at all, my bad.

@ariya ariya merged commit 2a84536 into ariya:master Mar 30, 2011
@ariya
Copy link
Owner

ariya commented Mar 30, 2011

Merged, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants