Skip to content

Commit d353e28

Browse files
flarmaheshj01
authored andcommitted
[DisplayList] remove obsolete use of Skia goemetry objects in DL utils (flutter#161553)
Accomplishes the `AccumulationRect and MatrixClipTracker` task in flutter#161456 Remove legacy Skia geometry APIs from the DisplayList utils classes (accumulation rect and matrix/clip state tracker) as well as the small number of remaining uses of them (mostly from their own unit tests).
1 parent 89f22a0 commit d353e28

File tree

8 files changed

+352
-769
lines changed

8 files changed

+352
-769
lines changed

engine/src/flutter/display_list/dl_builder.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -819,8 +819,8 @@ void DisplayListBuilder::Rotate(DlScalar degrees) {
819819
if (SkScalarMod(degrees, 360.0) != 0.0) {
820820
checkForDeferredSave();
821821
Push<RotateOp>(0, degrees);
822-
global_state().rotate(degrees);
823-
layer_local_state().rotate(degrees);
822+
global_state().rotate(DlDegrees(degrees));
823+
layer_local_state().rotate(DlDegrees(degrees));
824824
}
825825
}
826826
void DisplayListBuilder::Skew(DlScalar sx, DlScalar sy) {
@@ -914,7 +914,7 @@ void DisplayListBuilder::TransformReset() {
914914
// became singular while we were accumulating the current layer.
915915
// In either case, we should no longer be accumulating any
916916
// contents so we set the layer tracking transform to a singular one.
917-
layer_local_state().setTransform(SkMatrix::Scale(0.0f, 0.0f));
917+
layer_local_state().setTransform(DlMatrix::MakeScale({0.0f, 0.0f, 0.0f}));
918918
}
919919

920920
global_state().setIdentity();
@@ -1050,8 +1050,8 @@ void DisplayListBuilder::ClipPath(const DlPath& path,
10501050
return;
10511051
}
10521052
}
1053-
global_state().clipPath(path.GetSkPath(), clip_op, is_aa);
1054-
layer_local_state().clipPath(path.GetSkPath(), clip_op, is_aa);
1053+
global_state().clipPath(path, clip_op, is_aa);
1054+
layer_local_state().clipPath(path, clip_op, is_aa);
10551055
if (global_state().is_cull_rect_empty() ||
10561056
layer_local_state().is_cull_rect_empty()) {
10571057
current_info().is_nop = true;
@@ -1488,7 +1488,7 @@ void DisplayListBuilder::drawAtlas(const sk_sp<DlImage> atlas,
14881488
const DlRect& src = tex[i];
14891489
xform[i].toQuad(src.GetWidth(), src.GetHeight(), quad);
14901490
for (int j = 0; j < 4; j++) {
1491-
accumulator.accumulate(quad[j]);
1491+
accumulator.accumulate(ToDlPoint(quad[j]));
14921492
}
14931493
}
14941494
if (accumulator.is_empty() ||

engine/src/flutter/display_list/utils/dl_accumulation_rect.cc

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace flutter {
88

9-
void AccumulationRect::accumulate(SkScalar x, SkScalar y) {
9+
void AccumulationRect::accumulate(DlScalar x, DlScalar y) {
1010
if (!std::isfinite(x) || !std::isfinite(y)) {
1111
return;
1212
}
@@ -28,25 +28,25 @@ void AccumulationRect::accumulate(SkScalar x, SkScalar y) {
2828
}
2929
}
3030

31-
void AccumulationRect::accumulate(SkRect r) {
32-
if (r.isEmpty()) {
31+
void AccumulationRect::accumulate(DlRect r) {
32+
if (r.IsEmpty()) {
3333
return;
3434
}
35-
if (r.fLeft < max_x_ && r.fRight > min_x_ && //
36-
r.fTop < max_y_ && r.fBottom > min_y_) {
35+
if (r.GetLeft() < max_x_ && r.GetRight() > min_x_ && //
36+
r.GetTop() < max_y_ && r.GetBottom() > min_y_) {
3737
record_overlapping_bounds();
3838
}
39-
if (min_x_ > r.fLeft) {
40-
min_x_ = r.fLeft;
39+
if (min_x_ > r.GetLeft()) {
40+
min_x_ = r.GetLeft();
4141
}
42-
if (min_y_ > r.fTop) {
43-
min_y_ = r.fTop;
42+
if (min_y_ > r.GetTop()) {
43+
min_y_ = r.GetTop();
4444
}
45-
if (max_x_ < r.fRight) {
46-
max_x_ = r.fRight;
45+
if (max_x_ < r.GetRight()) {
46+
max_x_ = r.GetRight();
4747
}
48-
if (max_y_ < r.fBottom) {
49-
max_y_ = r.fBottom;
48+
if (max_y_ < r.GetBottom()) {
49+
max_y_ = r.GetBottom();
5050
}
5151
}
5252

@@ -78,17 +78,11 @@ DlRect AccumulationRect::GetBounds() const {
7878
: DlRect();
7979
}
8080

81-
SkRect AccumulationRect::bounds() const {
82-
return (max_x_ >= min_x_ && max_y_ >= min_y_)
83-
? SkRect::MakeLTRB(min_x_, min_y_, max_x_, max_y_)
84-
: SkRect::MakeEmpty();
85-
}
86-
8781
void AccumulationRect::reset() {
88-
min_x_ = std::numeric_limits<SkScalar>::infinity();
89-
min_y_ = std::numeric_limits<SkScalar>::infinity();
90-
max_x_ = -std::numeric_limits<SkScalar>::infinity();
91-
max_y_ = -std::numeric_limits<SkScalar>::infinity();
82+
min_x_ = std::numeric_limits<DlScalar>::infinity();
83+
min_y_ = std::numeric_limits<DlScalar>::infinity();
84+
max_x_ = -std::numeric_limits<DlScalar>::infinity();
85+
max_y_ = -std::numeric_limits<DlScalar>::infinity();
9286
overlap_detected_ = false;
9387
}
9488

engine/src/flutter/display_list/utils/dl_accumulation_rect.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
#ifndef FLUTTER_DISPLAY_LIST_UTILS_DL_ACCUMULATION_RECT_H_
66
#define FLUTTER_DISPLAY_LIST_UTILS_DL_ACCUMULATION_RECT_H_
77

8-
#include <functional>
9-
108
#include "flutter/display_list/geometry/dl_geometry_types.h"
11-
#include "flutter/display_list/geometry/dl_rtree.h"
12-
#include "flutter/fml/logging.h"
139

1410
namespace flutter {
1511

@@ -26,18 +22,15 @@ class AccumulationRect {
2622
public:
2723
AccumulationRect() { reset(); }
2824

29-
void accumulate(SkScalar x, SkScalar y);
30-
void accumulate(SkPoint p) { accumulate(p.fX, p.fY); }
25+
void accumulate(DlScalar x, DlScalar y);
3126
void accumulate(DlPoint p) { accumulate(p.x, p.y); }
32-
void accumulate(SkRect r);
33-
void accumulate(DlRect r) { accumulate(ToSkRect(r)); }
27+
void accumulate(DlRect r);
3428
void accumulate(AccumulationRect& ar);
3529

3630
bool is_empty() const { return min_x_ >= max_x_ || min_y_ >= max_y_; }
3731
bool is_not_empty() const { return min_x_ < max_x_ && min_y_ < max_y_; }
3832

3933
DlRect GetBounds() const;
40-
SkRect bounds() const;
4134

4235
void reset();
4336

0 commit comments

Comments
 (0)