Commit 47c854b8 authored by Adam Barth's avatar Adam Barth

Merge pull request #1673 from abarth/rm_old_paint_setters

Remove old setFoo functions on Paint
parents 27b5fc14 2aa79d56
...@@ -16,7 +16,7 @@ abstract class GameObject extends Node { ...@@ -16,7 +16,7 @@ abstract class GameObject extends Node {
Paint _paintDebug = new Paint() Paint _paintDebug = new Paint()
..color=new Color(0xffff0000) ..color=new Color(0xffff0000)
..strokeWidth = 1.0 ..strokeWidth = 1.0
..setStyle(ui.PaintingStyle.stroke); ..style = ui.PaintingStyle.stroke;
bool collidingWith(GameObject obj) { bool collidingWith(GameObject obj) {
return (GameMath.distanceBetweenPoints(position, obj.position) return (GameMath.distanceBetweenPoints(position, obj.position)
......
...@@ -10,7 +10,7 @@ class PowerBar extends NodeWithSize { ...@@ -10,7 +10,7 @@ class PowerBar extends NodeWithSize {
Paint _paintOutline = new Paint() Paint _paintOutline = new Paint()
..color = new Color(0xffffffff) ..color = new Color(0xffffffff)
..strokeWidth = 1.0 ..strokeWidth = 1.0
..setStyle(ui.PaintingStyle.stroke); ..style = ui.PaintingStyle.stroke;
void paint(PaintingCanvas canvas) { void paint(PaintingCanvas canvas) {
applyTransformForPivot(canvas); applyTransformForPivot(canvas);
......
...@@ -36,9 +36,10 @@ void drawText(ui.Canvas canvas, String lh) { ...@@ -36,9 +36,10 @@ void drawText(ui.Canvas canvas, String lh) {
path.lineTo(block.maxContentWidth, block.alphabeticBaseline); path.lineTo(block.maxContentWidth, block.alphabeticBaseline);
path.moveTo(0.0, block.height); path.moveTo(0.0, block.height);
path.lineTo(block.maxContentWidth, block.height); path.lineTo(block.maxContentWidth, block.height);
paint.color = const ui.Color(0xFFFF9000); paint
paint.setStyle(ui.PaintingStyle.stroke); ..color = const ui.Color(0xFFFF9000)
paint.strokeWidth = 3.0; ..style = ui.PaintingStyle.stroke
..strokeWidth = 3.0;
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
// paint the text // paint the text
...@@ -49,9 +50,9 @@ ui.Picture paint(ui.Rect paintBounds) { ...@@ -49,9 +50,9 @@ ui.Picture paint(ui.Rect paintBounds) {
ui.PictureRecorder recorder = new ui.PictureRecorder(); ui.PictureRecorder recorder = new ui.PictureRecorder();
ui.Canvas canvas = new ui.Canvas(recorder, paintBounds); ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
ui.Paint paint = new ui.Paint(); ui.Paint paint = new ui.Paint()
paint.color = const ui.Color(0xFFFFFFFF); ..color = const ui.Color(0xFFFFFFFF)
paint.setStyle(ui.PaintingStyle.fill); ..style = ui.PaintingStyle.fill;
canvas.drawRect(new ui.Rect.fromLTRB(0.0, 0.0, ui.view.width, ui.view.height), paint); canvas.drawRect(new ui.Rect.fromLTRB(0.0, 0.0, ui.view.width, ui.view.height), paint);
canvas.translate(10.0, 0.0); canvas.translate(10.0, 0.0);
......
...@@ -29,7 +29,7 @@ ui.Picture paint(ui.Rect paintBounds) { ...@@ -29,7 +29,7 @@ ui.Picture paint(ui.Rect paintBounds) {
[new ui.Point(-radius, -radius), new ui.Point(0.0, 0.0)], [new ui.Point(-radius, -radius), new ui.Point(0.0, 0.0)],
[const ui.Color(0xFFFFFF00), const ui.Color(0xFF0000FF)]); [const ui.Color(0xFFFFFF00), const ui.Color(0xFF0000FF)]);
canvas.drawRect(new ui.Rect.fromLTRB(-radius, -radius, radius, radius), canvas.drawRect(new ui.Rect.fromLTRB(-radius, -radius, radius, radius),
new ui.Paint()..setShader(yellowBlue)); new ui.Paint()..shader = yellowBlue);
// Scale x and y by 0.5. // Scale x and y by 0.5.
var scaleMatrix = new Float64List.fromList([ var scaleMatrix = new Float64List.fromList([
......
...@@ -48,10 +48,10 @@ RenderBox getBox(double lh) { ...@@ -48,10 +48,10 @@ RenderBox getBox(double lh) {
path.lineTo(w, baseline); path.lineTo(w, baseline);
path.moveTo(0.0, h); path.moveTo(0.0, h);
path.lineTo(w, h); path.lineTo(w, h);
Paint paint = new Paint(); Paint paint = new Paint()
paint.color = const Color(0xFFFF9000); ..color = const Color(0xFFFF9000)
paint.setStyle(ui.PaintingStyle.stroke); ..style = ui.PaintingStyle.stroke
paint.strokeWidth = 3.0; ..strokeWidth = 3.0;
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
} }
) )
......
...@@ -49,11 +49,11 @@ class StockArrow extends StatelessComponent { ...@@ -49,11 +49,11 @@ class StockArrow extends StatelessComponent {
path.lineTo(centerX + w, arrowY + h); path.lineTo(centerX + w, arrowY + h);
path.lineTo(centerX - w, arrowY + h); path.lineTo(centerX - w, arrowY + h);
path.close(); path.close();
paint.setStyle(ui.PaintingStyle.fill); paint.style = ui.PaintingStyle.fill;
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
// Draw a circle that circumscribes the arrow. // Draw a circle that circumscribes the arrow.
paint.setStyle(ui.PaintingStyle.stroke); paint.style = ui.PaintingStyle.stroke;
canvas.drawCircle(new Point(centerX, centerY), r, paint); canvas.drawCircle(new Point(centerX, centerY), r, paint);
}); });
......
...@@ -36,9 +36,10 @@ class Marker extends StatelessComponent { ...@@ -36,9 +36,10 @@ class Marker extends StatelessComponent {
double r = size / 2.0; double r = size / 2.0;
canvas.drawCircle(new Point(r, r), r, paint); canvas.drawCircle(new Point(r, r), r, paint);
paint.color = const Color(0xFFFFFFFF); paint
paint.setStyle(ui.PaintingStyle.stroke); ..color = const Color(0xFFFFFFFF)
paint.strokeWidth = 1.0; ..style = ui.PaintingStyle.stroke
..strokeWidth = 1.0;
if (type == MarkerType.topLeft) { if (type == MarkerType.topLeft) {
canvas.drawLine(new Point(r, r), new Point(r + r - 1.0, r), paint); canvas.drawLine(new Point(r, r), new Point(r + r - 1.0, r), paint);
canvas.drawLine(new Point(r, r), new Point(r, r + r - 1.0), paint); canvas.drawLine(new Point(r, r), new Point(r, r + r - 1.0), paint);
......
...@@ -866,7 +866,7 @@ class BoxPainter { ...@@ -866,7 +866,7 @@ class BoxPainter {
Paint paint = new Paint() Paint paint = new Paint()
..color = _decoration.border.top.color ..color = _decoration.border.top.color
..strokeWidth = width ..strokeWidth = width
..setStyle(ui.PaintingStyle.stroke); ..style = ui.PaintingStyle.stroke;
Point center = rect.center; Point center = rect.center;
double radius = (rect.shortestSide - width) / 2.0; double radius = (rect.shortestSide - width) / 2.0;
canvas.drawCircle(center, radius, paint); canvas.drawCircle(center, radius, paint);
......
...@@ -246,7 +246,7 @@ class PaintingContext { ...@@ -246,7 +246,7 @@ class PaintingContext {
static Paint _getPaintForAlpha(int alpha) { static Paint _getPaintForAlpha(int alpha) {
return new Paint() return new Paint()
..color = new Color.fromARGB(alpha, 0, 0, 0) ..color = new Color.fromARGB(alpha, 0, 0, 0)
..setTransferMode(TransferMode.srcOver) ..transferMode = TransferMode.srcOver
..isAntiAlias = false; ..isAntiAlias = false;
} }
......
...@@ -363,7 +363,7 @@ class ParticleSystem extends Node { ...@@ -363,7 +363,7 @@ class ParticleSystem extends Node {
List<Rect> rects = []; List<Rect> rects = [];
List<Color> colors = []; List<Color> colors = [];
_paint.setTransferMode(transferMode); _paint.transferMode = transferMode;
for (_Particle particle in _particles) { for (_Particle particle in _particles) {
// Rect // Rect
......
...@@ -43,7 +43,7 @@ class _PhysicsDebugDraw extends box2d.DebugDraw { ...@@ -43,7 +43,7 @@ class _PhysicsDebugDraw extends box2d.DebugDraw {
void drawCircle(Vector2 center, num radius, box2d.Color3i color, [Vector2 axis]) { void drawCircle(Vector2 center, num radius, box2d.Color3i color, [Vector2 axis]) {
Paint paint = new Paint() Paint paint = new Paint()
..color = _toColor(color) ..color = _toColor(color)
..setStyle(ui.PaintingStyle.stroke) ..style = ui.PaintingStyle.stroke
..strokeWidth = 1.0; ..strokeWidth = 1.0;
canvas.drawCircle(_toPoint(center), _scale(radius), paint); canvas.drawCircle(_toPoint(center), _scale(radius), paint);
......
...@@ -41,8 +41,8 @@ class TexturedLinePainter { ...@@ -41,8 +41,8 @@ class TexturedLinePainter {
ui.ImageShader shader = new ui.ImageShader(texture.image, ui.ImageShader shader = new ui.ImageShader(texture.image,
ui.TileMode.repeated, ui.TileMode.repeated, matrix.storage); ui.TileMode.repeated, ui.TileMode.repeated, matrix.storage);
_cachedPaint = new Paint(); _cachedPaint = new Paint()
_cachedPaint.setShader(shader); ..shader = shader;
} }
} }
......
...@@ -14,7 +14,7 @@ class VirtualJoystick extends NodeWithSize { ...@@ -14,7 +14,7 @@ class VirtualJoystick extends NodeWithSize {
_paintControl = new Paint() _paintControl = new Paint()
..color=new Color(0xffffffff) ..color=new Color(0xffffffff)
..strokeWidth = 1.0 ..strokeWidth = 1.0
..setStyle(ui.PaintingStyle.stroke); ..style = ui.PaintingStyle.stroke;
} }
Point _value = Point.origin; Point _value = Point.origin;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment