mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Compute the necessary texture resolution using more accurate scaling information provided by Mozart scene node metrics events instead of the device pixel ratio provided by the Mozart view properties (which we might remove in the future). This allows us to allocate smaller textures when a Flutter view is being scaled down.
38 lines
1.2 KiB
C++
38 lines
1.2 KiB
C++
// Copyright 2016 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "flutter/flow/export_node.h"
|
|
|
|
namespace flow {
|
|
|
|
ExportNode::ExportNode(uint32_t export_token_handle)
|
|
: export_token_(export_token_handle) {}
|
|
|
|
ExportNode::~ExportNode() {
|
|
// TODO(MZ-190): Ensure the node is properly unregistered on the rasterizer
|
|
// thread by attaching it to the update context in some way.
|
|
}
|
|
|
|
void ExportNode::Bind(SceneUpdateContext& context,
|
|
mozart::client::ContainerNode& container,
|
|
const SkPoint& offset,
|
|
bool hit_testable) {
|
|
ftl::MutexLocker lock(&mutex_);
|
|
|
|
if (export_token_) {
|
|
node_.reset(new mozart::client::EntityNode(container.session()));
|
|
node_->Export(std::move(export_token_));
|
|
}
|
|
|
|
if (node_) {
|
|
container.AddChild(*node_);
|
|
node_->SetTranslation(offset.x(), offset.y(), 0.f);
|
|
node_->SetHitTestBehavior(hit_testable
|
|
? mozart2::HitTestBehavior::kDefault
|
|
: mozart2::HitTestBehavior::kSuppress);
|
|
}
|
|
}
|
|
|
|
} // namespace flow
|