Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,8 @@ private void renderAndDrawAsBitmap(Canvas originalCanvas, CompositionLayer compo
int renderWidth = (int) Math.ceil(softwareRenderingTransformedBounds.width());
int renderHeight = (int) Math.ceil(softwareRenderingTransformedBounds.height());

if (renderWidth <= 0 || renderHeight <= 0) {
// Safeguard against errors during Bitmap creation by returning early if dimensions are invalid.
if (renderWidth <= 0 || renderHeight <= 0 || renderWidth > bounds.width() || renderHeight > bounds.height()) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Wouldn't this not render an image if it scaled up so it covered the whole screen + 1px?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

In that case can we clip the bounds so that we only allocate a bitmap large enough to draw what's shown onscreen?
I'm trying to guard against cases where the Canvas matrix returns an invalid scale or translation that causes something like a 1,000,000 x 1,000,000 bitmap to be allocated.

return;
}

Expand Down
Loading