Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
bc1b47e9
Commit
bc1b47e9
authored
Dec 05, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #755 from abarth/rm_painting_canvas
Remove PaintingCanvas
parents
5a17c2bc
abf03595
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
33 additions
and
39 deletions
+33
-39
sector_layout.dart
examples/rendering/lib/sector_layout.dart
+1
-1
touch_demo.dart
examples/rendering/touch_demo.dart
+1
-1
stock_arrow.dart
examples/stocks/lib/stock_arrow.dart
+1
-1
gestures.dart
examples/widgets/gestures.dart
+1
-1
overlay_geometry.dart
examples/widgets/overlay_geometry.dart
+1
-1
switch.dart
packages/flutter/lib/src/material/switch.dart
+1
-1
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+1
-1
object.dart
packages/flutter/lib/src/rendering/object.dart
+3
-9
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+1
-1
effect_line.dart
packages/flutter_sprites/lib/src/effect_line.dart
+1
-1
label.dart
packages/flutter_sprites/lib/src/label.dart
+1
-1
layer.dart
packages/flutter_sprites/lib/src/layer.dart
+2
-2
node.dart
packages/flutter_sprites/lib/src/node.dart
+6
-6
node_with_size.dart
packages/flutter_sprites/lib/src/node_with_size.dart
+2
-2
particle_system.dart
packages/flutter_sprites/lib/src/particle_system.dart
+1
-1
physics_debug.dart
packages/flutter_sprites/lib/src/physics_debug.dart
+1
-1
physics_world.dart
packages/flutter_sprites/lib/src/physics_world.dart
+2
-2
sprite.dart
packages/flutter_sprites/lib/src/sprite.dart
+1
-1
sprite_box.dart
packages/flutter_sprites/lib/src/sprite_box.dart
+1
-1
texture.dart
packages/flutter_sprites/lib/src/texture.dart
+1
-1
textured_line.dart
packages/flutter_sprites/lib/src/textured_line.dart
+2
-2
virtual_joystick.dart
packages/flutter_sprites/lib/src/virtual_joystick.dart
+1
-1
No files found.
examples/rendering/lib/sector_layout.dart
View file @
bc1b47e9
...
...
@@ -139,7 +139,7 @@ abstract class RenderDecoratedSector extends RenderSector {
return
;
if
(
_decoration
.
backgroundColor
!=
null
)
{
final
Painting
Canvas
canvas
=
context
.
canvas
;
final
Canvas
canvas
=
context
.
canvas
;
Paint
paint
=
new
Paint
()..
color
=
_decoration
.
backgroundColor
;
Path
path
=
new
Path
();
double
outerRadius
=
(
parentData
.
radius
+
deltaRadius
);
...
...
examples/rendering/touch_demo.dart
View file @
bc1b47e9
...
...
@@ -62,7 +62,7 @@ class RenderTouchDemo extends RenderBox {
}
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
final
Painting
Canvas
canvas
=
context
.
canvas
;
final
Canvas
canvas
=
context
.
canvas
;
Paint
white
=
new
Paint
()
..
color
=
const
Color
(
0xFFFFFFFF
);
canvas
.
drawRect
(
offset
&
size
,
white
);
...
...
examples/stocks/lib/stock_arrow.dart
View file @
bc1b47e9
...
...
@@ -10,7 +10,7 @@ class StockArrowPainter extends CustomPainter {
final
Color
color
;
final
double
percentChange
;
void
paint
(
Painting
Canvas
canvas
,
Size
size
)
{
void
paint
(
Canvas
canvas
,
Size
size
)
{
Paint
paint
=
new
Paint
()..
color
=
color
;
paint
.
strokeWidth
=
1.0
;
const
double
padding
=
2.0
;
...
...
examples/widgets/gestures.dart
View file @
bc1b47e9
...
...
@@ -30,7 +30,7 @@ class _GesturePainter extends CustomPainter {
final
bool
doubleTapEnabled
;
final
bool
longPressEnabled
;
void
paint
(
Painting
Canvas
canvas
,
Size
size
)
{
void
paint
(
Canvas
canvas
,
Size
size
)
{
Point
center
=
(
size
.
center
(
Point
.
origin
).
toOffset
()
*
zoom
+
offset
).
toPoint
();
double
radius
=
size
.
width
/
2.0
*
zoom
;
Gradient
gradient
=
new
RadialGradient
(
...
...
examples/widgets/overlay_geometry.dart
View file @
bc1b47e9
...
...
@@ -28,7 +28,7 @@ class _MarkerPainter extends CustomPainter {
final
double
size
;
final
MarkerType
type
;
void
paint
(
Painting
Canvas
canvas
,
_
)
{
void
paint
(
Canvas
canvas
,
_
)
{
Paint
paint
=
new
Paint
()..
color
=
const
Color
(
0x8000FF00
);
double
r
=
size
/
2.0
;
canvas
.
drawCircle
(
new
Point
(
r
,
r
),
r
,
paint
);
...
...
packages/flutter/lib/src/material/switch.dart
View file @
bc1b47e9
...
...
@@ -173,7 +173,7 @@ class _RenderSwitch extends RenderToggleable {
final
BoxPainter
_thumbPainter
=
new
BoxPainter
(
const
BoxDecoration
());
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
final
Painting
Canvas
canvas
=
context
.
canvas
;
final
Canvas
canvas
=
context
.
canvas
;
final
bool
isActive
=
onChanged
!=
null
;
...
...
packages/flutter/lib/src/material/tabs.dart
View file @
bc1b47e9
...
...
@@ -209,7 +209,7 @@ class _RenderTabBar extends RenderBox with
return
defaultHitTestChildren
(
result
,
position:
position
);
}
void
_paintIndicator
(
Painting
Canvas
canvas
,
RenderBox
selectedTab
,
Offset
offset
)
{
void
_paintIndicator
(
Canvas
canvas
,
RenderBox
selectedTab
,
Offset
offset
)
{
if
(
indicatorColor
==
null
)
return
;
...
...
packages/flutter/lib/src/rendering/object.dart
View file @
bc1b47e9
...
...
@@ -38,12 +38,6 @@ class ParentData {
String
toString
()
=>
'<none>'
;
}
/// Obsolete class that will be removed eventually
class
PaintingCanvas
extends
Canvas
{
PaintingCanvas
(
ui
.
PictureRecorder
recorder
,
Rect
bounds
)
:
super
(
recorder
,
bounds
);
// TODO(ianh): Just use ui.Canvas everywhere instead
}
typedef
void
PaintingContextCallback
(
PaintingContext
context
,
Offset
offset
);
/// A place to paint.
...
...
@@ -145,14 +139,14 @@ class PaintingContext {
// Recording state
PictureLayer
_currentLayer
;
ui
.
PictureRecorder
_recorder
;
Painting
Canvas
_canvas
;
Canvas
_canvas
;
/// The canvas on which to paint.
///
/// The current canvas can change whenever you paint a child using this
/// context, which means it's fragile to hold a reference to the canvas
/// returned by this getter.
Painting
Canvas
get
canvas
{
Canvas
get
canvas
{
if
(
_canvas
==
null
)
_startRecording
();
return
_canvas
;
...
...
@@ -162,7 +156,7 @@ class PaintingContext {
assert
(!
_isRecording
);
_currentLayer
=
new
PictureLayer
(
paintBounds:
_paintBounds
);
_recorder
=
new
ui
.
PictureRecorder
();
_canvas
=
new
Painting
Canvas
(
_recorder
,
_paintBounds
);
_canvas
=
new
Canvas
(
_recorder
,
_paintBounds
);
_containerLayer
.
append
(
_currentLayer
);
}
...
...
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
bc1b47e9
...
...
@@ -991,7 +991,7 @@ class RenderSizeObserver extends RenderProxyBox {
abstract
class
CustomPainter
{
const
CustomPainter
();
void
paint
(
Painting
Canvas
canvas
,
Size
size
);
void
paint
(
Canvas
canvas
,
Size
size
);
bool
shouldRepaint
(
CustomPainter
oldDelegate
);
bool
hitTest
(
Point
position
)
=>
null
;
}
...
...
packages/flutter_sprites/lib/src/effect_line.dart
View file @
bc1b47e9
...
...
@@ -121,7 +121,7 @@ class EffectLine extends Node {
}
}
void
paint
(
Painting
Canvas
canvas
)
{
void
paint
(
Canvas
canvas
)
{
if
(
points
.
length
<
2
)
return
;
_painter
.
points
=
points
;
...
...
packages/flutter_sprites/lib/src/label.dart
View file @
bc1b47e9
...
...
@@ -33,7 +33,7 @@ class Label extends Node {
TextPainter
_painter
;
double
_width
;
void
paint
(
Painting
Canvas
canvas
)
{
void
paint
(
Canvas
canvas
)
{
if
(
_painter
==
null
)
{
PlainTextSpan
textSpan
=
new
PlainTextSpan
(
_text
);
StyledTextSpan
styledTextSpan
=
new
StyledTextSpan
(
_textStyle
,
<
TextSpan
>[
textSpan
]);
...
...
packages/flutter_sprites/lib/src/layer.dart
View file @
bc1b47e9
...
...
@@ -25,14 +25,14 @@ class Layer extends Node with SpritePaint {
..
filterQuality
=
ui
.
FilterQuality
.
low
..
isAntiAlias
=
false
;
void
_prePaint
(
Painting
Canvas
canvas
,
Matrix4
matrix
)
{
void
_prePaint
(
Canvas
canvas
,
Matrix4
matrix
)
{
super
.
_prePaint
(
canvas
,
matrix
);
_updatePaint
(
_cachedPaint
);
canvas
.
saveLayer
(
layerRect
,
_cachedPaint
);
}
void
_postPaint
(
Painting
Canvas
canvas
,
Matrix4
totalMatrix
)
{
void
_postPaint
(
Canvas
canvas
,
Matrix4
totalMatrix
)
{
canvas
.
restore
();
super
.
_postPaint
(
canvas
,
totalMatrix
);
}
...
...
packages/flutter_sprites/lib/src/node.dart
View file @
bc1b47e9
...
...
@@ -648,7 +648,7 @@ class Node {
// Rendering
void
_visit
(
Painting
Canvas
canvas
,
Matrix4
totalMatrix
)
{
void
_visit
(
Canvas
canvas
,
Matrix4
totalMatrix
)
{
assert
(
canvas
!=
null
);
if
(!
visible
)
return
;
...
...
@@ -657,7 +657,7 @@ class Node {
_postPaint
(
canvas
,
totalMatrix
);
}
void
_prePaint
(
Painting
Canvas
canvas
,
Matrix4
matrix
)
{
void
_prePaint
(
Canvas
canvas
,
Matrix4
matrix
)
{
_savedTotalMatrix
=
new
Matrix4
.
copy
(
matrix
);
// Get the transformation matrix and apply transform
...
...
@@ -672,7 +672,7 @@ class Node {
/// bounding box's origin, override [NodeWithSize] and call the applyTransformForPivot method before making calls for
/// drawing.
///
/// void paint(
Painting
Canvas canvas) {
/// void paint(Canvas canvas) {
/// canvas.save();
/// applyTransformForPivot(canvas);
///
...
...
@@ -680,10 +680,10 @@ class Node {
///
/// canvas.restore();
/// }
void
paint
(
Painting
Canvas
canvas
)
{
void
paint
(
Canvas
canvas
)
{
}
void
_visitChildren
(
Painting
Canvas
canvas
,
Matrix4
totalMatrix
)
{
void
_visitChildren
(
Canvas
canvas
,
Matrix4
totalMatrix
)
{
// Sort children if needed
_sortChildren
();
...
...
@@ -709,7 +709,7 @@ class Node {
}
}
void
_postPaint
(
Painting
Canvas
canvas
,
Matrix4
totalMatrix
)
{
void
_postPaint
(
Canvas
canvas
,
Matrix4
totalMatrix
)
{
totalMatrix
.
setFrom
(
_savedTotalMatrix
);
}
...
...
packages/flutter_sprites/lib/src/node_with_size.dart
View file @
bc1b47e9
...
...
@@ -33,7 +33,7 @@ class NodeWithSize extends Node {
/// If you use this method you will need to save and restore your canvas at the beginning and
/// end of your [paint] method.
///
/// void paint(
Painting
Canvas canvas) {
/// void paint(Canvas canvas) {
/// canvas.save();
/// applyTransformForPivot(canvas);
///
...
...
@@ -41,7 +41,7 @@ class NodeWithSize extends Node {
///
/// canvas.restore();
/// }
void
applyTransformForPivot
(
Painting
Canvas
canvas
)
{
void
applyTransformForPivot
(
Canvas
canvas
)
{
if
(
pivot
.
x
!=
0
||
pivot
.
y
!=
0
)
{
double
pivotInPointsX
=
size
.
width
*
pivot
.
x
;
double
pivotInPointsY
=
size
.
height
*
pivot
.
y
;
...
...
packages/flutter_sprites/lib/src/particle_system.dart
View file @
bc1b47e9
...
...
@@ -357,7 +357,7 @@ class ParticleSystem extends Node {
_numEmittedParticles
++;
}
void
paint
(
Painting
Canvas
canvas
)
{
void
paint
(
Canvas
canvas
)
{
List
<
ui
.
RSTransform
>
transforms
=
<
ui
.
RSTransform
>[];
List
<
Rect
>
rects
=
<
Rect
>[];
...
...
packages/flutter_sprites/lib/src/physics_debug.dart
View file @
bc1b47e9
...
...
@@ -14,7 +14,7 @@ class _PhysicsDebugDraw extends box2d.DebugDraw {
PhysicsWorld
physicsWorld
;
Painting
Canvas
canvas
;
Canvas
canvas
;
void
drawSegment
(
Vector2
p1
,
Vector2
p2
,
box2d
.
Color3i
color
)
{
Paint
paint
=
new
Paint
()
...
...
packages/flutter_sprites/lib/src/physics_world.dart
View file @
bc1b47e9
...
...
@@ -267,7 +267,7 @@ class PhysicsWorld extends Node {
_contactHandler
.
addContactCallback
(
callback
,
tagA
,
tagB
,
type
);
}
void
paint
(
Painting
Canvas
canvas
)
{
void
paint
(
Canvas
canvas
)
{
if
(
drawDebug
)
{
_debugDrawTransform
=
new
Matrix4
.
fromFloat64List
(
canvas
.
getTotalMatrix
());
}
...
...
@@ -276,7 +276,7 @@ class PhysicsWorld extends Node {
/// Draws the debug data of the physics world, normally this method isn't
/// invoked directly. Instead, set the [drawDebug] property to true.
void
paintDebug
(
Painting
Canvas
canvas
)
{
void
paintDebug
(
Canvas
canvas
)
{
_debugDraw
.
canvas
=
canvas
;
b2World
.
drawDebugData
();
}
...
...
packages/flutter_sprites/lib/src/sprite.dart
View file @
bc1b47e9
...
...
@@ -44,7 +44,7 @@ class Sprite extends NodeWithSize with SpritePaint {
pivot
=
new
Point
(
0.5
,
0.5
);
}
void
paint
(
Painting
Canvas
canvas
)
{
void
paint
(
Canvas
canvas
)
{
// Account for pivot point
applyTransformForPivot
(
canvas
);
...
...
packages/flutter_sprites/lib/src/sprite_box.dart
View file @
bc1b47e9
...
...
@@ -336,7 +336,7 @@ class SpriteBox extends RenderBox {
}
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
final
Painting
Canvas
canvas
=
context
.
canvas
;
final
Canvas
canvas
=
context
.
canvas
;
canvas
.
save
();
// Move to correct coordinate space before drawing
...
...
packages/flutter_sprites/lib/src/texture.dart
View file @
bc1b47e9
...
...
@@ -73,7 +73,7 @@ class Texture {
return
new
Texture
.
_fromSpriteFrame
(
image
,
name
,
rect
.
size
,
false
,
false
,
srcFrame
,
dstFrame
,
new
Point
(
0.5
,
0.5
));
}
void
drawTexture
(
Painting
Canvas
canvas
,
Point
position
,
Paint
paint
)
{
void
drawTexture
(
Canvas
canvas
,
Point
position
,
Paint
paint
)
{
// Get drawing position
double
x
=
position
.
x
;
double
y
=
position
.
y
;
...
...
packages/flutter_sprites/lib/src/textured_line.dart
View file @
bc1b47e9
...
...
@@ -7,7 +7,7 @@ class TexturedLine extends Node {
TexturedLinePainter
painter
;
void
paint
(
Painting
Canvas
canvas
)
{
void
paint
(
Canvas
canvas
)
{
painter
.
paint
(
canvas
);
}
}
...
...
@@ -81,7 +81,7 @@ class TexturedLinePainter {
Paint
_cachedPaint
=
new
Paint
();
void
paint
(
Painting
Canvas
canvas
)
{
void
paint
(
Canvas
canvas
)
{
// Check input values
assert
(
_points
!=
null
);
if
(
_points
.
length
<
2
)
return
;
...
...
packages/flutter_sprites/lib/src/virtual_joystick.dart
View file @
bc1b47e9
...
...
@@ -54,7 +54,7 @@ class VirtualJoystick extends NodeWithSize {
return
true
;
}
void
paint
(
Painting
Canvas
canvas
)
{
void
paint
(
Canvas
canvas
)
{
applyTransformForPivot
(
canvas
);
canvas
.
drawCircle
(
_handlePos
,
25.0
,
_paintHandle
);
canvas
.
drawCircle
(
_center
,
40.0
,
_paintControl
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment