Flutter embedded in Flutter via Mozart is double scaled

We weren't correctly dividing by the device pixel ratio when asking Mozart to
present our child scene.
This commit is contained in:
Adam Barth
2016-03-11 13:36:59 -08:00
parent 13808f0218
commit 63976f2ef4
2 changed files with 8 additions and 3 deletions

View File

@@ -11,7 +11,7 @@ namespace flow {
// TODO(abarth): We need to figure out how to allocate these ids sensibly.
static uint32_t next_id = 10;
ChildSceneLayer::ChildSceneLayer() {
ChildSceneLayer::ChildSceneLayer() : device_pixel_ratio_(1.0f) {
}
ChildSceneLayer::~ChildSceneLayer() {
@@ -39,8 +39,8 @@ void ChildSceneLayer::UpdateScene(mojo::gfx::composition::SceneUpdate* update,
child_node->op->set_scene(mojo::gfx::composition::SceneNodeOp::New());
child_node->op->get_scene()->scene_resource_id = id;
child_node->content_clip = mojo::RectF::New();
child_node->content_clip->width = physical_size_.width();
child_node->content_clip->height = physical_size_.height();
child_node->content_clip->width = physical_size_.width() / device_pixel_ratio_;
child_node->content_clip->height = physical_size_.height() / device_pixel_ratio_;
child_node->content_transform = mojo::Transform::From(transform_);
update->nodes.insert(id, child_node.Pass());
container->child_node_ids.push_back(id);

View File

@@ -17,6 +17,10 @@ class ChildSceneLayer : public Layer {
void set_offset(const SkPoint& offset) { offset_ = offset; }
void set_device_pixel_ratio(float device_pixel_ratio) {
device_pixel_ratio_ = device_pixel_ratio;
}
void set_physical_size(const SkISize& physical_size) {
physical_size_ = physical_size;
}
@@ -32,6 +36,7 @@ class ChildSceneLayer : public Layer {
private:
SkPoint offset_;
float device_pixel_ratio_;
SkISize physical_size_;
mojo::gfx::composition::SceneTokenPtr scene_token_;
SkMatrix transform_;