Flutter Engine
Loading...
Searching...
No Matches
dl_accumulation_rect.h
Go to the documentation of this file.
1
// Copyright 2013 The Flutter Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#ifndef FLUTTER_DISPLAY_LIST_UTILS_DL_ACCUMULATION_RECT_H_
6
#define FLUTTER_DISPLAY_LIST_UTILS_DL_ACCUMULATION_RECT_H_
7
8
#include "
flutter/display_list/geometry/dl_geometry_types.h
"
9
10
namespace
flutter
{
11
12
// Utility class to collect bounds from a bunch of rectangles and points
13
// while also noting if there might be any overlap between any of the data
14
// point/rects. Note that the overlap protection is not sophisticated,
15
// simply noting if the new data intersects with the already accumulated
16
// bounds. This can successfully detect non-overlap of a linear sequence
17
// of non-overlapping objects, or even a cross of non-overlapping objects
18
// as long as they are built out from the center in the right order. True
19
// detection of non-overlapping objects would require much more time and/or
20
// space.
21
class
AccumulationRect
{
22
public
:
23
AccumulationRect
() {
reset
(); }
24
25
void
accumulate
(
DlScalar
x
,
DlScalar
y
);
26
void
accumulate
(
DlPoint
p) {
accumulate
(p.
x
, p.
y
); }
27
void
accumulate
(
DlRect
r);
28
void
accumulate
(
AccumulationRect
& ar);
29
30
bool
is_empty
()
const
{
return
min_x_ >= max_x_ || min_y_ >= max_y_; }
31
bool
is_not_empty
()
const
{
return
min_x_ < max_x_ && min_y_ < max_y_; }
32
33
DlRect
GetBounds
()
const
;
34
35
void
reset
();
36
37
bool
overlap_detected
()
const
{
return
overlap_detected_; }
38
void
record_overlapping_bounds
() { overlap_detected_ =
true
; }
39
40
private
:
41
DlScalar
min_x_;
42
DlScalar
min_y_;
43
DlScalar
max_x_;
44
DlScalar
max_y_;
45
bool
overlap_detected_;
46
};
47
48
}
// namespace flutter
49
50
#endif
// FLUTTER_DISPLAY_LIST_UTILS_DL_ACCUMULATION_RECT_H_
flutter::AccumulationRect
Definition
dl_accumulation_rect.h:21
flutter::AccumulationRect::overlap_detected
bool overlap_detected() const
Definition
dl_accumulation_rect.h:37
flutter::AccumulationRect::AccumulationRect
AccumulationRect()
Definition
dl_accumulation_rect.h:23
flutter::AccumulationRect::record_overlapping_bounds
void record_overlapping_bounds()
Definition
dl_accumulation_rect.h:38
flutter::AccumulationRect::reset
void reset()
Definition
dl_accumulation_rect.cc:81
flutter::AccumulationRect::accumulate
void accumulate(DlScalar x, DlScalar y)
Definition
dl_accumulation_rect.cc:9
flutter::AccumulationRect::is_not_empty
bool is_not_empty() const
Definition
dl_accumulation_rect.h:31
flutter::AccumulationRect::is_empty
bool is_empty() const
Definition
dl_accumulation_rect.h:30
flutter::AccumulationRect::GetBounds
DlRect GetBounds() const
Definition
dl_accumulation_rect.cc:75
flutter::AccumulationRect::accumulate
void accumulate(DlPoint p)
Definition
dl_accumulation_rect.h:26
dl_geometry_types.h
x
int32_t x
Definition
dl_golden_unittests.cc:458
y
double y
Definition
mouse-input-test.cc:83
flutter
Definition
asset_manager.cc:10
flutter::DlScalar
impeller::Scalar DlScalar
Definition
dl_geometry_types.h:17
impeller::TPoint< Scalar >
impeller::TPoint::y
Type y
Definition
point.h:31
impeller::TPoint::x
Type x
Definition
point.h:30
impeller::TRect< Scalar >
display_list
utils
dl_accumulation_rect.h
Generated on Wed Nov 5 2025 21:33:11 for Flutter Engine by
1.9.8