Skip to content

Commit bc1b47e

Browse files
committed
Merge pull request flutter#755 from abarth/rm_painting_canvas
Remove PaintingCanvas
2 parents 5a17c2b + abf0359 commit bc1b47e

22 files changed

+33
-39
lines changed

examples/rendering/lib/sector_layout.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ abstract class RenderDecoratedSector extends RenderSector {
139139
return;
140140

141141
if (_decoration.backgroundColor != null) {
142-
final PaintingCanvas canvas = context.canvas;
142+
final Canvas canvas = context.canvas;
143143
Paint paint = new Paint()..color = _decoration.backgroundColor;
144144
Path path = new Path();
145145
double outerRadius = (parentData.radius + deltaRadius);

examples/rendering/touch_demo.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class RenderTouchDemo extends RenderBox {
6262
}
6363

6464
void paint(PaintingContext context, Offset offset) {
65-
final PaintingCanvas canvas = context.canvas;
65+
final Canvas canvas = context.canvas;
6666
Paint white = new Paint()
6767
..color = const Color(0xFFFFFFFF);
6868
canvas.drawRect(offset & size, white);

examples/stocks/lib/stock_arrow.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class StockArrowPainter extends CustomPainter {
1010
final Color color;
1111
final double percentChange;
1212

13-
void paint(PaintingCanvas canvas, Size size) {
13+
void paint(Canvas canvas, Size size) {
1414
Paint paint = new Paint()..color = color;
1515
paint.strokeWidth = 1.0;
1616
const double padding = 2.0;

examples/widgets/gestures.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class _GesturePainter extends CustomPainter {
3030
final bool doubleTapEnabled;
3131
final bool longPressEnabled;
3232

33-
void paint(PaintingCanvas canvas, Size size) {
33+
void paint(Canvas canvas, Size size) {
3434
Point center = (size.center(Point.origin).toOffset() * zoom + offset).toPoint();
3535
double radius = size.width / 2.0 * zoom;
3636
Gradient gradient = new RadialGradient(

examples/widgets/overlay_geometry.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class _MarkerPainter extends CustomPainter {
2828
final double size;
2929
final MarkerType type;
3030

31-
void paint(PaintingCanvas canvas, _) {
31+
void paint(Canvas canvas, _) {
3232
Paint paint = new Paint()..color = const Color(0x8000FF00);
3333
double r = size / 2.0;
3434
canvas.drawCircle(new Point(r, r), r, paint);

packages/flutter/lib/src/material/switch.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class _RenderSwitch extends RenderToggleable {
173173
final BoxPainter _thumbPainter = new BoxPainter(const BoxDecoration());
174174

175175
void paint(PaintingContext context, Offset offset) {
176-
final PaintingCanvas canvas = context.canvas;
176+
final Canvas canvas = context.canvas;
177177

178178
final bool isActive = onChanged != null;
179179

packages/flutter/lib/src/material/tabs.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ class _RenderTabBar extends RenderBox with
209209
return defaultHitTestChildren(result, position: position);
210210
}
211211

212-
void _paintIndicator(PaintingCanvas canvas, RenderBox selectedTab, Offset offset) {
212+
void _paintIndicator(Canvas canvas, RenderBox selectedTab, Offset offset) {
213213
if (indicatorColor == null)
214214
return;
215215

packages/flutter/lib/src/rendering/object.dart

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ class ParentData {
3838
String toString() => '<none>';
3939
}
4040

41-
/// Obsolete class that will be removed eventually
42-
class PaintingCanvas extends Canvas {
43-
PaintingCanvas(ui.PictureRecorder recorder, Rect bounds) : super(recorder, bounds);
44-
// TODO(ianh): Just use ui.Canvas everywhere instead
45-
}
46-
4741
typedef void PaintingContextCallback(PaintingContext context, Offset offset);
4842

4943
/// A place to paint.
@@ -145,14 +139,14 @@ class PaintingContext {
145139
// Recording state
146140
PictureLayer _currentLayer;
147141
ui.PictureRecorder _recorder;
148-
PaintingCanvas _canvas;
142+
Canvas _canvas;
149143

150144
/// The canvas on which to paint.
151145
///
152146
/// The current canvas can change whenever you paint a child using this
153147
/// context, which means it's fragile to hold a reference to the canvas
154148
/// returned by this getter.
155-
PaintingCanvas get canvas {
149+
Canvas get canvas {
156150
if (_canvas == null)
157151
_startRecording();
158152
return _canvas;
@@ -162,7 +156,7 @@ class PaintingContext {
162156
assert(!_isRecording);
163157
_currentLayer = new PictureLayer(paintBounds: _paintBounds);
164158
_recorder = new ui.PictureRecorder();
165-
_canvas = new PaintingCanvas(_recorder, _paintBounds);
159+
_canvas = new Canvas(_recorder, _paintBounds);
166160
_containerLayer.append(_currentLayer);
167161
}
168162

packages/flutter/lib/src/rendering/proxy_box.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ class RenderSizeObserver extends RenderProxyBox {
991991
abstract class CustomPainter {
992992
const CustomPainter();
993993

994-
void paint(PaintingCanvas canvas, Size size);
994+
void paint(Canvas canvas, Size size);
995995
bool shouldRepaint(CustomPainter oldDelegate);
996996
bool hitTest(Point position) => null;
997997
}

packages/flutter_sprites/lib/src/effect_line.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class EffectLine extends Node {
121121
}
122122
}
123123

124-
void paint(PaintingCanvas canvas) {
124+
void paint(Canvas canvas) {
125125
if (points.length < 2) return;
126126

127127
_painter.points = points;

0 commit comments

Comments
 (0)