Skip to content

Optimize drawing solid backgrounds - #3521

Merged
mourner merged 3 commits into
masterfrom
optimize-background
Nov 3, 2016
Merged

mourner merged 3 commits into
masterfrom
optimize-background

Conversation

@mourner

@mourner mourner commented Nov 3, 2016 •

Copy link
Copy Markdown
Member

Closes #2773, closes #2925. There seems to be no FPS difference for me, but it might help on devices with weaker GPUs (e.g. phones).

👀 @ansis @brunoabinader

@mourner mourner added the performance ⚡ Speed, stability, CPU usage, memory usage, or power usage label Nov 3, 2016

@ansis ansis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good!

Comment thread js/render/draw_background.js Outdated
const image = layer.paint['background-pattern'];
const opacity = layer.paint['background-opacity'];

if (painter.isOpaquePass !== (!image && color[3] === 1)) return;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is not related to your changes, but it looks like this doesn't consider opacity when it should. If it's convenient it would nice to squeeze that in here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Whoa, you're right! Fixing this also fixes #2925 🎉

@mourner
mourner merged commit 68887b2 into master Nov 3, 2016
@mourner
mourner deleted the optimize-background branch November 3, 2016 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance ⚡ Speed, stability, CPU usage, memory usage, or power usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong rendering results with background layer with opacity as overlay Use glClear to draw solid background fills if they are the bottommost layer

2 participants