Flutter Engine
flutter::SceneUpdateContext::Transform Class Reference

#include <scene_update_context.h>

Inheritance diagram for flutter::SceneUpdateContext::Transform:
flutter::SceneUpdateContext::Entity

Public Member Functions

 Transform (SceneUpdateContext &context, const SkMatrix &transform)
 
 Transform (SceneUpdateContext &context, float scale_x, float scale_y, float scale_z)
 
virtual ~Transform ()
 
- Public Member Functions inherited from flutter::SceneUpdateContext::Entity
 Entity (SceneUpdateContext &context)
 
virtual ~Entity ()
 
SceneUpdateContextcontext ()
 
scenic::EntityNode & entity_node ()
 
virtual scenic::ContainerNode & embedder_node ()
 

Detailed Description

Definition at line 63 of file scene_update_context.h.

Constructor & Destructor Documentation

◆ Transform() [1/2]

flutter::SceneUpdateContext::Transform::Transform ( SceneUpdateContext context,
const SkMatrix &  transform 
)

Definition at line 236 of file scene_update_context.cc.

References flutter::SceneUpdateContext::Entity::entity_node(), flutter::MatrixDecomposition::IsValid(), flutter::MatrixDecomposition::rotation(), flutter::MatrixDecomposition::scale(), and flutter::MatrixDecomposition::translation().

238  : Entity(context),
239  previous_scale_x_(context.top_scale_x_),
240  previous_scale_y_(context.top_scale_y_) {
241  entity_node().SetLabel("flutter::Transform");
242  if (!transform.isIdentity()) {
243  // TODO(SCN-192): The perspective and shear components in the matrix
244  // are not handled correctly.
245  MatrixDecomposition decomposition(transform);
246  if (decomposition.IsValid()) {
247  // Don't allow clients to control the z dimension; we control that
248  // instead to make sure layers appear in proper order.
249  entity_node().SetTranslation(decomposition.translation().x, //
250  decomposition.translation().y, //
251  0.f //
252  );
253 
254  entity_node().SetScale(decomposition.scale().x, //
255  decomposition.scale().y, //
256  1.f //
257  );
258  context.top_scale_x_ *= decomposition.scale().x;
259  context.top_scale_y_ *= decomposition.scale().y;
260 
261  entity_node().SetRotation(decomposition.rotation().x, //
262  decomposition.rotation().y, //
263  decomposition.rotation().z, //
264  decomposition.rotation().w //
265  );
266  }
267  }
268 }
Entity(SceneUpdateContext &context)

◆ Transform() [2/2]

flutter::SceneUpdateContext::Transform::Transform ( SceneUpdateContext context,
float  scale_x,
float  scale_y,
float  scale_z 
)

Definition at line 270 of file scene_update_context.cc.

References flutter::SceneUpdateContext::Entity::entity_node().

274  : Entity(context),
275  previous_scale_x_(context.top_scale_x_),
276  previous_scale_y_(context.top_scale_y_) {
277  entity_node().SetLabel("flutter::Transform");
278  if (scale_x != 1.f || scale_y != 1.f || scale_z != 1.f) {
279  entity_node().SetScale(scale_x, scale_y, scale_z);
280  context.top_scale_x_ *= scale_x;
281  context.top_scale_y_ *= scale_y;
282  }
283 }
Entity(SceneUpdateContext &context)

◆ ~Transform()

flutter::SceneUpdateContext::Transform::~Transform ( )
virtual

Definition at line 285 of file scene_update_context.cc.

References flutter::SceneUpdateContext::Entity::context().

285  {
286  context().top_scale_x_ = previous_scale_x_;
287  context().top_scale_y_ = previous_scale_y_;
288 }

The documentation for this class was generated from the following files: