Cleanup unused entries in entity.

This commit is contained in:
Chinmay Garde
2021-07-20 13:14:08 -07:00
committed by Dan Field
parent 9c0f8af66a
commit 09eeecf86d
5 changed files with 9 additions and 158 deletions

View File

@@ -7,6 +7,10 @@ FormatStyle: none
CheckOptions:
- key: readability-identifier-naming.PrivateMemberCase
value: 'lower_case'
- key: readability-identifier-naming.EnumConstantCase
value: 'CamelCase'
- key: readability-identifier-naming.EnumConstantPrefix
value: 'k'
- key: readability-identifier-naming.PrivateMemberSuffix
value: '_'
- key: readability-identifier-naming.PublicMethodCase

View File

@@ -10,6 +10,8 @@ impeller_component("aiks") {
"canvas.h",
"paint.cc",
"paint.h",
"image.cc"
"image.h"
]
public_deps = [

View File

@@ -10,43 +10,6 @@ Entity::Entity() = default;
Entity::~Entity() = default;
Rect Entity::GetFrame() const {
Point origin(position_.x - (bounds_.size.width * anchor_point_.x),
position_.y - (bounds_.size.height * anchor_point_.y));
return Rect(origin, bounds_.size);
}
void Entity::SetFrame(const Rect& frame) {
SetBounds(Rect(bounds_.origin, frame.size));
SetPosition(Point(frame.origin.x + (anchor_point_.x * frame.size.width),
frame.origin.y + (anchor_point_.y * frame.size.height)));
}
const Rect& Entity::GetBounds() const {
return bounds_;
}
void Entity::SetBounds(const Rect& bounds) {
bounds_ = bounds;
}
const Point& Entity::GetPosition() const {
return position_;
}
void Entity::SetPosition(const Point& position) {
position_ = position;
}
const Point& Entity::GetAnchorPoint() const {
return anchor_point_;
}
void Entity::SetAnchorPoint(const Point& anchorPoint) {
anchor_point_ = anchorPoint;
}
const Matrix& Entity::GetTransformation() const {
return transformation_;
}
@@ -55,34 +18,6 @@ void Entity::SetTransformation(const Matrix& transformation) {
transformation_ = transformation;
}
Matrix Entity::GetModelMatrix() const {
/*
* The translation accounts for the offset in the origin of the bounds
* of the entity and its position about its anchor point.
*/
auto translation = Matrix::MakeTranslation(
{-bounds_.origin.x + position_.x - (bounds_.size.width * anchor_point_.x),
-bounds_.origin.y + position_.y -
(bounds_.size.height * anchor_point_.y)});
/*
* The transformation of an entity is applied about is anchor point. However,
* if the transformation is identity, we can avoid having to calculate the
* matrix adjustment and also the two matrix multiplications.
*/
if (transformation_.IsIdentity()) {
return translation;
}
auto anchorAdjustment =
Matrix::MakeTranslation({-anchor_point_.x * bounds_.size.width,
-anchor_point_.y * bounds_.size.height});
return translation * anchorAdjustment.Invert() * transformation_ *
anchorAdjustment;
}
const Color& Entity::GetBackgroundColor() const {
return background_color_;
}
@@ -91,14 +26,6 @@ void Entity::SetBackgroundColor(const Color& backgroundColor) {
background_color_ = backgroundColor;
}
const double& Entity::GetOpacity() const {
return opacity_;
}
void Entity::SetOpacity(double opacity) {
opacity_ = opacity;
}
const Color& Entity::GetStrokeColor() const {
return stroke_color_;
}
@@ -112,7 +39,7 @@ double Entity::GetStrokeSize() const {
}
void Entity::SetStrokeSize(double strokeSize) {
stroke_size_ = strokeSize;
stroke_size_ = std::max(strokeSize, 0.0);
}
const Path& Entity::GetPath() const {

View File

@@ -18,66 +18,6 @@ class Entity {
~Entity();
/**
* The frame specifies the origin and size of the entity in the coordinate
* space of its parent. This is a computed property derived from the bounds
* of the entity and its position.
*
* @return the frame of the entity
*/
Rect GetFrame() const;
/**
* Set the frame of the entity
*
* @param frame the new frame
*/
void SetFrame(const Rect& frame);
/**
* The bounds specifies the origin and size of the entity in its own
* coordinate space.
*
* @return the bounds of the entity
*/
const Rect& GetBounds() const;
/**
* Set the bounds of the entity
*
* @param bounds the new bounds
*/
void SetBounds(const Rect& bounds);
/**
* The position specifies the coordinates of the anchor position of the
* entity relative to its parent
*
* @return the position of the entity
*/
const Point& GetPosition() const;
/**
* Sets the position of the entity
*
* @param point the new position
*/
void SetPosition(const Point& point);
/**
* The position of the anchor point within this node in unit space
*
* @return the anchor point
*/
const Point& GetAnchorPoint() const;
/**
* Sets the new anchor point of this node
*
* @param anchorPoint the new anchor point
*/
void SetAnchorPoint(const Point& anchorPoint);
/**
* The transformation that is applied to the entity about its anchor point
*
@@ -92,13 +32,6 @@ class Entity {
*/
void SetTransformation(const Matrix& transformation);
/**
* The model matrix of the entity
*
* @return the view matrix
*/
Matrix GetModelMatrix() const;
/**
* The background color of the entity
*
@@ -113,21 +46,6 @@ class Entity {
*/
void SetBackgroundColor(const Color& backgroundColor);
/**
* The opacity of the entity. 0.0 is fully transparent and 1.0 is fully
* opaque. Default it 1.0.
*
* @return the opacity of the entity
*/
const double& GetOpacity() const;
/**
* Set the new opacity of the entity
*
* @param opacity the new opacity
*/
void SetOpacity(double opacity);
const Color& GetStrokeColor() const;
void SetStrokeColor(const Color& strokeColor);
@@ -148,8 +66,7 @@ class Entity {
Color background_color_;
Path path_;
double opacity_ = 1.0;
Color stroke_color_ = Color::Black();
Color stroke_color_;
double stroke_size_ = 1.0;
FML_DISALLOW_COPY_AND_ASSIGN(Entity);

View File

@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "path_component.h"
#include <cmath>
namespace impeller {