aboutsummaryrefslogtreecommitdiff
path: root/src/ui/render
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2019-12-13 23:53:06 +0800
committercrupest <crupest@outlook.com>2019-12-13 23:53:06 +0800
commit221c62de313ad811ca2b3ae8ba43996c96c347bc (patch)
tree57419e033536e4a9aec0b3ecd26274120352a6f2 /src/ui/render
parentf452d4826ad4023c28d6dd59686b3cf5d6340235 (diff)
downloadcru-221c62de313ad811ca2b3ae8ba43996c96c347bc.tar.gz
cru-221c62de313ad811ca2b3ae8ba43996c96c347bc.tar.bz2
cru-221c62de313ad811ca2b3ae8ba43996c96c347bc.zip
...
Diffstat (limited to 'src/ui/render')
-rw-r--r--src/ui/render/flex_layout_render_object.cpp6
-rw-r--r--src/ui/render/render_object.cpp12
2 files changed, 10 insertions, 8 deletions
diff --git a/src/ui/render/flex_layout_render_object.cpp b/src/ui/render/flex_layout_render_object.cpp
index a5fde12a..1cac6899 100644
--- a/src/ui/render/flex_layout_render_object.cpp
+++ b/src/ui/render/flex_layout_render_object.cpp
@@ -59,7 +59,7 @@ Size FlexLayoutRenderObject::OnMeasureContent(const Size& available_size) {
std::vector<int> no_basis_children;
std::vector<int> grow_children;
std::vector<int> shrink_chilren;
- for (int i = 0; i < child_layout_data_.size(); i++) {
+ for (int i = 0; i < static_cast<int>(child_layout_data_.size()); i++) {
const auto& layout_data = child_layout_data_[i];
if (layout_data.flex_basis.has_value())
has_basis_children.push_back(i);
@@ -189,7 +189,7 @@ void FlexLayoutRenderObject::OnLayoutContent(const Rect& content_rect) {
content_rect.width, actual_content_width);
float anchor_x = 0;
- for (int i = 0; i < children.size(); i++) {
+ for (int i = 0; i < static_cast<int>(children.size()); i++) {
const auto child = children[i];
const auto size = child->GetPreferredSize();
@@ -219,7 +219,7 @@ void FlexLayoutRenderObject::OnLayoutContent(const Rect& content_rect) {
content_rect.height, actual_content_height);
float anchor_y = 0;
- for (int i = 0; i < children.size(); i++) {
+ for (int i = 0; i < static_cast<int>(children.size()); i++) {
const auto child = children[i];
const auto size = child->GetPreferredSize();
diff --git a/src/ui/render/render_object.cpp b/src/ui/render/render_object.cpp
index b6a9e8e4..7f6255f7 100644
--- a/src/ui/render/render_object.cpp
+++ b/src/ui/render/render_object.cpp
@@ -11,9 +11,10 @@ void RenderObject::AddChild(RenderObject* render_object, const int position) {
assert(!(child_mode_ == ChildMode::Single && children_.size() > 0));
assert(render_object->GetParent() ==
- nullptr); // Render object already has a parent.
- assert(position >= 0); // Position index is less than 0.
- assert(position <= children_.size()); // Position index is out of bound.
+ nullptr); // Render object already has a parent.
+ assert(position >= 0); // Position index is less than 0.
+ assert(position <= static_cast<int>(
+ children_.size())); // Position index is out of bound.
children_.insert(children_.cbegin() + position, render_object);
render_object->SetParent(this);
@@ -21,8 +22,9 @@ void RenderObject::AddChild(RenderObject* render_object, const int position) {
}
void RenderObject::RemoveChild(const int position) {
- assert(position >= 0); // Position index is less than 0.
- assert(position < children_.size()); // Position index is out of bound.
+ assert(position >= 0); // Position index is less than 0.
+ assert(position < static_cast<int>(
+ children_.size())); // Position index is out of bound.
const auto i = children_.cbegin() + position;
const auto removed_child = *i;