From 9ed3637fa09bed4fa1452eb9637f18fb3436c58d Mon Sep 17 00:00:00 2001 From: Yegor Date: Fri, 5 Jun 2020 10:26:14 -0700 Subject: [PATCH] add nullability annotations to lib/ui/painting.dart (flutter/engine#18374) * add nullability annotations to lib/ui/painting.dart --- engine/src/flutter/lib/ui/painting.dart | 566 +++++++++--------- .../flutter/lib/web_ui/lib/src/ui/canvas.dart | 6 +- 2 files changed, 287 insertions(+), 285 deletions(-) diff --git a/engine/src/flutter/lib/ui/painting.dart b/engine/src/flutter/lib/ui/painting.dart index b56856b40ed..3f0229a2b40 100644 --- a/engine/src/flutter/lib/ui/painting.dart +++ b/engine/src/flutter/lib/ui/painting.dart @@ -105,7 +105,7 @@ class Color { /// Color(0xFFFF9000)` (`FF` for the alpha, `FF` for the red, `90` for the /// green, and `00` for the blue). @pragma('vm:entry-point') - const Color(int value) : value = value & 0xFFFFFFFF; + const Color(int/*!*/ value) : value = value & 0xFFFFFFFF; /// Construct a color from the lower 8 bits of four integers. /// @@ -119,7 +119,7 @@ class Color { /// /// See also [fromRGBO], which takes the alpha value as a floating point /// value. - const Color.fromARGB(int a, int r, int g, int b) : + const Color.fromARGB(int/*!*/ a, int/*!*/ r, int/*!*/ g, int/*!*/ b) : value = (((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | @@ -136,7 +136,7 @@ class Color { /// Out of range values are brought into range using modulo 255. /// /// See also [fromARGB], which takes the opacity as an integer value. - const Color.fromRGBO(int r, int g, int b, double opacity) : + const Color.fromRGBO(int/*!*/ r, int/*!*/ g, int/*!*/ b, double/*!*/ opacity) : value = ((((opacity * 0xff ~/ 1) & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | @@ -150,34 +150,34 @@ class Color { /// * Bits 16-23 are the red value. /// * Bits 8-15 are the green value. /// * Bits 0-7 are the blue value. - final int value; + final int/*!*/ value; /// The alpha channel of this color in an 8 bit value. /// /// A value of 0 means this color is fully transparent. A value of 255 means /// this color is fully opaque. - int get alpha => (0xff000000 & value) >> 24; + int/*!*/ get alpha => (0xff000000 & value) >> 24; /// The alpha channel of this color as a double. /// /// A value of 0.0 means this color is fully transparent. A value of 1.0 means /// this color is fully opaque. - double get opacity => alpha / 0xFF; + double/*!*/ get opacity => alpha / 0xFF; /// The red channel of this color in an 8 bit value. - int get red => (0x00ff0000 & value) >> 16; + int/*!*/ get red => (0x00ff0000 & value) >> 16; /// The green channel of this color in an 8 bit value. - int get green => (0x0000ff00 & value) >> 8; + int/*!*/ get green => (0x0000ff00 & value) >> 8; /// The blue channel of this color in an 8 bit value. - int get blue => (0x000000ff & value) >> 0; + int/*!*/ get blue => (0x000000ff & value) >> 0; /// Returns a new color that matches this color with the alpha channel /// replaced with `a` (which ranges from 0 to 255). /// /// Out of range values will have unexpected effects. - Color withAlpha(int a) { + Color/*!*/ withAlpha(int/*!*/ a) { return Color.fromARGB(a, red, green, blue); } @@ -185,7 +185,7 @@ class Color { /// replaced with the given `opacity` (which ranges from 0.0 to 1.0). /// /// Out of range values will have unexpected effects. - Color withOpacity(double opacity) { + Color/*!*/ withOpacity(double/*!*/ opacity) { assert(opacity >= 0.0 && opacity <= 1.0); return withAlpha((255.0 * opacity).round()); } @@ -194,7 +194,7 @@ class Color { /// with `r` (which ranges from 0 to 255). /// /// Out of range values will have unexpected effects. - Color withRed(int r) { + Color/*!*/ withRed(int/*!*/ r) { return Color.fromARGB(alpha, r, green, blue); } @@ -202,7 +202,7 @@ class Color { /// replaced with `g` (which ranges from 0 to 255). /// /// Out of range values will have unexpected effects. - Color withGreen(int g) { + Color/*!*/ withGreen(int/*!*/ g) { return Color.fromARGB(alpha, red, g, blue); } @@ -210,7 +210,7 @@ class Color { /// with `b` (which ranges from 0 to 255). /// /// Out of range values will have unexpected effects. - Color withBlue(int b) { + Color/*!*/ withBlue(int/*!*/ b) { return Color.fromARGB(alpha, red, green, b); } @@ -227,7 +227,7 @@ class Color { /// expensive to calculate. /// /// See . - double computeLuminance() { + double/*!*/ computeLuminance() { // See final double R = _linearizeColorComponent(red / 0xFF); final double G = _linearizeColorComponent(green / 0xFF); @@ -257,7 +257,7 @@ class Color { /// /// Values for `t` are usually obtained from an [Animation], such as /// an [AnimationController]. - static Color lerp(Color a, Color b, double t) { + static Color/*?*/ lerp(Color/*?*/ a, Color/*?*/ b, double/*!*/ t) { assert(t != null); if (a == null && b == null) return null; @@ -281,7 +281,7 @@ class Color { /// enhancement when trying to avoid needless alpha blending compositing /// operations for two things that are solid colors with the same shape, but /// overlay each other: instead, just paint one with the combined color. - static Color alphaBlend(Color foreground, Color background) { + static Color/*!*/ alphaBlend(Color/*!*/ foreground, Color/*!*/ background) { final int alpha = foreground.alpha; if (alpha == 0x00) { // Foreground completely transparent. return background; @@ -311,13 +311,13 @@ class Color { /// Returns an alpha value representative of the provided [opacity] value. /// /// The [opacity] value may not be null. - static int getAlphaFromOpacity(double opacity) { + static int/*!*/ getAlphaFromOpacity(double/*!*/ opacity) { assert(opacity != null); return (opacity.clamp(0.0, 1.0) * 255).round(); } @override - bool operator ==(dynamic other) { + bool/*!*/ operator ==(dynamic other) { if (identical(this, other)) return true; if (other.runtimeType != runtimeType) @@ -327,10 +327,10 @@ class Color { } @override - int get hashCode => value.hashCode; + int/*!*/ get hashCode => value.hashCode; @override - String toString() => 'Color(0x${value.toRadixString(16).padLeft(8, '0')})'; + String/*!*/ toString() => 'Color(0x${value.toRadixString(16).padLeft(8, '0')})'; } /// Algorithms to use when painting on the canvas. @@ -1087,7 +1087,7 @@ class Paint { static const int _kDataByteCount = 56; // Binary format must match the deserialization code in paint.cc. - List _objects; + List/*?*/ _objects; static const int _kShaderIndex = 0; static const int _kColorFilterIndex = 1; static const int _kImageFilterIndex = 2; @@ -1105,10 +1105,10 @@ class Paint { /// canvas. /// /// Defaults to true. - bool get isAntiAlias { + bool/*!*/ get isAntiAlias { return _data.getInt32(_kIsAntiAliasOffset, _kFakeHostEndian) == 0; } - set isAntiAlias(bool value) { + set isAntiAlias(bool/*!*/ value) { // We encode true as zero and false as one because the default value, which // we always encode as zero, is true. final int encoded = value ? 0 : 1; @@ -1130,11 +1130,11 @@ class Paint { /// /// This color is not used when compositing. To colorize a layer, use /// [colorFilter]. - Color get color { + Color/*!*/ get color { final int encoded = _data.getInt32(_kColorOffset, _kFakeHostEndian); return Color(encoded ^ _kColorDefault); } - set color(Color value) { + set color(Color/*!*/ value) { assert(value != null); final int encoded = value.value ^ _kColorDefault; _data.setInt32(_kColorOffset, encoded, _kFakeHostEndian); @@ -1160,11 +1160,11 @@ class Paint { /// * [Canvas.saveLayer], which uses its [Paint]'s [blendMode] to composite /// the layer when [restore] is called. /// * [BlendMode], which discusses the user of [saveLayer] with [blendMode]. - BlendMode get blendMode { + BlendMode/*!*/ get blendMode { final int encoded = _data.getInt32(_kBlendModeOffset, _kFakeHostEndian); return BlendMode.values[encoded ^ _kBlendModeDefault]; } - set blendMode(BlendMode value) { + set blendMode(BlendMode/*!*/ value) { assert(value != null); final int encoded = value.index ^ _kBlendModeDefault; _data.setInt32(_kBlendModeOffset, encoded, _kFakeHostEndian); @@ -1173,10 +1173,10 @@ class Paint { /// Whether to paint inside shapes, the edges of shapes, or both. /// /// Defaults to [PaintingStyle.fill]. - PaintingStyle get style { + PaintingStyle/*!*/ get style { return PaintingStyle.values[_data.getInt32(_kStyleOffset, _kFakeHostEndian)]; } - set style(PaintingStyle value) { + set style(PaintingStyle/*!*/ value) { assert(value != null); final int encoded = value.index; _data.setInt32(_kStyleOffset, encoded, _kFakeHostEndian); @@ -1187,10 +1187,10 @@ class Paint { /// the direction orthogonal to the direction of the path. /// /// Defaults to 0.0, which correspond to a hairline width. - double get strokeWidth { + double/*!*/ get strokeWidth { return _data.getFloat32(_kStrokeWidthOffset, _kFakeHostEndian); } - set strokeWidth(double value) { + set strokeWidth(double/*!*/ value) { assert(value != null); final double encoded = value; _data.setFloat32(_kStrokeWidthOffset, encoded, _kFakeHostEndian); @@ -1200,10 +1200,10 @@ class Paint { /// [style] is set to [PaintingStyle.stroke]. /// /// Defaults to [StrokeCap.butt], i.e. no caps. - StrokeCap get strokeCap { + StrokeCap/*!*/ get strokeCap { return StrokeCap.values[_data.getInt32(_kStrokeCapOffset, _kFakeHostEndian)]; } - set strokeCap(StrokeCap value) { + set strokeCap(StrokeCap/*!*/ value) { assert(value != null); final int encoded = value.index; _data.setInt32(_kStrokeCapOffset, encoded, _kFakeHostEndian); @@ -1234,10 +1234,10 @@ class Paint { /// this is set to [StrokeJoin.miter]. /// * [strokeCap] to control what is drawn at the ends of the stroke. /// * [StrokeJoin] for the definitive list of stroke joins. - StrokeJoin get strokeJoin { + StrokeJoin/*!*/ get strokeJoin { return StrokeJoin.values[_data.getInt32(_kStrokeJoinOffset, _kFakeHostEndian)]; } - set strokeJoin(StrokeJoin value) { + set strokeJoin(StrokeJoin/*!*/ value) { assert(value != null); final int encoded = value.index; _data.setInt32(_kStrokeJoinOffset, encoded, _kFakeHostEndian); @@ -1272,10 +1272,10 @@ class Paint { /// * [strokeJoin] to control the kind of finish to place on the joins /// between segments. /// * [strokeCap] to control what is drawn at the ends of the stroke. - double get strokeMiterLimit { + double/*!*/ get strokeMiterLimit { return _data.getFloat32(_kStrokeMiterLimitOffset, _kFakeHostEndian); } - set strokeMiterLimit(double value) { + set strokeMiterLimit(double/*!*/ value) { assert(value != null); final double encoded = value - _kStrokeMiterLimitDefault; _data.setFloat32(_kStrokeMiterLimitOffset, encoded, _kFakeHostEndian); @@ -1285,7 +1285,7 @@ class Paint { /// drawn but before it has been composited into the image. /// /// See [MaskFilter] for details. - MaskFilter get maskFilter { + MaskFilter/*?*/ get maskFilter { switch (_data.getInt32(_kMaskFilterOffset, _kFakeHostEndian)) { case MaskFilter._TypeNone: return null; @@ -1297,7 +1297,7 @@ class Paint { } return null; } - set maskFilter(MaskFilter value) { + set maskFilter(MaskFilter/*?*/ value) { if (value == null) { _data.setInt32(_kMaskFilterOffset, MaskFilter._TypeNone, _kFakeHostEndian); _data.setInt32(_kMaskFilterBlurStyleOffset, 0, _kFakeHostEndian); @@ -1317,10 +1317,10 @@ class Paint { /// /// Defaults to [FilterQuality.none]. // TODO(ianh): verify that the image drawing methods actually respect this - FilterQuality get filterQuality { + FilterQuality/*!*/ get filterQuality { return FilterQuality.values[_data.getInt32(_kFilterQualityOffset, _kFakeHostEndian)]; } - set filterQuality(FilterQuality value) { + set filterQuality(FilterQuality/*!*/ value) { assert(value != null); final int encoded = value.index; _data.setInt32(_kFilterQualityOffset, encoded, _kFakeHostEndian); @@ -1336,12 +1336,12 @@ class Paint { /// * [ImageShader], a shader that tiles an [Image]. /// * [colorFilter], which overrides [shader]. /// * [color], which is used if [shader] and [colorFilter] are null. - Shader get shader { + Shader/*?*/ get shader { if (_objects == null) return null; return _objects[_kShaderIndex] as Shader; } - set shader(Shader value) { + set shader(Shader/*?*/ value) { _objects ??= List(_kObjectCount); _objects[_kShaderIndex] = value; } @@ -1352,14 +1352,14 @@ class Paint { /// See [ColorFilter] for details. /// /// When a shape is being drawn, [colorFilter] overrides [color] and [shader]. - ColorFilter get colorFilter { + ColorFilter/*?*/ get colorFilter { if (_objects == null || _objects[_kColorFilterIndex] == null) { return null; } return _objects[_kColorFilterIndex].creator as ColorFilter; } - set colorFilter(ColorFilter value) { + set colorFilter(ColorFilter/*?*/ value) { final _ColorFilter nativeFilter = value?._toNativeColorFilter(); if (nativeFilter == null) { if (_objects != null) { @@ -1397,13 +1397,13 @@ class Paint { /// See also: /// /// * [MaskFilter], which is used for drawing geometry. - ImageFilter get imageFilter { + ImageFilter/*?*/ get imageFilter { if (_objects == null || _objects[_kImageFilterIndex] == null) return null; return _objects[_kImageFilterIndex].creator as ImageFilter; } - set imageFilter(ImageFilter value) { + set imageFilter(ImageFilter/*?*/ value) { if (value == null) { if (_objects != null) { _objects[_kImageFilterIndex] = null; @@ -1421,17 +1421,17 @@ class Paint { /// Inverting the colors of an image applies a new color filter that will /// be composed with any user provided color filters. This is primarily /// used for implementing smart invert on iOS. - bool get invertColors { + bool/*!*/ get invertColors { return _data.getInt32(_kInvertColorOffset, _kFakeHostEndian) == 1; } - set invertColors(bool value) { + set invertColors(bool/*!*/ value) { _data.setInt32(_kInvertColorOffset, value ? 1 : 0, _kFakeHostEndian); } - bool get _dither { + bool/*!*/ get _dither { return _data.getInt32(_kDitherOffset, _kFakeHostEndian) == 1; } - set _dither(bool value) { + set _dither(bool/*!*/ value) { _data.setInt32(_kDitherOffset, value ? 1 : 0, _kFakeHostEndian); } @@ -1450,10 +1450,10 @@ class Paint { /// /// To ensure that dithering is consistently enabled for your entire /// application, set this to true before invoking any drawing related code. - static bool enableDithering = false; + static bool/*!*/ enableDithering = false; @override - String toString() { + String/*!*/ toString() { if (const bool.fromEnvironment('dart.vm.product', defaultValue: false)) { return super.toString(); } @@ -1566,18 +1566,16 @@ enum PixelFormat { } class _ImageInfo { - _ImageInfo(this.width, this.height, this.format, this.rowBytes) { - rowBytes ??= width * 4; - } + _ImageInfo(this.width, this.height, this.format, int/*?*/ rowBytes) : rowBytes = rowBytes ?? width * 4; @pragma('vm:entry-point', 'get') - int width; + int/*!*/ width; @pragma('vm:entry-point', 'get') - int height; + int/*!*/ height; @pragma('vm:entry-point', 'get') - int format; + int/*!*/ format; @pragma('vm:entry-point', 'get') - int rowBytes; + int/*!*/ rowBytes; } /// Opaque handle to raw decoded image data (pixels). @@ -1601,10 +1599,10 @@ class Image extends NativeFieldWrapperClass2 { Image._(); /// The number of image pixels along the image's horizontal axis. - int get width native 'Image_width'; + int/*!*/ get width native 'Image_width'; /// The number of image pixels along the image's vertical axis. - int get height native 'Image_height'; + int/*!*/ get height native 'Image_height'; /// Converts the [Image] object into a byte array. /// @@ -1613,23 +1611,23 @@ class Image extends NativeFieldWrapperClass2 { /// /// Returns a future that completes with the binary image data or an error /// if encoding fails. - Future toByteData({ImageByteFormat format = ImageByteFormat.rawRgba}) { + Future/*!*/ toByteData({ImageByteFormat/*!*/ format = ImageByteFormat.rawRgba}) { return _futurize((_Callback callback) { - return _toByteData(format.index, (Uint8List encoded) { - callback(encoded?.buffer?.asByteData()); + return _toByteData(format.index, (Uint8List/*?*/ encoded) { + callback(encoded.buffer.asByteData()); }); }); } /// Returns an error message on failure, null on success. - String _toByteData(int format, _Callback callback) native 'Image_toByteData'; + String/*?*/ _toByteData(int format, _Callback callback) native 'Image_toByteData'; /// Release the resources used by this object. The object is no longer usable /// after this method is called. void dispose() native 'Image_dispose'; @override - String toString() => '[$width\u00D7$height]'; + String/*!*/ toString() => '[$width\u00D7$height]'; } /// Callback signature for [decodeImageFromList]. @@ -1650,11 +1648,11 @@ class FrameInfo extends NativeFieldWrapperClass2 { FrameInfo._(); /// The duration this frame should be shown. - Duration get duration => Duration(milliseconds: _durationMillis); - int get _durationMillis native 'FrameInfo_durationMillis'; + Duration/*!*/ get duration => Duration(milliseconds: _durationMillis); + int/*!*/ get _durationMillis native 'FrameInfo_durationMillis'; /// The [Image] object for this frame. - Image get image native 'FrameInfo_image'; + Image/*!*/ get image native 'FrameInfo_image'; } /// A handle to an image codec. @@ -1676,20 +1674,20 @@ class Codec extends NativeFieldWrapperClass2 { Codec._(); /// Number of frames in this image. - int get frameCount native 'Codec_frameCount'; + int/*!*/ get frameCount native 'Codec_frameCount'; /// Number of times to repeat the animation. /// /// * 0 when the animation should be played once. /// * -1 for infinity repetitions. - int get repetitionCount native 'Codec_repetitionCount'; + int/*!*/ get repetitionCount native 'Codec_repetitionCount'; /// Fetches the next animation frame. /// /// Wraps back to the first frame after returning the last frame. /// /// The returned future can complete with an error if the decoding has failed. - Future getNextFrame() { + Future/*!*/ getNextFrame() { return _futurize(_getNextFrame); } @@ -1715,9 +1713,9 @@ class Codec extends NativeFieldWrapperClass2 { /// /// The returned future can complete with an error if the image decoding has /// failed. -Future instantiateImageCodec(Uint8List list, { - int targetWidth, - int targetHeight, +Future/*!*/ instantiateImageCodec(Uint8List/*!*/ list, { + int/*?*/ targetWidth, + int/*?*/ targetHeight, }) { return _futurize( (_Callback callback) => _instantiateImageCodec(list, callback, null, targetWidth ?? _kDoNotResizeDimension, targetHeight ?? _kDoNotResizeDimension) @@ -1735,19 +1733,20 @@ Future instantiateImageCodec(Uint8List list, { /// If both are equal to [_kDoNotResizeDimension], then the image maintains its real size. /// /// Returns an error message if the instantiation has failed, null otherwise. -String _instantiateImageCodec(Uint8List list, _Callback callback, _ImageInfo imageInfo, int targetWidth, int targetHeight) +String/*?*/ _instantiateImageCodec(Uint8List list, _Callback callback, _ImageInfo imageInfo, int targetWidth, int targetHeight) native 'instantiateImageCodec'; /// Loads a single image frame from a byte array into an [Image] object. /// /// This is a convenience wrapper around [instantiateImageCodec]. Prefer using -/// [instantiateImageCodec] which also supports multi frame images. -void decodeImageFromList(Uint8List list, ImageDecoderCallback callback) { +/// [instantiateImageCodec] which also supports multi frame images and offers +/// better error handling. This function swallows asynchronous errors. +void decodeImageFromList(Uint8List/*!*/ list, ImageDecoderCallback/*!*/ callback) { _decodeImageFromListAsync(list, callback); } -Future _decodeImageFromListAsync(Uint8List list, - ImageDecoderCallback callback) async { +Future _decodeImageFromListAsync(Uint8List/*!*/ list, + ImageDecoderCallback/*!*/ callback) async { final Codec codec = await instantiateImageCodec(list); final FrameInfo frameInfo = await codec.getNextFrame(); callback(frameInfo.image); @@ -1768,12 +1767,12 @@ Future _decodeImageFromListAsync(Uint8List list, /// while forcing the image to match the other given dimension. If neither is /// specified, then the image maintains its real size. void decodeImageFromPixels( - Uint8List pixels, - int width, - int height, - PixelFormat format, - ImageDecoderCallback callback, - {int rowBytes, int targetWidth, int targetHeight} + Uint8List/*!*/ pixels, + int/*!*/ width, + int/*!*/ height, + PixelFormat/*!*/ format, + ImageDecoderCallback/*!*/ callback, + {int/*?*/ rowBytes, int/*?*/ targetWidth, int/*?*/ targetHeight} ) { final _ImageInfo imageInfo = _ImageInfo(width, height, format.index, rowBytes); final Future codecFuture = _futurize( @@ -1904,7 +1903,7 @@ class Path extends NativeFieldWrapperClass2 { /// /// This copy is fast and does not require additional memory unless either /// the `source` path or the path returned by this constructor are modified. - factory Path.from(Path source) { + factory Path.from(Path/*!*/ source) { final Path clonedPath = Path._(); source._clone(clonedPath); return clonedPath; @@ -1914,54 +1913,54 @@ class Path extends NativeFieldWrapperClass2 { /// Determines how the interior of this path is calculated. /// /// Defaults to the non-zero winding rule, [PathFillType.nonZero]. - PathFillType get fillType => PathFillType.values[_getFillType()]; + PathFillType/*!*/ get fillType => PathFillType.values[_getFillType()]; set fillType(PathFillType value) => _setFillType(value.index); int _getFillType() native 'Path_getFillType'; - void _setFillType(int fillType) native 'Path_setFillType'; + void _setFillType(int/*!*/ fillType) native 'Path_setFillType'; /// Starts a new sub-path at the given coordinate. - void moveTo(double x, double y) native 'Path_moveTo'; + void moveTo(double/*!*/ x, double/*!*/ y) native 'Path_moveTo'; /// Starts a new sub-path at the given offset from the current point. - void relativeMoveTo(double dx, double dy) native 'Path_relativeMoveTo'; + void relativeMoveTo(double/*!*/ dx, double/*!*/ dy) native 'Path_relativeMoveTo'; /// Adds a straight line segment from the current point to the given /// point. - void lineTo(double x, double y) native 'Path_lineTo'; + void lineTo(double/*!*/ x, double/*!*/ y) native 'Path_lineTo'; /// Adds a straight line segment from the current point to the point /// at the given offset from the current point. - void relativeLineTo(double dx, double dy) native 'Path_relativeLineTo'; + void relativeLineTo(double/*!*/ dx, double/*!*/ dy) native 'Path_relativeLineTo'; /// Adds a quadratic bezier segment that curves from the current /// point to the given point (x2,y2), using the control point /// (x1,y1). - void quadraticBezierTo(double x1, double y1, double x2, double y2) native 'Path_quadraticBezierTo'; + void quadraticBezierTo(double/*!*/ x1, double/*!*/ y1, double/*!*/ x2, double/*!*/ y2) native 'Path_quadraticBezierTo'; /// Adds a quadratic bezier segment that curves from the current /// point to the point at the offset (x2,y2) from the current point, /// using the control point at the offset (x1,y1) from the current /// point. - void relativeQuadraticBezierTo(double x1, double y1, double x2, double y2) native 'Path_relativeQuadraticBezierTo'; + void relativeQuadraticBezierTo(double/*!*/ x1, double/*!*/ y1, double/*!*/ x2, double/*!*/ y2) native 'Path_relativeQuadraticBezierTo'; /// Adds a cubic bezier segment that curves from the current point /// to the given point (x3,y3), using the control points (x1,y1) and /// (x2,y2). - void cubicTo(double x1, double y1, double x2, double y2, double x3, double y3) native 'Path_cubicTo'; + void cubicTo(double/*!*/ x1, double/*!*/ y1, double/*!*/ x2, double/*!*/ y2, double/*!*/ x3, double/*!*/ y3) native 'Path_cubicTo'; /// Adds a cubic bezier segment that curves from the current point /// to the point at the offset (x3,y3) from the current point, using /// the control points at the offsets (x1,y1) and (x2,y2) from the /// current point. - void relativeCubicTo(double x1, double y1, double x2, double y2, double x3, double y3) native 'Path_relativeCubicTo'; + void relativeCubicTo(double/*!*/ x1, double/*!*/ y1, double/*!*/ x2, double/*!*/ y2, double/*!*/ x3, double/*!*/ y3) native 'Path_relativeCubicTo'; /// Adds a bezier segment that curves from the current point to the /// given point (x2,y2), using the control points (x1,y1) and the /// weight w. If the weight is greater than 1, then the curve is a /// hyperbola; if the weight equals 1, it's a parabola; and if it is /// less than 1, it is an ellipse. - void conicTo(double x1, double y1, double x2, double y2, double w) native 'Path_conicTo'; + void conicTo(double/*!*/ x1, double/*!*/ y1, double/*!*/ x2, double/*!*/ y2, double/*!*/ w) native 'Path_conicTo'; /// Adds a bezier segment that curves from the current point to the /// point at the offset (x2,y2) from the current point, using the @@ -1969,7 +1968,7 @@ class Path extends NativeFieldWrapperClass2 { /// the weight w. If the weight is greater than 1, then the curve is /// a hyperbola; if the weight equals 1, it's a parabola; and if it /// is less than 1, it is an ellipse. - void relativeConicTo(double x1, double y1, double x2, double y2, double w) native 'Path_relativeConicTo'; + void relativeConicTo(double/*!*/ x1, double/*!*/ y1, double/*!*/ x2, double/*!*/ y2, double/*!*/ w) native 'Path_relativeConicTo'; /// If the `forceMoveTo` argument is false, adds a straight line /// segment and an arc segment. @@ -1987,12 +1986,12 @@ class Path extends NativeFieldWrapperClass2 { /// /// The line segment added if `forceMoveTo` is false starts at the /// current point and ends at the start of the arc. - void arcTo(Rect rect, double startAngle, double sweepAngle, bool forceMoveTo) { + void arcTo(Rect/*!*/ rect, double/*!*/ startAngle, double/*!*/ sweepAngle, bool/*!*/ forceMoveTo) { assert(_rectIsValid(rect)); _arcTo(rect.left, rect.top, rect.right, rect.bottom, startAngle, sweepAngle, forceMoveTo); } - void _arcTo(double left, double top, double right, double bottom, - double startAngle, double sweepAngle, bool forceMoveTo) native 'Path_arcTo'; + void _arcTo(double/*!*/ left, double/*!*/ top, double/*!*/ right, double/*!*/ bottom, + double/*!*/ startAngle, double/*!*/ sweepAngle, bool/*!*/ forceMoveTo) native 'Path_arcTo'; /// Appends up to four conic curves weighted to describe an oval of `radius` /// and rotated by `rotation`. @@ -2006,20 +2005,20 @@ class Path extends NativeFieldWrapperClass2 { /// point in the path is `arcEnd`. The radii are scaled to fit the last path /// point if both are greater than zero but too small to describe an arc. /// - void arcToPoint(Offset arcEnd, { - Radius radius = Radius.zero, - double rotation = 0.0, - bool largeArc = false, - bool clockwise = true, - }) { + void arcToPoint(Offset/*!*/ arcEnd, { + Radius/*!*/ radius = Radius.zero, + double/*!*/ rotation = 0.0, + bool/*!*/ largeArc = false, + bool/*!*/ clockwise = true, + }) { assert(_offsetIsValid(arcEnd)); assert(_radiusIsValid(radius)); _arcToPoint(arcEnd.dx, arcEnd.dy, radius.x, radius.y, rotation, largeArc, clockwise); } - void _arcToPoint(double arcEndX, double arcEndY, double radiusX, - double radiusY, double rotation, bool largeArc, - bool clockwise) native 'Path_arcToPoint'; + void _arcToPoint(double/*!*/ arcEndX, double/*!*/ arcEndY, double/*!*/ radiusX, + double/*!*/ radiusY, double/*!*/ rotation, bool/*!*/ largeArc, + bool/*!*/ clockwise) native 'Path_arcToPoint'; /// Appends up to four conic curves weighted to describe an oval of `radius` @@ -2036,12 +2035,12 @@ class Path extends NativeFieldWrapperClass2 { /// `arcEndDelta.dx` and `arcEndDelta.dy` are zero. The radii are scaled to /// fit the last path point if both are greater than zero but too small to /// describe an arc. - void relativeArcToPoint(Offset arcEndDelta, { - Radius radius = Radius.zero, - double rotation = 0.0, - bool largeArc = false, - bool clockwise = true, - }) { + void relativeArcToPoint(Offset/*!*/ arcEndDelta, { + Radius/*!*/ radius = Radius.zero, + double/*!*/ rotation = 0.0, + bool/*!*/ largeArc = false, + bool/*!*/ clockwise = true, + }) { assert(_offsetIsValid(arcEndDelta)); assert(_radiusIsValid(radius)); _relativeArcToPoint(arcEndDelta.dx, arcEndDelta.dy, radius.x, radius.y, @@ -2054,7 +2053,7 @@ class Path extends NativeFieldWrapperClass2 { /// Adds a new sub-path that consists of four lines that outline the /// given rectangle. - void addRect(Rect rect) { + void addRect(Rect/*!*/ rect) { assert(_rectIsValid(rect)); _addRect(rect.left, rect.top, rect.right, rect.bottom); } @@ -2065,7 +2064,7 @@ class Path extends NativeFieldWrapperClass2 { /// /// To add a circle, pass an appropriate rectangle as `oval`. [Rect.fromCircle] /// can be used to easily describe the circle's center [Offset] and radius. - void addOval(Rect oval) { + void addOval(Rect/*!*/ oval) { assert(_rectIsValid(oval)); _addOval(oval.left, oval.top, oval.right, oval.bottom); } @@ -2079,7 +2078,7 @@ class Path extends NativeFieldWrapperClass2 { /// crosses the horizontal line that intersects the center of the /// rectangle and with positive angles going clockwise around the /// oval. - void addArc(Rect oval, double startAngle, double sweepAngle) { + void addArc(Rect/*!*/ oval, double/*!*/ startAngle, double/*!*/ sweepAngle) { assert(_rectIsValid(oval)); _addArc(oval.left, oval.top, oval.right, oval.bottom, startAngle, sweepAngle); } @@ -2093,7 +2092,7 @@ class Path extends NativeFieldWrapperClass2 { /// last point to the first point. /// /// The `points` argument is interpreted as offsets from the origin. - void addPolygon(List points, bool close) { + void addPolygon(List/*!*/ points, bool/*!*/ close) { assert(points != null); _addPolygon(_encodePointList(points), close); } @@ -2102,7 +2101,7 @@ class Path extends NativeFieldWrapperClass2 { /// Adds a new sub-path that consists of the straight lines and /// curves needed to form the rounded rectangle described by the /// argument. - void addRRect(RRect rrect) { + void addRRect(RRect/*!*/ rrect) { assert(_rrectIsValid(rrect)); _addRRect(rrect._value32); } @@ -2114,7 +2113,7 @@ class Path extends NativeFieldWrapperClass2 { /// If `matrix4` is specified, the path will be transformed by this matrix /// after the matrix is translated by the given offset. The matrix is a 4x4 /// matrix stored in column major order. - void addPath(Path path, Offset offset, {Float64List matrix4}) { + void addPath(Path/*!*/ path, Offset/*!*/ offset, {Float64List/*?*/ matrix4}) { assert(path != null); // path is checked on the engine side assert(_offsetIsValid(offset)); if (matrix4 != null) { @@ -2133,7 +2132,7 @@ class Path extends NativeFieldWrapperClass2 { /// If `matrix4` is specified, the path will be transformed by this matrix /// after the matrix is translated by the given `offset`. The matrix is a 4x4 /// matrix stored in column major order. - void extendWithPath(Path path, Offset offset, {Float64List matrix4}) { + void extendWithPath(Path/*!*/ path, Offset/*!*/ offset, {Float64List/*?*/ matrix4}) { assert(path != null); // path is checked on the engine side assert(_offsetIsValid(offset)); if (matrix4 != null) { @@ -2162,7 +2161,7 @@ class Path extends NativeFieldWrapperClass2 { /// The `point` argument is interpreted as an offset from the origin. /// /// Returns true if the point is in the path, and false otherwise. - bool contains(Offset point) { + bool/*!*/ contains(Offset/*!*/ point) { assert(_offsetIsValid(point)); return _contains(point.dx, point.dy); } @@ -2170,7 +2169,7 @@ class Path extends NativeFieldWrapperClass2 { /// Returns a copy of the path with all the segments of every /// sub-path translated by the given offset. - Path shift(Offset offset) { + Path/*!*/ shift(Offset/*!*/ offset) { assert(_offsetIsValid(offset)); final Path path = Path._(); _shift(path, offset.dx, offset.dy); @@ -2180,7 +2179,7 @@ class Path extends NativeFieldWrapperClass2 { /// Returns a copy of the path with all the segments of every /// sub-path transformed by the given matrix. - Path transform(Float64List matrix4) { + Path/*!*/ transform(Float64List/*!*/ matrix4) { assert(_matrix4IsValid(matrix4)); final Path path = Path._(); _transform(path, matrix4); @@ -2203,7 +2202,7 @@ class Path extends NativeFieldWrapperClass2 { /// therefore ends up grossly overestimating the actual area covered by the /// circle. // see https://skia.org/user/api/SkPath_Reference#SkPath_getBounds - Rect getBounds() { + Rect/*!*/ getBounds() { final Float32List rect = _getBounds(); return Rect.fromLTRB(rect[0], rect[1], rect[2], rect[3]); } @@ -2215,7 +2214,7 @@ class Path extends NativeFieldWrapperClass2 { /// The resulting path will be constructed from non-overlapping contours. The /// curve order is reduced where possible so that cubics may be turned into /// quadratics, and quadratics maybe turned into lines. - static Path combine(PathOperation operation, Path path1, Path path2) { + static Path/*!*/ combine(PathOperation/*!*/ operation, Path/*!*/ path1, Path/*!*/ path2) { assert(path1 != null); assert(path2 != null); final Path path = Path(); @@ -2224,7 +2223,7 @@ class Path extends NativeFieldWrapperClass2 { } throw StateError('Path.combine() failed. This may be due an invalid path; in particular, check for NaN values.'); } - bool _op(Path path1, Path path2, int operation) native 'Path_op'; + bool/*!*/ _op(Path/*!*/ path1, Path/*!*/ path2, int/*!*/ operation) native 'Path_op'; /// Creates a [PathMetrics] object for this path, which can describe various /// properties about the contours of the path. @@ -2257,7 +2256,7 @@ class Path extends NativeFieldWrapperClass2 { /// /// If `forceClosed` is set to true, the contours of the path will be measured /// as if they had been closed, even if they were not explicitly closed. - PathMetrics computeMetrics({bool forceClosed = false}) { + PathMetrics/*!*/ computeMetrics({bool/*!*/ forceClosed = false}) { return PathMetrics._(this, forceClosed); } } @@ -2278,7 +2277,7 @@ class Tangent { /// /// The [vector] is computed to be the unit vector at the given angle, interpreted /// as clockwise radians from the x axis. - factory Tangent.fromAngle(Offset position, double angle) { + factory Tangent.fromAngle(Offset/*!*/ position, double/*!*/ angle) { return Tangent(position, Offset(math.cos(angle), math.sin(angle))); } @@ -2286,14 +2285,14 @@ class Tangent { /// /// When used with [PathMetric.getTangentForOffset], this represents the precise /// position that the given offset along the path corresponds to. - final Offset position; + final Offset/*!*/ position; /// The vector of the curve at [position]. /// /// When used with [PathMetric.getTangentForOffset], this is the vector of the /// curve that is at the given offset along the path (i.e. the direction of the /// curve at [position]). - final Offset vector; + final Offset/*!*/ vector; /// The direction of the curve at [position]. /// @@ -2307,7 +2306,7 @@ class Tangent { /// pointing upward toward the positive y-axis, i.e. in a counter-clockwise /// direction. // flip the sign to be consistent with [Path.arcTo]'s `sweepAngle` - double get angle => -math.atan2(vector.dy, vector.dx); + double/*!*/ get angle => -math.atan2(vector.dy, vector.dx); } /// An iterable collection of [PathMetric] objects describing a [Path]. @@ -2325,14 +2324,14 @@ class Tangent { /// This iterable does not memoize. Callers who need to traverse the list /// multiple times, or who need to randomly access elements of the list, should /// use [toList] on this object. -class PathMetrics extends collection.IterableBase { +class PathMetrics extends collection.IterableBase { PathMetrics._(Path path, bool forceClosed) : _iterator = PathMetricIterator._(_PathMeasure(path, forceClosed)); - final Iterator _iterator; + final Iterator/*!*/ _iterator; @override - Iterator get iterator => _iterator; + Iterator/*!*/ get iterator => _iterator; } /// Used by [PathMetrics] to track iteration from one segment of a path to the @@ -2340,11 +2339,11 @@ class PathMetrics extends collection.IterableBase { class PathMetricIterator implements Iterator { PathMetricIterator._(this._pathMeasure) : assert(_pathMeasure != null); - PathMetric _pathMetric; - _PathMeasure _pathMeasure; + PathMetric/*?*/ _pathMetric; + _PathMeasure/*!*/ _pathMeasure; @override - PathMetric get current => _pathMetric; + PathMetric/*?*/ get current => _pathMetric; @override bool moveNext() { @@ -2378,7 +2377,7 @@ class PathMetric { contourIndex = _measure.currentContourIndex; /// Return the total length of the current contour. - final double length; + final double/*!*/ length; /// Whether the contour is closed. /// @@ -2386,7 +2385,7 @@ class PathMetric { /// have been implied when using methods like [Path.addRect]) or if /// `forceClosed` was specified as true in the call to [Path.computeMetrics]. /// Returns false otherwise. - final bool isClosed; + final bool/*!*/ isClosed; /// The zero-based index of the contour. /// @@ -2400,9 +2399,9 @@ class PathMetric { /// the contours of the path at the time the path's metrics were computed. If /// additional contours were added or existing contours updated, this metric /// will be invalid for the current state of the path. - final int contourIndex; + final int/*!*/ contourIndex; - final _PathMeasure _measure; + final _PathMeasure/*!*/ _measure; /// Computes the position of the current contour at the given offset, and the @@ -2415,21 +2414,21 @@ class PathMetric { /// Returns null if the contour has zero [length]. /// /// The distance is clamped to the [length] of the current contour. - Tangent getTangentForOffset(double distance) { + Tangent/*?*/ getTangentForOffset(double/*!*/ distance) { return _measure.getTangentForOffset(contourIndex, distance); } /// Given a start and stop distance, return the intervening segment(s). /// - /// `start` and `end` are pinned to legal values (0..[length]) + /// `start` and `end` are clamped to legal values (0..[length]) /// Returns null if the segment is 0 length or `start` > `stop`. /// Begin the segment with a moveTo if `startWithMoveTo` is true. - Path extractPath(double start, double end, {bool startWithMoveTo = true}) { + Path/*?*/ extractPath(double/*!*/ start, double/*!*/ end, {bool/*!*/ startWithMoveTo = true}) { return _measure.extractPath(contourIndex, start, end, startWithMoveTo: startWithMoveTo); } @override - String toString() => '$runtimeType{length: $length, isClosed: $isClosed, contourIndex:$contourIndex}'; + String/*!*/ toString() => '$runtimeType{length: $length, isClosed: $isClosed, contourIndex:$contourIndex}'; } class _PathMeasure extends NativeFieldWrapperClass2 { @@ -2445,7 +2444,7 @@ class _PathMeasure extends NativeFieldWrapperClass2 { } double _length(int contourIndex) native 'PathMeasure_getLength'; - Tangent getTangentForOffset(int contourIndex, double distance) { + Tangent/*?*/ getTangentForOffset(int contourIndex, double distance) { assert(contourIndex <= currentContourIndex, 'Iterator must be advanced before index $contourIndex can be used.'); final Float32List posTan = _getPosTan(contourIndex, distance); // first entry == 0 indicates that Skia returned false @@ -2544,8 +2543,8 @@ class MaskFilter { ) : assert(_style != null), assert(_sigma != null); - final BlurStyle _style; - final double _sigma; + final BlurStyle/*!*/ _style; + final double/*!*/ _sigma; // The type of MaskFilter class to create for Skia. // These constants must be kept in sync with MaskFilterType in paint.cc. @@ -2553,17 +2552,17 @@ class MaskFilter { static const int _TypeBlur = 1; // SkBlurMaskFilter @override - bool operator ==(dynamic other) { + bool/*!*/ operator ==(dynamic other) { return other is MaskFilter && other._style == _style && other._sigma == _sigma; } @override - int get hashCode => hashValues(_style, _sigma); + int/*!*/ get hashCode => hashValues(_style, _sigma); @override - String toString() => 'MaskFilter.blur($_style, ${_sigma.toStringAsFixed(1)})'; + String/*!*/ toString() => 'MaskFilter.blur($_style, ${_sigma.toStringAsFixed(1)})'; } /// A description of a color filter to apply when drawing a shape or compositing @@ -2582,7 +2581,7 @@ class ColorFilter { /// The output of this filter is then composited into the background according /// to the [Paint.blendMode], using the output of this filter as the source /// and the background as the destination. - const ColorFilter.mode(Color color, BlendMode blendMode) + const ColorFilter.mode(Color/*!*/ color, BlendMode/*!*/ blendMode) : _color = color, _blendMode = blendMode, _matrix = null, @@ -2648,7 +2647,7 @@ class ColorFilter { /// 0, 0, 0, 1, 0, /// ]); /// ``` - const ColorFilter.matrix(List matrix) + const ColorFilter.matrix(List/*!*/ matrix) : _color = null, _blendMode = null, _matrix = matrix, @@ -2682,7 +2681,7 @@ class ColorFilter { static const int _TypeSrgbToLinearGamma = 4; // MakeSRGBToLinearGamma @override - bool operator ==(dynamic other) { + bool/*!*/ operator ==(dynamic other) { return other is ColorFilter && other._type == _type && _listEquals(other._matrix, _matrix) @@ -2690,7 +2689,7 @@ class ColorFilter { && other._blendMode == _blendMode; } - _ColorFilter _toNativeColorFilter() { + _ColorFilter/*?*/ _toNativeColorFilter() { switch (_type) { case _TypeMode: if (_color == null || _blendMode == null) { @@ -2713,10 +2712,10 @@ class ColorFilter { } @override - int get hashCode => hashValues(_color, _blendMode, hashList(_matrix), _type); + int/*!*/ get hashCode => hashValues(_color, _blendMode, hashList(_matrix), _type); @override - String toString() { + String/*!*/ toString() { switch (_type) { case _TypeMode: return 'ColorFilter.mode($_color, $_blendMode)'; @@ -2789,7 +2788,7 @@ class _ColorFilter extends NativeFieldWrapperClass2 { /// this class as a child layer filter. class ImageFilter { /// Creates an image filter that applies a Gaussian blur. - ImageFilter.blur({ double sigmaX = 0.0, double sigmaY = 0.0 }) + ImageFilter.blur({ double/*!*/ sigmaX = 0.0, double/*!*/ sigmaY = 0.0 }) : _data = _makeList(sigmaX, sigmaY), _filterQuality = null, _type = _kTypeBlur; @@ -2798,8 +2797,8 @@ class ImageFilter { /// /// For example, applying a positive scale matrix (see [Matrix4.diagonal3]) /// when used with [BackdropFilter] would magnify the background image. - ImageFilter.matrix(Float64List matrix4, - { FilterQuality filterQuality = FilterQuality.low }) + ImageFilter.matrix(Float64List/*!*/ matrix4, + { FilterQuality/*!*/ filterQuality = FilterQuality.low }) : _data = Float64List.fromList(matrix4), _filterQuality = filterQuality, _type = _kTypeMatrix { @@ -2816,10 +2815,10 @@ class ImageFilter { return list; } - final Float64List _data; - final FilterQuality _filterQuality; - final int _type; - _ImageFilter _nativeFilter; + final Float64List/*!*/ _data; + final FilterQuality/*?*/ _filterQuality; + final int/*!*/ _type; + _ImageFilter/*?*/ _nativeFilter; // The type of SkImageFilter class to create for Skia. static const int _kTypeBlur = 0; // MakeBlurFilter @@ -2850,10 +2849,10 @@ class ImageFilter { } @override - int get hashCode => hashValues(_filterQuality, hashList(_data), _type); + int/*!*/ get hashCode => hashValues(_filterQuality, hashList(_data), _type); @override - String toString() { + String/*!*/ toString() { switch (_type) { case _kTypeBlur: return 'ImageFilter.blur(${_data[0]}, ${_data[1]})'; @@ -2898,7 +2897,7 @@ class _ImageFilter extends NativeFieldWrapperClass2 { /// The original Dart object that created the native wrapper, which retains /// the values used for the filter. - final ImageFilter creator; + final ImageFilter/*!*/ creator; } /// Base class for objects such as [Gradient] and [ImageShader] which @@ -2961,7 +2960,7 @@ enum TileMode { mirror, } -Int32List _encodeColorList(List colors) { +Int32List/*!*/ _encodeColorList(List/*!*/ colors) { final int colorCount = colors.length; final Int32List result = Int32List(colorCount); for (int i = 0; i < colorCount; ++i) @@ -2969,7 +2968,7 @@ Int32List _encodeColorList(List colors) { return result; } -Float32List _encodePointList(List points) { +Float32List/*!*/ _encodePointList(List/*!*/ points) { assert(points != null); final int pointCount = points.length; final Float32List result = Float32List(pointCount * 2); @@ -2984,7 +2983,7 @@ Float32List _encodePointList(List points) { return result; } -Float32List _encodeTwoPoints(Offset pointA, Offset pointB) { +Float32List/*!*/ _encodeTwoPoints(Offset/*!*/ pointA, Offset/*!*/ pointB) { assert(_offsetIsValid(pointA)); assert(_offsetIsValid(pointB)); final Float32List result = Float32List(4); @@ -3030,12 +3029,12 @@ class Gradient extends Shader { /// specified 4x4 matrix relative to the local coordinate system. `matrix4` must /// be a column-major matrix packed into a list of 16 values. Gradient.linear( - Offset from, - Offset to, - List colors, [ - List colorStops, - TileMode tileMode = TileMode.clamp, - Float64List matrix4, + Offset/*!*/ from, + Offset/*!*/ to, + List/*!*/ colors, [ + List/*?*/ colorStops, + TileMode/*!*/ tileMode = TileMode.clamp, + Float64List/*?*/ matrix4, ]) : assert(_offsetIsValid(from)), assert(_offsetIsValid(to)), assert(colors != null), @@ -3081,14 +3080,14 @@ class Gradient extends Shader { /// provided and not equal to `center`, at least one of the two offsets must /// not be equal to [Offset.zero]. Gradient.radial( - Offset center, - double radius, - List colors, [ - List colorStops, - TileMode tileMode = TileMode.clamp, - Float64List matrix4, - Offset focal, - double focalRadius = 0.0 + Offset/*!*/ center, + double/*!*/ radius, + List/*!*/ colors, [ + List/*?*/ colorStops, + TileMode/*!*/ tileMode = TileMode.clamp, + Float64List/*?*/ matrix4, + Offset/*?*/ focal, + double/*!*/ focalRadius = 0.0 ]) : assert(_offsetIsValid(center)), assert(colors != null), assert(tileMode != null), @@ -3140,13 +3139,13 @@ class Gradient extends Shader { /// specified 4x4 matrix relative to the local coordinate system. `matrix4` must /// be a column-major matrix packed into a list of 16 values. Gradient.sweep( - Offset center, - List colors, [ - List colorStops, + Offset/*!*/ center, + List/*!*/ colors, [ + List/*?*/ colorStops, TileMode tileMode = TileMode.clamp, - double startAngle = 0.0, - double endAngle = math.pi * 2, - Float64List matrix4, + double startAngle/*?*/ = 0.0, + double endAngle/*!*/ = math.pi * 2, + Float64List/*?*/ matrix4, ]) : assert(_offsetIsValid(center)), assert(colors != null), assert(tileMode != null), @@ -3182,7 +3181,7 @@ class ImageShader extends Shader { /// matrix to apply to the effect. All the arguments are required and must not /// be null. @pragma('vm:entry-point') - ImageShader(Image image, TileMode tmx, TileMode tmy, Float64List matrix4) : + ImageShader(Image/*!*/ image, TileMode/*!*/ tmx, TileMode/*!*/ tmy, Float64List/*!*/ matrix4) : assert(image != null), // image is checked on the engine side assert(tmx != null), assert(tmy != null), @@ -3224,11 +3223,11 @@ class Vertices extends NativeFieldWrapperClass2 { /// If the [indices] parameter is provided, all values in the list must be /// valid index values for [positions]. Vertices( - VertexMode mode, - List positions, { - List textureCoordinates, - List colors, - List indices, + VertexMode/*!*/ mode, + List/*!*/ positions, { + List/*?*/ textureCoordinates, + List/*?*/ colors, + List/*?*/ indices, }) : assert(mode != null), assert(positions != null) { if (textureCoordinates != null && textureCoordinates.length != positions.length) @@ -3272,11 +3271,11 @@ class Vertices extends NativeFieldWrapperClass2 { /// If the [indices] list is provided, all values in the list must be /// valid index values for [positions]. Vertices.raw( - VertexMode mode, - Float32List positions, { - Float32List textureCoordinates, - Int32List colors, - Uint16List indices, + VertexMode/*!*/ mode, + Float32List/*!*/ positions, { + Float32List/*?*/ textureCoordinates, + Int32List/*?*/ colors, + Uint16List/*?*/ indices, }) : assert(mode != null), assert(positions != null) { if (textureCoordinates != null && textureCoordinates.length != positions.length) @@ -3373,7 +3372,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// To end the recording, call [PictureRecorder.endRecording] on the /// given recorder. @pragma('vm:entry-point') - Canvas(PictureRecorder recorder, [ Rect cullRect ]) : assert(recorder != null) { + Canvas(PictureRecorder/*!*/ recorder, [ Rect/*?*/ cullRect ]) : assert(recorder != null) { if (recorder.isRecording) throw ArgumentError('"recorder" must not already be associated with another Canvas.'); cullRect ??= Rect.largest; @@ -3504,7 +3503,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// for subsequent commands. /// * [BlendMode], which discusses the use of [Paint.blendMode] with /// [saveLayer]. - void saveLayer(Rect bounds, Paint paint) { + void saveLayer(Rect/*?*/ bounds, Paint/*!*/ paint) { assert(paint != null); if (bounds == null) { _saveLayerWithoutBounds(paint._objects, paint._data); @@ -3542,7 +3541,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// Add a translation to the current transform, shifting the coordinate space /// horizontally by the first argument and vertically by the second argument. - void translate(double dx, double dy) native 'Canvas_translate'; + void translate(double/*!*/ dx, double/*!*/ dy) native 'Canvas_translate'; /// Add an axis-aligned scale to the current transform, scaling by the first /// argument in the horizontal direction and the second in the vertical @@ -3550,22 +3549,22 @@ class Canvas extends NativeFieldWrapperClass2 { /// /// If [sy] is unspecified, [sx] will be used for the scale in both /// directions. - void scale(double sx, [double sy]) => _scale(sx, sy ?? sx); + void scale(double/*!*/ sx, [double/*?*/ sy]) => _scale(sx, sy ?? sx); void _scale(double sx, double sy) native 'Canvas_scale'; /// Add a rotation to the current transform. The argument is in radians clockwise. - void rotate(double radians) native 'Canvas_rotate'; + void rotate(double/*!*/ radians) native 'Canvas_rotate'; /// Add an axis-aligned skew to the current transform, with the first argument /// being the horizontal skew in rise over run units clockwise around the /// origin, and the second argument being the vertical skew in rise over run /// units clockwise around the origin. - void skew(double sx, double sy) native 'Canvas_skew'; + void skew(double/*!*/ sx, double/*!*/ sy) native 'Canvas_skew'; /// Multiply the current transform by the specified 4⨉4 transformation matrix /// specified as a list of values in column-major order. - void transform(Float64List matrix4) { + void transform(Float64List/*!*/ matrix4) { assert(matrix4 != null); if (matrix4.length != 16) throw ArgumentError('"matrix4" must have 16 entries.'); @@ -3584,7 +3583,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// /// Use [ClipOp.difference] to subtract the provided rectangle from the /// current clip. - void clipRect(Rect rect, { ClipOp clipOp = ClipOp.intersect, bool doAntiAlias = true }) { + void clipRect(Rect/*!*/ rect, { ClipOp/*!*/ clipOp = ClipOp.intersect, bool/*!*/ doAntiAlias = true }) { assert(_rectIsValid(rect)); assert(clipOp != null); assert(doAntiAlias != null); @@ -3605,7 +3604,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// If multiple draw commands intersect with the clip boundary, this can result /// in incorrect blending at the clip boundary. See [saveLayer] for a /// discussion of how to address that and some examples of using [clipRRect]. - void clipRRect(RRect rrect, {bool doAntiAlias = true}) { + void clipRRect(RRect/*!*/ rrect, {bool/*!*/ doAntiAlias = true}) { assert(_rrectIsValid(rrect)); assert(doAntiAlias != null); _clipRRect(rrect._value32, doAntiAlias); @@ -3621,7 +3620,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// multiple draw commands intersect with the clip boundary, this can result /// in incorrect blending at the clip boundary. See [saveLayer] for a /// discussion of how to address that. - void clipPath(Path path, {bool doAntiAlias = true}) { + void clipPath(Path/*!*/ path, {bool/*!*/ doAntiAlias = true}) { assert(path != null); // path is checked on the engine side assert(doAntiAlias != null); _clipPath(path, doAntiAlias); @@ -3631,7 +3630,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// Paints the given [Color] onto the canvas, applying the given /// [BlendMode], with the given color being the source and the background /// being the destination. - void drawColor(Color color, BlendMode blendMode) { + void drawColor(Color/*!*/ color, BlendMode/*!*/ blendMode) { assert(color != null); assert(blendMode != null); _drawColor(color.value, blendMode.index); @@ -3642,7 +3641,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// stroked, the value of the [Paint.style] is ignored for this call. /// /// The `p1` and `p2` arguments are interpreted as offsets from the origin. - void drawLine(Offset p1, Offset p2, Paint paint) { + void drawLine(Offset/*!*/ p1, Offset/*!*/ p2, Paint/*!*/ paint) { assert(_offsetIsValid(p1)); assert(_offsetIsValid(p2)); assert(paint != null); @@ -3659,7 +3658,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// /// To fill the canvas with a solid color and blend mode, consider /// [drawColor] instead. - void drawPaint(Paint paint) { + void drawPaint(Paint/*!*/ paint) { assert(paint != null); _drawPaint(paint._objects, paint._data); } @@ -3667,7 +3666,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// Draws a rectangle with the given [Paint]. Whether the rectangle is filled /// or stroked (or both) is controlled by [Paint.style]. - void drawRect(Rect rect, Paint paint) { + void drawRect(Rect/*!*/ rect, Paint/*!*/ paint) { assert(_rectIsValid(rect)); assert(paint != null); _drawRect(rect.left, rect.top, rect.right, rect.bottom, @@ -3682,7 +3681,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// Draws a rounded rectangle with the given [Paint]. Whether the rectangle is /// filled or stroked (or both) is controlled by [Paint.style]. - void drawRRect(RRect rrect, Paint paint) { + void drawRRect(RRect/*!*/ rrect, Paint/*!*/ paint) { assert(_rrectIsValid(rrect)); assert(paint != null); _drawRRect(rrect._value32, paint._objects, paint._data); @@ -3696,7 +3695,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// is controlled by [Paint.style]. /// /// This shape is almost but not quite entirely unlike an annulus. - void drawDRRect(RRect outer, RRect inner, Paint paint) { + void drawDRRect(RRect/*!*/ outer, RRect/*!*/ inner, Paint/*!*/ paint) { assert(_rrectIsValid(outer)); assert(_rrectIsValid(inner)); assert(paint != null); @@ -3710,7 +3709,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// Draws an axis-aligned oval that fills the given axis-aligned rectangle /// with the given [Paint]. Whether the oval is filled or stroked (or both) is /// controlled by [Paint.style]. - void drawOval(Rect rect, Paint paint) { + void drawOval(Rect/*!*/ rect, Paint/*!*/ paint) { assert(_rectIsValid(rect)); assert(paint != null); _drawOval(rect.left, rect.top, rect.right, rect.bottom, @@ -3727,7 +3726,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// that has the radius given by the second argument, with the [Paint] given in /// the third argument. Whether the circle is filled or stroked (or both) is /// controlled by [Paint.style]. - void drawCircle(Offset c, double radius, Paint paint) { + void drawCircle(Offset/*!*/ c, double/*!*/ radius, Paint/*!*/ paint) { assert(_offsetIsValid(c)); assert(paint != null); _drawCircle(c.dx, c.dy, radius, paint._objects, paint._data); @@ -3738,17 +3737,18 @@ class Canvas extends NativeFieldWrapperClass2 { List paintObjects, ByteData paintData) native 'Canvas_drawCircle'; - /// Draw an arc scaled to fit inside the given rectangle. It starts from - /// startAngle radians around the oval up to startAngle + sweepAngle - /// radians around the oval, with zero radians being the point on - /// the right hand side of the oval that crosses the horizontal line - /// that intersects the center of the rectangle and with positive - /// angles going clockwise around the oval. If useCenter is true, the arc is + /// Draw an arc scaled to fit inside the given rectangle. + /// + /// It starts from `startAngle` radians around the oval up to + /// `startAngle` + `sweepAngle` radians around the oval, with zero radians + /// being the point on the right hand side of the oval that crosses the + /// horizontal line that intersects the center of the rectangle and with positive + /// angles going clockwise around the oval. If `useCenter` is true, the arc is /// closed back to the center, forming a circle sector. Otherwise, the arc is /// not closed, forming a circle segment. /// /// This method is optimized for drawing arcs and should be faster than [Path.arcTo]. - void drawArc(Rect rect, double startAngle, double sweepAngle, bool useCenter, Paint paint) { + void drawArc(Rect/*!*/ rect, double/*!*/ startAngle, double/*!*/ sweepAngle, bool/*!*/ useCenter, Paint/*!*/ paint) { assert(_rectIsValid(rect)); assert(paint != null); _drawArc(rect.left, rect.top, rect.right, rect.bottom, startAngle, @@ -3764,10 +3764,12 @@ class Canvas extends NativeFieldWrapperClass2 { List paintObjects, ByteData paintData) native 'Canvas_drawArc'; - /// Draws the given [Path] with the given [Paint]. Whether this shape is - /// filled or stroked (or both) is controlled by [Paint.style]. If the path is - /// filled, then sub-paths within it are implicitly closed (see [Path.close]). - void drawPath(Path path, Paint paint) { + /// Draws the given [Path] with the given [Paint]. + /// + /// Whether this shape is filled or stroked (or both) is controlled by + /// [Paint.style]. If the path is filled, then sub-paths within it are + /// implicitly closed (see [Path.close]). + void drawPath(Path/*!*/ path, Paint/*!*/ paint) { assert(path != null); // path is checked on the engine side assert(paint != null); _drawPath(path, paint._objects, paint._data); @@ -3778,11 +3780,11 @@ class Canvas extends NativeFieldWrapperClass2 { /// Draws the given [Image] into the canvas with its top-left corner at the /// given [Offset]. The image is composited into the canvas using the given [Paint]. - void drawImage(Image image, Offset p, Paint paint) { + void drawImage(Image/*!*/ image, Offset/*!*/ offset, Paint/*!*/ paint) { assert(image != null); // image is checked on the engine side - assert(_offsetIsValid(p)); + assert(_offsetIsValid(offset)); assert(paint != null); - _drawImage(image, p.dx, p.dy, paint._objects, paint._data); + _drawImage(image, offset.dx, offset.dy, paint._objects, paint._data); } void _drawImage(Image image, double x, @@ -3799,7 +3801,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// Multiple calls to this method with different arguments (from the same /// image) can be batched into a single call to [drawAtlas] to improve /// performance. - void drawImageRect(Image image, Rect src, Rect dst, Paint paint) { + void drawImageRect(Image/*!*/ image, Rect/*!*/ src, Rect/*!*/ dst, Paint/*!*/ paint) { assert(image != null); // image is checked on the engine side assert(_rectIsValid(src)); assert(_rectIsValid(dst)); @@ -3841,7 +3843,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// five regions are drawn by stretching them to fit such that they exactly /// cover the destination rectangle while maintaining their relative /// positions. - void drawImageNine(Image image, Rect center, Rect dst, Paint paint) { + void drawImageNine(Image/*!*/ image, Rect/*!*/ center, Rect/*!*/ dst, Paint/*!*/ paint) { assert(image != null); // image is checked on the engine side assert(_rectIsValid(center)); assert(_rectIsValid(dst)); @@ -3872,7 +3874,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// Draw the given picture onto the canvas. To create a picture, see /// [PictureRecorder]. - void drawPicture(Picture picture) { + void drawPicture(Picture/*!*/ picture) { assert(picture != null); // picture is checked on the engine side _drawPicture(picture); } @@ -3898,7 +3900,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// If the text is centered, the centering axis will be at the position /// described by adding half of the [ParagraphConstraints.width] given to /// [Paragraph.layout], to the `offset` argument's [Offset.dx] coordinate. - void drawParagraph(Paragraph paragraph, Offset offset) { + void drawParagraph(Paragraph/*!*/ paragraph, Offset/*!*/ offset) { assert(paragraph != null); assert(_offsetIsValid(offset)); paragraph._paint(this, offset.dx, offset.dy); @@ -3912,7 +3914,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// /// * [drawRawPoints], which takes `points` as a [Float32List] rather than a /// [List]. - void drawPoints(PointMode pointMode, List points, Paint paint) { + void drawPoints(PointMode/*!*/ pointMode, List/*!*/ points, Paint/*!*/ paint) { assert(pointMode != null); assert(points != null); assert(paint != null); @@ -3928,7 +3930,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// /// * [drawPoints], which takes `points` as a [List] rather than a /// [List]. - void drawRawPoints(PointMode pointMode, Float32List points, Paint paint) { + void drawRawPoints(PointMode/*!*/ pointMode, Float32List/*!*/ points, Paint/*!*/ paint) { assert(pointMode != null); assert(points != null); assert(paint != null); @@ -3950,7 +3952,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// * [new Vertices], which creates a set of vertices to draw on the canvas. /// * [Vertices.raw], which creates the vertices using typed data lists /// rather than unencoded lists. - void drawVertices(Vertices vertices, BlendMode blendMode, Paint paint) { + void drawVertices(Vertices/*!*/ vertices, BlendMode/*!*/ blendMode, Paint/*!*/ paint) { assert(vertices != null); // vertices is checked on the engine side assert(paint != null); assert(blendMode != null); @@ -3973,13 +3975,13 @@ class Canvas extends NativeFieldWrapperClass2 { /// /// * [drawRawAtlas], which takes its arguments as typed data lists rather /// than objects. - void drawAtlas(Image atlas, - List transforms, - List rects, - List colors, - BlendMode blendMode, - Rect cullRect, - Paint paint) { + void drawAtlas(Image/*!*/ atlas, + List/*!*/ transforms, + List/*!*/ rects, + List/*!*/ colors, + BlendMode/*!*/ blendMode, + Rect/*?*/ cullRect, + Paint/*!*/ paint) { assert(atlas != null); // atlas is checked on the engine side assert(transforms != null); assert(rects != null); @@ -4043,13 +4045,13 @@ class Canvas extends NativeFieldWrapperClass2 { /// /// * [drawAtlas], which takes its arguments as objects rather than typed /// data lists. - void drawRawAtlas(Image atlas, - Float32List rstTransforms, - Float32List rects, - Int32List colors, - BlendMode blendMode, - Rect cullRect, - Paint paint) { + void drawRawAtlas(Image/*!*/ atlas, + Float32List/*!*/ rstTransforms, + Float32List/*!*/ rects, + Int32List/*!*/ colors, + BlendMode/*!*/ blendMode, + Rect/*?*/ cullRect, + Paint/*!*/ paint) { assert(atlas != null); // atlas is checked on the engine side assert(rstTransforms != null); assert(rects != null); @@ -4086,7 +4088,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// is not opaque. /// /// The arguments must not be null. - void drawShadow(Path path, Color color, double elevation, bool transparentOccluder) { + void drawShadow(Path/*!*/ path, Color/*!*/ color, double/*!*/ elevation, bool/*!*/ transparentOccluder) { assert(path != null); // path is checked on the engine side assert(color != null); assert(transparentOccluder != null); @@ -4122,7 +4124,7 @@ class Picture extends NativeFieldWrapperClass2 { /// /// Although the image is returned synchronously, the picture is actually /// rasterized the first time the image is drawn and then cached. - Future toImage(int width, int height) { + Future/*!*/ toImage(int/*!*/ width, int/*!*/ height) { if (width <= 0 || height <= 0) throw Exception('Invalid image dimensions.'); return _futurize( @@ -4140,7 +4142,7 @@ class Picture extends NativeFieldWrapperClass2 { /// /// The actual size of this picture may be larger, particularly if it contains /// references to image or other large objects. - int get approximateBytesUsed native 'Picture_GetAllocationSize'; + int/*!*/ get approximateBytesUsed native 'Picture_GetAllocationSize'; } /// Records a [Picture] containing a sequence of graphical operations. @@ -4162,7 +4164,7 @@ class PictureRecorder extends NativeFieldWrapperClass2 { /// call to [endRecording], and false if either this /// [PictureRecorder] has not yet been associated with a [Canvas], /// or the [endRecording] method has already been called. - bool get isRecording native 'PictureRecorder_isRecording'; + bool/*!*/ get isRecording native 'PictureRecorder_isRecording'; /// Finishes recording graphical operations. /// @@ -4171,7 +4173,7 @@ class PictureRecorder extends NativeFieldWrapperClass2 { /// and the canvas objects are invalid and cannot be used further. /// /// Returns null if the PictureRecorder is not associated with a canvas. - Picture endRecording() { + Picture/*!*/ endRecording() { final Picture picture = Picture._(); _endRecording(picture); return picture; @@ -4214,17 +4216,17 @@ class Shadow { /// /// The shadows are shapes composited directly over the base canvas, and do not /// represent optical occlusion. - final Color color; + final Color/*!*/ color; /// The displacement of the shadow from the casting element. /// /// Positive x/y offsets will shift the shadow to the right and down, while /// negative offsets shift the shadow to the left and up. The offsets are /// relative to the position of the element that is casting it. - final Offset offset; + final Offset/*!*/ offset; /// The standard deviation of the Gaussian to convolve with the shadow's shape. - final double blurRadius; + final double/*!*/ blurRadius; /// Converts a blur radius in pixels to sigmas. /// @@ -4232,14 +4234,14 @@ class Shadow { /// // See SkBlurMask::ConvertRadiusToSigma(). // - static double convertRadiusToSigma(double radius) { + static double/*!*/ convertRadiusToSigma(double/*!*/ radius) { return radius * 0.57735 + 0.5; } /// The [blurRadius] in sigmas instead of logical pixels. /// /// See the sigma argument to [MaskFilter.blur]. - double get blurSigma => convertRadiusToSigma(blurRadius); + double/*!*/ get blurSigma => convertRadiusToSigma(blurRadius); /// Create the [Paint] object that corresponds to this shadow description. /// @@ -4251,7 +4253,7 @@ class Shadow { /// inconsistencies in shadow blur rendering, primarily as a method of /// reducing test flakiness. [toPaint] should be overridden in subclasses to /// provide this functionality. - Paint toPaint() { + Paint/*!*/ toPaint() { return Paint() ..color = color ..maskFilter = MaskFilter.blur(BlurStyle.normal, blurSigma); @@ -4259,7 +4261,7 @@ class Shadow { /// Returns a new shadow with its [offset] and [blurRadius] scaled by the given /// factor. - Shadow scale(double factor) { + Shadow/*!*/ scale(double/*!*/ factor) { return Shadow( color: color, offset: offset * factor, @@ -4286,7 +4288,7 @@ class Shadow { /// Values for `t` are usually obtained from an [Animation], such as /// an [AnimationController]. /// {@endtemplate} - static Shadow lerp(Shadow a, Shadow b, double t) { + static Shadow/*?*/ lerp(Shadow/*?*/ a, Shadow/*?*/ b, double/*!*/ t) { assert(t != null); if (a == null && b == null) return null; @@ -4306,13 +4308,13 @@ class Shadow { /// If the lists differ in length, excess items are lerped with null. /// /// {@macro dart.ui.shadow.lerp} - static List lerpList(List a, List b, double t) { + static List/*?*/ lerpList(List/*?*/ a, List/*?*/ b, double/*!*/ t) { assert(t != null); if (a == null && b == null) return null; - a ??= []; - b ??= []; - final List result = []; + a ??= []; + b ??= []; + final List result = []; final int commonLength = math.min(a.length, b.length); for (int i = 0; i < commonLength; i += 1) result.add(Shadow.lerp(a[i], b[i], t)); @@ -4324,7 +4326,7 @@ class Shadow { } @override - bool operator ==(dynamic other) { + bool/*!*/ operator ==(dynamic other) { if (identical(this, other)) return true; return other is Shadow @@ -4334,7 +4336,7 @@ class Shadow { } @override - int get hashCode => hashValues(color, offset, blurRadius); + int/*!*/ get hashCode => hashValues(color, offset, blurRadius); // Serialize [shadows] into ByteData. The format is a single uint_32_t at // the beginning indicating the number of shadows, followed by _kBytesPerShadow @@ -4370,7 +4372,7 @@ class Shadow { } @override - String toString() => 'TextShadow($color, $offset, $blurRadius)'; + String/*!*/ toString() => 'TextShadow($color, $offset, $blurRadius)'; } /// Generic callback signature, used by [_futurize]. @@ -4380,7 +4382,7 @@ typedef _Callback = void Function(T result); /// /// Return value should be null on success, and a string error message on /// failure. -typedef _Callbacker = String Function(_Callback callback); +typedef _Callbacker = String/*?*/ Function(_Callback/*!*/ callback); /// Converts a method that receives a value-returning callback to a method that /// returns a Future. @@ -4403,7 +4405,7 @@ typedef _Callbacker = String Function(_Callback callback); /// return _futurize(_doSomethingAndCallback); /// } /// ``` -Future _futurize(_Callbacker callbacker) { +Future/*!*/ _futurize(_Callbacker/*!*/ callbacker) { final Completer completer = Completer.sync(); final String error = callbacker((T t) { if (t == null) { diff --git a/engine/src/flutter/lib/web_ui/lib/src/ui/canvas.dart b/engine/src/flutter/lib/web_ui/lib/src/ui/canvas.dart index b6d863874d1..955a5fa0413 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/ui/canvas.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/ui/canvas.dart @@ -696,11 +696,11 @@ class Canvas { /// Draws the given [Image] into the canvas with its top-left corner at the /// given [Offset]. The image is composited into the canvas using the given [Paint]. - void drawImage(Image image, Offset p, Paint paint) { + void drawImage(Image image, Offset offset, Paint paint) { assert(image != null); // image is checked on the engine side - assert(engine.offsetIsValid(p)); + assert(engine.offsetIsValid(offset)); assert(paint != null); - _drawImage(image, p, paint); + _drawImage(image, offset, paint); } void _drawImage(Image image, Offset p, Paint paint) {