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

使用 ResizeImage 来降低图片的绘制成本 #865

Closed
andycall opened this issue Nov 10, 2021 · 0 comments · Fixed by #879
Closed

使用 ResizeImage 来降低图片的绘制成本 #865

andycall opened this issue Nov 10, 2021 · 0 comments · Fixed by #879
Assignees
Labels
enhancement New feature or request

Comments

@andycall
Copy link
Member

使用场景 | Use case

现在 Kraken 在绘制图片的时候,会直接将按照图片的原尺寸进行绘制,而通常情况下,图片展示的大小是原小于图片原有的大小。
使用 flutter 内置的工具可以看到大量无用的像素背浪费在绘制阶段。这可能也是直接 overflow scroll 滚动过程中,GPU 线程复杂太高的原因。

Flutter 所提供的 Image widget 默认会使用 ResizeImage 来渲染图片,而 Kraken 现在并没有使用这个方案。

因此我们也应当将图片采用 ResizeImage 进行渲染。

flutter: ══╡ EXCEPTION CAUGHT BY PAINTING LIBRARY ╞══════════════════════════════════════════════════════════
flutter: The following message was thrown while painting an image:
flutter: Image null has a display size of 106×55 but a decode size of 400×195, which uses an additional
flutter: 375KB.
flutter:
flutter: Consider resizing the asset ahead of time, supplying a cacheWidth parameter of 106, a cacheHeight
flutter: parameter of 55, or using a ResizeImage.
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
flutter: Another exception was thrown: Image null has a display size of 106×55 but a decode size of 400×195, which uses an additional 375KB.
flutter: Another exception was thrown: Image null has a display size of 106×55 but a decode size of 400×195, which uses an additional 375KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 105×55 but a decode size of 400×195, which uses an additional 376KB.
flutter: Another exception was thrown: Image null has a display size of 165×96 but a decode size of 448×252, which uses an additional 505KB.
flutter: Another exception was thrown: Image null has a display size of 165×96 but a decode size of 448×252, which uses an additional 505KB.
flutter: Another exception was thrown: Image null has a display size of 165×96 but a decode size of 448×252, which uses an additional 505KB.
flutter: Another exception was thrown: Image null has a display size of 165×96 but a decode size of 448×252, which uses an additional 505KB.
@andycall andycall added the enhancement New feature or request label Nov 10, 2021
@andycall andycall self-assigned this Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant