Make NewTextPainter actually work
The NewTextPainter is still disabled by default. A future patch will flip the flag to enable it. This patch uses a new approach to writing bindings by encoding data into array buffers. This approach is more efficient than the existing IDL based approach. If this works out well, we should convert our other performance-sensitive interfaces to this approach in future patches.
This commit is contained in:
@@ -309,7 +309,7 @@ class _NewTextPainter implements TextPainter {
|
||||
_text = value;
|
||||
ui.ParagraphBuilder builder = new ui.ParagraphBuilder();
|
||||
_text.build(builder);
|
||||
_paragraph = builder.build(_text.paragraphStyle);
|
||||
_paragraph = builder.build(_text.paragraphStyle ?? new ui.ParagraphStyle());
|
||||
_needsLayout = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -151,8 +151,27 @@ class TextStyle {
|
||||
return toCSS[decorationStyle];
|
||||
}
|
||||
|
||||
ui.TextStyle get textStyle => null;
|
||||
ui.ParagraphStyle get paragraphStyle => null;
|
||||
ui.TextStyle get textStyle {
|
||||
return new ui.TextStyle(
|
||||
color: color,
|
||||
decoration: decoration,
|
||||
decorationColor: decorationColor,
|
||||
decorationStyle: decorationStyle,
|
||||
fontWeight: fontWeight,
|
||||
fontStyle: fontStyle,
|
||||
fontFamily: fontFamily,
|
||||
fontSize: fontSize
|
||||
);
|
||||
}
|
||||
|
||||
ui.ParagraphStyle get paragraphStyle {
|
||||
return new ui.ParagraphStyle(
|
||||
// TODO(abarth): Restore once the analyzer can see the new dart:ui interface.
|
||||
// textAlign: textAlign,
|
||||
textBaseline: textBaseline,
|
||||
lineHeight: height
|
||||
);
|
||||
}
|
||||
|
||||
/// Program this text style into the engine
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user