Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 21c7d6a

Browse files
authored
Revert "Add antiAlias and saveCount to clipPath and restore (#5638)" (#5660)
This reverts commit a2bf805. Reason for revert: need to fix several things including the framework test in order to unblock the engine roll. TBR: @matthew-carroll
1 parent 70dcbb5 commit 21c7d6a

File tree

3 files changed

+12
-29
lines changed

3 files changed

+12
-29
lines changed

lib/ui/painting.dart

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2886,15 +2886,6 @@ class Canvas extends NativeFieldWrapperClass2 {
28862886
/// cause the new layer to be composited into the previous layer.
28872887
void restore() native 'Canvas_restore';
28882888

2889-
/// Restore the current save stack to the state where [saveCount] is gotten.
2890-
///
2891-
/// Use [save] and [saveLayer] to push state onto the stack, and use
2892-
/// [getSaveCount] to get the [saveCount].
2893-
///
2894-
/// If a state was pushed with with [saveLayer], then this call will also
2895-
/// cause the new layer to be composited into the previous layer.
2896-
void restoreToCount(int saveCount) native 'Canvas_restoreToCount';
2897-
28982889
/// Returns the number of items on the save stack, including the
28992890
/// initial state. This means it returns 1 for a clean canvas, and
29002891
/// that each call to [save] and [saveLayer] increments it, and that
@@ -2965,11 +2956,11 @@ class Canvas extends NativeFieldWrapperClass2 {
29652956
/// multiple draw commands intersect with the clip boundary, this can result
29662957
/// in incorrect blending at the clip boundary. See [saveLayer] for a
29672958
/// discussion of how to address that and some examples of using [clipRRect].
2968-
void clipRRect(RRect rrect, [bool doAntiAlias = true]) {
2959+
void clipRRect(RRect rrect) {
29692960
assert(_rrectIsValid(rrect));
2970-
_clipRRect(rrect._value, doAntiAlias);
2961+
_clipRRect(rrect._value);
29712962
}
2972-
void _clipRRect(Float32List rrect, bool doAntiAlias) native 'Canvas_clipRRect';
2963+
void _clipRRect(Float32List rrect) native 'Canvas_clipRRect';
29732964

29742965
/// Reduces the clip region to the intersection of the current clip and the
29752966
/// given [Path].
@@ -2978,11 +2969,11 @@ class Canvas extends NativeFieldWrapperClass2 {
29782969
/// multiple draw commands intersect with the clip boundary, this can result
29792970
/// in incorrect blending at the clip boundary. See [saveLayer] for a
29802971
/// discussion of how to address that.
2981-
void clipPath(Path path, [bool doAntiAlias = true]) {
2972+
void clipPath(Path path) {
29822973
assert(path != null); // path is checked on the engine side
2983-
_clipPath(path, doAntiAlias);
2974+
_clipPath(path);
29842975
}
2985-
void _clipPath(Path path, bool doAntiAlias) native 'Canvas_clipPath';
2976+
void _clipPath(Path path) native 'Canvas_clipPath';
29862977

29872978
/// Paints the given [Color] onto the canvas, applying the given
29882979
/// [BlendMode], with the given color being the source and the background

lib/ui/painting/canvas.cc

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ IMPLEMENT_WRAPPERTYPEINFO(ui, Canvas);
3535
V(Canvas, saveLayerWithoutBounds) \
3636
V(Canvas, saveLayer) \
3737
V(Canvas, restore) \
38-
V(Canvas, restoreToCount) \
3938
V(Canvas, getSaveCount) \
4039
V(Canvas, translate) \
4140
V(Canvas, scale) \
@@ -121,12 +120,6 @@ void Canvas::restore() {
121120
canvas_->restore();
122121
}
123122

124-
void Canvas::restoreToCount(int saveCount) {
125-
if (!canvas_)
126-
return;
127-
canvas_->restoreToCount(saveCount);
128-
}
129-
130123
int Canvas::getSaveCount() {
131124
if (!canvas_)
132125
return 0;
@@ -173,19 +166,19 @@ void Canvas::clipRect(double left,
173166
canvas_->clipRect(SkRect::MakeLTRB(left, top, right, bottom), clipOp, true);
174167
}
175168

176-
void Canvas::clipRRect(const RRect& rrect, bool doAntiAlias) {
169+
void Canvas::clipRRect(const RRect& rrect) {
177170
if (!canvas_)
178171
return;
179-
canvas_->clipRRect(rrect.sk_rrect, doAntiAlias);
172+
canvas_->clipRRect(rrect.sk_rrect, true);
180173
}
181174

182-
void Canvas::clipPath(const CanvasPath* path, bool doAntiAlias) {
175+
void Canvas::clipPath(const CanvasPath* path) {
183176
if (!canvas_)
184177
return;
185178
if (!path)
186179
Dart_ThrowException(
187180
ToDart("Canvas.clipPath called with non-genuine Path."));
188-
canvas_->clipPath(path->path(), doAntiAlias);
181+
canvas_->clipPath(path->path(), true);
189182
}
190183

191184
void Canvas::drawColor(SkColor color, SkBlendMode blend_mode) {

lib/ui/painting/canvas.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ class Canvas : public fxl::RefCountedThreadSafe<Canvas>,
4848
const Paint& paint,
4949
const PaintData& paint_data);
5050
void restore();
51-
void restoreToCount(int saveCount);
5251
int getSaveCount();
5352

5453
void translate(double dx, double dy);
@@ -62,8 +61,8 @@ class Canvas : public fxl::RefCountedThreadSafe<Canvas>,
6261
double right,
6362
double bottom,
6463
SkClipOp clipOp);
65-
void clipRRect(const RRect& rrect, bool doAntiAlias = true);
66-
void clipPath(const CanvasPath* path, bool doAntiAlias = true);
64+
void clipRRect(const RRect& rrect);
65+
void clipPath(const CanvasPath* path);
6766

6867
void drawColor(SkColor color, SkBlendMode blend_mode);
6968
void drawLine(double x1,

0 commit comments

Comments
 (0)