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

Do not enable antialiasing by default in CanvasKit mode #17534

Merged
merged 3 commits into from
Apr 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/web_ui/lib/src/engine/compositor/surface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,12 @@ class Surface {
..position = 'absolute'
..width = '${logicalSize.width.ceil()}px'
..height = '${logicalSize.height.ceil()}px';
final int glContext = canvasKit
.callMethod('GetWebGLContext', <html.CanvasElement>[htmlCanvas]);
final int glContext = canvasKit.callMethod('GetWebGLContext', <dynamic>[
htmlCanvas,
// Default to no anti-aliasing. Paint commands can be explicitly
// anti-aliased by setting their `Paint` object's `antialias` property.
js.JsObject.jsify({'antialias': 0}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a comment above explaining why it's OK to set it to 0 here. For example, I imagine it doesn't disable AA globally but let's Skia control it?

Copy link
Contributor Author

@harryterkelsen harryterkelsen Apr 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Yes, this flag doesn't force-disable anti-aliasing: it just sets the default to have no anti-aliasing.

]);
final js.JsObject grContext =
canvasKit.callMethod('MakeGrContext', <dynamic>[glContext]);
final js.JsObject skSurface =
Expand Down