summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp30
-rw-r--r--Userland/Applications/SpaceAnalyzer/TreeMapWidget.h2
-rw-r--r--Userland/Applications/SpaceAnalyzer/main.cpp4
3 files changed, 18 insertions, 18 deletions
diff --git a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp
index 487c1b655c..d45c63008f 100644
--- a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp
+++ b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp
@@ -123,19 +123,19 @@ void TreeMapWidget::lay_out_children(const TreeMapNode& node, const Gfx::IntRect
}
}
- int total_area = node.area();
+ i64 total_area = node.area();
Gfx::IntRect canvas = rect;
bool remaining_nodes_are_too_small = false;
for (size_t i = 0; !remaining_nodes_are_too_small && i < node.num_children(); i++) {
- const int i_node_area = node.child_at(i).area();
+ const i64 i_node_area = node.child_at(i).area();
if (i_node_area == 0)
break;
- const int long_side_size = max(canvas.width(), canvas.height());
- const int short_side_size = min(canvas.width(), canvas.height());
+ const size_t long_side_size = max(canvas.width(), canvas.height());
+ const size_t short_side_size = min(canvas.width(), canvas.height());
- int row_or_column_size = (long long int)long_side_size * i_node_area / total_area;
- int node_area_sum = i_node_area;
+ size_t row_or_column_size = long_side_size * i_node_area / total_area;
+ i64 node_area_sum = i_node_area;
size_t k = i + 1;
// Try to add nodes to this row or column so long as the worst aspect ratio of
@@ -146,14 +146,14 @@ void TreeMapWidget::lay_out_children(const TreeMapNode& node, const Gfx::IntRect
// Do a preliminary calculation of the worst aspect ratio of the nodes at index i and k
// if that aspect ratio is better than the 'best_worst_aspect_ratio_so_far' we keep it,
// otherwise it is discarded.
- int k_node_area = node.child_at(k).area();
+ i64 k_node_area = node.child_at(k).area();
if (k_node_area == 0) {
break;
}
- int new_node_area_sum = node_area_sum + k_node_area;
- int new_row_or_column_size = (long long int)long_side_size * new_node_area_sum / total_area;
- int i_node_size = (long long int)short_side_size * i_node_area / new_node_area_sum;
- int k_node_size = (long long int)short_side_size * k_node_area / new_node_area_sum;
+ i64 new_node_area_sum = node_area_sum + k_node_area;
+ size_t new_row_or_column_size = long_side_size * new_node_area_sum / total_area;
+ size_t i_node_size = short_side_size * i_node_area / new_node_area_sum;
+ size_t k_node_size = short_side_size * k_node_area / new_node_area_sum;
float i_node_aspect_ratio = get_normalized_aspect_ratio(new_row_or_column_size, i_node_size);
float k_node_aspect_ratio = get_normalized_aspect_ratio(new_row_or_column_size, k_node_size);
float new_worst_aspect_ratio = min(i_node_aspect_ratio, k_node_aspect_ratio);
@@ -168,9 +168,9 @@ void TreeMapWidget::lay_out_children(const TreeMapNode& node, const Gfx::IntRect
// Paint the elements from 'i' up to and including 'k-1'.
{
- const int fixed_side_size = row_or_column_size;
- int placement_area = node_area_sum;
- int main_dim = short_side_size;
+ const size_t fixed_side_size = row_or_column_size;
+ i64 placement_area = node_area_sum;
+ size_t main_dim = short_side_size;
// Lay out nodes in a row or column.
Orientation orientation = canvas.width() > canvas.height() ? Orientation::Horizontal : Orientation::Vertical;
@@ -178,7 +178,7 @@ void TreeMapWidget::lay_out_children(const TreeMapNode& node, const Gfx::IntRect
layout_rect.set_primary_size_for_orientation(orientation, fixed_side_size);
for (size_t q = i; q < k; q++) {
auto& child = node.child_at(q);
- int node_size = (long long int)main_dim * child.area() / placement_area;
+ size_t node_size = main_dim * child.area() / placement_area;
Gfx::IntRect cell_rect = layout_rect;
cell_rect.set_secondary_size_for_orientation(orientation, node_size);
Gfx::IntRect inner_rect;
diff --git a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.h b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.h
index 3dec6f2ce8..0fb5dc2268 100644
--- a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.h
+++ b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.h
@@ -13,7 +13,7 @@ namespace SpaceAnalyzer {
struct TreeMapNode {
virtual String name() const = 0;
- virtual int64_t area() const = 0;
+ virtual i64 area() const = 0;
virtual size_t num_children() const = 0;
virtual const TreeMapNode& child_at(size_t i) const = 0;
virtual void sort_children_by_area() const = 0;
diff --git a/Userland/Applications/SpaceAnalyzer/main.cpp b/Userland/Applications/SpaceAnalyzer/main.cpp
index 687f1a2bbd..f1411614b9 100644
--- a/Userland/Applications/SpaceAnalyzer/main.cpp
+++ b/Userland/Applications/SpaceAnalyzer/main.cpp
@@ -33,7 +33,7 @@ struct TreeNode : public SpaceAnalyzer::TreeMapNode {
: m_name(move(name)) {};
virtual String name() const { return m_name; }
- virtual int64_t area() const { return m_area; }
+ virtual i64 area() const { return m_area; }
virtual size_t num_children() const
{
if (m_children) {
@@ -51,7 +51,7 @@ struct TreeNode : public SpaceAnalyzer::TreeMapNode {
}
String m_name;
- int64_t m_area { 0 };
+ i64 m_area { 0 };
OwnPtr<Vector<TreeNode>> m_children;
};