未验证 提交 82cd793e 编写于 作者: C Chris Bracken 提交者: GitHub

Use iOS scale when computing render buffer size (#4171) (#4373)

When checking whether render buffer size has changed, apply the device
scale factor used to convert points to pixels to ensure we're not
needlessly re-allocating render buffer storage.

Adds trace + debug log to make this easier to detect in future.

Originally introduced in 2d530dae, but
rolled back in 0a6e415b to test whether
it was responsible for regressions to
flutter_gallery_ios__transition_perf benchmarks:
  * average_frame_build_time_millis
  * missed_frame_build_budget_count

Re-landed in d43d3534, and reverted in
459f722b after it appeared to regress
the above two benchmarks. After recent changes to microtask execution
order which fixed https://github.com/flutter/flutter/issues/9998,
re-introducing this fix results in benchmark improvements to the above
two benchmarks in local testing.
上级 4733e337
......@@ -163,14 +163,16 @@ bool IOSGLContext::PresentRenderBuffer() const {
bool IOSGLContext::UpdateStorageSizeIfNecessary() {
const CGSize layer_size = [layer_.get() bounds].size;
const GLint size_width = layer_size.width;
const GLint size_height = layer_size.height;
const CGFloat contents_scale = layer_.get().contentsScale;
const GLint size_width = layer_size.width * contents_scale;
const GLint size_height = layer_size.height * contents_scale;
if (size_width == storage_size_width_ && size_height == storage_size_height_) {
// Nothing to since the stoage size is already consistent with the layer.
return true;
}
TRACE_EVENT_INSTANT0("flutter", "IOSGLContext::UpdateStorageSizeIfNecessary");
FXL_DLOG(INFO) << "Updating render buffer storage size.";
if (![EAGLContext setCurrentContext:context_]) {
return false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册