Skip to content
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

fixed image drawing for the both UI #1302

Merged

Conversation

azhavoro
Copy link
Contributor

No description provided.

@azhavoro azhavoro requested a review from bsekachev March 23, 2020 13:19
@@ -692,6 +692,7 @@ export class CanvasViewImpl implements CanvasView, Listener {
ctx.scale(image.renderWidth / image.imageData.width,
image.renderHeight / image.imageData.height);
ctx.putImageData(image.imageData, 0, 0);
ctx.drawImage(this.background, 0, 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is problem here?
Why putImageData is not enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current path, transformation matrix, shadow attributes, global alpha, the clipping region, and global composition operator must not affect the getImageData() and putImageData() methods.

from: https://www.w3.org/TR/2dcontext/#dom-context-2d-putimagedata

By this reason I have to redraw canvas to apply scale.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this fast operation? As far as I remember it was quite slow before

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case putImageData takes ~1ms, drawImage < 1ms for fullHD and ~10 ms and <1ms for 4k.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if you left a comment in the code about why we need this line (just to do not forget)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

bsekachev
bsekachev previously approved these changes Mar 24, 2020
@@ -692,6 +692,7 @@ export class CanvasViewImpl implements CanvasView, Listener {
ctx.scale(image.renderWidth / image.imageData.width,
image.renderHeight / image.imageData.height);
ctx.putImageData(image.imageData, 0, 0);
ctx.drawImage(this.background, 0, 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if you left a comment in the code about why we need this line (just to do not forget)

@nmanovic nmanovic merged commit 0135908 into az/data_chunk_streaming Mar 24, 2020
@bsekachev bsekachev deleted the az/fix_image_size_for_data_streaming branch March 25, 2020 08:56
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